diff options
author | ivan <ivan> | 2007-08-01 22:26:52 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-08-01 22:26:52 +0000 |
commit | eb4ff7f73c5d4bdf74a3472448b5a195598ff4cd (patch) | |
tree | bb38241e8c865c3bca861da7749071feeadd2b5b /httemplate/search | |
parent | 32b5d3a31f112a381f0a15ac5e3a2204242f3405 (diff) |
event refactor, landing on HEAD!
Diffstat (limited to 'httemplate/search')
-rwxr-xr-x | httemplate/search/cust_bill.html | 31 | ||||
-rw-r--r-- | httemplate/search/cust_bill_event.cgi | 16 | ||||
-rwxr-xr-x | httemplate/search/cust_bill_event.html | 3 | ||||
-rw-r--r-- | httemplate/search/cust_event.html | 282 | ||||
-rw-r--r-- | httemplate/search/elements/search.html | 225 | ||||
-rw-r--r-- | httemplate/search/report_cust_bill.html | 4 | ||||
-rw-r--r-- | httemplate/search/report_cust_credit.html | 4 | ||||
-rw-r--r-- | httemplate/search/report_cust_event.html | 65 | ||||
-rw-r--r-- | httemplate/search/report_cust_main-zip.html | 4 | ||||
-rw-r--r-- | httemplate/search/report_cust_pay.html | 4 | ||||
-rw-r--r-- | httemplate/search/report_cust_pay_batch.html | 4 | ||||
-rwxr-xr-x | httemplate/search/report_cust_pkg.html | 6 | ||||
-rwxr-xr-x | httemplate/search/svc_acct.cgi | 4 | ||||
-rwxr-xr-x | httemplate/search/svc_broadband.cgi | 13 | ||||
-rwxr-xr-x | httemplate/search/svc_domain.cgi | 4 | ||||
-rwxr-xr-x | httemplate/search/svc_forward.cgi | 5 | ||||
-rw-r--r-- | httemplate/search/svc_phone.cgi | 4 | ||||
-rwxr-xr-x | httemplate/search/svc_www.cgi | 4 |
18 files changed, 566 insertions, 116 deletions
diff --git a/httemplate/search/cust_bill.html b/httemplate/search/cust_bill.html index b65608eab..7b9386ec6 100755 --- a/httemplate/search/cust_bill.html +++ b/httemplate/search/cust_bill.html @@ -199,18 +199,41 @@ my $html_init = join("\n", map { qq!<INPUT TYPE="hidden" NAME="open" VALUE="$open">!, qq!<INPUT TYPE="hidden" NAME="days" VALUE="$days">!, qq!</FORM>! -} qw( print_ email_ fax_ ) ); +} qw( print_ email_ fax_ ) ). + +'<SCRIPT TYPE="text/javascript"> + +function confirm_print_process() { + if ( ! confirm("Are you sure you want to reprint these invoices?") ) { + return; + } + print_process(); +} +function confirm_email_process() { + if ( ! confirm("Are you sure you want to re-email these invoices?") ) { + return; + } + email_process(); +} +function confirm_fax_process() { + if ( ! confirm("Are you sure you want to re-fax these invoices?") ) { + return; + } + fax_process(); +} + +</SCRIPT>'; my $menubar = [ 'Main menu' => $p, 'Print these invoices' => - "javascript:print_process()", + "javascript:confirm_print_process()", 'Email these invoices' => - "javascript:email_process()", + "javascript:confirm_email_process()", ]; push @$menubar, 'Fax these invoices' => - "javascript:fax_process()" + "javascript:confirm_fax_process()" if $conf->exists('hylafax'); </%init> diff --git a/httemplate/search/cust_bill_event.cgi b/httemplate/search/cust_bill_event.cgi index ada7e4362..ffd95e976 100644 --- a/httemplate/search/cust_bill_event.cgi +++ b/httemplate/search/cust_bill_event.cgi @@ -64,8 +64,12 @@ %> <%init> +my $curuser = $FS::CurrentUser::CurrentUser; + die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Billing event reports'); + unless $curuser->access_right('Billing event reports') + or $curuser->access_right('View customer billing events') + && $cgi->param('invnum') =~ /^(\d+)$/; my $title = $cgi->param('failed') ? 'Failed invoice events' @@ -93,6 +97,10 @@ if ( $cgi->param('part_bill_event.payby') =~ /^(\w+)$/ ) { push @search, "part_bill_event.payby = '$1'"; } +if ( $cgi->param('invnum') =~ /^(\d+)$/ ) { + push @search, "cust_bill_event.invnum = '$1'"; +} + #here is the agent virtualization push @search, $FS::CurrentUser::CurrentUser->agentnums_sql; @@ -123,7 +131,11 @@ my $conf = new FS::Conf; my $failed = $cgi->param('failed'); -my $html_init = join("\n", map { +my $html_init = ' + <FONT SIZE="+1">Invoice events are the deprecated, old-style actions taken o +n open invoices. See Reports->Billing events->Billing events for current event reports.</FONT><BR><BR>'; + +$html_init .= join("\n", map { ( my $action = $_ ) =~ s/_$//; include('/elements/progress-init.html', $_.'form', diff --git a/httemplate/search/cust_bill_event.html b/httemplate/search/cust_bill_event.html index 334bda3d3..0e78ce125 100755 --- a/httemplate/search/cust_bill_event.html +++ b/httemplate/search/cust_bill_event.html @@ -4,6 +4,9 @@ ) %> + <FONT SIZE="+1">Invoice events are the deprecated, old-style actions taken + on open invoices. See Reports->Billing events->Billing events for current event reports.</FONT><BR><BR> + <FORM ACTION="cust_bill_event.cgi" METHOD="GET"> <INPUT TYPE="hidden" NAME="failed" VALUE="<% $cgi->param('failed') %>"> <TABLE> diff --git a/httemplate/search/cust_event.html b/httemplate/search/cust_event.html new file mode 100644 index 000000000..f9cce46ca --- /dev/null +++ b/httemplate/search/cust_event.html @@ -0,0 +1,282 @@ +<% include( 'elements/search.html', + 'title' => $title, + 'html_init' => $html_init, + 'menubar' => $menubar, + 'name' => 'billing events', + 'query' => $sql_query, + 'count_query' => $count_sql, + 'header' => [ 'Event', + 'Date', + 'Status', + 'Trigger', + #'Inv #', 'Inv Date', 'Cust #', + #'Invoice', + + FS::UI::Web::cust_header(), #'cust_main_custnum', + ], + 'fields' => [ + 'event', + sub { time2str("%b %d %Y %T", $_[0]->_date) }, + $status_sub, + $trigger_sub, + #sub { + # #my $cust_event = shift; + # 'Invoice #'. $_[0]->invnum. + # ' ('. + # time2str("%D", $_[0]->cust_bill_date). + # ')'; + # }, + \&FS::UI::Web::cust_fields, + ], + 'align' => 'lrll'.FS::UI::Web::cust_aligns(), + 'links' => [ + '', + '', + '', + $trigger_link, + #sub { + # my $part_event = shift; + # #XXX + # my $template = $part_event->templatename; + # $template .= '-' if $template; + # [ "${p}view/cust_bill.cgi?$template", 'invnum']; + #}, + + ( map { $_ ne 'Cust. Status' ? $link_cust : '' } + FS::UI::Web::cust_header() + ), + ], + 'color' => [ + '', + '', + '', + '', + #'', + FS::UI::Web::cust_colors(), + ], + 'style' => [ + '', + '', + '', + '', + #'', + FS::UI::Web::cust_styles(), + ], + ) +%> +<%once> + +my $status_sub = sub { + my $cust_event = shift; + + my $status = $cust_event->status; + $status .= ': '.$cust_event->statustext + if $cust_event->statustext; + + my $part_event = $cust_event->part_event; + + if ( $part_event->eventtable eq 'cust_bill' && $part_event->templatename ) { + my $alt_templatename = $part_event->templatename; + my $alt_link = "$alt_templatename-". $cust_event->tablenum; + + my $conf = new FS::Conf; + my $cust_bill = $cust_event->cust_X; + + $status .= qq{ + ( <A HREF="${p}view/cust_bill.cgi?$alt_link">view</A> + | <A HREF="${p}view/cust_bill-pdf.cgi?$alt_link.pdf">view + typeset</A> + | <A HREF="${p}misc/print-invoice.cgi?$alt_link">re-print</A> + }; + + if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { + $status .= qq{ + | <A HREF="${p}misc/email-invoice.cgi?$alt_link">re-email</A> + }; + } + + if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { + $status .= qq{ + | <A HREF="${p}misc/fax-invoice.cgi?$alt_link">re-fax</A> + } + } + + $status .= ' ) '; + + } + + $status; +}; + +my $trigger_sub = sub { + my $cust_event = shift; + my $eventtable = $cust_event->eventtable; + my $label = FS::part_event->eventtable_labels->{$eventtable}; + #if ( $eventtable eq 'cust_pkg' || $eventtable eq 'cust_bill' ) { + "$label #". $cust_event->tablenum; + #} else { + # $label; + #} +}; + +my $trigger_link = sub { + my $cust_event = shift; + my $eventtable = $cust_event->eventtable; + if ( $eventtable eq 'cust_pkg' ) { + my $custnum = $cust_event->cust_main_custnum; + [ "${p}view/cust_main.cgi?$custnum#cust_pkg", 'tablenum' ]; + } else { + [ "${p}view/$eventtable.cgi?", 'tablenum' ]; + } +}; + +</%once> +<%init> + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('Billing event reports') + or $curuser->access_right('View customer billing events') + && ( $cgi->param('custnum') =~ /^(\d+)$/ + || $cgi->param('invnum') =~ /^(\d+)$/ + || $cgi->param('pkgnum') =~ /^(\d+)$/ + ); + + +my $title = $cgi->param('failed') + ? 'Failed billing events' + : 'Billing events'; + +my @search = (); + +if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) { + push @search, "agentnum = $1"; + #my $agent = qsearchs('agent', { 'agentnum' => $1 } ); + #die "unknown agentnum $1" unless $agent; +} + +my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi); +push @search, "cust_event._date >= $beginning", + "cust_event._date <= $ending"; + +if ( $cgi->param('failed') ) { + push @search, "statustext != ''", + "statustext IS NOT NULL", + "statustext != 'N/A'"; +} + +#if ( $cgi->param('part_event.payby') =~ /^(\w+)$/ ) { +# push @search, "part_event.payby = '$1'"; +#} + +if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { + push @search, "cust_main.custnum = '$1'"; +} +if ( $cgi->param('invnum') =~ /^(\d+)$/ ) { + push @search, "part_event.eventtable = 'cust_bill'", + "tablenum = '$1'"; +} +if ( $cgi->param('pkgnum') =~ /^(\d+)$/ ) { + push @search, "part_event.eventtable = 'cust_pkg'", + "tablenum = '$1'"; +} + +#here is the agent virtualization +my $agent_sql = $curuser->agentnums_sql; +$agent_sql =~ s/agentnum/cust_main.agentnum/g; +push @search, $agent_sql; + +my $where = 'WHERE '. join(' AND ', @search ); + +my $join = " + JOIN part_event USING ( eventpart ) + LEFT JOIN cust_bill ON ( eventtable = 'cust_bill' AND tablenum = invnum ) + LEFT JOIN cust_pkg ON ( eventtable = 'cust_pkg' AND tablenum = pkgnum ) + LEFT JOIN cust_main ON ( ( eventtable = 'cust_main' AND tablenum = cust_main.custnum ) + OR ( eventtable = 'cust_bill' AND cust_bill.custnum = cust_main.custnum ) + OR ( eventtable = 'cust_pkg' AND cust_pkg.custnum = cust_main.custnum ) + ) +"; + #'LEFT JOIN cust_main USING ( custnum ) '; + +my $sql_query = { + 'table' => 'cust_event', + 'select' => join(', ', + 'cust_event.*', + 'part_event.*', + #'cust_bill.custnum', + #'cust_bill._date AS cust_bill_date', + 'cust_main.custnum AS cust_main_custnum', + FS::UI::Web::cust_sql_fields(), + ), + 'hashref' => {}, + 'extra_sql' => "$where ORDER BY _date ASC", + 'addl_from' => $join, +}; + +my $count_sql = "SELECT COUNT(*) FROM cust_event $join $where"; + +my $conf = new FS::Conf; + +my $failed = $cgi->param('failed'); + +my $html_init = join("\n", map { + ( my $action = $_ ) =~ s/_$//; + include('/elements/progress-init.html', + $_.'form', + [ 'action', 'beginning', 'ending', 'failed' ], + "../misc/${_}events.cgi", + { 'message' => "Invoices re-${action}ed" }, #would be nice to show the number of them, but... + $_, #key + ), + qq!<FORM NAME="${_}form">!, + qq!<INPUT TYPE="hidden" NAME="action" VALUE="$_">!, #not used though + qq!<INPUT TYPE="hidden" NAME="beginning" VALUE="$beginning">!, + qq!<INPUT TYPE="hidden" NAME="ending" VALUE="$ending">!, + qq!<INPUT TYPE="hidden" NAME="failed" VALUE="$failed">!, + qq!</FORM>! +} qw( print_ email_ fax_ ) ). + +'<SCRIPT TYPE="text/javascript"> + +function confirm_print_process() { + if ( ! confirm("Are you sure you want to reprint these invoices?") ) { + return; + } + print_process(); +} +function confirm_email_process() { + if ( ! confirm("Are you sure you want to re-email these invoices?") ) { + return; + } + email_process(); +} +function confirm_fax_process() { + if ( ! confirm("Are you sure you want to re-fax these invoices?") ) { + return; + } + fax_process(); +} + +</SCRIPT>'; + +my $menubar = [ + 'Re-print these events' => + "javascript:confirm_print_process()", + 'Re-email these events' => + "javascript:confirm_email_process()", + ]; + +push @$menubar, 'Re-fax these events' => + "javascript:confirm_fax_process()" + if $conf->exists('hylafax'); + +my $link_cust = sub { + my $cust_event = shift; + $cust_event->cust_main_custnum + ? [ "${p}view/cust_main.cgi?", 'cust_main_custnum' ] + : ''; +}; + +</%init> diff --git a/httemplate/search/elements/search.html b/httemplate/search/elements/search.html index 7d5e58a3b..5afc3dc20 100644 --- a/httemplate/search/elements/search.html +++ b/httemplate/search/elements/search.html @@ -34,7 +34,7 @@ % # 'select' => '*', % # 'addl_from' => '', #'LEFT JOIN othertable USING ( key )', % # 'extra_sql' => '', #'AND otherstuff', #'WHERE onlystuff', -% # +% # 'order_by' => 'ORDER BY something', % # % # }, % # # "select * from tablename"; @@ -54,6 +54,20 @@ % # 'disable_nonefound' => '', # set true to disable the "No matching Xs found" % # # message % # +% # 'disableable' => 1, # set true if this table has a "disabled" field, to +% # # hide disabled records & have "show disabled" links +% # 'disabled_statuspos' => 3, #optional position (starting from 0) to insert +% # #a Status column when showing disabled records +% # #(query needs to be a qsearch hashref and +% # # header & fields need to be defined) + +% # 'agent_virt' => 1, # set true if this search should be agent-virtualized +% # 'agent_null_right' => 'Access Right', #opt. right to view global records +% # 'agent_pos' => 3, #optional position (starting from 0) to insert +% # #an Agent column +% # #(query needs to be a qsearch hashref and +% # # header & fields need to be defined) +% # % # #listref - each item is a literal column name (or method) or coderef % # #if not specified all columns will be shown % # 'fields' => [ @@ -88,11 +102,11 @@ % # #(can't be used with a literal query) % # 'disableable' => 1, % -% my $DEBUG = 0; -% % my(%opt) = @_; % #warn join(' / ', map { "$_ => $opt{$_}" } keys %opt ). "\n"; % +% my $curuser = $FS::CurrentUser::CurrentUser; +% % my %align = ( % 'l' => 'left', % 'r' => 'right', @@ -103,6 +117,90 @@ % $opt{align} = [ map $align{$_}, split(//, $opt{align}) ], % unless !$opt{align} || ref($opt{align}); % +% if ( $opt{'agent_virt'} ) { +% +% my $agentnums_sql = $curuser->agentnums_sql( +% 'null_right' => $opt{'agent_null_right'} +% ); +% +% $opt{'query'}{'extra_sql'} .= +% ( $opt{'query'} =~ /WHERE/i ? ' AND ' : ' WHERE ' ). +% $agentnums_sql; +% $opt{'count_query'} .= +% ( $opt{'count_query'} =~ /WHERE/i ? ' AND ' : ' WHERE ' ). +% $agentnums_sql; +% +% if ( $opt{'agent_pos'} || $opt{'agent_pos'} eq '0' +% and scalar($curuser->agentnums) > 1 ) { +% #false laziness w/statuspos above +% my $pos = $opt{'agent_pos'}; +% +% foreach my $att (qw( align style color size )) { +% $opt{$att} ||= [ map '', @{ $opt{'fields'} } ]; +% } +% +% splice @{ $opt{'header'} }, $pos, 0, 'Agent'; +% splice @{ $opt{'align'} }, $pos, 0, 'c'; +% splice @{ $opt{'style'} }, $pos, 0, ''; +% splice @{ $opt{'size'} }, $pos, 0, ''; +% splice @{ $opt{'fields'} }, $pos, 0, +% sub { $_[0]->agentnum ? $_[0]->agent->agent : '(global)'; }; +% splice @{ $opt{'color'} }, $pos, 0, ''; +% splice @{ $opt{'links'} }, $pos, 0, '' #[ 'agent link?', 'agentnum' ] +% if $opt{'links'}; +% +% } +% +% } +% +% if ( $opt{'disableable'} ) { +% +% unless ( $cgi->param('showdisabled') ) { #modify searches +% +% $opt{'query'}{'hashref'}{'disabled'} = ''; +% $opt{'query'}{'extra_sql'} =~ s/^\s*WHERE/ AND/i; +% +% $opt{'count_query'} .= +% ( $opt{'count_query'} =~ /WHERE/i ? ' AND ' : ' WHERE ' ). +% "( disabled = '' OR disabled IS NULL )"; +% +% } elsif ( $opt{'disabled_statuspos'} +% || $opt{'disabled_statuspos'} eq '0' ) { #add status column +% +% my $pos = $opt{'disabled_statuspos'}; +% +% foreach my $att (qw( align style color size )) { +% $opt{$att} ||= [ map '', @{ $opt{'fields'} } ]; +% } +% +% splice @{ $opt{'header'} }, $pos, 0, 'Status'; +% splice @{ $opt{'align'} }, $pos, 0, 'c'; +% splice @{ $opt{'style'} }, $pos, 0, 'b'; +% splice @{ $opt{'size'} }, $pos, 0, ''; +% splice @{ $opt{'fields'} }, $pos, 0, +% sub { shift->disabled ? 'DISABLED' : 'Active'; }; +% splice @{ $opt{'color'} }, $pos, 0, +% sub { shift->disabled ? 'FF0000' : '00CC00'; }; +% splice @{ $opt{'links'} }, $pos, 0, '' +% if $opt{'links'}; +% } +% +% #add show/hide disabled links +% my $items = $opt{'name'} || PL($opt{'name_singular'}); +% if ( $cgi->param('showdisabled') ) { +% $cgi->param('showdisabled', 0); +% $opt{'html_posttotal'} .= +% '( <a href="'. $cgi->self_url. qq!">hide disabled $items</a> )!; +% $cgi->param('showdisabled', 1); +% } else { +% $cgi->param('showdisabled', 1); +% $opt{'html_posttotal'} .= +% '( <a href="'. $cgi->self_url. qq!">show disabled $items</a> )!; +% $cgi->param('showdisabled', 0); +% } +% +% } +% % my $type = ''; % my $limit = ''; % my($confmax, $maxrecords, $total, $offset, $count_arrayref); @@ -146,61 +244,6 @@ % % } % -% #disableable handling -% my $posttotal = ''; -% if ( $opt{disableable} ) { -% -% my $name= $opt{'name_singular'} ? PL($opt{'name_singular'}) : $opt{'name'}; -% -% if ( $cgi->param('showdisabled') ) { -% $cgi->param('showdisabled', 0); -% $posttotal= '( <a href="'. $cgi->self_url. '">'. -% "hide disabled $name</a> )"; -% $cgi->param('showdisabled', 1); -% } else { -% $cgi->param('showdisabled', 1); -% $posttotal= '( <a href="'. $cgi->self_url. '">'. -% "show disabled $name</a> )"; -% $cgi->param('showdisabled', 0); -% } -% -% if ( $cgi->param('showdisabled') ) { -% -% my $offset = $opt{disableable}; -% -% splice @{ $opt{header} }, $offset, 0, 'Status'; -% -% splice @{ $opt{fields} }, $offset, 0, -% sub { shift->disabled ? 'DISABLED' : 'Active' }; -% -% if ( $opt{links} && scalar( @{ $opt{links} } ) ) { -% splice @{ $opt{links} }, $offset, 0, ''; -% } -% -% if ( $opt{align} && scalar( @{ $opt{align} } ) ) { -% splice @{ $opt{align} }, $offset, 0, 'center'; -% } -% -% unless ( $opt{color} && scalar( @{ $opt{color} } ) ) { -% #$opt{color} = [ map { '000000'; } @{$opt{header}} ]; -% $opt{color} = [ map { ''; } @{$opt{header}} ]; -% } -% splice @{ $opt{color} }, $offset, 0, -% sub { shift->disabled ? 'FF0000' : '00CC00'; }; -% -% if ( $opt{size} && scalar( @{ $opt{size} } ) ) { -% splice @{ $opt{size} }, $offset, 0, ''; -% } -% -% unless ( $opt{style} && scalar( @{ $opt{style} } ) ) { -% $opt{style} = [ map { ''; } @{$opt{header}} ]; -% } -% splice @{ $opt{style} }, $offset, 0, 'b'; -% -% } -% -% } -% % # run the query % % my $header = $opt{header}; @@ -214,17 +257,15 @@ % } % % #eval "use FS::$opt{'query'};"; -% $rows = [ qsearch( -% $opt{'query'}->{'table'}, -% $opt{'query'}->{'hashref'} || {}, -% $opt{'query'}->{'select'}, -% $opt{'query'}->{'extra_sql'}. " $limit", -% '', -% (exists($opt{'query'}->{'addl_from'}) ? $opt{'query'}->{'addl_from'} : '') -% ) ]; -% +% $rows = [ qsearch({ +% 'select' => $opt{'query'}->{'select'}, +% 'table' => $opt{'query'}->{'table'}, +% 'addl_from' => (exists($opt{'query'}->{'addl_from'}) ? $opt{'query'}->{'addl_from'} : ''), +% 'hashref' => $opt{'query'}->{'hashref'} || {}, +% 'extra_sql' => $opt{'query'}->{'extra_sql'}, +% 'order_by' => $opt{'query'}->{'order_by'}. " $limit", +% }) ]; % } else { -% % my $sth = dbh->prepare("$opt{'query'} $limit") % or die "Error preparing $opt{'query'}: ". dbh->errstr; % $sth->execute @@ -234,15 +275,8 @@ % $rows = $sth->fetchall_arrayref; % % $header ||= $sth->{NAME}; -% % } % -% warn scalar(@$rows). ' rows returned from '. -% ( ref($opt{'query'}) ? 'qsearch query' : 'literal SQL query' ) -% if $DEBUG || $opt{'debug'}; -% -% # display the results - csv, xls or html -% % if ( $type eq 'csv' ) { % % #http_header('Content-Type' => 'text/comma-separated-values' ); #IE chokes @@ -430,8 +464,6 @@ % $cgi->param('maxrecords', $maxrecords); % } - <% $posttotal %> - <% defined($opt{'html_posttotal'}) ? ( ref($opt{'html_posttotal'}) ? &{$opt{'html_posttotal'}}() @@ -522,7 +554,7 @@ % % my $tableref = $_; % -% '<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0>'. +% '<TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0 WIDTH="100%">'. % % join('', map { % @@ -532,22 +564,37 @@ % % join('', map { % -% my $element = $_; +% my $e = $_; +% +% '<TD '. +% join(' ', map { +% uc($_).'="'. $e->{$_}. '"'; +% } +% grep exists($e->{$_}), +% qw( align bgcolor colspan rowspan +% style valign width ) +% ). +% '>'. % -% '<TD'. -% ( $element->{'align'} -% ? ' ALIGN="'. $element->{'align'}. '"' +% ( $e->{'link'} +% ? '<A HREF="'. $e->{'link'}. '">' % : '' -% ). '>'. -% ( $element->{'link'} -% ? '<A HREF="'. $element->{'link'}.'">' +% ). +% ( $e->{'size'} +% ? '<FONT SIZE="'.uc($e->{'size'}).'">' +% : '' +% ). +% ( $e->{'data_style'} +% ? '<'. uc($e->{'data_style'}). '>' % : '' % ). -% $element->{'data'}. -% ( $element->{'link'} -% ? '</A>' +% $e->{'data'}. +% ( $e->{'data_style'} +% ? '</'. uc($e->{'data_style'}). '>' % : '' % ). +% ( $e->{'size'} ? '</FONT>' : '' ). +% ( $e->{'link'} ? '</A>' : '' ). % '</td>'; % % } @$rowref ). @@ -620,7 +667,7 @@ % } else { % foreach ( @$row ) { - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><% $_ %></TD> + <TD CLASS="grid" BGCOLOR="$bgcolor"><% $_ %></TD> % } % } diff --git a/httemplate/search/report_cust_bill.html b/httemplate/search/report_cust_bill.html index d6848921e..892f5c4d9 100644 --- a/httemplate/search/report_cust_bill.html +++ b/httemplate/search/report_cust_bill.html @@ -5,8 +5,8 @@ <TABLE> <% include( '/elements/tr-select-agent.html', - ($cgi->param('agentnum') || ''), - 'label' => 'Invoices for agent: ', + 'curr_value' => scalar( $cgi->param('agentnum') ), + 'label' => 'Invoices for agent: ', ) %> <% include( '/elements/tr-input-beginning_ending.html' ) %> diff --git a/httemplate/search/report_cust_credit.html b/httemplate/search/report_cust_credit.html index 139902228..0490f4323 100644 --- a/httemplate/search/report_cust_credit.html +++ b/httemplate/search/report_cust_credit.html @@ -18,8 +18,8 @@ </TR> <% include( '/elements/tr-select-agent.html', - ($cgi->param('agentnum') || ''), - 'label' => 'for agent: ', + 'curr_value' => scalar( $cgi->param('agentnum') ), + 'label' => 'for agent: ', ) %> diff --git a/httemplate/search/report_cust_event.html b/httemplate/search/report_cust_event.html new file mode 100644 index 000000000..44cbadbe6 --- /dev/null +++ b/httemplate/search/report_cust_event.html @@ -0,0 +1,65 @@ +<% include( + '/elements/header.html', + ( $cgi->param('failed') ? 'Failed billing events' : 'Billing events' ), + ) +%> + + <FORM ACTION="cust_event.html" METHOD="GET"> + <INPUT TYPE="hidden" NAME="failed" VALUE="<% $cgi->param('failed') %>"> + <TABLE> + + <% include( '/elements/tr-select-agent.html' ) %> + + <!--<TR> + <TD ALIGN="right">Customer type</TD> + <TD><SELECT MULTIPLE NAME="perhaps_payby"> + <OPTION SELECTED VALUE="CARD">Credit card (automatic) + <OPTION SELECTED VALUE="CHEK">E-check (automatic) + <OPTION SELECTED VALUE="LECB">Phone bill billing + <OPTION SELECTED VALUE="BILL">Billing + <OPTION SELECTED VALUE="DCRD">Credit card (on-demand) + <OPTION SELECTED VALUE="DCHK">E-check (on-demand) + </TD> + </TR> + --> + <% include( '/elements/tr-input-beginning_ending.html' ) %> + <!-- + <TR> + <TD ALIGN="right">Events: </TD> + <TD> + <SELECT NAME="eventpart"> + <OPTION SELECTED VALUE=""><% $cgi->param('failed') ? '(all failed events)' : '(all events)' %> +% #foreach my $part_bill_event ( qsearch( 'part_bill_event', {} ) ) { +% #} + + </SELECT> + </TD> + </TR> + --> +<!-- <TR> + <TD ALIGN="right">Events for payment type: </TD> + <TD> + <SELECT NAME="part_bill_event.payby"> + <OPTION SELECTED VALUE="">(all) + <OPTION VALUE="CARD">Credit card (automatic) + <OPTION VALUE="BILL">Billing + <OPTION VALUE="CHEK">Electronic check (automatic) + <OPTION VALUE="DCRD">Credit card (on-demand) + <OPTION VALUE="DCHK">Electronic check (on-demand) + <OPTION VALUE="LECB">Phone bill billing + <OPTION VALUE="COMP">Complimentary + </SELECT> + </TD> + </TR> +--> + </TABLE> + <BR><INPUT TYPE="submit" VALUE="Get Report"> + </FORM> + +<% include('/elements/footer.html') %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Billing event reports'); + +</%init> diff --git a/httemplate/search/report_cust_main-zip.html b/httemplate/search/report_cust_main-zip.html index c5a64ae7a..19b7ecc91 100644 --- a/httemplate/search/report_cust_main-zip.html +++ b/httemplate/search/report_cust_main-zip.html @@ -34,8 +34,8 @@ </TR> <% include( '/elements/tr-select-agent.html', - ($cgi->param('agentnum') || ''), - 'label' => 'for agent: ', + 'curr_value' => scalar( $cgi->param('agentnum') ), + 'label' => 'For agent: ', ) %> diff --git a/httemplate/search/report_cust_pay.html b/httemplate/search/report_cust_pay.html index b32b1287e..d7cb0aec9 100644 --- a/httemplate/search/report_cust_pay.html +++ b/httemplate/search/report_cust_pay.html @@ -49,8 +49,8 @@ </TR> <% include( '/elements/tr-select-agent.html', - ($cgi->param('agentnum') || ''), - 'label' => 'for agent: ', + 'curr_value' => scalar($cgi->param('agentnum')), + 'label' => 'for agent: ', ) %> diff --git a/httemplate/search/report_cust_pay_batch.html b/httemplate/search/report_cust_pay_batch.html index 4e8937cac..0cd656c49 100644 --- a/httemplate/search/report_cust_pay_batch.html +++ b/httemplate/search/report_cust_pay_batch.html @@ -16,8 +16,8 @@ </TR> <% include( '/elements/tr-select-agent.html', - ($cgi->param('agentnum') || ''), - 'label' => 'for agent: ', + 'curr_value' => scalar( $cgi->param('agentnum') ), + 'label' => 'For agent: ', ) %> diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html index 57180c18e..dd62f3ead 100755 --- a/httemplate/search/report_cust_pkg.html +++ b/httemplate/search/report_cust_pkg.html @@ -9,11 +9,11 @@ <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH> </TR> <% include( '/elements/tr-select-agent.html', - ($cgi->param('agentnum') || ''), + 'curr_value' => scalar( $cgi->param('agentnum') ), ) %> - <% include( '/elements/tr-select-cust_pkg-status.html', '', + <% include( '/elements/tr-select-cust_pkg-status.html', 'onchange' => 'status_changed(this);', ) %> @@ -62,7 +62,7 @@ </SCRIPT> - <% include( '/elements/tr-select-pkg_class.html', '', + <% include( '/elements/tr-select-pkg_class.html', 'pre_options' => [ '0' => 'all' ], 'empty_label' => '(empty class)', ) diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi index a702d604b..ee8a5d0a7 100755 --- a/httemplate/search/svc_acct.cgi +++ b/httemplate/search/svc_acct.cgi @@ -132,7 +132,9 @@ my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. ' LEFT JOIN cust_main USING ( custnum ) '; #here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ); my $extra_sql = scalar(@extra_sql) diff --git a/httemplate/search/svc_broadband.cgi b/httemplate/search/svc_broadband.cgi index 1bbdbfcdb..a89b19610 100755 --- a/httemplate/search/svc_broadband.cgi +++ b/httemplate/search/svc_broadband.cgi @@ -5,9 +5,18 @@ % %my @svc_broadband = (); %my $sortby=\*svcnum_sort; +%#XXX agent-virtualization needs to be finished :/ +%my $agentnums_sql = $FS::CurrentUser::CurrentUser->agentnums_sql( +% 'null_right' => 'View/link unlinked services' +% ); +% %if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) { % -% @svc_broadband=qsearch('svc_broadband',{}); +% @svc_broadband = qsearch( +% 'table' => 'svc_broadband', +% 'hashref' => {}, +% #needs the join first 'extra_sql' => "WHERE $agentnums_sql", +% ); % % if ( $cgi->param('magic') eq 'unlinked' ) { % @svc_broadband = grep { qsearchs('cust_svc', { @@ -17,7 +26,7 @@ % ) % } % @svc_broadband; -% } +% } else { % % if ( $cgi->param('sortby') =~ /^(\w+)$/ ) { % my $sortby = $1; diff --git a/httemplate/search/svc_domain.cgi b/httemplate/search/svc_domain.cgi index b14a1cc4f..08ffdba5e 100755 --- a/httemplate/search/svc_domain.cgi +++ b/httemplate/search/svc_domain.cgi @@ -69,7 +69,9 @@ my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. ' LEFT JOIN cust_main USING ( custnum ) '; #here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ); my $extra_sql = ''; if ( @extra_sql ) { diff --git a/httemplate/search/svc_forward.cgi b/httemplate/search/svc_forward.cgi index eeb4c1075..2bcd0c8c8 100755 --- a/httemplate/search/svc_forward.cgi +++ b/httemplate/search/svc_forward.cgi @@ -46,7 +46,6 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('List services'); - my $conf = new FS::Conf; my $orderby = 'ORDER BY svcnum'; @@ -71,7 +70,9 @@ my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. ' LEFT JOIN cust_main USING ( custnum ) '; #here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ); my $extra_sql = scalar(@extra_sql) diff --git a/httemplate/search/svc_phone.cgi b/httemplate/search/svc_phone.cgi index 0c1d57887..49340c6c3 100644 --- a/httemplate/search/svc_phone.cgi +++ b/httemplate/search/svc_phone.cgi @@ -74,7 +74,9 @@ my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. ' LEFT JOIN cust_main USING ( custnum ) '; #here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ); my $extra_sql = ''; if ( @extra_sql ) { diff --git a/httemplate/search/svc_www.cgi b/httemplate/search/svc_www.cgi index d9332e95d..2e3c4615b 100755 --- a/httemplate/search/svc_www.cgi +++ b/httemplate/search/svc_www.cgi @@ -76,7 +76,9 @@ my $addl_from = ' LEFT JOIN cust_svc USING ( svcnum ) '. ' LEFT JOIN cust_main USING ( custnum ) '; #here is the agent virtualization -push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql; +push @extra_sql, $FS::CurrentUser::CurrentUser->agentnums_sql( + 'null_right' => 'View/link unlinked services' + ); my $extra_sql = scalar(@extra_sql) |