[freeside-commits] branch master updated. 50b038e338455c5d20f48f99767767b70c515c31

Jonathan Prykop jonathan at 420.am
Fri Oct 23 18:47:02 PDT 2015


The branch, master has been updated
       via  50b038e338455c5d20f48f99767767b70c515c31 (commit)
      from  acfdb8bec93849e35ae5c4abc276d6ca8006f717 (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 50b038e338455c5d20f48f99767767b70c515c31
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Fri Oct 23 20:46:01 2015 -0500

    RT#38533: One click re-send refund,payment receipt, invoice

diff --git a/httemplate/elements/popup_link_onclick.html b/httemplate/elements/popup_link_onclick.html
index 612de75..8faa27f 100644
--- a/httemplate/elements/popup_link_onclick.html
+++ b/httemplate/elements/popup_link_onclick.html
@@ -9,12 +9,13 @@ Example:
     #required
     'action'         => 'content.html', # uri for content of popup
 
-    #alternately, use instead of action
-    'js_action'      => 'url',          # javascript variable or expression
-   
     #strongly recommended
     'actionlabel     => 'You clicked',  # popup title
    
+    #alternately, use instead of action, values will be passed unquoted to overlib
+    'js_action'      => 'url',          # javascript variable or expression
+    'js_actionlabel' => 'actionlabel',  # javascript variable or expression   
+
     #opt
     'width'          => 540,
     'height'         => 336,
@@ -50,9 +51,10 @@ if (ref($_[0]) eq 'HASH') {
   $params = { @_ };
 }
 
-$action      = q(') . $params->{'action'} . q(') if exists $params->{'action'};
+$action      = q(') . $params->{'action'} . q(');
 $action      = $params->{'js_action'}   if exists $params->{'js_action'};
-$actionlabel = $params->{'actionlabel'} if exists $params->{'actionlabel'};
+$actionlabel = q(') . $params->{'actionlabel'} . q(');
+$actionlabel = $params->{'js_actionlabel'} if exists $params->{'js_actionlabel'};
 $width       = $params->{'width'}       if exists $params->{'width'};
 $height      = $params->{'height'}      if exists $params->{'height'};
 $color       = $params->{'color'}       if exists $params->{'color'};
@@ -66,7 +68,7 @@ my $popup_name = 'popup-'.random_id();
 
 my $onclick =
   "overlib( OLiframeContent($action, $width, $height, '$popup_name', 0, '$scrolling' ), ".
-    "CAPTION, '$actionlabel', STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, ".
+    "CAPTION, $actionlabel, STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0, ".
     "DRAGGABLE, CLOSECLICK, ".
     "BGCOLOR, '$color', CGCOLOR, '$color', FGCOLOR, '#f8f8f8', ".
     "CLOSETEXT, '$closetext'".
diff --git a/httemplate/misc/send-invoice.cgi b/httemplate/misc/send-invoice.cgi
index dd9c3ad..4358753 100644
--- a/httemplate/misc/send-invoice.cgi
+++ b/httemplate/misc/send-invoice.cgi
@@ -1,4 +1,12 @@
-% if ( $error ) {
+% if ($cgi->param('popup')) {
+%   my $title = $error ? 'Error sending invoice email' : 'Invoice email sent';
+<% 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.html') %>
+% } elsif ( $error ) {
 %   errorpage($error);
 % } else {
 <% $cgi->redirect("${p}view/cust_main.cgi?$custnum") %>
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 95cb5da..af611bb 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -35,6 +35,14 @@ function areyousure(href, message) {
   if (confirm(message) == true)
     window.location.href = href;
 }
+function areyousure_popup(message, action, actionlabel) {
+  if (confirm(message) == true) {
+<% include('/elements/popup_link_onclick.html',
+     'js_action' => 'action',
+     'js_actionlabel' => 'actionlabel',
+   ) %>
+  }
+}
 </SCRIPT>
 
 <br>
diff --git a/httemplate/view/cust_main/payment_history.html b/httemplate/view/cust_main/payment_history.html
index d81fe99..4812514 100644
--- a/httemplate/view/cust_main/payment_history.html
+++ b/httemplate/view/cust_main/payment_history.html
@@ -226,7 +226,7 @@ my %opt = (
   #rights
   ( map { $_ => $curuser->access_right($_) }
       (
-        'View invoices', 'Void invoices', 'Unvoid invoices',
+        'View invoices', 'Void invoices', 'Unvoid invoices', 'Resend invoices',
         'Apply payment', 'Refund credit card payment', 'Refund Echeck payment',
         'Post refund', 'Post check refund', 'Post cash refund ', 'Refund payment',
         'Credit card void', 'Echeck void', 'Void payments', 'Unvoid payments',
@@ -240,6 +240,7 @@ my %opt = (
   #customer information
   'total_owed'              => $cust_main->total_owed,
   'total_unapplied_refunds' => $cust_main->total_unapplied_refunds,
+  'has_email_address'       => scalar($cust_main->invoicing_list_emailonly),
 );
 
 $opt{'date_format'} ||= '%m/%d/%Y';
diff --git a/httemplate/view/cust_main/payment_history/invoice.html b/httemplate/view/cust_main/payment_history/invoice.html
index be4e93e..058da54 100644
--- a/httemplate/view/cust_main/payment_history/invoice.html
+++ b/httemplate/view/cust_main/payment_history/invoice.html
@@ -1,4 +1,4 @@
-<% $link %><% $invoice %><% $link ? '</A>' : '' %><% "$void$under" %>
+<% $link %><% $invoice %><% $link ? '</A>' : '' %><% "$email$void$under" %>
 <%init>
 
 my( $cust_bill, %opt ) = @_;
@@ -34,6 +34,15 @@ if ( $cust_bill->closed !~ /^Y/i && $opt{'Void invoices'} ) {
      ')';
 }
 
+my $email = ($opt{'has_email_address'} && $opt{'Resend invoices'}) ? 
+  q! (<A HREF="javascript:void(0)" ONCLICK="areyousure_popup('Send email receipt for invoice #!.
+  $cust_bill->invnum.
+  q! to customer?','!.
+  "${p}misc/send-invoice.cgi?method=email;notice_name=Invoice;popup=1;invnum=".
+  $cust_bill->invnum.
+  q!','Email Invoice Receipt')" TITLE="Send email receipt">email receipt</A>)!
+  : '';
+
 my $events = '';
 if ( $cust_bill->num_cust_event
      && ($opt{'Billing event reports'} || $opt{'View customer billing events'})
diff --git a/httemplate/view/cust_main/payment_history/payment.html b/httemplate/view/cust_main/payment_history/payment.html
index fd336b8..d72e34b 100644
--- a/httemplate/view/cust_main/payment_history/payment.html
+++ b/httemplate/view/cust_main/payment_history/payment.html
@@ -1,5 +1,5 @@
 <% $payment. ' '.  $info. $desc.
-   $view. $change_pkg. $apply. $refund. $void. $unapply
+   $view. $email. $change_pkg. $apply. $refund. $void. $unapply
 %>
 <%init>
 
@@ -139,6 +139,13 @@ my $view =
                ).
    ')';
 
+my $email = $opt{'has_email_address'} ? 
+  q! (<A HREF="javascript:void(0)" ONCLICK="areyousure_popup('Send email receipt for payment to customer?','!.
+  "${p}view/cust_pay.html?link=email;paynum=".
+  $cust_pay->paynum.
+  q!','Email Payment Receipt')" TITLE="Send email receipt">email receipt</A>)!
+  : '';
+
 my $change_pkg = '';
 if ( $apply && $opt{'pkg-balances'} && $cust_pay->pkgnum ) {
   $change_pkg =
diff --git a/httemplate/view/cust_main/payment_history/refund.html b/httemplate/view/cust_main/payment_history/refund.html
index fc2a5cc..e82df90 100644
--- a/httemplate/view/cust_main/payment_history/refund.html
+++ b/httemplate/view/cust_main/payment_history/refund.html
@@ -1,6 +1,6 @@
 <% $refund %> 
 (<% "$payby$payinfo" %>)
-<% "$view$delete" %>
+<% "$view$email$delete" %>
 <%init>
 
 my( $cust_refund, %opt ) = @_;
@@ -26,6 +26,13 @@ my $view =
                ).
    ')';
 
+my $email = $opt{'has_email_address'} ? 
+  q! (<A HREF="javascript:void(0)" ONCLICK="areyousure_popup('Send email receipt for refund to customer?','!.
+  "${p}view/cust_refund.html?link=email;refundnum=".
+  $cust_refund->refundnum.
+  q!','Email Refund Receipt')" TITLE="Send email receipt">email receipt</A>)!
+  : '';
+
 my $delete = '';
 $delete = areyousure_link("${p}misc/delete-cust_refund.cgi?".$cust_refund->refundnum,
                            emt('Are you sure you want to delete this refund?'),

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

Summary of changes:
 httemplate/elements/popup_link_onclick.html            |   14 ++++++++------
 httemplate/misc/send-invoice.cgi                       |   10 +++++++++-
 httemplate/view/cust_main.cgi                          |    8 ++++++++
 httemplate/view/cust_main/payment_history.html         |    3 ++-
 httemplate/view/cust_main/payment_history/invoice.html |   11 ++++++++++-
 httemplate/view/cust_main/payment_history/payment.html |    9 ++++++++-
 httemplate/view/cust_main/payment_history/refund.html  |    9 ++++++++-
 7 files changed, 53 insertions(+), 11 deletions(-)




More information about the freeside-commits mailing list