diff options
| author | Mark Wells <mark@freeside.biz> | 2016-07-13 16:18:33 -0700 | 
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2016-07-13 16:19:16 -0700 | 
| commit | d6e395fe6863ae7524e026aabc5c85ae7a553d29 (patch) | |
| tree | 562ed004e6b8981204399036841de4a3b16b0088 | |
| parent | 2d5a8b0b5dc2ddbaa84d9884169c52ead1f790c8 (diff) | |
limit column width of line item descriptions and details, #38130
| -rw-r--r-- | conf/invoice_latex | 43 | 
1 files changed, 27 insertions, 16 deletions
diff --git a/conf/invoice_latex b/conf/invoice_latex index fd0f95210..c1d04d651 100644 --- a/conf/invoice_latex +++ b/conf/invoice_latex @@ -20,6 +20,7 @@  \documentclass[letterpaper]{article}
  \usepackage{fancyhdr,lastpage,ifthen,array,longtable,afterpage,caption,multirow,bigstrut}
 +\usepackage[breakwords]{truncate} % to avoid overflowing boxes
  \usepackage{graphicx}			% required for logo graphic
  \usepackage[utf8]{inputenc}             % multilanguage support
  \usepackage[T1]{fontenc}
 @@ -192,7 +193,9 @@    \hline
    \rule{0pt}{2.5ex}
    \makebox[1.4cm]{} &
 -  \multicolumn{\FSdescriptioncolumncount}{l}{\makebox[\FSdescriptionlength][l]{\textbf{[@-- emt('Description') --@]}}}&
 +  \multicolumn{\FSdescriptioncolumncount}{l}{
 +    \truncate{\FSdescriptionlength}{\textbf{[@-- emt('Description') --@]}}
 +  } &
    \FSunitcolumns
    \makebox[1.6cm][r]{\textbf{[@-- emt('Amount') --@]}} \\
    \hline
 @@ -203,7 +206,7 @@    \rule{0pt}{2.5ex}
    \makebox[1.4cm]{} &
    \multicolumn{4}{l}{
 -    \makebox[\FSdescriptionlength][l]{\textbf{[@-- emt('Description') --@]}}
 +    \truncate{\FSdescriptionlength}{\textbf{[@-- emt('Description') --@]}}
    } &
    \textbf{~~[@-- emt('Calls') --@]} &
    \textbf{~~[@-- emt('Duration') --@]} &
 @@ -214,7 +217,9 @@  % ...description...
  \newcommand{\FSdesc}[5]{
    \multicolumn{1}{c}{\rule{0pt}{2.5ex}\textbf{#1}} &
 -  \multicolumn{[@-- $unitprices ? '4' : '6' --@]}{l}{\textbf{#2}} &
 +  \multicolumn{[@-- $unitprices ? '4' : '6' --@]}{l}{
 +    \truncate{\FSdescriptionlength}{\textbf{#2}}
 +  } &
  [@-- $unitprices ? '  \multicolumn{1}{r}{\textbf{#3}} &'."\n".
                     '  \multicolumn{1}{r}{\textbf{#4}} &'."\n"
                   : ''
 @@ -224,12 +229,23 @@  % ...extended description...
  \newcommand{\FSextdesc}[1]{
    \multicolumn{1}{l}{\rule{0pt}{1.0ex}} &
 -%%  \multicolumn{2}{l}{\small{~-~#1}}\\
 -#1\\
 +  \multicolumn{6}{l}{
 +    \truncate{12.8cm}{\small{~~~#1}}
 +  } \\
  }
 -% ...and total line items.
 +% ...call detail (multiple columns already)...
 +\newcommand{\FScalldetail}[1]{
 +  \multicolumn{1}{l}{\rule{0pt}{1.0ex}} &
 +  ~~~#1
 +  \\
 +}
 +}
 +% ...and total line items (which use the full 12.8cm length, ignoring
 +% unitprice/quantity
  \newcommand{\FStotaldesc}[2]{
 -  & \multicolumn{6}{l}{#1} & #2\\
 +  & \multicolumn{6}{l}{
 +    \truncate{12.8cm}{#1}
 +  } & #2\\
  }
  % ...usage class summary
 @@ -399,15 +415,10 @@          foreach my $ext_desc (@$ext_description) {
            if ($section->{extended_description_generator}) {
              $OUT .= &{$section->{extended_description_generator}}($ext_desc);
 -          } else {
 -            if ( $ext_desc !~ /[^\\]&/ ) {
 -              $ext_desc = substr($ext_desc, 0, 80) . '...'
 -                if (length($ext_desc) > 80);
 -              $ext_desc = '\multicolumn{6}{l}{\small{~~~'. $ext_desc. '}}';
 -            }else{
 -              $ext_desc = "~~~$ext_desc";
 -            }
 -            $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n";
 +          } elsif ( $ext_desc !~ /[^\\]&/ ) {
 +            $OUT .= '\FSextdesc{' . $ext_desc . "}$rowbreak\n";
 +          } else { # call detail
 +            $OUT .= '\FScalldetail{' . $ext_desc . "}$rowbreak\n";
            }
          }
  | 
