[freeside-commits] branch master updated. 0b07c1da9b37ce82bf505f0a860bb0693cedb264

Mark Wells mark at 420.am
Sat Nov 28 16:58:36 PST 2015


The branch, master has been updated
       via  0b07c1da9b37ce82bf505f0a860bb0693cedb264 (commit)
       via  c161480fdf36c2a54cff211f5e661cf0bc91b90e (commit)
       via  a66b6c5609a308c654c56aa858a645fbdfb82495 (commit)
      from  974347d88d264c60e65cbd22ac52553931b25ab8 (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 0b07c1da9b37ce82bf505f0a860bb0693cedb264
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Nov 28 16:48:35 2015 -0800

    when unholding a package, optionally set it to start on the next bill date, #38921

diff --git a/httemplate/misc/process/unhold_pkg.html b/httemplate/misc/process/unhold_pkg.html
new file mode 100755
index 0000000..6eec7ee
--- /dev/null
+++ b/httemplate/misc/process/unhold_pkg.html
@@ -0,0 +1,54 @@
+<& /elements/header-popup.html &>
+  <SCRIPT TYPE="text/javascript">
+    window.top.location.reload();
+  </SCRIPT>
+  </BODY>
+</HTML>
+<%init>
+
+warn Dumper +{$cgi->Vars}; # XXX
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+die "access denied"
+  unless $curuser->access_right('Unsuspend customer package');
+
+$cgi->param('pkgnum') =~ /^(\d+)$/
+  or die "illegal pkgnum";
+my $pkgnum = $1;
+
+my $cust_pkg = qsearchs({
+  table     => 'cust_pkg',
+  addl_from => ' JOIN cust_main USING (custnum) ',
+  hashref   => { 'pkgnum' => $pkgnum },
+  extra_sql => ' AND '. $curuser->agentnums_sql,
+}) or die "Unknown pkgnum: $pkgnum";
+
+my $cust_main = $cust_pkg->cust_main;
+
+my $error;
+my $start_date;
+if ( $cgi->param('when') eq 'now' ) {
+  # start it the next time billing runs
+  $start_date = '';
+} elsif ( $cgi->param('when') eq 'next_bill_date' ) {
+  $start_date = $cust_main->next_bill_date;
+} elsif ( $cgi->param('when') eq 'date' ) {
+  $start_date = parse_datetime($cgi->param('start_date'));
+}
+
+# In this process, always unsuspend the package _now_ but with a future start
+# date, rather than set a resume date. (There is some semantic overlap between
+# them, yes.)
+
+if ( $cust_pkg->setup or !$cust_pkg->susp ) {
+  $error = 'This package is '. $cust_pkg->status . ', not on hold.';
+} else {
+  $cust_pkg->set('start_date', $start_date);
+  $error = $cust_pkg->unsuspend;
+}
+
+if ( $error ) {
+  $cgi->param('error', $error);
+  print $cgi->redirect($fsurl.'misc/unhold_pkg.html?', $cgi->query_string);
+}
+</%init>
diff --git a/httemplate/misc/unhold_pkg.html b/httemplate/misc/unhold_pkg.html
new file mode 100755
index 0000000..0c110b4
--- /dev/null
+++ b/httemplate/misc/unhold_pkg.html
@@ -0,0 +1,93 @@
+<& /elements/header-popup.html, mt($title) &>
+
+<& /elements/error.html &>
+
+%# use unsusp_pkg.cgi, the same target as a direct "unsuspend package" link
+<FORM NAME="UnholdForm" ACTION="process/unhold_pkg.html" METHOD=POST>
+<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
+
+<BR>
+<% emt('Start billing [_1]', $part_pkg->pkg_comment(cust_pkg => $cust_pkg)) %>
+<UL STYLE="padding-left: 3ex; list-style: none; background-color: #cccccc">
+<LI>
+  <& /elements/radio.html,
+    field => 'when',
+    id    => 'when_now',
+    value => 'now',
+    curr_value => $when,
+  &>
+  <label for="when_now"><% emt('Immediately') %></label>
+</LI>
+% if ( $next_bill_date ) {
+<LI>
+  <& /elements/radio.html,
+    field => 'when',
+    id    => 'when_next_bill_date',
+    value => 'next_bill_date',
+    curr_value => $when,
+  &>
+  <label for="when_next_bill_date">
+    <% emt('On the next bill date: [_1]', 
+      time2str($date_format, $next_bill_date) ) %>
+  </label>
+</LI>
+% }
+<LI>
+<& /elements/radio.html,
+  field => 'when',
+  id    => 'when_date',
+  value => 'date',
+  curr_value => $when,
+&>
+<label for="when_date"> <% emt('On this date:') %> </label>
+<& /elements/input-date-field.html,
+  { name  => 'start_date',
+    value => $cgi->param('start_date'),
+  }
+&>
+</LI>
+</UL>
+<INPUT TYPE="submit" NAME="submit" VALUE="<% emt('Start billing') %>">
+
+</FORM>
+</BODY>
+</HTML>
+
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+die "access denied"
+  unless $curuser->access_right('Unsuspend customer package');
+
+my $pkgnum;
+if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) {
+  $pkgnum = $1;
+} else {
+  die "illegal query ". $cgi->keywords;
+}
+
+my $conf = new FS::Conf;
+my $date_format = $conf->config('date_format') || '%m/%d/%Y';
+
+my $title = 'Start billing package';
+
+my $cust_pkg = qsearchs({
+  table     => 'cust_pkg',
+  addl_from => ' JOIN cust_main USING (custnum) ',
+  hashref   => { 'pkgnum' => $pkgnum },
+  extra_sql => ' AND '. $curuser->agentnums_sql,
+}) or die "Unknown pkgnum: $pkgnum";
+
+my $next_bill_date = $cust_pkg->cust_main->next_bill_date;
+
+my $part_pkg = $cust_pkg->part_pkg;
+
+my $when = $cgi->param('when'); # on error
+if (!$when) {
+  if ($next_bill_date) {
+    $when = 'next_bill_date';
+  } else {
+    $when = 'now';
+  }
+}
+</%init>
diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html
index 62e9be5..1a215f3 100644
--- a/httemplate/view/cust_main/packages/status.html
+++ b/httemplate/view/cust_main/packages/status.html
@@ -73,11 +73,11 @@
 
     <% pkg_status_row_discount( $cust_pkg, %opt ) %>
 
