summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-04-26 17:35:14 -0700
committerIvan Kohler <ivan@freeside.biz>2012-04-26 17:35:14 -0700
commit2a7f90bbc8958c0674bb470ecd8e4bed00e6a8c4 (patch)
treee855867f9cfdf6028a27472de24ab0cd7dab7b07 /httemplate/elements
parent4f94568dd0bc4c857441ec531e2c936fefa78635 (diff)
parent6ff1c755b054201c38b0a2a7b6161325af5c0bcf (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/customer-table.html46
-rw-r--r--httemplate/elements/menu.html20
2 files changed, 47 insertions, 19 deletions
diff --git a/httemplate/elements/customer-table.html b/httemplate/elements/customer-table.html
index a517ece2a..fc1af69c6 100644
--- a/httemplate/elements/customer-table.html
+++ b/httemplate/elements/customer-table.html
@@ -41,6 +41,8 @@ Example:
<SCRIPT TYPE="text/javascript">
+ var num_open_invoices = new Array;
+
function clearhint_invnum() {
if ( this.value == 'Not found' || this.value == 'Multiple' ) {
@@ -90,7 +92,7 @@ Example:
customer_select.style.display = 'none';
return false;
- } else if ( customerArray.length == 5 ) {
+ } else if ( customerArray.length == 6 ) {
custnum_obj.value = customerArray[0];
custnum_obj.style.color = '#000000';
@@ -99,6 +101,7 @@ Example:
update_balance_text(searchrow, customerArray[2]);
update_status_text( searchrow, customerArray[3]);
update_status_color(searchrow, '#'+customerArray[4]);
+ update_num_open(searchrow, customerArray[5]);
customer.style.display = '';
customer_select.style.display = 'none';
@@ -140,6 +143,7 @@ Example:
update_balance_text(searchrow, '');
update_status_text(searchrow, '');
update_status_color(searchrow, '#000000');
+ update_num_open(searchrow, 0);
function search_invnum_update(customers) {
@@ -192,6 +196,7 @@ Example:
update_balance_text(searchrow, '');
update_status_text( searchrow, '');
update_status_color(searchrow, '#000000');
+ update_num_open(searchrow, 0);
function search_custnum_update(customers) {
@@ -337,6 +342,9 @@ Example:
document.getElementById('balance'+rownum+'_text').innerHTML = newval;
}
+ function update_num_open(rownum, newval) {
+ num_open_invoices[rownum] = newval;
+ }
</SCRIPT>
@@ -356,7 +364,7 @@ Example:
% my $row = 0;
% for ( $row = 0; exists($param->{"custnum$row"}); $row++ ) {
- <TR>
+ <TR id="row<%$row%>" rownum="<%$row%>">
<TD>
<INPUT TYPE = "text"
NAME = "invnum<% $row %>"
@@ -458,19 +466,24 @@ Example:
% my $color = $opt{color}->[$col];
% my $font = $color ? qq(<FONT COLOR="$color">) : '';
% my $onchange = '';
-% if ( $opt{footer}->[$col] eq '_TOTAL' ) {
+% if ( $opt{onchange}->[$col] ) {
+% $onchange = 'onchange="'.$opt{onchange}->[$col].'"';
+% }
+% elsif ( $opt{footer}->[$col] eq '_TOTAL' ) {
% $total[$col] += $value;
% $onchange = $opt{prefix}. "calc_total$col();";
% $onchange = qq(onchange="$onchange" onkeyup="$onchange");
% }
<TD ALIGN="<% $align %>">
-% if (! $types->[$col] || $types->[$col] eq 'text') {
- <INPUT TYPE = "text"
+% my $type = $types->[$col] || 'text';
+% if ($type eq 'text' or $type eq 'checkbox') {
+ <INPUT TYPE = "<% $type %>"
NAME = "<% $name %>"
ID = "<% $name %>"
SIZE = "<% $size %>"
STYLE = "text-align: <% $align %>;"
VALUE = "<% $value %>"
+ rownum = "<% $row %>"
<% $onchange %>
>
% } elsif ($types->[$col] eq 'immutable') {
@@ -485,7 +498,7 @@ Example:
</TR>
% }
-<TR>
+<TR id="row_total">
<TH COLSPAN=5 ID="<% $opt{'prefix'} %>_TOTAL_TOTAL">
Total <% $row ? $row-1 : 0 %>
<% PL($opt{name_singular} || 'customer', ( $row ? $row-1 : 0 ) ) %>
@@ -559,7 +572,8 @@ Example:
var table = document.getElementById('<% $opt{prefix} %>OneTrueTable');
var tablebody = table.getElementsByTagName('tbody').item(0);
- var row = table.insertRow(rownum+1);
+ var row = table.insertRow(table.rows.length - 1);
+ row.setAttribute('id', 'row'+rownum);
var invnum_cell = document.createElement('TD');
@@ -676,7 +690,7 @@ Example:
% } else {
% $value = $param->{"$field$row"};
% }
- var my_text = document.createTextNode('<% $value %>');
+ var my_text = document.createTextNode(<% $value |js_string %>);
my_cell.appendChild(my_text);
% }
@@ -686,10 +700,17 @@ Example:
my_input.setAttribute('id', '<% $name %>'+<% $opt{prefix} %>rownum);
my_input.style.textAlign = '<% $align{ $opt{align}->[$col] || 'l' } %>';
my_input.setAttribute('size', <% $sizes->[$col] || 10 %>);
-% if ($types->[$col] eq 'immutable') {
+ my_input.setAttribute('rownum', <% $opt{prefix} %>rownum);
+% if ( $types->[$col] eq 'immutable' ) {
my_input.setAttribute('type', 'hidden');
% }
-% if ( $opt{footer}->[$col] eq '_TOTAL' ) {
+% elsif ( $types->[$col] eq 'checkbox' ) {
+ my_input.setAttribute('type', 'checkbox');
+% }
+% if ( $opt{onchange}->[$col] ) {
+ my_input.onchange = <% $opt{onchange}->[$col] %>;
+% }
+% elsif ( $opt{footer}->[$col] eq '_TOTAL' ) {
my_input.onchange = <% $opt{prefix} %>calc_total<%$col%>;
my_input.onkeyup = <% $opt{prefix} %>calc_total<%$col%>;
% }
@@ -713,6 +734,11 @@ Example:
+ ' <% PL($opt{name_singular} || 'customer') %>';
}
+% if ( $opt{add_row_callback} ) {
+ <% $opt{add_row_callback} %>(<% $opt{prefix} %>rownum,
+ '<% $opt{prefix} %>');
+% }
+
<% $opt{prefix} %>rownum++;
}
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index b1cbebf34..0f36500b0 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -221,7 +221,8 @@ foreach my $svcdb ( FS::part_svc->svc_tables() ) {
}
- $report_services{$name} = [ \%report_svc, $longname ];
+ $report_services{$name} = [ \%report_svc, $longname ] if
+ $curuser->access_right("Services: $name");
}
@@ -253,14 +254,15 @@ tie my %report_inventory, 'Tie::IxHash',
'Inventory activity' => [ $fsurl.'search/report_h_inventory_item.html', '' ],
;
-tie my %report_rating, 'Tie::IxHash',
- 'RADIUS sessions' => [ $fsurl.'search/sqlradius.html', '' ],
- 'Call Detail Records (CDRs)' => [ $fsurl.'search/report_cdr.html', '' ],
- 'Unrateable CDRs' => [ $fsurl.'search/cdr.html?freesidestatus=failed'.
- ';cdrbatchnum=_ALL_' ],
- 'Time worked' => [ $fsurl.'search/report_rt_transaction.html', '' ],
- 'Time worked summary' => [ $fsurl.'search/report_rt_ticket.html', '' ],
-;
+my @report_rating = ();
+push(@report_rating, 'RADIUS sessions' => [ $fsurl.'search/sqlradius.html', '' ]) if $curuser->access_right("Usage: RADIUS sessions");
+push(@report_rating, 'Call Detail Records (CDRs)' => [ $fsurl.'search/report_cdr.html', '' ]) if $curuser->access_right("Usage: Call Detail Records (CDRs)");
+push(@report_rating, 'Unrateable CDRs' => [ $fsurl.'search/cdr.html?freesidestatus=failed'.
+ ';cdrbatchnum=_ALL_' ]) if $curuser->access_right("Usage: Unrateable CDRs");
+push(@report_rating, 'Time worked' => [ $fsurl.'search/report_rt_transaction.html', '' ]) if $curuser->access_right("Usage: Time worked");
+push(@report_rating, 'Time worked summary' => [ $fsurl.'search/report_rt_ticket.html', '' ]) if $curuser->access_right("Usage: Time worked summary");
+
+tie my %report_rating, 'Tie::IxHash', @report_rating;
tie my %report_ticketing_statistics, 'Tie::IxHash',
'Tickets per day per Queue' => [ $fsurl.'rt/RTx/Statistics/CallsQueueDay', 'View the number of tickets created, resolved or deleted in a specific Queue, over the requested period of days' ],