[freeside-commits] branch master updated. 8c450aab9bae89373c2c1b35c85597bb52299de3

Ivan ivan at 420.am
Thu Jul 26 14:05:15 PDT 2012


The branch, master has been updated
       via  8c450aab9bae89373c2c1b35c85597bb52299de3 (commit)
       via  2528cc7b182781a82844d8bbb1b555560487abc7 (commit)
       via  0397a2246116fbb87961200865983760fea6a82c (commit)
       via  c1cabbc4cea2e0cfd9e1db668100b97069140cf5 (commit)
      from  bd647f16de5352722baed016b45baa4e7c695278 (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 8c450aab9bae89373c2c1b35c85597bb52299de3
Merge: 2528cc7 bd647f1
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Jul 26 14:05:08 2012 -0700

    Merge branch 'master' of git.freeside.biz:/home/git/freeside


commit 2528cc7b182781a82844d8bbb1b555560487abc7
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Jul 26 14:05:05 2012 -0700

    quotations, RT#16996

diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html
index 7aa024a..57fdd64 100644
--- a/httemplate/misc/order_pkg.html
+++ b/httemplate/misc/order_pkg.html
@@ -1,4 +1,6 @@
-<& /elements/header-popup.html, mt('Order new package') &>
+<& /elements/header-popup.html, $quotationnum ? mt('Add package to quotation')
+                                              : mt('Order new package')
+&>
 
 <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
 <SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT>
@@ -11,8 +13,10 @@
 
 <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST">
 
-<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main->custnum %>">
+<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main ? $cust_main->custnum : '' %>">
+<INPUT TYPE="hidden" NAME="prospectnum" VALUE="<% $prospect_main ? $prospect_main->prospectnum : '' %>">
 <INPUT TYPE="hidden" NAME="qualnum" VALUE="<% scalar($cgi->param('qualnum')) |h %>">
+<INPUT TYPE="hidden" NAME="quotationnum" VALUE="<% $quotationnum %>">
 % if ( $svcpart ) {
     <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
 % }
@@ -26,9 +30,10 @@
     </TR>
 % } else {
     <& /elements/tr-select-cust-part_pkg.html,
-                 'curr_value' => $pkgpart,
-                 'classnum'   => -1,
-                 'cust_main'  => $cust_main,
+                 'curr_value'    => $pkgpart,
+                 'classnum'      => -1,
+                 'cust_main'     => $cust_main,
+                 'prospect_main' => $prospect_main,
     &>
 % }
 
@@ -54,7 +59,7 @@
   </TD>
 </TR>
 
-% if ( $cust_main->payby =~ /^(CARD|CHEK)$/ ) {
+% if ( $cust_main && $cust_main->payby =~ /^(CARD|CHEK)$/ ) {
 %   my $what = lc(FS::payby->shortname($cust_main->payby));
     <TR>
       <TH ALIGN="right"><% mt("Disable automatic $what charge") |h %> </TH>
@@ -97,8 +102,9 @@
 % } else {
 
     <& /elements/tr-select-cust_location.html,
-                 'cgi'       => $cgi,
-                 'cust_main' => $cust_main,
+                 'cgi'           => $cgi,
+                 'cust_main'     => $cust_main,
+                 'prospect_main' => $prospect_main,
     &>
 
 % }
@@ -152,20 +158,42 @@ die "access denied"
 my $conf = new FS::Conf;
 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
 
-$cgi->param('custnum') =~ /^(\d+)$/ or die "no custnum";
-my $custnum = $1;
-my $cust_main = qsearchs({
-  'table'     => 'cust_main',
-  'hashref'   => { 'custnum' => $custnum },
-  'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
-});
+my $cust_main = '';
+if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
+  my $custnum = $1;
+  $cust_main = qsearchs({
+    'table'     => 'cust_main',
+    'hashref'   => { 'custnum' => $custnum },
+    'extra_sql' => ' AND '. $curuser->agentnums_sql,
+  });
+}
+
+my $prospect_main = '';
+if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
+  my $prospectnum = $1;
+  $prospect_main = qsearchs({
+    'table'     => 'prospect_main',
+    'hashref'   => { 'prospectnum' => $prospectnum },
+    'extra_sql' => ' AND '. $curuser->agentnums_sql,
+  });
+}
+
+my $quotationnum = '';
+if ( $cgi->param('quotationnum') =~ /^(\d+)$/ ) {
+  $quotationnum = $1;
+}
+
+die 'no custnum or prospectnum' unless $cust_main || $prospect_main;
 
 my $part_pkg = '';
 if ( $cgi->param('lock_pkgpart') ) {
   $part_pkg = qsearchs({
     'table'     => 'part_pkg',
     'hashref'   => { 'pkgpart' => scalar($cgi->param('lock_pkgpart')) },
-    'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql( $cust_main->agent ),
+    'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql(
+                              $cust_main ? $cust_main->agent
+                                         : $prospect_main->agent
+                            ),
   })
     or die "unknown pkgpart ". $cgi->param('lock_pkgpart');
 }