-%   unless ( $cust_pkg->order_date eq $cust_pkg->get('susp') ) { #on hold
-%     unless ( $cust_pkg->get('setup') ) { 
-        <% pkg_status_row_colspan( $cust_pkg, emt('Never billed'), '', %opt ) %>
-%     } else { 
+%   if ( $cust_pkg->order_date ne $cust_pkg->get('susp') ) { # not on hold
+%     if ( $cust_pkg->get('setup') ) {
         <% pkg_status_row($cust_pkg, emt('Setup'), 'setup', %opt ) %>
+%     } else {
+        <% pkg_status_row_colspan( $cust_pkg, emt('Never billed'), '', %opt ) %>
 %     }
 %   }
 
@@ -115,7 +115,7 @@
 %           }
 %           if ( $curuser->access_right('Unsuspend customer package') ) { 
 %             if ( $cust_pkg->order_date eq $cust_pkg->get('susp') ) { #on hold
-                ( <% pkg_link('misc/unsusp_pkg', emt('Start billing now'), $cust_pkg) %> )
+                ( <% pkg_unhold_link($cust_pkg) %> )
 %             } else {
                 ( <% pkg_unsuspend_link($cust_pkg) %> )
                 ( <% pkg_resume_link($cust_pkg) %> )
@@ -665,6 +665,18 @@ sub pkg_resume_link {
          )
 }
 
+sub pkg_unhold_link {
+  include( '/elements/popup_link-cust_pkg.html',
+             'action'      => $p. 'misc/unhold_pkg.html?',
+             'label'       => emt('Start billing'),
+             'actionlabel' => emt('Start billing'),
+             'color'       => '#00CC00',
+             'width'       => 510,
+             'height'      => 310,
+             'cust_pkg'    => shift,
+         )
+}
+
 sub pkg_unsuspend_link { pkg_link('misc/unsusp_pkg',    emt('Unsuspend now'), @_ ); }
 sub pkg_unadjourn_link { pkg_link('misc/unadjourn_pkg', emt('Abort'),     @_ ); }
 sub pkg_unexpire_link  { pkg_link('misc/unexpire_pkg',  emt('Abort'),     @_ ); }

commit c161480fdf36c2a54cff211f5e661cf0bc91b90e
Author: Mark Wells <mark at freeside.biz>
Date:   Sat Nov 28 16:47:31 2015 -0800

    temporary fix for (un)suspend notices, #37908

diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index d741907..c507a45 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -38,6 +38,9 @@ use FS::sales;
 # for modify_charge
 use FS::cust_credit;
 
+# temporary fix; remove this once (un)suspend admin notices are cleaned up
+use FS::Misc qw(send_email);
+
 # need to 'use' these instead of 'require' in sub { cancel, suspend, unsuspend,
 # setup }
 # because they load configuration by setting FS::UID::callback (see TODO)

commit a66b6c5609a308c654c56aa858a645fbdfb82495
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Nov 27 14:54:55 2015 -0800

    spelling

diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 570c5ac..ba615bb 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -297,7 +297,7 @@
                      { field=>'agent_pkgpartid', type=>'text', size=>21 },
 
                      { type  => 'tablebreak-tr-title',
-                       value => 'Line-item revenue recogition', #better name?
+                       value => 'Line-item revenue recognition', #better name?
                      },
                      { field=>'pay_weight',    type=>'text', size=>6 },
                      { field=>'credit_weight', type=>'text', size=>6 },

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

Summary of changes:
 FS/FS/cust_pkg.pm                              |    3 +
 httemplate/edit/part_pkg.cgi                   |    2 +-
 httemplate/misc/process/unhold_pkg.html        |   54 ++++++++++++++
 httemplate/misc/unhold_pkg.html                |   93 ++++++++++++++++++++++++
 httemplate/view/cust_main/packages/status.html |   22 ++++--
 5 files changed, 168 insertions(+), 6 deletions(-)
 create mode 100755 httemplate/misc/process/unhold_pkg.html
 create mode 100755 httemplate/misc/unhold_pkg.html




More information about the freeside-commits mailing list