summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-09-27 17:29:17 -0700
committerMark Wells <mark@freeside.biz>2013-09-27 17:29:17 -0700
commit1d6a32338660e3d7202faa7e4ce14736b4569a48 (patch)
tree681f6a7887f43974b7e58508e5aeb5b59db531b7 /httemplate/elements
parentc64ff892b9067f7aa719e78b20379d3274907946 (diff)
invoice configurations, #24723
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/columnstart.html77
-rw-r--r--httemplate/elements/menu.html1
-rw-r--r--httemplate/elements/tr-select-invoice_mode.html10
3 files changed, 87 insertions, 1 deletions
diff --git a/httemplate/elements/columnstart.html b/httemplate/elements/columnstart.html
index be37d817d..1ffbcb9e8 100644
--- a/httemplate/elements/columnstart.html
+++ b/httemplate/elements/columnstart.html
@@ -1,6 +1,81 @@
+<%doc>
+<table>
+ <& /elements/columnstart.html &>
+ <tr> ... </tr>
+ <tr> ... </tr>
+ <& /elements/columnnext.html &>
+ ...
+ <& /elements/columnend.html &>
+</table>
+
+Pass 'aligned' => 1 to have corresponding rows in the columns line up.
+</%doc>
+% my $id = sprintf('table%08d', rand(100000000));
<TR>
<TD CLASS="background" COLSPAN=99>
- <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
+ <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 id="<%$id%>">
<TR>
<TD VALIGN="top">
<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
+% if ( $aligned ) {
+%# Instead of changing all the tr-* elements to sometimes output table
+%# cells without wrapping them in a row, we're just going to completely
+%# rebuild the table on the client side.
+<script type="text/javascript">
+<&| onload.js &>
+ var table = document.getElementById('<%$id%>'); // has one row, always
+ var rows = []; // row contents, each containing
+ var n_rows = []; // rows in each subtable
+ var n_cols = []; // cols in each subtable
+ var total_rows = 0; // max(n_rows)
+ for(var i=0; i < table.rows[0].cells.length; i++) {
+ // these are cells created by columnstart/columnnext
+ // each contains a table, and nothing else
+ var subtable = table.rows[0].cells[i].children[0];
+ n_rows[i] = subtable.rows.length;
+ if ( total_rows < n_rows[i] ) {
+ total_rows = n_rows[i];
+ }
+ n_cols[i] = 0;
+ var subrows = []; // the rows of this table
+ for(var j=0; j < n_rows[i]; j++) {
+ // these are the actual tr-* rows within the table, and
+ // can contain multiple cells
+ subrows[j] = [];
+ var tr = subtable.rows[j];
+ if ( n_cols[i] < tr.cells.length ) {
+ n_cols[i] = tr.cells.length;
+ }
+ for(var k=0; k < tr.cells.length; k++) {
+ subrows[j][k] = tr.cells[k];
+ }
+ } // for(j)
+ rows[i] = subrows;
+ } // for(i)
+ var new_table = document.createElement('TABLE');
+ for (var j = 0; j < total_rows; j++) {
+ var tr = document.createElement('TR');
+ for (var i = 0; i < rows.length; i++) { // subtables
+ var k = 0; // subrow position
+ if ( j < n_rows[i] ) { // then subtable i has this row
+ for (k = 0; k < rows[i][j].length; k++) { // cells
+ tr.appendChild(rows[i][j][k]);
+ }
+ } // else k is just 0
+ if ( k < n_cols[i] ) { // then we need a spacer
+ var spacer = document.createElement('TD');
+ spacer.setAttribute('colspan', n_cols[i] - k);
+ tr.appendChild(spacer);
+ }
+ } // for(i); subtables
+ // tr is complete
+ new_table.appendChild(tr);
+ } // for(j); rows
+ table.parentNode.insertBefore( new_table, table );
+ table.parentNode.removeChild(table);
+</&>
+</script>
+% } # if $aligned
+<%args>
+$aligned => 0
+</%args>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index 0d446d997..c5d8f27e5 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -593,6 +593,7 @@ $config_billing{'Billing events'} = [ $fsurl.'browse/part_event.html', 'Billing
|| $curuser->access_right('Edit global billing events');
if ( $curuser->access_right('Configuration') ) {
#$config_billing{'Invoice events'} = [ $fsurl.'browse/part_bill_event.cgi', 'Deprecated, old-style actions for overdue invoices' ];
+ $config_billing{'Invoice configurations'} = [ $fsurl.'browse/invoice_conf.html', 'Adjust invoice settings for special-purpose notices' ];
$config_billing{'Invoice templates'} = [ $fsurl.'browse/invoice_template.html', 'Edit templates for HTML, plaintext and typeset invoices' ];
$config_billing{'Prepaid cards'} = [ $fsurl.'search/prepay_credit.html', 'View outstanding cards, generate new cards' ];
$config_billing{'Call rates and regions'} = [ \%config_billing_rates, 'Manage rate plans, regions and prefixes for VoIP and call billing' ];
diff --git a/httemplate/elements/tr-select-invoice_mode.html b/httemplate/elements/tr-select-invoice_mode.html
new file mode 100644
index 000000000..3dccdccc2
--- /dev/null
+++ b/httemplate/elements/tr-select-invoice_mode.html
@@ -0,0 +1,10 @@
+<& tr-select-table.html,
+ 'label' => 'Invoice mode',
+ 'table' => 'invoice_mode',
+ 'field' => 'modenum',
+ 'name_col' => 'modename',
+ 'agent_virt' => 1,
+ 'agent_null' => 1,
+ 'empty_label' => '(none)',
+ @_
+&>