invoice_sections_with_taxes per-agent, RT#79636
authorIvan Kohler <ivan@freeside.biz>
Wed, 4 Apr 2018 19:49:49 +0000 (12:49 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 4 Apr 2018 19:49:49 +0000 (12:49 -0700)
FS/FS/Conf.pm
FS/FS/Template_Mixin.pm

index f3e2890..0a29075 100644 (file)
@@ -1581,6 +1581,7 @@ and customer address. Include units.',
     'description' => 'Split invoice into sections and label according to either package category or location when enabled.',
     'type'        => 'checkbox',
     'per_agent'   => 1,
     'description' => 'Split invoice into sections and label according to either package category or location when enabled.',
     'type'        => 'checkbox',
     'per_agent'   => 1,
+    'config_bool' => 1,
   },
 
   {
   },
 
   {
@@ -1612,6 +1613,8 @@ and customer address. Include units.',
     'section'     => 'invoicing',
     'description' => 'Include taxes within each section of mutli-section invoices.',
     'type'        => 'checkbox',
     'section'     => 'invoicing',
     'description' => 'Include taxes within each section of mutli-section invoices.',
     'type'        => 'checkbox',
+    'per_agent'   => 1,
+    'agent_bool'  => 1,
   },
 
   {
   },
 
   {
index 3d206db..f1db477 100644 (file)
@@ -299,7 +299,7 @@ before that line item (quotations only)
 
 =item template
 
 
 =item template
 
-Dprecated.  Used as a suffix for a configuration template.  Please
+Deprecated.  Used as a suffix for a configuration template.  Please
 don't use this, it deprecated in favor of more flexible alternatives.
 
 =back
 don't use this, it deprecated in favor of more flexible alternatives.
 
 =back
@@ -1195,7 +1195,7 @@ sub print_generic {
     my %options = ();
     $options{'section'} = $section if $multisection;
     $options{'section_with_taxes'} = 1
     my %options = ();
     $options{'section'} = $section if $multisection;
     $options{'section_with_taxes'} = 1
-      if $conf->exists('invoice_sections_with_taxes');
+      if $conf->config_bool('invoice_sections_with_taxes', $cust_main->agentnum);
     $options{'format'} = $format;
     $options{'escape_function'} = $escape_function;
     $options{'no_usage'} = 1 unless $unsquelched;
     $options{'format'} = $format;
     $options{'escape_function'} = $escape_function;
     $options{'no_usage'} = 1 unless $unsquelched;
@@ -1384,7 +1384,7 @@ sub print_generic {
         $tax_section->{'description'} = $self->mt($tax_description);
         $tax_section->{'summarized'} = '';
 
         $tax_section->{'description'} = $self->mt($tax_description);
         $tax_section->{'summarized'} = '';
 
-        if ( $conf->exists('invoice_sections_with_taxes')) {
+        if ( $conf->config_bool('invoice_sections_with_taxes', $cust_main->agentnum) ) {
 
           # remove tax section if taxes are itemized within other sections
           @sections = grep{ $_ ne $tax_section } @sections;
 
           # remove tax section if taxes are itemized within other sections
           @sections = grep{ $_ ne $tax_section } @sections;
@@ -2038,7 +2038,7 @@ sub balance_due_msg {
   my $msg = $self->mt('Balance Due');
   return $msg unless $self->terms; # huh?
   if ( !$self->conf->exists('invoice_show_prior_due_date')
   my $msg = $self->mt('Balance Due');
   return $msg unless $self->terms; # huh?
   if ( !$self->conf->exists('invoice_show_prior_due_date')
-       or $self->conf->exists('invoice_sections') ) {
+       || $self->has_sections ) {
     # if enabled, the due date is shown with Total New Charges (see
     # _items_total) and not here
     # (yes, or if invoice_sections is enabled; this is just for compatibility)
     # if enabled, the due date is shown with Total New Charges (see
     # _items_total) and not here
     # (yes, or if invoice_sections is enabled; this is just for compatibility)
@@ -3846,8 +3846,8 @@ sub has_sections {
 
   return 0 unless $self->invnum > 0;
 
 
   return 0 unless $self->invnum > 0;
 
-  $agentnum ||= $self->cust_main->agentnum;
-  return 1 if $self->conf->exists('invoice_sections', $agentnum);
+  $agentnum ||= $self->agentnum;
+  return 1 if $self->conf->config_bool('invoice_sections', $agentnum);
   return 1 if $self->conf->exists('sections_by_location', $agentnum);
 
   my $location_min = $self->conf->config(
   return 1 if $self->conf->exists('sections_by_location', $agentnum);
 
   my $location_min = $self->conf->config(