conf switches to turn on smaller notes and footer sections with stock templates,...
authorivan <ivan>
Thu, 8 Oct 2009 01:15:06 +0000 (01:15 +0000)
committerivan <ivan>
Thu, 8 Oct 2009 01:15:06 +0000 (01:15 +0000)
FS/FS/Conf.pm
FS/FS/cust_bill.pm
conf/invoice_html
conf/invoice_latex

index be4c744..13bec18 100644 (file)
@@ -2326,14 +2326,28 @@ worry that config_items is freeside-specific and icky.
   {
     'key'         => 'invoice-ship_address',
     'section'     => 'billing',
-    'description' => 'Enable this switch to include the ship address on the invoice.',
+    'description' => 'Include the shipping address on invoices.',
     'type'        => 'checkbox',
   },
 
   {
     'key'         => 'invoice-unitprice',
     'section'     => 'billing',
-    'description' => 'This switch enables unit pricing on the invoice.',
+    'description' => 'Enable unit pricing on invoices.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'invoice-smallernotes',
+    'section'     => 'billing',
+    'description' => 'Display the notes section in a smaller font on invoices.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'invoice-smallerfooter',
+    'section'     => 'billing',
+    'description' => 'Display footers in a smaller font on invoices.',
     'type'        => 'checkbox',
   },
 
index e7c0be8..961d86e 100644 (file)
@@ -2252,36 +2252,43 @@ sub print_generic {
   }
 
   my %invoice_data = (
+
+    #invoice from info
     'company_name'    => scalar( $conf->config('company_name', $self->cust_main->agentnum) ),
     'company_address' => join("\n", $conf->config('company_address', $self->cust_main->agentnum) ). "\n",
-    'custnum'         => $cust_main->display_custnum,
+    'returnaddress'   => $returnaddress,
+    'agent'           => &$escape_function($cust_main->agent->agent),
+
+    #invoice info
     'invnum'          => $self->invnum,
     'date'            => time2str($date_format, $self->_date),
     'today'           => time2str('%b %o, %Y', $today),
-    'agent'           => &$escape_function($cust_main->agent->agent),
-    'agent_custid'    => &$escape_function($cust_main->agent_custid),
-    'payname'         => &$escape_function($cust_main->payname),
-    'company'         => &$escape_function($cust_main->company),
-    'address1'        => &$escape_function($cust_main->address1),
-    'address2'        => &$escape_function($cust_main->address2),
-    'city'            => &$escape_function($cust_main->city),
-    'state'           => &$escape_function($cust_main->state),
-    'zip'             => &$escape_function($cust_main->zip),
-    'fax'             => &$escape_function($cust_main->fax),
-    'returnaddress'   => $returnaddress,
-    #'quantity'        => 1,
     'terms'           => $self->terms,
     'template'        => $template, #params{'template'},
-    #'notes'           => join("\n", $conf->config('invoice_latexnotes') ),
-    # better hang on to conf_dir for a while
-    'conf_dir'        => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
-    'page'            => 1,
-    'total_pages'     => 1,
+    'notice_name'     => ($params{'notice_name'} || 'Invoice'),#escape_function?
     'current_charges' => sprintf("%.2f", $self->charged),
     'duedate'         => $self->due_date2str('%m/%d/%Y'), #date_format?
+
+    #customer info
+    'custnum'         => $cust_main->display_custnum,
+    'agent_custid'    => &$escape_function($cust_main->agent_custid),
+    ( map { $_ => &$escape_function($cust_main->$_()) } qw(
+      payname company address1 address2 city state zip fax
+    )),
+
+    #global config
     'ship_enable'     => $conf->exists('invoice-ship_address'),
     'unitprices'      => $conf->exists('invoice-unitprice'),
-    'notice_name'     => ($params{'notice_name'} || 'Invoice'),#escape_function?
+    'smallernotes'    => $conf->exists('invoice-smallernotes'),
+    'smallerfooter'   => $conf->exists('invoice-smallerfooter'),
+   
+    # better hang on to conf_dir for a while (for old templates)
+    'conf_dir'        => "$FS::UID::conf_dir/conf.$FS::UID::datasrc",
+
+    #these are only used when doing paged plaintext
+    'page'            => 1,
+    'total_pages'     => 1,
+
   );
 
   $invoice_data{finance_section} = '';
index 7ee0fdc..b7f7b97 100644 (file)
   </table>
   <br><br>
 
-<%= length($summary) ? '' : $notes %>
+<%= length($summary)
+      ? ''
+      : ( $smallernotes
+            ? '<FONT SIZE="-1">'.$notes.'</FONT>'
+            : $notes
+        )
+%>
 
   <hr NOSHADE SIZE=2 COLOR="#000000">
-  <p align="center"><%= $footer %>
+  <p align="center" <%= $smallerfooter ? 'STYLE="font-size:75%;"' : '' %>><%= $footer %>
 
 </td></tr></table>
index 42a9f93..ef6546f 100644 (file)
     $OUT .= $coupon;\r
   }\r
   '';\r
---@] \small{\r
+--@] [@-- $smallerfooter ? '\scriptsize{' : '\small{' --@]\r
 [@-- $footer --@]\r
     }[@-- $coupon ? '\vspace{\extracouponspace}' : '' --@]\r
   }\r
   { % ... pages\r
-    \small{\r
+    [@-- $smallerfooter ? '\scriptsize{' : '\small{' --@]\r
 [@-- $smallfooter --@]\r
     }\r
   }\r
@@ -322,7 +322,13 @@ Terms: [@-- $terms --@]\\
 --@]\r
 \vfill\r
 \begin{minipage}[t]{\textwidth}\r
-  [@-- length($summary) ? '' : $notes --@]\r
+  [@-- length($summary)\r
+         ? ''\r
+        : ( $smallernotes\r
+              ? '\scriptsize{ '.$notes.' }'\r
+              : $notes\r
+          )\r
+  --@]\r
   [@-- $coupon ? '\ifthenelse{\equal{\thepage}{1}}{\rule{0pt}{\extracouponspace}}{}' : '' --@]\r
 \end{minipage}\r
 \end{document}\r