[freeside-commits] branch master updated. 59669128b6409e2556aa26d659c5cc22a1c7b945

Ivan ivan at 420.am
Sat Mar 26 22:45:18 PDT 2016


The branch, master has been updated
       via  59669128b6409e2556aa26d659c5cc22a1c7b945 (commit)
       via  73a0010272b15b42c19a40f59fd09c74fca2af5c (commit)
      from  8ea01f3b6874ee3a96441a821b422def2ceead5d (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 59669128b6409e2556aa26d659c5cc22a1c7b945
Merge: 73a0010 8ea01f3
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Mar 26 22:45:14 2016 -0700

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


commit 73a0010272b15b42c19a40f59fd09c74fca2af5c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sat Mar 26 22:45:09 2016 -0700

    freeside inc. web services for address normalizaion and printing, RT#33849

diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index a24d736..7004d70 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -183,6 +183,7 @@ tie my %rights, 'Tie::IxHash',
   'Customer invoice / financial info rights' => [
     'View invoices',
     'Resend invoices', #NEWNEW
+    { rightname=>'Print and mail invoices', desc=>"Print and mail via Freeside's web service", }, ##NEWER than NEWNEWNEW
     'Void invoices',
     'Unvoid invoices',
     'View customer tax exemptions', #yow
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index 57f67de..59defb7 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -254,6 +254,7 @@ sub _upgrade_data { # class method
     'Add on-the-fly void credit reason' => 'Add on-the-fly void reason',
     '_ALL' => 'Employee preference telephony integration',
     'Edit customer package dates' => 'Change package start date', #4.x
+    'Resend invoices' => 'Print and mail invoices',
   );
 
 #  foreach my $old_acl ( keys %onetime ) {
diff --git a/httemplate/misc/post_fsinc-invoice.cgi b/httemplate/misc/post_fsinc-invoice.cgi
new file mode 100644
index 0000000..94eaf66
--- /dev/null
+++ b/httemplate/misc/post_fsinc-invoice.cgi
@@ -0,0 +1,43 @@
+% my $title = $error ? 'Error printing and mailing invoice' : 'Invoice printed and mailed';
+<% include('/elements/header-popup.html', $title ) %>
+<DIV STYLE="text-align: center;">
+<SPAN STYLE="color: red; font-weight: bold;"><% $error %></SPAN><BR>
+<BUTTON TYPE="button" onClick="parent.cClick();">Close</BUTTON>
+</DIV>
+<% include('/elements/footer-popup.html') %>
+
+<%init>
+
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Print and mail invoices');
+
+my $invnum      = $cgi->param('invnum');
+
+my $template    = $cgi->param('template');
+my $notice_name = $cgi->param('notice_name') if $cgi->param('notice_name');
+my $no_coupon   = $cgi->param('no_coupon');
+
+#XXX agent-virt
+my $cust_bill = qsearchs('cust_bill',{'invnum'=>$invnum})
+  or die "Unknown invnum\n";
+
+my $mode;
+if ( $cgi->param('mode') =~ /^(\d+)$/ ) {
+  $mode = $1;
+}
+$cust_bill->set('mode' => $mode) if $mode;
+
+#these methods die instead of return errors, so, handle that without a backtrace
+local $@;
+my $letter_id = 
+  eval { $cust_bill->postal_mail_fsinc( 'template'    => $template,
+                                        'notice_name' => $notice_name,
+                                        'no_coupon'   => $no_coupon,
+                                      ); 
+       };
+my $error = "$@";
+
+$error ||= 'Unknown print and mail error: no letter ID returned'
+  unless $letter_id;
+
+</%init>
diff --git a/httemplate/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi
index cf0c319..c95e01d 100755
--- a/httemplate/view/cust_bill.cgi
+++ b/httemplate/view/cust_bill.cgi
@@ -95,8 +95,18 @@ function areyousure(href, message) {
 % }
 
 % if ( $curuser->access_right('Resend invoices') ) {
+        <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Print this invoice') |h %></A>
+% }
+
+% if ( $curuser->access_right('Print and mail invoices') ) {
+        | <& /elements/popup_link.html,
+               'action'      => $p."misc/post_fsinc-invoice.cgi?$link",
+               'label'       => 'Print and mail this invoice online',
+               'actionlabel' => 'Invoice printing and mailing',
+          &>
+% }
 
-    <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A>
+% if ( $curuser->access_right('Resend invoices') ) {
 
 %   if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { 
         | <A HREF="<% $p %>misc/send-invoice.cgi?method=email;<% $link %>"><% mt('Re-email this invoice') |h %></A>
@@ -106,8 +116,11 @@ function areyousure(href, message) {
         | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A>
 %   } 
 
-    <BR><BR>
+% }
 
+% if (    $curuser->access_right('Resend invoices')
+%      || $curuser->access_right('Print and mail invoices') ) {
+        <BR><BR>
 % } 
 
 % my $br = 0;

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

Summary of changes:
 FS/FS/AccessRight.pm                   |    1 +
 FS/FS/access_right.pm                  |    1 +
 httemplate/misc/post_fsinc-invoice.cgi |   43 ++++++++++++++++++++++++++++++++
 httemplate/view/cust_bill.cgi          |   17 +++++++++++--
 4 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100644 httemplate/misc/post_fsinc-invoice.cgi




More information about the freeside-commits mailing list