Merge branch 'master' of git.freeside.biz:/home/git/freeside
authorIvan Kohler <ivan@freeside.biz>
Fri, 25 Aug 2017 22:06:19 +0000 (15:06 -0700)
committerIvan Kohler <ivan@freeside.biz>
Fri, 25 Aug 2017 22:06:19 +0000 (15:06 -0700)
1  2 
FS/FS/AccessRight.pm
FS/FS/Conf.pm
FS/FS/access_right.pm
FS/FS/cust_main_Mixin.pm

diff --combined FS/FS/AccessRight.pm
@@@ -329,7 -329,7 +329,7 @@@ tie my %rights, 'Tie::IxHash'
      'Usage: Unrateable CDRs',
      'Usage: Time worked',
      #gone in 4.x as a distinct ACL (for now?) { rightname=>'Employees: Commission Report', global=>1 },
 -    { rightname=>'Employees: Audit Report', global=>1 },
 +    { rightname=>'Employee Reports', global=>1 },
  
      #{ rightname => 'List customers of all agents', global=>1 },
    ],
      { rightname=>'Employee preference telephony integration' },
    #]
  
+   #'RT preference rights' => [
+     { rightname=>'RT activity notification' },
+   #]
    ],
    
    ###
diff --combined FS/FS/Conf.pm
@@@ -898,6 -898,14 +898,14 @@@ my $validate_email = sub { $_[0] =
    },
  
    {
+     'key'         => 'email-to-voice_domain',
+     'section'     => 'email_to_voice_services',
+     'description' => 'The Domain to send email to voice to',
+     'type'        => 'text',
+     'per_agent'   => 1,
+   },
+   {
      'key'         => 'next-bill-ignore-time',
      'section'     => 'billing',
      'description' => 'Ignore the time portion of next bill dates when billing, matching anything from 00:00:00 to 23:59:59 on the billing day.',
@@@ -5788,8 -5796,8 +5796,8 @@@ and customer address. Include units.'
  
    {
      'key'         => 'logout-timeout',
 -    'section'     => 'UI',
 -    'description' => 'If set, automatically log users out of the backoffice after this many minutes.',
 +    'section'     => 'deprecated',
 +    'description' => 'Deprecated.  Used to automatically log users out of the backoffice after this many minutes.  Set session timeouts in employee groups instead.',
      'type'       => 'text',
    },
    
diff --combined FS/FS/access_right.pm
@@@ -155,7 -155,6 +155,7 @@@ sub _upgrade_data { # class metho
      'Refund payment'  => [ 'Refund credit card payment', 'Refund Echeck payment' ],
      'Regular void'    => [ 'Void payments' ],
      'Unvoid'          => [ 'Unvoid payments', 'Unvoid invoices' ],
 +    'Employees: Audit Report' => [ 'Employee Reports' ],
    );
  
    foreach my $oldright (keys %migrate) {
                              'Usage: Unrateable CDRs',
                            ],
      'Provision customer service' => [ 'Edit password' ],
 -    'Financial reports' => [ 'Employees: Commission Report',
 -                             'Employees: Audit Report',
 -                           ],
 +    'Financial reports' => 'Employee Reports',
      'Change customer package' => 'Detach customer package',
      'Services: Accounts' => 'Services: Cable Subscribers',
      'Bulk change customer packages' => 'Bulk move customer services',
      'Generate quotation' => 'Disable quotation',
      'Add on-the-fly void credit reason' => 'Add on-the-fly void reason',
      '_ALL' => 'Employee preference telephony integration',
+     '_ALL' => 'RT activity notification',
      'Edit customer package dates' => [ 'Change package start date', #4.x
                                         'Change package contract end date',
                                       ],
diff --combined FS/FS/cust_main_Mixin.pm
@@@ -262,17 -262,6 +262,17 @@@ sub cust_statuscolor 
      : '000000';
  }
  
 +=item agent_name
 +
 +=cut
 +
 +sub agent_name {
 +  my $self = shift;
 +  $self->cust_linked
 +    ? $self->cust_main->agent_name
 +    : $self->cust_unlinked_msg;
 +}
 +
  =item prospect_sql
  
  =item active_sql
@@@ -408,14 -397,21 +408,21 @@@ use Digest::SHA qw(sha1); # for duplica
  sub email_search_result {
    my($class, $param) = @_;
  
+   my $conf = FS::Conf->new;
+   my $send_to_domain = $conf->config('email-to-voice_domain');
    my $msgnum = $param->{msgnum};
    my $from = delete $param->{from};
    my $subject = delete $param->{subject};
    my $html_body = delete $param->{html_body};
    my $text_body = delete $param->{text_body};
    my $to_contact_classnum = delete $param->{to_contact_classnum};
+   my $emailtovoice_name = delete $param->{emailtovoice_contact};
    my $error = '';
  
+   my $to = $emailtovoice_name . '@' . $send_to_domain unless !$emailtovoice_name;
    my $job = delete $param->{'job'}
      or die "email_search_result must run from the job queue.\n";
    
        next; # unlinked object; nothing else we can do
      }
  
+ my %to = {};
+ if ($to) { $to{'to'} = $to; }
      my $cust_msg = $msg_template->prepare(
        'cust_main' => $cust_main,
        'object'    => $obj,
        'to_contact_classnum' => $to_contact_classnum,
+       %to,
      );
  
      # For non-cust_main searches, we avoid duplicates based on message