agent-virt "email a notice to this customer" from address, RT#27424
authorIvan Kohler <ivan@freeside.biz>
Thu, 27 Feb 2014 08:29:19 +0000 (00:29 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 27 Feb 2014 08:29:19 +0000 (00:29 -0800)
httemplate/elements/email-link.html
httemplate/misc/email-customers.html
httemplate/view/cust_main.cgi

index 692e5bc..2612faa 100644 (file)
@@ -1,9 +1,10 @@
 % if ( $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices') ) {
-<A HREF="<%$p%>misc/email-customers.html?table=<%$table%>&<%$query%>"><%$label%></A>
+<A HREF="<%$p%>misc/email-customers.html?table=<%$table%>&agent_virt_agentnum=<%$agent_virt_agentnum%>&<%$query%>"><%$label%></A>
 % }
 <%init>
 my %opt = @_;
 my $table = $opt{'table'};
+my $agent_virt_agentnum = $opt{'agent_virt_agentnum'};
 my $search_hash = $opt{'search_hash'};
 die "'table' required" if !$table;
 die "'search_hash' required" if !$search_hash;
index b47f441..de800ec 100644 (file)
@@ -109,7 +109,7 @@ Template:
           <& /elements/input-text.html,
               'field' => 'from_addr',
               'type'  => 'email', # HTML5, woot
-              'value' => $conf->config('invoice_from'),
+              'value' => $conf->config('invoice_from', $agent_virt_agentnum),
               'size'  => 20,
           &>&gt;</TD>
  
@@ -154,7 +154,10 @@ die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices');
 
 my $conf = FS::Conf->new;
+
 my $table = $cgi->param('table') or die "'table' required";
+my $agent_virt_agentnum = $cgi->param('agent_virt_agentnum') || '';
+
 my %search;
 if ( $cgi->param('search') ) {
   %search = %{ thaw(decode_base64($cgi->param('search'))) };
index ee615e8..d135248 100755 (executable)
@@ -131,9 +131,10 @@ function areyousure(href, message) {
 % 
 % my $email_link = ($cust_main->invoicing_list_emailonly) && 
 %   include('/elements/email-link.html',
-%            'table' => 'cust_main', 
-%            'search_hash' => { 'custnum' => $custnum },
-%            'label' => 'Email a notice to this customer',
+%            'table'               => 'cust_main', 
+%            'search_hash'         => { 'custnum' => $custnum },
+%            'agent_virt_agentnum' => $cust_main->agentnum,
+%            'label'               => 'Email a notice to this customer',
 % );
 % if ( $email_link and $br ) {
  |