[freeside-commits] branch FREESIDE_3_BRANCH updated. 793113e437c711b726f3b2fefb3091ff93ddd4d7

Mitch Jackson mitch at freeside.biz
Sat Oct 27 19:21:19 PDT 2018


The branch, FREESIDE_3_BRANCH has been updated
       via  793113e437c711b726f3b2fefb3091ff93ddd4d7 (commit)
       via  2d9e07f765e6c9a6d7a536ce3163aa83e822499b (commit)
      from  702c7a001e2a065ca833a7d5711754b38278e41d (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 793113e437c711b726f3b2fefb3091ff93ddd4d7
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Sat Oct 27 22:19:55 2018 -0400

    RT# 38217 Fix substitutions for System Log email template

diff --git a/FS/FS/log.pm b/FS/FS/log.pm
index 75e17c847..67a74d196 100644
--- a/FS/FS/log.pm
+++ b/FS/FS/log.pm
@@ -4,6 +4,7 @@ use strict;
 use base qw( FS::Record );
 use FS::Record qw( qsearch qsearchs dbdef );
 use FS::UID qw( dbh driver_name );
+use FS::Log;
 use FS::log_context;
 use FS::log_email;
 use FS::upgrade_journal;
@@ -81,9 +82,11 @@ Will send emails according to the conditions in L<FS::log_email>.
 sub insert {
   # not using process_o2m for this, because we don't have a web interface
   my $self = shift;
+
   my $error = $self->SUPER::insert;
   return $error if $error;
-  my $contexts = {}; #for quick checks when sending emails
+
+  my $contexts = {};
   foreach ( @_ ) {
     my $context = FS::log_context->new({
         'lognum'  => $self->lognum,
@@ -93,6 +96,7 @@ sub insert {
     return $error if $error;
     $contexts->{$_} = 1;
   }
+
   foreach my $log_email (
     qsearch('log_email',
       {
@@ -112,11 +116,11 @@ sub insert {
       next;
     }
     my $emailerror = $msg_template->send(
-      'msgtype'       => 'admin',
-      'to'            => $log_email->to_addr,
+      'msgtype' => 'admin',
+      'to'      => $log_email->to_addr,
       'substitutions' => {
-        'loglevel'   => $FS::Log::LEVELS{$self->level}, # which has hopefully been loaded...
-        'logcontext' => $log_email->context, # use the one that triggered the email
+        'loglevel'   => $FS::Log::LEVELS{$self->level} || 'unknown',
+        'logcontext' => join(', ', keys( %$contexts )) || 'unknown',
         'logmessage' => $self->message,
       },
     );

commit 2d9e07f765e6c9a6d7a536ce3163aa83e822499b
Author: Mitch Jackson <mitch at freeside.biz>
Date:   Sat Oct 27 22:18:36 2018 -0400

    RT# 38217 Help for variables in System Log template

diff --git a/httemplate/edit/msg_template.html b/httemplate/edit/msg_template.html
index 0478a8066..17e9966de 100644
--- a/httemplate/edit/msg_template.html
+++ b/httemplate/edit/msg_template.html
@@ -305,6 +305,11 @@ my %substitutions = (
     '$payinfo'        => 'Card/account# (masked)',
     '$payinfo_end'    => 'Card/account last 4 digits',
   ],
+  'system_log' => [
+    '$loglevel'   => 'Log event severity level',
+    '$logcontext' => 'Log event context',
+    '$logmessage' => 'Log event message text'
+  ],
 );
 
 tie my %sections, 'Tie::IxHash', (
@@ -319,6 +324,7 @@ tie my %sections, 'Tie::IxHash', (
 'svc_domain'=> 'Domain service fields',
 'svc_phone' => 'Phone service fields',
 'svc_broadband' => 'Broadband service fields',
+'system_log' => 'System log fields',
 );
 
 my $widget = new HTML::Widgets::SelectLayers(

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

Summary of changes:
 FS/FS/log.pm                      | 14 +++++++++-----
 httemplate/edit/msg_template.html |  6 ++++++
 2 files changed, 15 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list