[freeside-commits] branch FREESIDE_4_BRANCH updated. 77c3202f902126afe13a7fe6543d0e88d7f4deea

Mark Wells mark at 420.am
Thu Mar 31 16:52:54 PDT 2016


The branch, FREESIDE_4_BRANCH has been updated
       via  77c3202f902126afe13a7fe6543d0e88d7f4deea (commit)
       via  166741cba0f861e264cb4ee5ddccf28b5be0ed05 (commit)
      from  6c80350b6c5301cfbd3b9a69e76f4f945ce806f8 (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 77c3202f902126afe13a7fe6543d0e88d7f4deea
Author: Mark Wells <mark at freeside.biz>
Date:   Tue Mar 29 16:39:08 2016 -0700

    some fixes for contact selfservice login and password reset, #25533

diff --git a/FS/FS/contact.pm b/FS/FS/contact.pm
index 39abed2..2cea2d1 100644
--- a/FS/FS/contact.pm
+++ b/FS/FS/contact.pm
@@ -749,9 +749,9 @@ sub contact_email {
 
 =item by_selfservice_email EMAILADDRESS
 
-Alternate search constructor (class method).  Given an email address,
-returns the contact for that address, or the empty string if no contact
-has that email address.
+Alternate search constructor (class method).  Given an email address, returns
+the contact for that address. If that contact doesn't have selfservice access,
+or there isn't one, returns the empty string.
 
 =cut
 
@@ -762,7 +762,8 @@ sub by_selfservice_email {
     'table'     => 'contact_email',
     'addl_from' => ' LEFT JOIN contact USING ( contactnum ) ',
     'hashref'   => { 'emailaddress' => $email, },
-    'extra_sql' => " AND ( disabled IS NULL OR disabled = '' )",
+    'extra_sql' => " AND ( contact.disabled IS NULL ) ".
+                   " AND ( contact.selfservice_access = 'Y' )",
   }) or return '';
 
   $contact_email->contact;
@@ -883,9 +884,9 @@ sub send_reset_email {
   my $agentnum = $cust_main ? $cust_main->agentnum : '';
   my $msgnum = $conf->config('selfservice-password_reset_msgnum', $agentnum);
   #die "selfservice-password_reset_msgnum unset" unless $msgnum;
-  return { 'error' => "selfservice-password_reset_msgnum unset" } unless $msgnum;
+  return "selfservice-password_reset_msgnum unset" unless $msgnum;
   my $msg_template = qsearchs('msg_template', { msgnum => $msgnum } );
-  return { 'error' => "selfservice-password_reset_msgnum cannot be loaded" } unless $msg_template;
+  return "selfservice-password_reset_msgnum cannot be loaded" unless $msg_template;
   my %msg_template = (
     'to'            => join(',', map $_->emailaddress, @contact_email ),
     'cust_main'     => $cust_main,
@@ -897,7 +898,7 @@ sub send_reset_email {
 
     my $cust_msg = $msg_template->prepare( %msg_template );
     my $error = $cust_msg->insert;
-    return { 'error' => $error } if $error;
+    return $error if $error;
     my $queue = new FS::queue {
       'job'     => 'FS::cust_msg::process_send',
       'custnum' => $cust_main ? $cust_main->custnum : '',

commit 166741cba0f861e264cb4ee5ddccf28b5be0ed05
Author: Mark Wells <mark at freeside.biz>
Date:   Thu Mar 31 16:51:19 2016 -0700

    fix invoice_email_pdf_msgnum template inclusion, #41502, from #21654

diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index 6974f7d..a82d51d 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2116,13 +2116,22 @@ sub generate_email {
 
       my $msg_template = FS::msg_template->by_key($msgnum)
         or die "${tc}email_pdf_msgnum $msgnum not found\n";
-      my %prepared = $msg_template->prepare(
+      my $cust_msg = $msg_template->prepare(
         cust_main => $self->cust_main,
-        object    => $self
+        object    => $self,
+        msgtype   => 'invoice',
       );
 
-      @text = split(/(?=\n)/, $prepared{'text_body'});
-      $html = $prepared{'html_body'};
+      # XXX hack to make this work in the new cust_msg era; consider replacing
+      # with cust_bill_send_with_notice events.
+      my @parts = $cust_msg->parts;
+      foreach my $part (@parts) { # will only have two parts, normally
+        if ( $part->mime_type eq 'text/plain' ) {
+          @text = @{ $part->body };
+        } elsif ( $part->mime_type eq 'text/html' ) {
+          $html = $part->bodyhandle->as_string;
+        }
+      }
 
     } elsif ( my @note = $conf->config($tc.'email_pdf_note') ) {
 

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

Summary of changes:
 FS/FS/Template_Mixin.pm |   17 +++++++++++++----
 FS/FS/contact.pm        |   15 ++++++++-------
 2 files changed, 21 insertions(+), 11 deletions(-)




More information about the freeside-commits mailing list