@@ -179,7 +207,7 @@ if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) {
 
 my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi?
 my $start_date = '';
-if( ! $conf->exists('order_pkg-no_start_date') ) {
+if( ! $conf->exists('order_pkg-no_start_date') && $cust_main ) {
   $start_date = $cust_main->next_bill_date;
   $start_date = $start_date ? time2str($format, $start_date) : '';
 }

commit 0397a2246116fbb87961200865983760fea6a82c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Jul 26 14:03:23 2012 -0700

    23commit working from top level now i guess

diff --git a/bin/23commit b/bin/23commit
index b7b0c1e..d64459c 100755
--- a/bin/23commit
+++ b/bin/23commit
@@ -19,7 +19,7 @@ die "no files!" unless @ARGV;
 #print <<END;
 system join('',
   "( cd /home/$USER/freeside2.3/$prefix; git pull ) && ",
-  "git diff -u @ARGV | ( cd /home/$USER/freeside2.3/$prefix; patch  ) ",
+  "git diff -u @ARGV | ( cd /home/$USER/freeside2.3/$prefix; patch -p1 ) ",
   " && ( ( git pull && git commit  -m $desc @ARGV && git push ); ",
   "( cd /home/$USER/freeside2.3/$prefix; git commit -m $desc @ARGV && git push ) )"
 );

commit c1cabbc4cea2e0cfd9e1db668100b97069140cf5
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Thu Jul 26 14:02:36 2012 -0700

    add anniversary date, RT#18631

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 7e64130..0435945 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3653,6 +3653,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'cust_main-enable_anniversary_date',
+    'section'     => 'UI',
+    'description' => 'Enable tracking of an anniversary date with each customer record',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'cust_main-edit_calling_list_exempt',
     'section'     => 'UI',
     'description' => 'Display the "calling_list_exempt" checkbox on customer edit.',
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 797b705..3fc26b0 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -858,6 +858,7 @@ sub tables_hashref {
         'stateid_state', 'varchar', 'NULL', $char_d, '', '', 
         'birthdate' , at date_type, '', '', 
         'spouse_birthdate' , at date_type, '', '', 
+        'anniversary_date' , at date_type, '', '', 
         'signupdate', at date_type, '', '', 
         'dundate',   @date_type, '', '', 
         'company',  'varchar', 'NULL', $char_d, '', '', 
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 82b09b6..78791dd 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -1779,8 +1779,10 @@ sub check {
     || $self->ut_textn('custbatch')
     || $self->ut_name('last')
     || $self->ut_name('first')
-    || $self->ut_snumbern('birthdate')
     || $self->ut_snumbern('signupdate')
+    || $self->ut_snumbern('birthdate')
+    || $self->ut_snumbern('spouse_birthdate')
+    || $self->ut_snumbern('anniversary_date')
     || $self->ut_textn('company')
     || $self->ut_anything('comments')
     || $self->ut_numbern('referral_custnum')
diff --git a/FS/FS/cust_main/Import.pm b/FS/FS/cust_main/Import.pm
index 6681f9e..ee14cba 100644
--- a/FS/FS/cust_main/Import.pm
+++ b/FS/FS/cust_main/Import.pm
@@ -375,7 +375,8 @@ sub batch_import {
     }
 
     $cust_main{$_} = parse_datetime($cust_main{$_})
-      foreach grep $cust_main{$_}, qw( birthdate spouse_birthdate );
+      foreach grep $cust_main{$_},
+        qw( birthdate spouse_birthdate anniversary_date );
 
     my $invoicing_list = $cust_main{'invoicing_list'}
                            ? [ delete $cust_main{'invoicing_list'} ]
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index b528a68..b213bbc 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -475,6 +475,10 @@ listref of start date, end date
 
 listref of start date, end date
 
+=item anniversary_date
+
+listref of start date, end date
+
 =item payby
 
 listref
@@ -617,7 +621,7 @@ sub search {
   # dates
   ##
 
-  foreach my $field (qw( signupdate birthdate spouse_birthdate )) {
+  foreach my $field (qw( signupdate birthdate spouse_birthdate anniversary_date )) {
 
     next unless exists($params->{$field});
 
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index ef81eba..1ad031d 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -30,6 +30,7 @@
 %# birthdate
 % if (    $conf->exists('cust_main-enable_birthdate')
 %      || $conf->exists('cust_main-enable_spouse_birthdate')
+%      || $conf->exists('cust_main-enable_anniversary_date')
 %    )
 % {
   <BR>
diff --git a/httemplate/edit/cust_main/birthdate.html b/httemplate/edit/cust_main/birthdate.html
index 5d6a123..5447a3a 100644
--- a/httemplate/edit/cust_main/birthdate.html
+++ b/httemplate/edit/cust_main/birthdate.html
@@ -1,5 +1,7 @@
 <% ntable("#cccccc", 2) %>
+
 % # maybe put after the contact names?
+
 % if ( $conf->exists('cust_main-enable_birthdate') ) {
   <% include( '/elements/tr-input-date-field.html', {
                 'name'        => 'birthdate',
@@ -11,6 +13,7 @@
             })
   %>
 % }
+
 % if ( $conf->exists('cust_main-enable_spouse_birthdate') ) {
   <% include( '/elements/tr-input-date-field.html', {
                 'name'        => 'spouse_birthdate',
@@ -22,6 +25,19 @@
             })
   %>
 % }
+
+% if ( $conf->exists('cust_main-enable_anniversary_date') ) {
+  <% include( '/elements/tr-input-date-field.html', {
+                'name'        => 'anniversary_date',
+                'value'       => $cust_main->anniversary_date,
+                'label'       => 'Anniversary Date',
+                'format'      => ( $conf->config('date_format') || "%m/%d/%Y" ),
+                'usedatetime' => 1,
+                'noinit'      => $noinit++,
+            })
+  %>
+% }
+
 </TABLE>
 <%init>
 
diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 5ee553b..866452d 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -112,9 +112,12 @@ $new->tagnum( [ $cgi->param('tagnum') ] );
 
 my %usedatetime = ( 'birthdate'        => 1,
                     'spouse_birthdate' => 1,
+                    'anniversary_date' => 1,
                   );
 
-foreach my $dfield (qw( birthdate spouse_birthdate signupdate )) {
+foreach my $dfield (qw(
+  signupdate birthdate spouse_birthdate anniversary_date
+)) {
 
   if ( $cgi->param($dfield) && $cgi->param($dfield) =~ /^([ 0-9\-\/]{0,10})$/) {
 
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index e164b98..f75b451 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -61,7 +61,7 @@ for my $param (qw( classnum refnum payby tagnum )) {
 # parse dates
 ###
 
-foreach my $field (qw( signupdate birthdate spouse_birthdate )) {
+foreach my $field (qw( signupdate birthdate spouse_birthdate anniversary_date )) {
 
   my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
 
diff --git a/httemplate/search/report_cust_main.html b/httemplate/search/report_cust_main.html
index 39cf695..526bce2 100755
--- a/httemplate/search/report_cust_main.html
+++ b/httemplate/search/report_cust_main.html
@@ -76,6 +76,20 @@
       </TR>
 %   }
 
+%    if ( $conf->exists('cust_main-enable_anniversary_date') ) {
+      <TR>
+          <TD ALIGN="right" VALIGN="center"><% mt('Anniversary Date') |h %></TD>
+          <TD>
+          <TABLE>
+              <& /elements/tr-input-beginning_ending.html,
+                        prefix   => 'anniversary_date',
+                        layout   => 'horiz',
+              &>
+          </TABLE>
+          </TD>
+      </TR>
+%   }
+
     <& /elements/tr-select-cust_tag.html,
                   'cgi'		 => $cgi,
                   'is_report'    => 1,
diff --git a/httemplate/view/cust_main/misc.html b/httemplate/view/cust_main/misc.html
index a0ab403..dc6da53 100644
--- a/httemplate/view/cust_main/misc.html
+++ b/httemplate/view/cust_main/misc.html
@@ -130,6 +130,20 @@
 
 % }
 
+% if ( $conf->exists('cust_main-enable_anniversary_date') ) {
+%   my $dt = $cust_main->anniversary_date ne ''
+%              ? DateTime->from_epoch( 'epoch'  => $cust_main->anniversary_date,
+%                                      'time_zone' =>'floating',
+%                                    )
+%              : '';
+
+  <TR>
+    <TD ALIGN="right"><% mt('Anniversary Date') |h %></TD>
+    <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD>
+  </TR>
+
+% }
+
 % if ( $conf->exists('cust_main-require_censustract') ) {
 
   <TR>

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

Summary of changes:
 FS/FS/Conf.pm                            |    7 +++
 FS/FS/Schema.pm                          |    1 +
 FS/FS/cust_main.pm                       |    4 +-
 FS/FS/cust_main/Import.pm                |    3 +-
 FS/FS/cust_main/Search.pm                |    6 ++-
 httemplate/edit/cust_main.cgi            |    1 +
 httemplate/edit/cust_main/birthdate.html |   16 ++++++++
 httemplate/edit/process/cust_main.cgi    |    5 ++-
 httemplate/misc/order_pkg.html           |   62 +++++++++++++++++++++--------
 httemplate/search/cust_main.html         |    2 +-
 httemplate/search/report_cust_main.html  |   14 +++++++
 httemplate/view/cust_main/misc.html      |   14 +++++++
 12 files changed, 113 insertions(+), 22 deletions(-)




More information about the freeside-commits mailing list