[freeside-commits] branch FREESIDE_3_BRANCH updated. 3e8cad17fc7fd48d4b622771d6b77c6c136d80f2

Ivan ivan at 420.am
Fri Nov 15 14:25:09 PST 2013


The branch, FREESIDE_3_BRANCH has been updated
       via  3e8cad17fc7fd48d4b622771d6b77c6c136d80f2 (commit)
      from  beeaed152f7b8d6e663176abfe53a2fa058657e2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3e8cad17fc7fd48d4b622771d6b77c6c136d80f2
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Nov 15 14:25:08 2013 -0800

    fix detaching w/cust_main-require_phone, RT#25987

diff --git a/FS/FS/contact_phone.pm b/FS/FS/contact_phone.pm
index 0eb2166..610753f 100644
--- a/FS/FS/contact_phone.pm
+++ b/FS/FS/contact_phone.pm
@@ -4,6 +4,7 @@ use base qw( FS::Record );
 use strict;
 use FS::Record qw( qsearch qsearchs );
 use FS::contact;
+use FS::phone_type;
 
 =head1 NAME
 
@@ -144,6 +145,16 @@ sub contact {
   qsearchs( 'contact', { 'contactnum' => $self->contactnum } );
 }
 
+sub phone_type {
+  my $self = shift;
+  qsearchs('phone_type', { 'phonetypenum' => $self->phonetypenum } );
+}
+
+sub typename {
+  my $self = shift;
+  $self->phone_type->typename;
+}
+
 =back
 
 =head1 BUGS
diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html
index 4140ec1..c2ebb09 100644
--- a/httemplate/edit/cust_main/contact.html
+++ b/httemplate/edit/cust_main/contact.html
@@ -94,30 +94,13 @@
 </%def>
 
 <%def phones>
-  <TR>
-    <TD ALIGN="right" VALIGN="top"><% mt('Phones') %></TD>
-    <TD COLSPAN=6>
-
-      <TABLE CELLSPACING=0 CELLPADDING=0>
-        <TR>
-          <TD>
-            <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
-            <BR><FONT SIZE=-1><% $daytime_label %></FONT>
-          </TD>
-          <TD> </TD>
-          <TD>
-            <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
-            <BR><FONT SIZE=-1><% $night_label %></FONT>
-          </TD>
-          <TD> </TD>
-          <TD>
-            <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
-            <BR><FONT SIZE=-1><% $mobile_label %></FONT>
-          </TD>
-        </TR>
-      </TABLE>
-    </TD>
-  </TR>
+  <& /elements/tr-cust_main-phones.html,
+       'prefix'       => $pre,
+       'cust_main'    => $cust_main,
+       'onchange'     => $onchange,
+       'disabled'     => $disabled,
+       'style'        => $style,
+  &>
 </%def>
 
 <%def fax>
@@ -136,9 +119,7 @@ my $r = qq!<font color="#ff0000">*</font> !;
 </%once>
 <%shared>
 
-my( %opt, $cust_main, $pre, $onchange, $disabled, @style, $style,
-    $daytime_label, $night_label, $mobile_label,
-  );
+my( %opt, $cust_main, $pre, $onchange, $disabled, @style, $style );
 
 </%shared>
 <%init>
@@ -176,16 +157,6 @@ $opt{geocode} ||= $cust_main->get('geocode');
 
 $opt{censustract} ||= $cust_main->censustract;
 
-$daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
-                   ? 'Day'
-                   : FS::Msgcat::_gettext('daytime');
-$night_label   = FS::Msgcat::_gettext('night') =~/^(night)?$/
-                   ? 'Night'
-                   : FS::Msgcat::_gettext('night') || 'Night';
-$mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/
-                   ? 'Mobile'
-                   : FS::Msgcat::_gettext('mobile') || 'Mobile';
-
 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
                   ? 'Driver’s License'
                   : FS::Msgcat::_gettext('stateid') || 'Driver’s License';
diff --git a/httemplate/elements/tr-cust_main-phones.html b/httemplate/elements/tr-cust_main-phones.html
new file mode 100644
index 0000000..accf8ac
--- /dev/null
+++ b/httemplate/elements/tr-cust_main-phones.html
@@ -0,0 +1,45 @@
+  <TR>
+    <TD ALIGN="right" VALIGN="top"><% mt('Phones') %></TD>
+    <TD COLSPAN=6>
+
+      <TABLE CELLSPACING=0 CELLPADDING=0>
+        <TR>
+          <TD>
+            <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
+            <BR><FONT SIZE=-1><% $daytime_label %></FONT>
+          </TD>
+          <TD> </TD>
+          <TD>
+            <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
+            <BR><FONT SIZE=-1><% $night_label %></FONT>
+          </TD>
+          <TD> </TD>
+          <TD>
+            <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
+            <BR><FONT SIZE=-1><% $mobile_label %></FONT>
+          </TD>
+        </TR>
+      </TABLE>
+    </TD>
+  </TR>
+<%init>
+
+my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
+                      ? 'Day'
+                      : FS::Msgcat::_gettext('daytime');
+my $night_label   = FS::Msgcat::_gettext('night') =~/^(night)?$/
+                      ? 'Night'
+                      : FS::Msgcat::_gettext('night') || 'Night';
+my $mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/
+                      ? 'Mobile'
+                      : FS::Msgcat::_gettext('mobile') || 'Mobile';
+
+my %opt = @_;
+
+my $pre       = $opt{'prefix'};
+my $cust_main = $opt{'cust_main'};
+my $onchange  = $opt{'onchange'};
+my $disabled  = $opt{'disabled'};
+my $style     = $opt{'style'};
+
+</%init>
diff --git a/httemplate/misc/detach_pkg.html b/httemplate/misc/detach_pkg.html
index 64b3e6e..366bbac 100755
--- a/httemplate/misc/detach_pkg.html
+++ b/httemplate/misc/detach_pkg.html
@@ -50,9 +50,26 @@
     </TD>
   </TR>
 
+%  if ( $conf->config_bool('cust_main-require_phone') ) {
+%    #XXX should be sticky on errors
+%    my $ph_cust_main = FS::cust_main->new({});
+%    foreach my $contact_phone ( $cust_contact->contact_phone ) {
+%      my $t = $contact_phone->typename;
+%      #countrycodes?  interface doesn't parse/take em yet
+%      $ph_cust_main->daytime( $contact_phone->phonenum ) if $t eq 'Work';
+%      $ph_cust_main->night(   $contact_phone->phonenum ) if $t eq 'Home';
+%      $ph_cust_main->mobile(  $contact_phone->phonenum ) if $t eq 'Mobile';
+%      $ph_cust_main->fax(     $contact_phone->phonenum ) if $t eq 'Fax';
+%    }
+
+     <& /elements/tr-cust_main-phones.html,
+          'cust_main'    => $ph_cust_main,
+     &>
+%  }
+
 </TABLE>
 
-%#XXX payment info
+%#payment info
 %#XXX should be sticky on errors...
 <& /edit/cust_main/billing.html, FS::cust_main->new({}),
                                  invoicing_list => [],

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/contact_phone.pm                       |   11 ++++++
 httemplate/edit/cust_main/contact.html       |   45 ++++---------------------
 httemplate/elements/tr-cust_main-phones.html |   45 ++++++++++++++++++++++++++
 httemplate/misc/detach_pkg.html              |   19 ++++++++++-
 4 files changed, 82 insertions(+), 38 deletions(-)
 create mode 100644 httemplate/elements/tr-cust_main-phones.html




More information about the freeside-commits mailing list