[freeside-commits] branch master updated. 3a9052a3f2026b8ba2f94bf9f194a36c0a2b76e4

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


The branch, master has been updated
       via  3a9052a3f2026b8ba2f94bf9f194a36c0a2b76e4 (commit)
       via  900b2e6344ff3b0978542b967964ac7f2d4a54bd (commit)
      from  afaeb8d17e05caf0a596fb5385059bc5040f7fbd (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 3a9052a3f2026b8ba2f94bf9f194a36c0a2b76e4
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') ) {
 

commit 900b2e6344ff3b0978542b967964ac7f2d4a54bd
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 592c719..f6d9d03 100644
--- a/FS/FS/contact.pm
+++ b/FS/FS/contact.pm
@@ -743,9 +743,9 @@ sub firstlast {
 
 =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
 
@@ -756,7 +756,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;
@@ -877,9 +878,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,
@@ -891,7 +892,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 : '',

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

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