diff options
-rw-r--r-- | FS/FS.pm | 4 | ||||
-rw-r--r-- | FS/FS/AccessRight.pm | 1 | ||||
-rw-r--r-- | FS/FS/Conf.pm | 5 | ||||
-rw-r--r-- | FS/FS/cust_pay_batch.pm | 37 | ||||
-rwxr-xr-x | httemplate/browse/part_bill_event.cgi | 122 | ||||
-rwxr-xr-x | httemplate/edit/part_bill_event.cgi | 570 | ||||
-rwxr-xr-x | httemplate/edit/process/part_bill_event.cgi | 106 | ||||
-rw-r--r-- | httemplate/elements/menu.html | 3 | ||||
-rw-r--r-- | httemplate/misc/email_invoice_events.cgi | 9 | ||||
-rw-r--r-- | httemplate/misc/fax_invoice_events.cgi | 9 | ||||
-rw-r--r-- | httemplate/misc/print_invoice_events.cgi | 9 | ||||
-rw-r--r-- | httemplate/search/cust_bill_event.cgi | 167 | ||||
-rwxr-xr-x | httemplate/search/cust_bill_event.html | 67 | ||||
-rwxr-xr-x | httemplate/view/cust_bill.cgi | 4 |
14 files changed, 2 insertions, 1111 deletions
@@ -408,10 +408,6 @@ L<FS::cust_bill_pkg_detail> - Invoice line item detail class L<FS::legacy_cust_bill> - Legacy data invoice class -L<FS::part_bill_event> - (Old) Invoice event definition class - -L<FS::cust_bill_event> - (Old) Completed invoice event class - L<FS::part_event> - (New) Billing event definition class L<FS::part_event_option> - (New) Billing event option class diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index 121f83c40..f741b7190 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -53,7 +53,6 @@ assigned to users and/or groups. # 'billing' => [ # '_desc' => 'Access to billing configuration', # 'payment_gateway' => {}, -# 'part_bill_event' => {}, # 'prepay_credit' => {}, # 'rate' => {}, # 'cust_main_county' => {}, diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 091070ec5..bb04d9427 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2147,11 +2147,6 @@ and customer address. Include units.', }, { - 'key' => 'safe-part_bill_event', - 'section' => 'UI', - 'description' => 'Validates invoice event expressions against a preset list. Useful for webdemos, annoying to powerusers.', - 'type' => 'checkbox', - }, { 'key' => 'show_ship_company', diff --git a/FS/FS/cust_pay_batch.pm b/FS/FS/cust_pay_batch.pm index d4d40b580..a4b4957aa 100644 --- a/FS/FS/cust_pay_batch.pm +++ b/FS/FS/cust_pay_batch.pm @@ -49,7 +49,7 @@ following fields are currently supported: =item batchnum - indentifies group in batch -=item payby - CARD/CHEK/LECB/BILL/COMP +=item payby - CARD/CHEK =item payinfo @@ -154,7 +154,7 @@ sub check { if ( $self->exp eq '' ) { return "Expiration date required" - unless $self->payby =~ /^(CHEK|DCHK|LECB|WEST)$/; + unless $self->payby =~ /^(CHEK|DCHK|WEST)$/; $self->exp(''); } else { if ( $self->exp =~ /^(\d{4})[\/\-](\d{1,2})[\/\-](\d{1,2})$/ ) { @@ -246,39 +246,6 @@ sub retriable { confess "deprecated method cust_pay_batch->retriable called; try removing ". "the once condition and adding an every condition?"; - my $self = shift; - - local $SIG{HUP} = 'IGNORE'; #Hmm - local $SIG{INT} = 'IGNORE'; - local $SIG{QUIT} = 'IGNORE'; - local $SIG{TERM} = 'IGNORE'; - local $SIG{TSTP} = 'IGNORE'; - local $SIG{PIPE} = 'IGNORE'; - - my $oldAutoCommit = $FS::UID::AutoCommit; - local $FS::UID::AutoCommit = 0; - my $dbh = dbh; - - my $cust_bill = qsearchs('cust_bill', { 'invnum' => $self->invnum } ) - or return "event $self->eventnum references nonexistant invoice $self->invnum"; - - warn "cust_pay_batch->retriable working with self of " . $self->paybatchnum . " and invnum of " . $self->invnum; - my @cust_bill_event = - sort { $a->part_bill_event->seconds <=> $b->part_bill_event->seconds } - grep { - $_->part_bill_event->eventcode =~ /\$cust_bill->batch_card/ - && $_->status eq 'done' - && ! $_->statustext - } - $cust_bill->cust_bill_event; - # complain loudly if scalar(@cust_bill_event) > 1 ? - my $error = $cust_bill_event[0]->retriable; - if ($error ) { - # gah, even with transactions. - $dbh->commit if $oldAutoCommit; #well. - return "error marking invoice event retriable: $error"; - } - ''; } =item approve OPTIONS diff --git a/httemplate/browse/part_bill_event.cgi b/httemplate/browse/part_bill_event.cgi deleted file mode 100755 index 11bc14e5c..000000000 --- a/httemplate/browse/part_bill_event.cgi +++ /dev/null @@ -1,122 +0,0 @@ -<% include('/elements/header.html', 'Invoice Event Listing') %> - - <FONT SIZE="+1">Invoice events are the deprecated, old-style actions taken on open invoices. Any events still listed here should be migrated to new-style events.</FONT><BR><BR> - -<A HREF="<% $p %>edit/part_bill_event.cgi"><I>Add a new invoice event</I></A> -<BR><BR> - -<% $total %> events -<% $cgi->param('showdisabled') - ? do { $cgi->param('showdisabled', 0); - '( <a href="'. $cgi->self_url. '">hide disabled events</a> )'; } - : do { $cgi->param('showdisabled', 1); - '( <a href="'. $cgi->self_url. '">show disabled events</a> )'; } -%> -<BR><BR> -% tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname; -% tie my %freq, 'Tie::IxHash', '1d' => 'daily', '1m' => 'monthly'; -% foreach my $payby ( keys %payby ) { -% my $oldfreq = ''; -% -% my @payby_part_bill_event = -% grep { $payby eq $_->payby } -% sort { ( $a->freq || '1d') cmp ( $b->freq || '1d' ) # for now -% || $a->seconds <=> $b->seconds -% || $a->weight <=> $b->weight -% || $a->eventpart <=> $b->eventpart -% } -% @part_bill_event; -% -% -% if ( @payby_part_bill_event ) { - - - <% include('/elements/table-grid.html') %> -% my $bgcolor1 = '#eeeeee'; -% my $bgcolor2 = '#ffffff'; -% my $bgcolor; -% -% -% foreach my $part_bill_event ( @payby_part_bill_event ) { -% my $url = "${p}edit/part_bill_event.cgi?". $part_bill_event->eventpart; -% my $delay = duration_exact($part_bill_event->seconds); -% ( my $plandata = $part_bill_event->plandata ) =~ s/\n/<BR>/go; -% my $freq = $part_bill_event->freq || '1d'; -% my $reason = $part_bill_event->reasontext ; -% -% if ( $oldfreq ne $freq ) { - - - <TR> - <TH CLASS="grid" BGCOLOR="#999999" COLSPAN=<% $cgi->param('showdisabled') ? 7 : 8 %>><% ucfirst($freq{$freq}) %> event tests for <FONT SIZE="+1"><I><% $payby{$payby} %> customers</I></FONT></TH> - </TR> - - <TR> - <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=<% $cgi->param('showdisabled') ? 2 : 3 %>>Event</TH> - <TH CLASS="grid" BGCOLOR="#cccccc">After</TH> - <TH CLASS="grid" BGCOLOR="#cccccc">Action</TH> - <TH CLASS="grid" BGCOLOR="#cccccc">Reason</TH> - <TH CLASS="grid" BGCOLOR="#cccccc">Options</TH> - <TH CLASS="grid" BGCOLOR="#cccccc">Code</TH> - </TR> -% -% $oldfreq = $freq; -% $bgcolor = ''; -% -% } -% -% if ( $bgcolor eq $bgcolor1 ) { -% $bgcolor = $bgcolor2; -% } else { -% $bgcolor = $bgcolor1; -% } -% - - - <TR> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<% $url %>"> - <% $part_bill_event->eventpart %></A></TD> -% unless ( $cgi->param('showdisabled') ) { - - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $part_bill_event->disabled ? 'DISABLED' : '' %></TD> -% } - - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><A HREF="<% $url %>"> - <% $part_bill_event->event %></A></TD> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $delay %></TD> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $part_bill_event->plan %></TD> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $reason %></TD> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"> - <% $plandata %></TD> - <TD CLASS="grid" BGCOLOR="<% $bgcolor %>"><FONT SIZE="-1"> - <% $part_bill_event->eventcode %></FONT></TD> - </TR> -% } - - </TABLE> - <BR><BR> -% } -% } - -<% include('/elements/footer.html') %> - -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my %search; -if ( $cgi->param('showdisabled') ) { -%search = (); -} else { -%search = ( 'disabled' => '' ); -} - -my @part_bill_event = qsearch('part_bill_event', \%search ); -my $total = scalar(@part_bill_event); - -</%init> diff --git a/httemplate/edit/part_bill_event.cgi b/httemplate/edit/part_bill_event.cgi deleted file mode 100755 index c0ff38689..000000000 --- a/httemplate/edit/part_bill_event.cgi +++ /dev/null @@ -1,570 +0,0 @@ -<% include('/elements/header.html', - "$action Invoice Event Definition", - menubar( - 'View all invoice events' => popurl(2). 'browse/part_bill_event.cgi', - ) - ) -%> - -<% include('/elements/error.html') %> - -<FORM ACTION="<% popurl(1) %>process/part_bill_event.cgi" NAME="editEvent" METHOD=POST> -<INPUT TYPE="hidden" NAME="eventpart" VALUE="<% $part_bill_event->eventpart %>"> -Invoice Event #<% $hashref->{eventpart} ? $hashref->{eventpart} : "(NEW)" %> - -<% ntable("#cccccc",2) %> - - <TR> - <TD ALIGN="right">Event name </TD> - <TD><INPUT TYPE="text" NAME="event" VALUE="<% $hashref->{event} %>"></TD> - </TR> - - <TR> - <TD ALIGN="right">For </TD> - <TD> - <SELECT NAME="payby" <% $hashref->{eventpart} ? '' : 'MULTIPLE SIZE=7'%>> -% tie my %payby, 'Tie::IxHash', FS::payby->cust_payby2longname; -% foreach my $payby ( keys %payby ) { - <OPTION VALUE="<% $payby %>"<% ($part_bill_event->payby eq $payby) ? ' SELECTED' : '' %>><% $payby{$payby} %></OPTION> -% } - </SELECT> customers - </TD> - </TR> -% my $days = $hashref->{seconds}/86400; - - - <TR> - <TD ALIGN="right">After</TD> - <TD><INPUT TYPE="text" NAME="days" VALUE="<% $days %>"> days</TD> - </TR> - - <TR> - <TD ALIGN="right">Test event</TD> - <TD> - <SELECT NAME="freq"> -% tie my %freq, 'Tie::IxHash', '1d' => 'daily', '1m' => 'monthly'; -% foreach my $freq ( keys %freq ) { -% - - - <OPTION VALUE="<% $freq %>"<% ($part_bill_event->freq eq $freq) ? ' SELECTED' : '' %>><% $freq{$freq} %></OPTION> -% } - - - </SELECT> - </TD> - </TR> - - - <TR> - <TD ALIGN="right">Disabled</TD> - <TD> - <INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref->{disabled} eq 'Y' ? ' CHECKED' : '' %>> - </TD> - </TR> - - <TR> - <TD VALIGN="top" ALIGN="right">Action</TD> - <TD> -% -% -%#print ntable(); -% -%sub select_pkgpart { -% my $label = shift; -% my $plandata = shift; -% my %selected = map { $_=>1 } split(/,\s*/, $plandata->{$label}); -% qq(<SELECT NAME="$label" MULTIPLE>). -% join("\n", map { -% '<OPTION VALUE="'. $_->pkgpart. '"'. -% ( $selected{$_->pkgpart} ? ' SELECTED' : '' ). -% '>'. $_->pkg_comment -% } qsearch('part_pkg', { 'disabled' => '' } ) ). -% '</SELECT>'; -%} -% -%sub select_agentnum { -% my $plandata = shift; -% #my $agentnum = $plandata->{'agentnum'}; -% my %agentnums = map { $_=>1 } split(/,\s*/, $plandata->{'agentnum'}); -% '<SELECT NAME="agentnum" MULTIPLE>'. -% join("\n", map { -% '<OPTION VALUE="'. $_->agentnum. '"'. -% ( $agentnums{$_->agentnum} ? ' SELECTED' : '' ). -% '>'. $_->agent -% } qsearch('agent', { 'disabled' => '' } ) ). -% '</SELECT>'; -%} -% -%sub honor_dundate { -% my $label = shift; -% my $plandata = shift; -% '<TABLE>'. -% '<TR><TD ALIGN="right">Allow delay until dun date? </TD>'. -% qq(<TD><INPUT TYPE="checkbox" NAME="$label" VALUE="$label => 1," ). -% ( $plandata->{$label} eq "$label => 1," ? 'CHECKED' : '' ). -% '>'. -% '</TD></TR>'. -% '</TABLE>' -%} -% -%my $conf = new FS::Conf; -%my $money_char = $conf->config('money_char') || '$'; -% -%my $late_taxclass = ''; -%my $late_percent_taxclass = ''; -%if ( $conf->exists('enable_taxclasses') ) { -% $late_taxclass = -% '<BR>Taxclass '. -% include('/elements/select-taxclass.html', -% 'curr_value' => '%%%late_taxclass%%%', -% 'name' => 'late_taxclass' ); -% $late_percent_taxclass = -% '<BR>Taxclass '. -% include('/elements/select-taxclass.html', -% 'curr_value' => '%%%late_percent_taxclass%%%', -% 'name' => 'late_percent_taxclass' ); -%} -% -%#this is pretty kludgy right here. -%tie my %events, 'Tie::IxHash', -% -% 'fee' => { -% 'name' => 'Late fee (flat)', -% 'code' => '$cust_main->charge( %%%charge%%%, \'%%%reason%%%\', \'$%%%charge%%%\', \'%%%late_taxclass%%%\' );', -% 'html' => -% 'Amount <INPUT TYPE="text" SIZE="7" NAME="charge" VALUE="%%%charge%%%">'. -% '<BR>Reason <INPUT TYPE="text" NAME="reason" VALUE="%%%reason%%%">'. -% $late_taxclass, -% 'weight' => 10, -% }, -% 'fee_percent' => { -% 'name' => 'Late fee (percentage)', -% 'code' => '$cust_main->charge( sprintf(\'%.2f\', $cust_bill->owed * %%%percent%%% / 100 ), \'%%%percent_reason%%%\', \'%%%percent%%% percent\', \'%%%late_percent_taxclass%%%\' );', -% 'html' => -% 'Percent <INPUT TYPE="text" SIZE="2" NAME="percent" VALUE="%%%percent%%%">%'. -% '<BR>Reason <INPUT TYPE="text" NAME="percent_reason" VALUE="%%%percent_reason%%%">'. -% $late_percent_taxclass, -% 'weight' => 10, -% }, -% 'suspend' => { -% 'name' => 'Suspend', -% 'code' => '$cust_main->suspend(reason => %%%sreason%%%, %%%honor_dundate%%% );', -% 'html' => sub { &honor_dundate('honor_dundate', @_) }, -% 'weight' => 10, -% 'reason' => 'S', -% }, -% 'suspend-if-balance' => { -% 'name' => 'Suspend if balance (this invoice and previous) over', -% 'code' => '$cust_bill->cust_suspend_if_balance_over( %%%balanceover%%%, reason => %%%sreason%%%, %%%balance_honor_dundate%%% );', -% 'html' => sub { " $money_char ". '<INPUT TYPE="text" SIZE="7" NAME="balanceover" VALUE="%%%balanceover%%%"> '. &honor_dundate('balance_honor_dundate', @_) }, -% 'weight' => 10, -% 'reason' => 'S', -% }, -% 'suspend-if-pkgpart' => { -% 'name' => 'Suspend packages', -% 'code' => '$cust_main->suspend_if_pkgpart({pkgparts => [%%%if_pkgpart%%%,], reason => %%%sreason%%%, %%%if_pkgpart_honor_dundate%%% });', -% 'html' => sub { &select_pkgpart('if_pkgpart', @_). &honor_dundate('if_pkgpart_honor_dundate', @_) }, -% 'weight' => 10, -% 'reason' => 'S', -% }, -% 'suspend-unless-pkgpart' => { -% 'name' => 'Suspend packages except', -% 'code' => '$cust_main->suspend_unless_pkgpart({unless_pkgpart => [%%%unless_pkgpart%%%], reason => %%%sreason%%%, %%%unless_pkgpart_honor_dundate%%% });', -% 'html' => sub { &select_pkgpart('unless_pkgpart', @_). &honor_dundate('unless_pkgpart_honor_dundate' => @_) }, -% 'weight' => 10, -% 'reason' => 'S', -% }, -% 'cancel' => { -% 'name' => 'Cancel', -% 'code' => '$cust_main->cancel(reason => %%%creason%%%);', -% 'weight' => 80, #10, -% 'reason' => 'C', -% }, -% -% 'addpost' => { -% 'name' => 'Add postal invoicing', -% 'code' => '$cust_main->invoicing_list_addpost(); "";', -% 'weight' => 20, -% }, -% -% 'comp' => { -% 'name' => 'Pay invoice with a complimentary "payment"', -% 'code' => '$cust_bill->comp();', -% 'weight' => 90, #30, -% }, -% -% 'credit' => { -% 'name' => "Create and apply a credit for the customer's balance (i.e. write off as bad debt)", -% 'code' => '$cust_main->credit( $cust_main->balance, \'%%%credit_reason%%%\' );', -% 'html' => '<INPUT TYPE="text" NAME="credit_reason" VALUE="%%%credit_reason%%%">', -% 'weight' => 30, -% }, -% -% 'realtime-card' => { -% 'name' => 'Run card with a <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> realtime gateway', -% 'code' => '$cust_bill->realtime_card();', -% 'weight' => 30, -% }, -% -% 'realtime-check' => { -% 'name' => 'Run check with a <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> realtime gateway', -% 'code' => '$cust_bill->realtime_ach();', -% 'weight' => 30, -% }, -% -% 'realtime-lec' => { -% 'name' => 'Run phone bill ("LEC") billing with a <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a> realtime gateway', -% 'code' => '$cust_bill->realtime_lec();', -% 'weight' => 30, -% }, -% -% 'batch-card' => { -% 'name' => 'Add card or check to a pending batch', -% 'code' => '$cust_bill->batch_card(%options);', -% 'weight' => 40, -% }, -% -% -% #'retriable' => { -% # 'name' => 'Mark batched card event as retriable', -% # 'code' => '$cust_pay_batch->retriable();', -% # 'weight' => 60, -% #}, -% -% 'send' => { -% 'name' => 'Send invoice (email/print/fax)', -% 'code' => '$cust_bill->send();', -% 'weight' => 50, -% }, -% -% 'send_email' => { -% 'name' => 'Send invoice (email only)', -% 'code' => '$cust_bill->email();', -% 'weight' => 50, -% }, -% -% 'send_alternate' => { -% 'name' => 'Send invoice (email/print/fax) with alternate template', -% 'code' => '$cust_bill->send(\'%%%templatename%%%\');', -% 'html' => -% '<INPUT TYPE="text" NAME="templatename" VALUE="%%%templatename%%%">', -% 'weight' => 50, -% }, -% -% 'send_if_newest' => { -% 'name' => 'Send invoice (email/print/fax) with alternate template, if it is still the newest invoice (useful for late notices - set to 31 days or later)', -% 'code' => '$cust_bill->send_if_newest(\'%%%if_newest_templatename%%%\');', -% 'html' => -% '<INPUT TYPE="text" NAME="if_newest_templatename" VALUE="%%%if_newest_templatename%%%">', -% 'weight' => 50, -% }, -% -% 'send_agent' => { -% 'name' => 'Send invoice (email/print/fax) ', -% 'code' => '$cust_bill->send( \'%%%agent_templatename%%%\', -% [ %%%agentnum%%% ], -% \'%%%agent_invoice_from%%%\', -% %%%agent_balanceover%%% -% );', -% 'html' => sub { -% '<TABLE BORDER=0> -% <TR> -% <TD ALIGN="right">only for agent(s) </TD> -% <TD>'. &select_agentnum(@_). '</TD> -% </TR> -% <TR> -% <TD ALIGN="right">with template </TD> -% <TD> -% <INPUT TYPE="text" NAME="agent_templatename" VALUE="%%%agent_templatename%%%"> -% </TD> -% </TR> -% <TR> -% <TD ALIGN="right">email From: </TD> -% <TD> -% <INPUT TYPE="text" NAME="agent_invoice_from" VALUE="%%%agent_invoice_from%%%"> -% </TD> -% </TR> -% <TR> -% <TD ALIGN="right">if balance (this invoice and previous) over -% </TD> -% <TD> -% '. $money_char. '<INPUT TYPE="text" SIZE="7" NAME="agent_balanceover" VALUE="%%%agent_balanceover%%%"> -% </TD> -% </TR> -% </TABLE>'; -% }, -% 'weight' => 50, -% }, -% -% 'send_csv_ftp' => { -% 'name' => 'Upload CSV invoice data to an FTP server', -% 'code' => '$cust_bill->send_csv( protocol => \'ftp\', -% server => \'%%%ftpserver%%%\', -% username => \'%%%ftpusername%%%\', -% password => \'%%%ftppassword%%%\', -% dir => \'%%%ftpdir%%%\', -% \'format\' => \'%%%ftpformat%%%\', -% );', -% 'html' => -% '<TABLE BORDER=0>'. -% '<TR><TD ALIGN="right">Format ("default" or "billco"): </TD>'. -% '<TD>'. -% '<!--'. -% '<SELECT NAME="ftpformat">'. -% '<OPTION VALUE="default">Default'. -% '<OPTION VALUE="billco">Billco'. -% '</SELECT>'. -% '-->'. -% '<INPUT TYPE="text" NAME="ftpformat" VALUE="%%%ftpformat%%%">'. -% '</TD></TR>'. -% '<TR><TD ALIGN="right">FTP server: </TD>'. -% '<TD><INPUT TYPE="text" NAME="ftpserver" VALUE="%%%ftpserver%%%">'. -% '</TD></TR>'. -% '<TR><TD ALIGN="right">FTP username: </TD><TD>'. -% '<INPUT TYPE="text" NAME="ftpusername" VALUE="%%%ftpusername%%%">'. -% '</TD></TR>'. -% '<TR><TD ALIGN="right">FTP password: </TD><TD>'. -% '<INPUT TYPE="text" NAME="ftppassword" VALUE="%%%ftppassword%%%">'. -% '</TD></TR>'. -% '<TR><TD ALIGN="right">FTP directory: </TD>'. -% '<TD><INPUT TYPE="text" NAME="ftpdir" VALUE="%%%ftpdir%%%">'. -% '</TD></TR>'. -% '</TABLE>', -% 'weight' => 50, -% }, -% -% 'spool_csv' => { -% 'name' => 'Spool CSV invoice data', -% 'code' => '$cust_bill->spool_csv( -% \'format\' => \'%%%spoolformat%%%\', -% \'dest\' => \'%%%spooldest%%%\', -% \'balanceover\' => \'%%%spoolbalanceover%%%\', -% \'agent_spools\' => \'%%%spoolagent_spools%%%\', -% );', -% 'html' => sub { -% my $plandata = shift; -% -% my $html = -% '<TABLE BORDER=0>'. -% '<TR><TD ALIGN="right">Format: </TD>'. -% '<TD>'. -% '<SELECT NAME="spoolformat">'; -% -% foreach my $option (qw( default billco )) { -% $html .= qq(<OPTION VALUE="$option"); -% $html .= ' SELECTED' if $option eq $plandata->{'spoolformat'}; -% $html .= ">\u$option"; -% } -% -% $html .= -% '</SELECT>'. -% '</TD></TR>'. -% '<TR><TD ALIGN="right">For destination: </TD>'. -% '<TD>'. -% '<SELECT NAME="spooldest">'; -% -% tie my %dest, 'Tie::IxHash', -% '' => '(all)', -% 'POST' => 'Postal Mail', -% 'EMAIL' => 'Email', -% 'FAX' => 'Fax', -% ; -% -% foreach my $dest (keys %dest) { -% $html .= qq(<OPTION VALUE="$dest"); -% $html .= ' SELECTED' if $dest eq $plandata->{'spooldest'}; -% $html .= '>'. $dest{$dest}; -% } -% -% $html .= -% '</SELECT>'. -% '</TD></TR>'. -% -% '<TR>'. -% '<TD ALIGN="right">if balance (this invoice and previous) over </TD>'. -% '<TD>'. -% "$money_char ". -% '<INPUT TYPE="text" SIZE="7" NAME="spoolbalanceover" VALUE="%%%spoolbalanceover%%%">'. -% '</TD>'. -% '<TR><TD ALIGN="right">Individual per-agent spools? </TD>'. -% '<TD><INPUT TYPE="checkbox" NAME="spoolagent_spools" VALUE="1" '. -% ( $plandata->{'spoolagent_spools'} ? 'CHECKED' : '' ). -% '>'. -% '</TD></TR>'. -% '</TABLE>'; -% -% $html; -% }, -% 'weight' => 50, -% }, -% -% 'bill' => { -% 'name' => 'Generate invoices (normally only used with a <i>Late Fee</i> event)', -% 'code' => '$cust_main->bill();', -% 'weight' => 60, -% }, -% -% 'apply' => { -% 'name' => 'Apply unapplied payments and credits', -% 'code' => '$cust_main->apply_payments_and_credits; "";', -% 'weight' => 70, -% }, -% -%; -% -<SCRIPT TYPE="text/javascript">var myreasons = new Array();</SCRIPT> -%foreach my $event ( keys %events ) { -% my %plandata = map { /^(\w+) (.*)$/; ($1, $2); } -% split(/\n/, $part_bill_event->plandata); -% my $html = $events{$event}{html}; -% if ( ref($html) eq 'CODE' ) { -% $html = &{$html}(\%plandata); -% } -% while ( $html =~ /%%%(\w+)%%%/ ) { -% my $field = $1; -% $html =~ s/%%%$field%%%/$plandata{$field}/; -% } -% -<SCRIPT TYPE="text/javascript">myreasons.push('<% $events{$event}{reason} %>'); -</SCRIPT> -% if ($event eq $part_bill_event->plan){ -% $currentreasonclass=$events{$event}{reason}; -% } -% print ntable( "#cccccc", 2). -% qq!<TR><TD><INPUT TYPE="radio" NAME="plan_weight_eventcode" !; -% print "CHECKED " if $event eq $part_bill_event->plan; -% print qq!onClick="showhide_table()" !; -% print qq!VALUE="!. $event. ":". $events{$event}{weight}. ":". -% encode_entities($events{$event}{code}). -% qq!">$events{$event}{name}</TD>!; -% print '<TD>'. $html. '</TD>' if $html; -% print qq!</TR>!; -% print '</TABLE>'; -% print qq!<HR WIDTH="90%">!; -%} -% -% if ($currentreasonclass eq 'C'){ -% if ($cgi->param('creason') =~ /^(-?\d+)$/){ -% $creason = $1; -% }else{ -% $creason = $part_bill_event->reason; -% } -% if ($cgi->param('newcreasonT') =~ /^(\d+)$/){ -% $newcreasonT = $1; -% } -% if ($cgi->param('newcreason') =~ /^([\w\s]+)$/){ -% $newcreason = $1; -% } -% }elsif ($currentreasonclass eq 'S'){ -% if ($cgi->param('sreason') =~ /^(-?\d+)$/){ -% $sreason = $1; -% }else{ -% $sreason = $part_bill_event->reason; -% } -% if ($cgi->param('newsreasonT') =~ /^(\d+)$/){ -% $newsreasonT = $1; -% } -% if ($cgi->param('newsreason') =~ /^([\w\s]+)$/){ -% $newsreason = $1; -% } -% } -% - -</TD></TR> -</TABLE> - -<SCRIPT TYPE="text/javascript"> - function showhide_table() - { - for(i=0;i<document.editEvent.plan_weight_eventcode.length;i++){ - if (document.editEvent.plan_weight_eventcode[i].checked == true){ - currentevent=i; - } - } - if(myreasons[currentevent] == 'C'){ - document.getElementById('Ctable').style.display = 'inline'; - document.getElementById('Stable').style.display = 'none'; - }else if(myreasons[currentevent] == 'S'){ - document.getElementById('Ctable').style.display = 'none'; - document.getElementById('Stable').style.display = 'inline'; - }else{ - document.getElementById('Ctable').style.display = 'none'; - document.getElementById('Stable').style.display = 'none'; - } - } -</SCRIPT> - -<TABLE BGCOLOR="#cccccc" BORDER=0 WIDTH="100%"> -<TR><TD> -<TABLE BORDER=0 id="Ctable" style="display:<% $currentreasonclass eq 'C' ? 'inline' : 'none' %>"> -<% include('/elements/tr-select-reason.html', - 'field' => 'creason', - 'reason_class' => 'C', - 'curr_value' => $creason, - 'init_type' => $newcreasonT, - 'init_newreason' => $newcreason - ) -%> -</TABLE> -</TR></TD> -</TABLE> - -<TABLE BGCOLOR="#cccccc" BORDER=0 WIDTH="100%"> -<TR><TD> -<TABLE BORDER=0 id="Stable" style="display:<% $currentreasonclass eq 'S' ? 'inline' : 'none' %>"> -<% include('/elements/tr-select-reason.html', - 'field' => 'sreason', - 'reason_class' => 'S', - 'curr_value' => $sreason, - 'init_type' => $newsreasonT, - 'init_newreason' => $newsreason - ) -%> -</TABLE> -</TR></TD> -</TABLE> - -% -%print qq!<INPUT TYPE="submit" VALUE="!, -% $hashref->{eventpart} ? "Apply changes" : "Add invoice event", -% qq!">!; -% - - - </FORM> - -<% include('/elements/footer.html') %> - -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -if ( $cgi->param('eventpart') && $cgi->param('eventpart') =~ /^(\d+)$/ ) { - $cgi->param('eventpart', $1); -} else { - $cgi->param('eventpart', ''); -} - -my ($creason, $newcreasonT, $newcreason); -my ($sreason, $newsreasonT, $newsreason); - -my ($query) = $cgi->keywords; -my $action = ''; -my $part_bill_event = ''; -my $currentreasonclass = ''; -if ( $cgi->param('error') ) { - $part_bill_event = new FS::part_bill_event ( { - map { $_, scalar($cgi->param($_)) } fields('part_bill_event') - } ); -} -if ( $query && $query =~ /^(\d+)$/ ) { - $part_bill_event ||= qsearchs('part_bill_event',{'eventpart'=>$1}); -} else { - $part_bill_event ||= new FS::part_bill_event {}; -} -$action ||= $part_bill_event->eventpart ? 'Edit' : 'Add'; -my $hashref = $part_bill_event->hashref; - -</%init> diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi deleted file mode 100755 index eb0529bb8..000000000 --- a/httemplate/edit/process/part_bill_event.cgi +++ /dev/null @@ -1,106 +0,0 @@ -%if ( $error ) { -% $cgi->param('error', $error); -<% $cgi->redirect(popurl(2). "part_bill_event.cgi?". $cgi->query_string ) %> -%} else { -<% $cgi->redirect(popurl(3)."browse/part_bill_event.cgi") %> -%} -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); - -my $eventpart = $cgi->param('eventpart'); - -my $old = qsearchs('part_bill_event',{'eventpart'=>$eventpart}) if $eventpart; - -#s/days/seconds/ -$cgi->param('seconds', int( $cgi->param('days') * 86400 ) ); - -my $error; -if ( ! $cgi->param('plan_weight_eventcode') ) { - $error = "Must select an action"; -} else { - - $cgi->param('plan_weight_eventcode') =~ /^([\w\-]+):(\d+):(.*)$/s - or die "illegal plan_weight_eventcode:". - $cgi->param('plan_weight_eventcode'); - $cgi->param('plan', $1); - $cgi->param('weight', $2); - my $eventcode = $3; - my $plandata = ''; - - my $rnum; - my $rtype; - my $reasonm; - my $class = ''; - $class='c' if ($eventcode =~ /cancel/); - $class='s' if ($eventcode =~ /suspend/); - if ($class) { - $cgi->param("${class}reason") =~ /^(-?\d+)$/ - or $error = "Invalid ${class}reason"; - $rnum = $1; - if ($rnum == -1) { - $cgi->param("new${class}reasonT") =~ /^(\d+)$/ - or $error = "Invalid new${class}reasonT"; - $rtype = $1; - $cgi->param("new${class}reason") =~ /^([\s\w]+)$/ - or $error = "Invalid new${class}reason"; - $reasonm = $1; - } - } - - if ($rnum == -1 && !$error) { - my $reason = new FS::reason ({ 'reason' => $reasonm, - 'reason_type' => $rtype, - }); - $error = $reason->insert; - unless ($error) { - $rnum = $reason->reasonnum; - $cgi->param("${class}reason", $rnum); - $cgi->param("new${class}reason", ''); - $cgi->param("new${class}reasonT", ''); - } - } - - while ( $eventcode =~ /%%%(\w+)%%%/ ) { - my $field = $1; - my $value = join(', ', $cgi->param($field) ); - $cgi->param($field, $value); #in case it errors out - $eventcode =~ s/%%%$field%%%/$value/; - $plandata .= "$field $value\n"; - } - $cgi->param('eventcode', $eventcode); - $cgi->param('plandata', $plandata); - - unless($error) { - - if ( $eventpart ) { - - my $new = new FS::part_bill_event ( { - map { $_ => scalar($cgi->param($_)) } - fields('part_bill_event'), - } ); - $new->setfield('reason' => $rnum); - $error = $new->replace($old); - - } else { - - foreach my $payby ( $cgi->param('payby') ) { - my $new = new FS::part_bill_event ( { - map { $_ => scalar($cgi->param($_)) } - grep { $_ ne 'payby' } - fields('part_bill_event') - } ); - $new->setfield('payby' => $payby); - $new->setfield('reason' => $rnum ); - $error = $new->insert; - last if $error; - } - - } - - } - -} - -</%init> diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html index 7d5d4f398..548dd9a88 100644 --- a/httemplate/elements/menu.html +++ b/httemplate/elements/menu.html @@ -317,8 +317,6 @@ tie my %report_ticketing, 'Tie::IxHash', tie my %report_bill_event, 'Tie::IxHash', 'All billing events' => [ $fsurl.'search/report_cust_event.html', 'All billing events for a date range' ], 'Billing event errors' => [ $fsurl.'search/report_cust_event.html?failed=1', 'Failed credit cards, processor or printer problems, etc.' ], -# 'All invoice events' => [ $fsurl.'search/cust_bill_event.html', 'Reports on deprecated, old-style invoice events for a date range' ], -# 'Invoice event errors' => [ $fsurl.'search/cust_bill_event.html?failed=1', 'Reports on deprecated, old-style events for failed credit cards, processor or printer problems, etc.' ], ; tie my %report_payments, 'Tie::IxHash', @@ -667,7 +665,6 @@ $config_billing{'Billing events'} = [ $fsurl.'browse/part_event.html', 'Billing if $curuser->access_right('Edit billing events') || $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{'separator'} = ''; #its a separator! diff --git a/httemplate/misc/email_invoice_events.cgi b/httemplate/misc/email_invoice_events.cgi deleted file mode 100644 index d65fe172b..000000000 --- a/httemplate/misc/email_invoice_events.cgi +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); - -my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_reemail', $cgi; - -</%init> diff --git a/httemplate/misc/fax_invoice_events.cgi b/httemplate/misc/fax_invoice_events.cgi deleted file mode 100644 index 05420eeca..000000000 --- a/httemplate/misc/fax_invoice_events.cgi +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); - -my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_refax', $cgi; - -</%init> diff --git a/httemplate/misc/print_invoice_events.cgi b/httemplate/misc/print_invoice_events.cgi deleted file mode 100644 index c974d5f4e..000000000 --- a/httemplate/misc/print_invoice_events.cgi +++ /dev/null @@ -1,9 +0,0 @@ -<% $server->process %> -<%init> - -die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Resend invoices'); - -my $server = new FS::UI::Web::JSRPC 'FS::cust_bill_event::process_reprint', $cgi; - -</%init> diff --git a/httemplate/search/cust_bill_event.cgi b/httemplate/search/cust_bill_event.cgi deleted file mode 100644 index 9fb533a5f..000000000 --- a/httemplate/search/cust_bill_event.cgi +++ /dev/null @@ -1,167 +0,0 @@ -<& 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', - #'Inv #', 'Inv Date', 'Cust #', - 'Invoice', - FS::UI::Web::cust_header(), - ], - 'fields' => [ - 'event', - sub { time2str("%b %d %Y %T", $_[0]->_date) }, - sub { - #my $cust_bill_event = shift; - my $status = $_[0]->status; - $status .= ': '.$_[0]->statustext - if $_[0]->statustext; - $status; - }, - sub { - #my $cust_bill_event = shift; - 'Invoice #'. $_[0]->invnum. - ' ('. - time2str("%D", $_[0]->cust_bill_date). - ')'; - }, - \&FS::UI::Web::cust_fields, - ], - 'align' => 'lrlr'.FS::UI::Web::cust_aligns(), - 'links' => [ - '', - '', - '', - sub { - my $part_bill_event = shift; - my $template = $part_bill_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(), - ], - -&> -<%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('invnum') =~ /^(\d+)$/; - -my $title = $cgi->param('failed') - ? 'Failed invoice events' - : 'Invoice events'; - -my %search = (); - -if ( $cgi->param('agentnum') && $cgi->param('agentnum') =~ /^(\d+)$/ ) { - $search{agentnum} = $1; -} - -($search{beginning}, $search{ending}) - = FS::UI::Web::parse_beginning_ending($cgi); - -if ( $cgi->param('failed') ) { - $search{failed} = '1'; -} - -if ( $cgi->param('part_bill_event.payby') =~ /^(\w+)$/ ) { - $search{payby} = $1; -} - -if ( $cgi->param('invnum') =~ /^(\d+)$/ ) { - $search{invnum} = $1; -} - -my $where = 'WHERE '. FS::cust_bill_event->search_sql_where( \%search ); - -my $join = 'LEFT JOIN part_bill_event USING ( eventpart ) '. - 'LEFT JOIN cust_bill USING ( invnum ) '. - FS::UI::Web::join_cust_main('cust_bill'); - -my $sql_query = { - 'table' => 'cust_bill_event', - 'select' => join(', ', - 'cust_bill_event.*', - 'part_bill_event.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' => 'ORDER BY _date ASC', - 'addl_from' => $join, -}; - -my $count_sql = "SELECT COUNT(*) FROM cust_bill_event $join $where"; - -my $conf = new FS::Conf; - -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', - [ keys(%search) ], - "../misc/${_}invoice_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 - (map {qq!<INPUT TYPE="hidden" NAME="$_" VALUE="$search{$_}">!} keys(%search)), - qq!</FORM>! -} qw( print_ email_ fax_ ) ); - -my $menubar = []; - -if ( $curuser->access_right('Resend invoices') ) { - - push @$menubar, 'Re-print these events' => - "javascript:print_process()", - 'Re-email these events' => - "javascript:email_process()", - ; - - push @$menubar, 'Re-fax these events' => - "javascript:fax_process()" - if $conf->exists('hylafax'); - -} - -my $link_cust = sub { - my $cust_bill_event = shift; - $cust_bill_event->cust_main_custnum - ? [ "${p}view/cust_main.cgi?", 'custnum' ] - : ''; -}; - -</%init> diff --git a/httemplate/search/cust_bill_event.html b/httemplate/search/cust_bill_event.html deleted file mode 100755 index 0f84a5581..000000000 --- a/httemplate/search/cust_bill_event.html +++ /dev/null @@ -1,67 +0,0 @@ -<% include( - '/elements/header.html', - ( $cgi->param('failed') ? 'Failed invoice events' : 'Invoice events' ), - ) -%> - - <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') ? 1 : 0 %>"> - <TABLE> - - <% include( '/elements/tr-select-agent.html', 'disable_empty'=>0 ) %> - - <!--<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/view/cust_bill.cgi b/httemplate/view/cust_bill.cgi index 27376d505..4ee4efbf4 100755 --- a/httemplate/view/cust_bill.cgi +++ b/httemplate/view/cust_bill.cgi @@ -111,10 +111,6 @@ <A HREF="<%$p%>search/cust_event.html?invnum=<% $cust_bill->invnum %>">( <% mt('View invoice events') |h %> )</A> % } -% if ( $cust_bill->num_cust_bill_event ) { $br++; -<A HREF="<%$p%>search/cust_bill_event.cgi?invnum=<% $cust_bill->invnum %>">( <% mt('View deprecated, old-style invoice events') |h %> )</A> -% } - % my @modes = grep {! $_->disabled} % $cust_bill->cust_main->agent->invoice_modes; % if ( @modes ) { |