From c8bdf37b4d6d1496b217a0af7114c4a86a1348fc Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Aug 2010 02:57:15 +0000 Subject: cleaner timeworked results w/link to customer --- httemplate/misc/timeworked.html | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/timeworked.html b/httemplate/misc/timeworked.html index 46063e829..5c3c95560 100755 --- a/httemplate/misc/timeworked.html +++ b/httemplate/misc/timeworked.html @@ -8,22 +8,11 @@ - Trans Ticket - Time + Hours Customer Multiplier - - - # - # - Subject - hours - # - Name - - @@ -35,9 +24,9 @@ % my ($custnum, $name) = split(':', pop @customers, 2); % my $link = $p. 'rt/Ticket/Display.html?id='. $ticketmap{$tr_id}. % '#txn-'. $tr_id; +% my $clink = $p. 'view/cust_main.cgi?'. $custnum; - <% $tr_id %> <% $ticketmap{$tr_id} %> <% $ticket{$ticketmap{$tr_id}} |h %> @@ -47,8 +36,8 @@ % } <% sprintf("%0.2f", $seconds/3600) %> - <% $custnum %> - <% $name %> + <% $custnum %> + <% $name %> @@ -67,7 +56,7 @@ % ($custnum, $name) = split(':', $_, 2); - <% $custnum %> + <% $custnum %> <% $name %> -- cgit v1.2.1 From 746eb018918ec4660870c79d0ff907fe0920696a Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 3 Aug 2010 02:58:47 +0000 Subject: cleaner timeworked results w/link to customer --- httemplate/misc/timeworked.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/timeworked.html b/httemplate/misc/timeworked.html index 5c3c95560..672fad8d6 100755 --- a/httemplate/misc/timeworked.html +++ b/httemplate/misc/timeworked.html @@ -54,10 +54,11 @@ % foreach ( @customers ) { % ($custnum, $name) = split(':', $_, 2); +% $clink = $p. 'view/cust_main.cgi?'. $custnum; - <% $custnum %> - <% $name %> + <% $custnum %> + <% $name %> % $multiplier = $default_multiplier; -- cgit v1.2.1 From 720cf723d2c8e88760704e2fdc50ebf48e0574f2 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 3 Aug 2010 03:30:20 +0000 Subject: customer view tab for an external info page, RT#8903 --- httemplate/misc/custom_link_proxy.cgi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 httemplate/misc/custom_link_proxy.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/custom_link_proxy.cgi b/httemplate/misc/custom_link_proxy.cgi new file mode 100644 index 000000000..e5934e4a6 --- /dev/null +++ b/httemplate/misc/custom_link_proxy.cgi @@ -0,0 +1,24 @@ +% if( $response->is_success ) { +<% $response->decoded_content %> +% } +% else { +<% $response->error_as_HTML %> +% } +<%init> + +my( $custnum ) = $cgi->param('custnum'); +my $cust_main = qsearchs('cust_main', { custnum => $custnum } ) + or die "custnum '$custnum' not found"; # just check for existence + +my $conf = new FS::Conf; +my $url = $conf->config('cust_main-custom_link') . $cust_main->custnum; +#warn $url; + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" + unless $curuser->access_right('View customer'); + +my $ua = new LWP::UserAgent; +my $response = $ua->get($url); + -- cgit v1.2.1 From b1d445f94514a29e5d4753839798b0291d89aee3 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 9 Aug 2010 01:03:49 +0000 Subject: package web import from CSV/XLS, RT#9529 --- httemplate/misc/cust_main-import.cgi | 2 +- httemplate/misc/cust_pkg-import.html | 132 +++++++++++++++++++++++++++ httemplate/misc/process/cust_pkg-import.html | 10 ++ 3 files changed, 143 insertions(+), 1 deletion(-) create mode 100644 httemplate/misc/cust_pkg-import.html create mode 100644 httemplate/misc/process/cust_pkg-import.html (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index 9c1f98479..2ccf997c8 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -119,7 +119,7 @@ advertising source table.
  • invoicing_list: Email address for invoices, or POST for postal invoices. -
  • pkgpart: Package definition. Configuration -> Provisioning, services and packages -> View/Edit package definitions +
  • pkgpart: Package definition. Configuration -> Packages -> Package definitions
  • username and _password are required if pkgpart is specified. (Extended and Extended plus company formats) diff --git a/httemplate/misc/cust_pkg-import.html b/httemplate/misc/cust_pkg-import.html new file mode 100644 index 000000000..ad582b088 --- /dev/null +++ b/httemplate/misc/cust_pkg-import.html @@ -0,0 +1,132 @@ +<% include("/elements/header.html",'Batch Package Import') %> + +Import a file containing package records. +

    + +<% include( '/elements/form-file_upload.html', + 'name' => 'PackageImportForm', + 'action' => 'process/cust_pkg-import.html', + 'num_files' => 1, + 'fields' => [ 'agentnum', 'pkgbatch', 'format' ], + 'message' => 'Package import successful', + 'url' => $p."search/cust_pkg.cgi?pkgbatch=$pkgbatch", + ) +%> + +<% &ntable("#cccccc", 2) %> + + <% include( '/elements/tr-select-agent.html', + #'curr_value' => '', #$agentnum, + 'label' => "Agent", + 'empty_label' => 'Select agent', + ) + %> + + + + + Format + + + + + + <% include( '/elements/file-upload.html', + 'field' => 'file', + 'label' => 'Filename', + ) + %> + + + + + + + + + + + +
    +Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. The file should have a .CSV or .XLS extension. +

    + +Default format has the following field order: custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire +

    + +Default with agent_custid format has the following field order: agent_custid<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire +

    + +Account service format has the following field order: custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, username, _password +

    + +Account service with agent_custid format has the following field order: agent_custid<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, username, _password +

    + +Phone sevice format has the following field order: custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, countrycode, phonenum, sip_password, pin +

    + +Phone service with agent_custid format has the following field order: agent_custid<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, countrycode, phonenum, sip_password, pin +

    + +External sevice format has the following field order: custnum<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, id, title +

    + +External service with agent_custid format has the following field order: agent_custid<%$req%>, pkgpart<%$req%>, discountnum, start_date, setup, bill, last_bill, susp, adjourn, cancel, expire, id, title +

    + +<%$req%> Required fields +

    + +Field information: + +
      + +
    • custnum: This specifies an existing customer by custnum. + +
    • agent_custid: This specifies an existing customer record by agent_custid. + +
    • pkgpart: Package definition. Configuration -> Packages -> Package definitions + +
    • pkgpart: Optional discount. Configuration -> Packages -> Discounts + + + +
    • id: External service id, integer + +
    • title: External service identifier, text + +
    + +
    + +<% include('/elements/footer.html') %> + +<%once> + +my $req = qq!*!; + + +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + +my $pkgbatch = time2str('webimport-%Y/%m/%d-%T'. "-$$-". rand() * 2**32, time); + + diff --git a/httemplate/misc/process/cust_pkg-import.html b/httemplate/misc/process/cust_pkg-import.html new file mode 100644 index 000000000..1021817e4 --- /dev/null +++ b/httemplate/misc/process/cust_pkg-import.html @@ -0,0 +1,10 @@ +<% $server->process %> +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Import'); + +my $server = + new FS::UI::Web::JSRPC 'FS::cust_pkg::Import::process_batch_import', $cgi; + + -- cgit v1.2.1 From 5ba9e554e180575013c128f1fcd67723fcc2a75d Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 9 Aug 2010 15:46:37 +0000 Subject: fix label, RT#9529 --- httemplate/misc/cust_pkg-import.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_pkg-import.html b/httemplate/misc/cust_pkg-import.html index ad582b088..404e96588 100644 --- a/httemplate/misc/cust_pkg-import.html +++ b/httemplate/misc/cust_pkg-import.html @@ -101,7 +101,7 @@ Field information:
  • pkgpart: Package definition. Configuration -> Packages -> Package definitions -
  • pkgpart: Optional discount. Configuration -> Packages -> Discounts +
  • discountnum: Optional discount. Configuration -> Packages -> Discounts +
  • domsvc: Domain svcnum +
  • id: External service id, integer
  • title: External service identifier, text -- cgit v1.2.1 From 9f3d1466f4dd917aeb07d7e85222d97e131062f1 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 11 Aug 2010 06:35:20 +0000 Subject: a better customer delete, RT#9564 --- httemplate/misc/process/delete-customer.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/delete-customer.cgi b/httemplate/misc/process/delete-customer.cgi index d509a5e0e..12011311a 100755 --- a/httemplate/misc/process/delete-customer.cgi +++ b/httemplate/misc/process/delete-customer.cgi @@ -28,6 +28,6 @@ if ( $cgi->param('new_custnum') ) { my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ) or die "Customer not found: $custnum"; -my $error = $cust_main->delete($new_custnum); +my $error = $cust_main->delete('new_custnum' => $new_custnum); -- cgit v1.2.1 From 80f722b82cb92fa49ee172230be3c61f72e56f41 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 15 Aug 2010 06:21:06 +0000 Subject: fix payment and refund searches by otaker (now usernum), RT#9555 --- httemplate/misc/process/batch-cust_pay.cgi | 2 +- httemplate/misc/process/cust_pay-import.cgi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi index 058a2251a..4da00c63d 100644 --- a/httemplate/misc/process/batch-cust_pay.cgi +++ b/httemplate/misc/process/batch-cust_pay.cgi @@ -42,6 +42,6 @@ % } else { % % -<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %> +<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %> % } diff --git a/httemplate/misc/process/cust_pay-import.cgi b/httemplate/misc/process/cust_pay-import.cgi index d4ff226ec..92b6e5a36 100644 --- a/httemplate/misc/process/cust_pay-import.cgi +++ b/httemplate/misc/process/cust_pay-import.cgi @@ -1,4 +1,4 @@ -<% $cgi->redirect(popurl(3). "search/cust_pay.cgi?magic=paybatch;paybatch=$paybatch") %> +<% $cgi->redirect(popurl(3). "search/cust_pay.html?magic=paybatch;paybatch=$paybatch") %> <%init> my $fh = $cgi->upload('csvfile'); -- cgit v1.2.1 From 4117c20f85ce085d7dd42b8970ce9c65b95d7e27 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 19 Aug 2010 19:11:45 +0000 Subject: part_pkg prorate mixin and sync_bill_date option, RT#9554 --- httemplate/misc/order_pkg.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 33b2bb390..2511a3deb 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -128,7 +128,11 @@ my $cust_main = qsearchs({ my $pkgpart = scalar($cgi->param('pkgpart')); my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi? -my $start_date = $cust_main->next_bill_date; -$start_date = $start_date ? time2str($format, $start_date) : ''; +my $start_date = ''; +if(! $conf->exists('order_pkg-no_start_date') ) { + warn "foo"; + $cust_main->next_bill_date; + $start_date = $start_date ? time2str($format, $start_date) : ''; +} -- cgit v1.2.1 From a567bc97334064af26655c1dce66e534e9d5d9cc Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 19 Aug 2010 20:21:04 +0000 Subject: fix my mistake --- httemplate/misc/order_pkg.html | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 2511a3deb..8479a7573 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -129,9 +129,8 @@ my $pkgpart = scalar($cgi->param('pkgpart')); my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi? my $start_date = ''; -if(! $conf->exists('order_pkg-no_start_date') ) { - warn "foo"; - $cust_main->next_bill_date; +if( ! $conf->exists('order_pkg-no_start_date') ) { + $start_date = $cust_main->next_bill_date; $start_date = $start_date ? time2str($format, $start_date) : ''; } -- cgit v1.2.1 From 57999adbee73616a2c18b82df74d476f5005dcd8 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 23 Aug 2010 16:35:33 +0000 Subject: work around ffiec bug and add year 2010 --- httemplate/misc/xmlhttp-cust_main-censustract.html | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/xmlhttp-cust_main-censustract.html b/httemplate/misc/xmlhttp-cust_main-censustract.html index 9d588d712..3ba68afd4 100644 --- a/httemplate/misc/xmlhttp-cust_main-censustract.html +++ b/httemplate/misc/xmlhttp-cust_main-censustract.html @@ -36,23 +36,32 @@ if ( $sub eq 'censustract' ) { my $content = $res->content; my $p = new HTML::TokeParser \$content; my $viewstate; + my $eventvalidation; while (my $token = $p->get_tag('input') ) { - next unless $token->[1]->{name} eq '__VIEWSTATE'; - $viewstate = $token->[1]->{value}; - last; + if ($token->[1]->{name} eq '__VIEWSTATE') { + $viewstate = $token->[1]->{value}; + } + if ($token->[1]->{name} eq '__EVENTVALIDATION') { + $eventvalidation = $token->[1]->{value}; + } + last if $viewstate && $eventvalidation; } - unless ($viewstate) { + unless ($viewstate && $eventvalidation ) { - $error = "no __VIEWSTATE found"; + $error = "either no __VIEWSTATE or __EVENTVALIDATION found"; } else { my($zip5, $zip4) = split('-',$arg{zip}); + #ugh workaround a mess at ffiec + $arg{year} = " $arg{year}" unless $arg{year} = "2010"; my @ffiec_args = ( __VIEWSTATE => $viewstate, + __EVENTVALIDATION => $eventvalidation, ddlbYear => $arg{year}, + ddlbYear => ' 2009', txtAddress => $arg{address}, txtCity => $arg{city}, ddlbState => $arg{state}, @@ -62,6 +71,7 @@ if ( $sub eq 'censustract' ) { warn join("\n", @ffiec_args ) if $DEBUG; + push @{ $ua->requests_redirectable }, 'POST'; $res = $ua->request( POST( $url, \@ffiec_args ) ); warn $res->as_string if $DEBUG > 1; @@ -74,6 +84,7 @@ if ( $sub eq 'censustract' ) { my @id = qw( MSACode StateCode CountyCode TractCode ); $content = $res->content; + warn $res->content if $DEBUG > 1; $p = new HTML::TokeParser \$content; my $prefix = 'UcGeoResult11_lb'; my $compare = -- cgit v1.2.1 From 4289a88d7ac580599e4af7242f6af90aa2653cb8 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 23 Aug 2010 20:02:41 +0000 Subject: support importing charges by agent_custid --- httemplate/misc/cust_main-import_charges.cgi | 63 +++++++++++++++++++--- .../misc/process/cust_main-import_charges.cgi | 3 +- 2 files changed, 57 insertions(+), 9 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main-import_charges.cgi b/httemplate/misc/cust_main-import_charges.cgi index 3801929e8..c844e0ee4 100644 --- a/httemplate/misc/cust_main-import_charges.cgi +++ b/httemplate/misc/cust_main-import_charges.cgi @@ -1,22 +1,69 @@ -<% include('/elements/header.html', 'Batch Customer Charge') %> +<% include("/elements/header.html",'Batch Payment Charge') %> + +Import a CSV file containing customer payments. +

    -Import a CSV file containing customer charges.

    -Default file format is CSV, with the following field order: custnum, amount, description

    -If amount is negative, a credit will be applied instead.

    -

    +<% &ntable("#cccccc", 2) %> + +<% include('/elements/tr-select-agent.html', + #'curr_value' => '', #$agentnum, + 'label' => "Agent", + 'empty_label' => 'Select agent', + ) +%> + + + Format + + + + + + + CSV filename + + -CSV Filename:

    - + + +
    -<% include('/elements/footer.html') %> +
    + +Simple file format is CSV, with the following field order: custnum, agent_custid, amount, description +

    + + +Field information: + +
      + +
    • custnum: This is the freeside customer number. It may be left blank. If specified, agent_custid must be blank. + +
    • agent_custid: This is the reseller's idea of the customer number or identifier. It may be left blank. If specified, custnum must be blank. + +
    • amount: A numeric value with at most two digits after the decimal point. If amount is negative, a credit will be applied instead. + +
    • description: Text describing the transaction. + +
    + +
    + +<% include('/elements/footer.html') %> <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Import'); + diff --git a/httemplate/misc/process/cust_main-import_charges.cgi b/httemplate/misc/process/cust_main-import_charges.cgi index 3ca68944a..bda3e3b70 100644 --- a/httemplate/misc/process/cust_main-import_charges.cgi +++ b/httemplate/misc/process/cust_main-import_charges.cgi @@ -16,7 +16,8 @@ my $fh = $cgi->upload('csvfile'); my $error = defined($fh) ? FS::cust_main::batch_charge( { filehandle => $fh, - 'fields' => [qw( custnum amount pkg )], + 'agentnum' => scalar($cgi->param('agentnum')), + 'format' => scalar($cgi->param('format')), } ) : 'No file'; -- cgit v1.2.1 From 1d0c67ac17b4b8d9256d7ed8192611d808d2be0f Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 23 Aug 2010 20:05:39 +0000 Subject: support importing customer notes by agent_custid --- httemplate/misc/cust_main_note-import.cgi | 8 ++++++-- httemplate/misc/cust_main_note-import.html | 12 ++++++++++++ httemplate/misc/process/cust_main_note-import.cgi | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main_note-import.cgi b/httemplate/misc/cust_main_note-import.cgi index b93c5c1cc..8a94ae4d4 100644 --- a/httemplate/misc/cust_main_note-import.cgi +++ b/httemplate/misc/cust_main_note-import.cgi @@ -108,6 +108,7 @@ % my $fh = $cgi->upload('csvfile'); % my $csv = new Text::CSV_XS; % my $skip_fuzzies = $cgi->param('fuzzies') ? 0 : 1; +% my $use_agent_custid = $cgi->param('use_agent_custid') ? 1 : 0; % % if ( defined($fh) ) { @@ -118,7 +119,7 @@ -% my $agentnum => scalar($cgi->param('agentnum')), +% my $agentnum = scalar($cgi->param('agentnum')); % my $line; % my $row = 0; % while ( defined($line=<$fh>) ) { @@ -138,7 +139,10 @@ % next unless ( $last || $first || $note ); % my @cust_main = (); % warn "searching for: $last, $first" if ($first || $last); -% if ($custnum) { +% if ($agentnum && $custnum && $use_agent_custid) { +% @cust_main = qsearch('cust_main', { 'agent' => $agentnum, +% 'agent_custid' => $custnum } ); +% } elsif ($custnum) { # && !use_agent_custid % @cust_main = qsearch('cust_main', { 'custnum' => $custnum }); % } else { % @cust_main = FS::cust_main::smart_search( diff --git a/httemplate/misc/cust_main_note-import.html b/httemplate/misc/cust_main_note-import.html index d8fefa732..cc1645d2e 100644 --- a/httemplate/misc/cust_main_note-import.html +++ b/httemplate/misc/cust_main_note-import.html @@ -13,6 +13,13 @@ Anything after the character sequence #! is ignored. <% &ntable("#cccccc") %> +<% include('/elements/tr-select-agent.html', + #'curr_value' => '', #$agentnum, + 'label' => "Agent", + 'empty_label' => 'Select agent', + ) +%> + @@ -22,6 +29,11 @@ Anything after the character sequence #! is ignored. + + + + +
    First Note to be added
    CSV filename
    custnum is reseller's customer number


    diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi index 6aa8b1d37..ec96f2349 100644 --- a/httemplate/misc/process/cust_main_note-import.cgi +++ b/httemplate/misc/process/cust_main_note-import.cgi @@ -26,6 +26,7 @@ The following items <% $op eq 'Preview' ? 'would be' : 'were' %> imported. (See die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Import'); +$FS::cust_main::import=1; # the customer records are already in the database my $date = time; my $otaker = $FS::CurrentUser::CurrentUser->username; my $csv = new Text::CSV_XS; -- cgit v1.2.1 From 48e3f879908a13cb87786e32e158ff8a8bf18fbb Mon Sep 17 00:00:00 2001 From: mark Date: Sat, 4 Sep 2010 02:19:03 +0000 Subject: set expire date for customer packages, RT#9697 --- httemplate/misc/cancel_cust.html | 42 ++++++++++++++++++++++++++++++------ httemplate/misc/cust_main-cancel.cgi | 31 ++++++++++++++++++++------ 2 files changed, 60 insertions(+), 13 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cancel_cust.html b/httemplate/misc/cancel_cust.html index 12c37ebe2..b7ecccd7e 100644 --- a/httemplate/misc/cancel_cust.html +++ b/httemplate/misc/cancel_cust.html @@ -2,18 +2,46 @@ <% include('/elements/error.html') %> +

    Permanently delete all services and cancel this customer? - <% $ban %> - -

    - -<% ntable("#cccccc", 2) %> + + + + + + + + + +
    + + Cancel now
    + + Cancel on date:  + <% include('/elements/input-date-field.html', { + 'name' => 'expire', + 'value' => time, + } ) %> +
    + +<% $ban %> + <% include('/elements/tr-select-reason.html', 'field' => 'reasonnum', 'reason_class' => 'C', @@ -50,8 +78,8 @@ die "No customer # $custnum" unless $cust_main; my $ban = ''; if ( $cust_main->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ ) { - $ban = '

    '. - ' Ban this customer\'s '; + $ban = '

    '. + ' Ban this customer\'s '; if ( $cust_main->payby =~ /^(CARD|DCRD)$/ ) { $ban .= 'credit card'; } elsif ( $cust_main->payby =~ /^(CHEK|DCHK)$/ ) { diff --git a/httemplate/misc/cust_main-cancel.cgi b/httemplate/misc/cust_main-cancel.cgi index 009a7d41b..44be20c8a 100755 --- a/httemplate/misc/cust_main-cancel.cgi +++ b/httemplate/misc/cust_main-cancel.cgi @@ -1,4 +1,4 @@ -<% header("Customer cancelled") %> +<% include('/elements/header.html', "Customer cancelled") %> @@ -11,9 +11,11 @@ die "access denied" my $custnum; my $ban = ''; +my $expire = ''; if ( $cgi->param('custnum') =~ /^(\d+)$/ ) { $custnum = $1; $ban = $cgi->param('ban'); + $expire = $cgi->param('expire'); } else { my($query) = $cgi->keywords; $query =~ /^(\d+)$/ || die "Illegal custnum"; @@ -42,11 +44,28 @@ my $cust_main = qsearchs( { 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, } ); -warn "cancelling $cust_main"; -my @errors = $cust_main->cancel( - 'ban' => $ban, - 'reason' => $reasonnum, -); +my @errors; +if($cgi->param('now_or_later')) { + $expire = parse_datetime($expire); + if($expire) { + #warn "setting expire dates on custnum#$custnum\n"; + my @pkgs = $cust_main->ncancelled_pkgs; + @errors = grep {$_} map { $_->cancel( + 'reason' => $reasonnum, + 'date' => $expire, + ) } @pkgs; + } + else { + @errors = ("error parsing expire date: ".$cgi->param('expire')); + } +} +else { + warn "cancelling $cust_main"; + @errors = $cust_main->cancel( + 'ban' => $ban, + 'reason' => $reasonnum, + ); +} my $error = join(' / ', @errors) if scalar(@errors); if ( $error ) { -- cgit v1.2.1 From 6c9cd1c36adbb9fc950fcf0a0b269fa6f16838a1 Mon Sep 17 00:00:00 2001 From: mark Date: Fri, 17 Sep 2010 18:12:08 +0000 Subject: email_search_result for cust_pkg and svc_broadband, RT#8736 --- httemplate/misc/email-customers.html | 108 +++++++++++++++++++-------- httemplate/misc/process/email-customers.html | 2 +- 2 files changed, 79 insertions(+), 31 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html index 201aed428..0ec8bb9df 100644 --- a/httemplate/misc/email-customers.html +++ b/httemplate/misc/email-customers.html @@ -1,69 +1,77 @@ <% include('/elements/header.html', $title) %> -% foreach my $key ( keys %search ) { -% my @values = ref($search{$key}) ? @{$search{$key}} : ( $search{$key} ); -% foreach my $value ( @values ) { - -% } -% } + +%# Mixing search params with from address, subject, etc. required special-case +%# handling of those, risked name conflicts, and caused massive problems with +%# multi-valued search params. We are no longer in search context, so we +%# pack the search into a Storable string for later use. + -% if ( $cgi->param('magic') eq 'send' ) { +% if ( $cgi->param('action') eq 'send' ) { Sending notice <% include('/elements/progress-init.html', 'OneTrueForm', - [ keys(%search), qw( from subject html_body text_body ) ], + [ qw( search table from subject html_body text_body msgnum ) ], 'process/email-customers.html', { 'message' => "Notice sent" }, #would be nice to show #, but.. ) %> -% } elsif ( $cgi->param('magic') eq 'preview' ) { +% } elsif ( $cgi->param('action') eq 'preview' ) { Preview notice % } -% if ( $cgi->param('magic') ) { +% if ( $cgi->param('action') ) {

    +% if ( $msg_template ) { + <% include('/elements/tr-fixed.html', + 'label' => 'Template:', + 'value' => $msg_template->msgname, + ) + %> +% } + <% include('/elements/tr-fixed.html', 'field' => 'from', 'label' => 'From:', - 'value' => scalar( $cgi->param('from') ), + 'value' => scalar( $from ), ) %> <% include('/elements/tr-fixed.html', 'field' => 'subject', 'label' => 'Subject:', - 'value' => scalar( $cgi->param('subject') ), + 'value' => scalar( $subject ), ) %> - + - + % my $text_body = HTML::FormatText->new(leftmargin=>0)->format( % HTML::TreeBuilder->new_from_content( -% $cgi->param('html_body') +% $html_body % ) % ); - +
    Message (HTML display): <% $cgi->param('html_body') %><% $html_body %>
    Message (Text display):
    <% $text_body %>
    <% $text_body %>
    -% if ( $cgi->param('magic') eq 'preview' ) { +% if ( $cgi->param('action') eq 'preview' ) {
    - + % } % } else { - + +Template: + <% include('/elements/select-table.html', + 'label' => 'Template:', + 'table' => 'msg_template', + 'name_col' => 'msgname', + 'empty_label' => '(none)', + 'onchange' => 'toggle(this)', + ) + %>
    +
    <% include('/elements/tr-input-text.html', 'field' => 'from', 'label' => 'From:', @@ -102,15 +124,14 @@ %#Substitution vars: -

    - + % } -% if ( $cgi->param('magic') eq 'send' ) { +% if ( $cgi->param('action') eq 'send' ) { @@ -123,16 +144,32 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices'); -my %search = $cgi->Vars; -delete $search{$_} for qw( magic from subject html_body text_body ); -$search{$_} = [ split(/\0/, $search{$_}) ] - foreach grep { $_ eq 'payby' || $search{$_} =~ /\0/ } keys %search; - -my $title = 'Bulk send customer notices'; +my $table = $cgi->param('table') or die "'table' required"; +my %search; +if ( $cgi->param('search') ) { + %search = %{ thaw(decode_base64($cgi->param('search'))) }; +} +else { + %search = $cgi->Vars; + delete $search{$_} for qw( action table from subject html_body text_body ); + # FS::$table->search is expected to know which parameters might be + # multi-valued, and to accept scalar values for them also. No good + # solution to this since CGI can't tell whether a parameter _might_ + # have had multiple values, only whether it does. + @search{keys %search} = map { /\0/ ? [ split /\0/, $_ ] : $_ } values %search; +} + +my $title = 'Send bulk customer notices'; my $num_cust; -if ( $cgi->param('magic') eq 'preview' ) { - my $sql_query = FS::cust_main->search(\%search); +my $from = $cgi->param('from') || ''; +my $subject = $cgi->param('subject') || ''; +my $html_body = $cgi->param('html_body') || ''; + +my $msg_template = ''; + +if ( $cgi->param('action') eq 'preview' ) { + my $sql_query = "FS::$table"->search(\%search); my $count_query = delete($sql_query->{'count_query'}); my $count_sth = dbh->prepare($count_query) or die "Error preparing $count_query: ". dbh->errstr; @@ -140,6 +177,17 @@ if ( $cgi->param('magic') eq 'preview' ) { or die "Error executing $count_query: ". $count_sth->errstr; my $count_arrayref = $count_sth->fetchrow_arrayref; $num_cust = $count_arrayref->[0]; + + if ( $cgi->param('msgnum') ) { + $msg_template = qsearchs('msg_template', + { msgnum => $cgi->param('msgnum') } ) + or die "template not found: ".$cgi->param('msgnum'); + $sql_query->{'extra_sql'} .= ' LIMIT 1'; + $sql_query->{'order_by'} = ''; + my $cust = qsearchs($sql_query)->cust_main; + my %message = $msg_template->prepare( 'cust_main' => $cust ); + ($from, $subject, $html_body) = @message{'from', 'subject', 'html_body'}; + } } diff --git a/httemplate/misc/process/email-customers.html b/httemplate/misc/process/email-customers.html index c54bc6dca..de2bb926b 100644 --- a/httemplate/misc/process/email-customers.html +++ b/httemplate/misc/process/email-customers.html @@ -4,6 +4,6 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bulk send customer notices'); -my $server = new FS::UI::Web::JSRPC 'FS::cust_main::process_email_search_result', $cgi; +my $server = new FS::UI::Web::JSRPC 'FS::cust_main_Mixin::process_email_search_result', $cgi; -- cgit v1.2.1 From 5250c44bd7f282c7d782bf0e8349af12376929df Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 22 Sep 2010 19:16:20 +0000 Subject: prepayment discounts rt#5318 --- httemplate/misc/batch-cust_pay.html | 98 ++++++++++++++++++++-- httemplate/misc/payment.cgi | 5 ++ httemplate/misc/process/batch-cust_pay.cgi | 13 +-- httemplate/misc/process/payment.cgi | 26 ++++-- .../misc/xmlhttp-cust_main-discount_terms.cgi | 24 ++++++ 5 files changed, 142 insertions(+), 24 deletions(-) create mode 100644 httemplate/misc/xmlhttp-cust_main-discount_terms.cgi (limited to 'httemplate/misc') diff --git a/httemplate/misc/batch-cust_pay.html b/httemplate/misc/batch-cust_pay.html index 505f2d0ff..610f6e1db 100644 --- a/httemplate/misc/batch-cust_pay.html +++ b/httemplate/misc/batch-cust_pay.html @@ -13,23 +13,63 @@ function warnUnload() { } } window.onbeforeunload = warnUnload; + +function select_discount_term(row, prefix) { + var custnum_obj = document.getElementById('custnum'+prefix+row); + var select_obj = document.getElementById('discount_term'+prefix+row); + + var value = ''; + if (select_obj.type == 'hidden') { + value = select_obj.value; + } + + var term_select = document.createElement('SELECT'); + term_select.setAttribute('name', 'discount_term'+row); + term_select.setAttribute('id', 'discount_term'+row); + term_select.setAttribute('rownum', row); + term_select.style.display = ''; + select_obj.parentNode.replaceChild(term_select, select_obj); + opt(term_select, '', '1 month'); + + function select_discount_term_update(discount_terms) { + + var termArray = eval('(' + discount_terms + ')'); + for ( var t = 0; t < termArray.length; t++ ) { + opt(term_select, termArray[t][0], termArray[t][1]); + if (termArray[t][0] == value) { + term_select.selectedIndex = t+1; + } + } + + } + + discount_terms(custnum_obj.value, select_discount_term_update); + +} +<% include('/elements/xmlhttp.html', + 'url' => $p. 'misc/xmlhttp-cust_main-discount_terms.cgi', + 'subs' => [qw( discount_terms )], + ) +%> +
    <% include( "/elements/customer-table.html", name_singular => 'payment', - header => [ '', 'Amount', 'Check #', '' ], - fields => [ sub {'$'}, 'paid', 'payinfo', 'error', ], - types => [ 'immutable', '', '', 'immutable', ], - align => [ 'c', 'r', 'r', 'l' ], - sizes => [ 0, 8, 10, 0, ], - colors => [ '', '', '', '#ff0000' ], - param => { () }, - footer => [ '$', '_TOTAL', '', '' ], - footer_align => [ 'c', 'r', 'r', '' ], + header => \@header, + fields => \@fields, + types => \@types, + align => \@align, + sizes => \@sizes, + colors => \@colors, + param => \%param, + footer => \@footer, + footer_align => \@footer_align, + custnum_update_callback => $custnum_update_callback, ) %> @@ -41,6 +81,14 @@ window.onbeforeunload = warnUnload; +%if ( $cgi->param('error') ) { + +%} + <% include('/elements/footer.html') %> <%init> @@ -48,4 +96,36 @@ window.onbeforeunload = warnUnload; die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Post payment batch'); +my @header = ( '', 'Amount', 'Check #' ); +my @fields = ( sub {'$'}, 'paid', 'payinfo' ); +my @types = ( 'immutable', '', '' ); +my @align = ( 'c', 'r', 'r' ); +my @sizes = ( 0, 8, 10 ); +my @colors = ( '', '', '' ); +my %param = (); +my @footer = ( '$', '_TOTAL', '' ); +my @footer_align = ( 'c', 'r', 'r' ); +my $custnum_update_callback = ''; + +if ( FS::Record->scalar_sql('SELECT count(*) FROM part_pkg_discount') ) { + push @header, ''; + push @fields, 'discount_term'; + push @types, 'immutable'; + push @align, 'r'; + push @sizes, '0'; + push @colors, ''; + push @footer, ''; + push @footer_align, ''; + $custnum_update_callback = 'select_discount_term'; +} + +push @header, ''; +push @fields, 'error'; +push @types, 'immutable'; +push @align, 'l'; +push @sizes, '0'; +push @colors, '#ff0000'; +push @footer, ''; +push @footer_align, ''; + diff --git a/httemplate/misc/payment.cgi b/httemplate/misc/payment.cgi index 813b560bd..bcab68aae 100644 --- a/httemplate/misc/payment.cgi +++ b/httemplate/misc/payment.cgi @@ -67,6 +67,11 @@ % } +<% include('/elements/tr-select-discount_term.html', + 'custnum' => $custnum, + 'cgi' => $cgi + ) +%> % if ( $payby eq 'CARD' ) { % diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi index 4da00c63d..aefc00654 100644 --- a/httemplate/misc/process/batch-cust_pay.cgi +++ b/httemplate/misc/process/batch-cust_pay.cgi @@ -11,12 +11,13 @@ % #while ( exists($param->{"custnum$row"}) ) { % for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { % push @cust_pay, new FS::cust_pay { -% 'custnum' => $param->{"custnum$row"}, -% 'paid' => $param->{"paid$row"}, -% 'payby' => 'BILL', -% 'payinfo' => $param->{"payinfo$row"}, -% 'paybatch' => $paybatch, -% } +% 'custnum' => $param->{"custnum$row"}, +% 'paid' => $param->{"paid$row"}, +% 'payby' => 'BILL', +% 'payinfo' => $param->{"payinfo$row"}, +% 'discount_term' => $param->{"discount_term$row"}, +% 'paybatch' => $paybatch, +% } % if $param->{"custnum$row"} % || $param->{"paid$row"} % || $param->{"payinfo$row"}; diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi index 665001ea9..c1c9071f9 100644 --- a/httemplate/misc/process/payment.cgi +++ b/httemplate/misc/process/payment.cgi @@ -119,19 +119,26 @@ if ( $payby eq 'CHEK' ) { die "unknown payby $payby"; } +$cgi->param('discount_term') =~ /^\d*$/ + or errorpage("illegal discount_term"); +my $discount_term = $1; + my $error = ''; my $paynum = ''; if ( $cgi->param('batch') ) { - $error = $cust_main->batch_card( - 'payby' => $payby, - 'amount' => $amount, - 'payinfo' => $payinfo, - 'paydate' => "$year-$month-01", - 'payname' => $payname, - map { $_ => $cgi->param($_) } - @{$payby2fields{$payby}} - ); + $error = 'Prepayment discounts not supported with batched payments' + if $discount_term; + + $error ||= $cust_main->batch_card( + 'payby' => $payby, + 'amount' => $amount, + 'payinfo' => $payinfo, + 'paydate' => "$year-$month-01", + 'payname' => $payname, + map { $_ => $cgi->param($_) } + @{$payby2fields{$payby}} + ); errorpage($error) if $error; } else { @@ -146,6 +153,7 @@ if ( $cgi->param('batch') ) { 'payunique' => $payunique, 'paycvv' => $paycvv, 'paynum_ref' => \$paynum, + 'discount_term' => $discount_term, map { $_ => $cgi->param($_) } @{$payby2fields{$payby}} ); errorpage($error) if $error; diff --git a/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi b/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi new file mode 100644 index 000000000..71e2da597 --- /dev/null +++ b/httemplate/misc/xmlhttp-cust_main-discount_terms.cgi @@ -0,0 +1,24 @@ +% if ( $sub eq 'discount_terms' ) { +% +% my $return = []; +% my $custnum = $cgi->param('arg'); +% my $cust_main = ''; +% $cust_main = qsearchs({ +% 'table' => 'cust_main', +% 'hashref' => { 'custnum' => $custnum }, +% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +% }); +% +% if ($cust_main) { +% $return = [ map [ $_, "$_ months" ], $cust_main->discount_terms ]; +% } +% +<% objToJson($return) %> +% } +<%init> + +my $conf = new FS::Conf; + +my $sub = $cgi->param('sub'); + + -- cgit v1.2.1 From 7f75baeccde8bf68e6914ce7efac73cdb7e7dcd0 Mon Sep 17 00:00:00 2001 From: mark Date: Thu, 23 Sep 2010 23:21:06 +0000 Subject: fix use of agent_custid in quick payment entry, RT#10035 --- httemplate/misc/process/batch-cust_pay.cgi | 21 ++++++++++++++++++++- httemplate/misc/xmlhttp-cust_main-search.cgi | 4 ++-- 2 files changed, 22 insertions(+), 3 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/batch-cust_pay.cgi b/httemplate/misc/process/batch-cust_pay.cgi index aefc00654..e51b9e6d7 100644 --- a/httemplate/misc/process/batch-cust_pay.cgi +++ b/httemplate/misc/process/batch-cust_pay.cgi @@ -10,8 +10,27 @@ % #my $row = 0; % #while ( exists($param->{"custnum$row"}) ) { % for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { +% my $custnum = $param->{"custnum$row"}; +% my $cust_main; +% if ( $custnum =~ /^(\d+)$/ and $1 <= 2147483647 ) { +% $cust_main = qsearchs({ +% 'table' => 'cust_main', +% 'hashref' => { 'custnum' => $1 }, +% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +% }); +% } +% if ( !$cust_main ) { # not found, try agent_custid +% $cust_main = qsearchs({ +% 'table' => 'cust_main', +% 'hashref' => { 'agent_custid' => $custnum }, +% 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +% }); +% } +% $custnum = $cust_main->custnum if $cust_main; +% # if !$cust_main, then this will throw an error on batch_insert +% % push @cust_pay, new FS::cust_pay { -% 'custnum' => $param->{"custnum$row"}, +% 'custnum' => $custnum, % 'paid' => $param->{"paid$row"}, % 'payby' => 'BILL', % 'payinfo' => $param->{"payinfo$row"}, diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi index 26e68b5d8..615a4bb1e 100644 --- a/httemplate/misc/xmlhttp-cust_main-search.cgi +++ b/httemplate/misc/xmlhttp-cust_main-search.cgi @@ -2,10 +2,10 @@ % % my $custnum = $cgi->param('arg'); % my $cust_main = ''; -% if ( $custnum <= 2147483647 ) { +% if ( $custnum =~ /^(\d+)$/ and $1 <= 2147483647 ) { % $cust_main = qsearchs({ % 'table' => 'cust_main', -% 'hashref' => { 'custnum' => $custnum }, +% 'hashref' => { 'custnum' => $1 }, % 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, % }); % } -- cgit v1.2.1 From f8d8c84ace077c33cb889db5013145802bb7ed70 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 24 Sep 2010 22:07:11 +0000 Subject: import to notes --- httemplate/misc/process/cust_main_note-import.cgi | 40 ++++++++++++----------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/process/cust_main_note-import.cgi b/httemplate/misc/process/cust_main_note-import.cgi index ec96f2349..6625e0029 100644 --- a/httemplate/misc/process/cust_main_note-import.cgi +++ b/httemplate/misc/process/cust_main_note-import.cgi @@ -39,25 +39,27 @@ my @inserted = (); my @uninserted = (); for ( my $row = 0; exists($param->{"custnum$row"}); $row++ ) { if ( $param->{"custnum$row"} ) { -# my $cust_main_note = new FS::cust_main_note { -# 'custnum' => $param->{"custnum$row"}, -# '_date' => $date, -# 'otaker' => $otaker, -# 'comments' => $param->{"note$row"}, -# }; -# my $error = ''; -# $error = $cust_main_note->insert unless ($op eq "Preview"); - my $cust_main = qsearchs('cust_main', - { 'custnum' => $param->{"custnum$row"} } - ); - my $error; - if ($cust_main) { - $cust_main->comments - ? $cust_main->comments($cust_main->comments. " ". $param->{"note$row"}) - : $cust_main->comments($param->{"note$row"}); - $error = $cust_main->replace; - }else{ - $error = "Can't find customer " . $param->{"custnum$row"}; + my $error = ''; + if ( $param->{use_comments} ) { # why? notes are sexier + my $cust_main = qsearchs('cust_main', + { 'custnum' => $param->{"custnum$row"} } + ); + if ($cust_main) { + $cust_main->comments + ? $cust_main->comments($cust_main->comments. " ". $param->{"note$row"}) + : $cust_main->comments($param->{"note$row"}); + $error = $cust_main->replace; + }else{ + $error = "Can't find customer " . $param->{"custnum$row"}; + } + } else { + my $cust_main_note = new FS::cust_main_note { + 'custnum' => $param->{"custnum$row"}, + '_date' => $date, + 'otaker' => $otaker, + 'comments' => $param->{"note$row"}, + }; + $error = $cust_main_note->insert unless ($op eq "Preview"); } my $result = { 'custnum' => $param->{"custnum$row"}, 'last' => $param->{"last$row"}, -- cgit v1.2.1 From e4c72328fb4c89eca20c4fe7645252ecb287ba89 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 24 Sep 2010 22:08:05 +0000 Subject: import tax exempt and force postal invoice optiosn --- httemplate/misc/cust_main-import.cgi | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main-import.cgi b/httemplate/misc/cust_main-import.cgi index 2ccf997c8..edf466566 100644 --- a/httemplate/misc/cust_main-import.cgi +++ b/httemplate/misc/cust_main-import.cgi @@ -30,7 +30,9 @@ Import a file containing customer records. @@ -89,7 +91,11 @@ Uploaded files can be CSV (comma-separated value) files or Excel spreadsheets. Extended format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password

    +Extended plus options format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password, options + Extended plus company format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, company, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_company, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password + +Extended plus company and options format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, company, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_company, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, username, _password, options

    External service format has the following field order: agent_custid, refnum<%$req%>, last<%$req%>, first<%$req%>, company, address1<%$req%>, address2, city<%$req%>, state<%$req%>, zip<%$req%>, country, daytime, night, ship_last, ship_first, ship_company, ship_address1, ship_address2, ship_city, ship_state, ship_zip, ship_country, payinfo, paycvv, paydate, invoicing_list, pkgpart, next_bill_date, id, title @@ -111,7 +117,7 @@ Field information: of an integer, the string is searched for and if necessary auto-created in the advertising source table. -
  • payinfo: Credit card number, or leave this, paycvv and paydate blank for email/paper invoicing. +
  • payinfo: Credit card number, or leave this, paycvv and paydate blank for email/paper invoicing. You may optionally prepend an 'A' or 'D' to the credit card number for automatic or on demand of customer billing respectively
  • paycvv: CVV2 number (three digits on the back of the credit card) @@ -127,6 +133,13 @@ advertising source table.
  • title: External service identifier, text +
  • options: text containing one or more of + +
      +
    • taxexempt: this customer does not pay taxes +
    • postalinvoice: ensure this customer receives a postal invoice +
    +
    -- cgit v1.2.1 From d6c837efb2bf63450de150b29f2ef7514cd249b6 Mon Sep 17 00:00:00 2001 From: mark Date: Fri, 1 Oct 2010 05:33:08 +0000 Subject: fix templated notices, RT#10103 --- httemplate/misc/email-customers.html | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate/misc') diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html index 0ec8bb9df..759c8bf94 100644 --- a/httemplate/misc/email-customers.html +++ b/httemplate/misc/email-customers.html @@ -29,6 +29,7 @@ % if ( $cgi->param('action') ) {
  • + % if ( $msg_template ) { <% include('/elements/tr-fixed.html', -- cgit v1.2.1 From eec4949e2c8f09a0b89331437186b77c4db6ff38 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 11 Oct 2010 19:00:33 +0000 Subject: external taxes support package locations RT10093 --- httemplate/misc/change_pkg.cgi | 12 ++- httemplate/misc/choose_tax_location.html | 90 ++++++++++++++++++++++ httemplate/misc/order_pkg.html | 14 +++- .../xmlhttp-cust_main-address_standardize.html | 1 + 4 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 httemplate/misc/choose_tax_location.html (limited to 'httemplate/misc') diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi index 16b707121..ec10b85cf 100755 --- a/httemplate/misc/change_pkg.cgi +++ b/httemplate/misc/change_pkg.cgi @@ -2,7 +2,7 @@ <% include('/elements/error.html') %> -
    + <% ntable('#cccccc') %> @@ -31,8 +31,16 @@
    +<% include( '/elements/standardize_locations.html', + 'form' => "OrderPkgForm", + 'onlyship' => 1, + 'no_company' => 1, + 'callback' => 'document.OrderPkgForm.submit();', + ) +%> +
    - + diff --git a/httemplate/misc/choose_tax_location.html b/httemplate/misc/choose_tax_location.html new file mode 100644 index 000000000..dce04c77d --- /dev/null +++ b/httemplate/misc/choose_tax_location.html @@ -0,0 +1,90 @@ +

    +

    Choose tax location

    +

    the geocode is:<% $header %>

    +

    <% $header %>

    + +

    + + + + + +
    + +
    +
    +<%init> + +my $conf = new FS::Conf; + +my %location = (); + +($location{data_vendor}) = $cgi->param('data_vendor') =~ /^([-\w]+)$/; +($location{city}) = $cgi->param('city') =~ /^([\w ]+)$/; +($location{state}) = $cgi->param('state') =~ /^(\w+)$/; +($location{zip}) = $cgi->param('zip') =~ /^([-\w ]+)$/; +($location{country}) = $cgi->param('country') =~ /^([\w ]+)$/; + +my($geocode) = $cgi->param('geocode') =~ /^([\w]+)$/; + +my($formname) = $cgi->param('formname') =~ /^([\w]*)$/; +$formname ||= 'CustomerForm'; + +my($zip5, $zip4) = split('-', $location{zip}); + +#only support US & CA +my $hashref = { 'data_vendor' => $location{data_vendor} }; +$hashref->{zip} = $location{country} eq 'CA' ? substr($zip5,0,1) : $zip5, + +my @keys = keys(%$hashref); +my @cust_tax_location = (); +until ( @cust_tax_location ) { + @cust_tax_location = qsearch({ table => 'cust_tax_location', + hashref => $hashref, + order_by => 'LIMIT 50', + }); + last unless scalar(@keys); + delete $hashref->{ shift @keys }; +} + +my %max = ( city => 4, county => 6, state => 5); +foreach my $location (@cust_tax_location) { + foreach ( qw( city county state ) ) { + my $length = length($location->$_); + $max{$_} = ($length > $max{$_}) ? $length : $max{$_}; + } +} +foreach ( qw( city county state ) ) { + $max{$_} = $location{$_} if $location{$_} > $max{$_}; + $max{$_}++; +} + +my $header = '  '; +$header .= $_. ' ' x ( $max{lc($_)} - length($_) ) + foreach qw( City County State ); +$header .= "In city?"; + +my $style = "font-family:monospace;"; + + diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index 8479a7573..e9a56b1a5 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -9,14 +9,14 @@ function enable_order_pkg () { if ( document.OrderPkgForm.pkgpart.selectedIndex > 0 ) { - document.OrderPkgForm.submit.disabled = false; + document.OrderPkgForm.submitButton.disabled = false; if ( document.OrderPkgForm.pkgpart.options[document.OrderPkgForm.pkgpart.selectedIndex].getAttribute('data-can_discount') == 1 ) { document.OrderPkgForm.discountnum.disabled = false; } else { document.OrderPkgForm.discountnum.disabled = true; } } else { - document.OrderPkgForm.submit.disabled = true; + document.OrderPkgForm.submitButton.disabled = true; document.OrderPkgForm.discountnum.disabled = true; } } @@ -101,8 +101,16 @@ +<% include( '/elements/standardize_locations.html', + 'form' => "OrderPkgForm", + 'onlyship' => 1, + 'no_company' => 1, + 'callback' => 'document.OrderPkgForm.submit();', + ) +%> +
    -> +> diff --git a/httemplate/misc/xmlhttp-cust_main-address_standardize.html b/httemplate/misc/xmlhttp-cust_main-address_standardize.html index 3b9e142f5..d0627cd59 100644 --- a/httemplate/misc/xmlhttp-cust_main-address_standardize.html +++ b/httemplate/misc/xmlhttp-cust_main-address_standardize.html @@ -28,6 +28,7 @@ if ( $sub eq 'address_standardize' ) { } ); foreach my $pre ( '', 'ship_' ) { + next unless ($pre || !$arg{onlyship}); my($zip5, $zip4) = split('-',$arg{$pre.'zip'}); -- cgit v1.2.1 From 29472410e3b882a6a6b74fe48d28db411fe8fcff Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 12 Oct 2010 01:15:17 +0000 Subject: package contract end date field, RT#9918 --- httemplate/misc/order_pkg.html | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html index e9a56b1a5..b232debd7 100644 --- a/httemplate/misc/order_pkg.html +++ b/httemplate/misc/order_pkg.html @@ -38,34 +38,19 @@ ) %> -%# false laziness w/edit/quick-charge.html Start date - - + <% include('/elements/input-date-field.html',{ + 'name' => 'start_date', + 'format' => $date_format, + 'value' => $start_date, + 'noinit' => 1, + }) %> (leave blank to start immediately) - - % if ( $cust_main->payby =~ /^(CARD|CHEK)$/ ) { % my $what = lc(FS::payby->shortname($cust_main->payby)); @@ -99,6 +84,18 @@ ) %> + + Contract end date + + <% include('/elements/input-date-field.html',{ + 'name' => 'contract_end', + 'format' => $date_format, + 'value' => '', + 'noinit' => 1, + }) %> + + + <% include( '/elements/standardize_locations.html', -- cgit v1.2.1 From f3b1e139720b2262516ee3690b1d4b2b9941b500 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 17 Oct 2010 22:35:58 +0000 Subject: dns editing improvements: show an error from adding default records, redirect back to the dns section on all operations, finish editing. RT#8933 --- httemplate/misc/delete-domain_record.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/delete-domain_record.cgi b/httemplate/misc/delete-domain_record.cgi index 08eedde5f..200365d2f 100755 --- a/httemplate/misc/delete-domain_record.cgi +++ b/httemplate/misc/delete-domain_record.cgi @@ -1,7 +1,7 @@ % if ( $error ) { % errorpage($error); % } else { -<% $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum) %> +<% $cgi->redirect($p. "view/svc_domain.cgi?". $domain_record->svcnum. '#dns') %> % } <%init> -- cgit v1.2.1 From a8e4b1744a6bbd2e1509b58e73b1d52751563880 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 20 Oct 2010 02:07:02 +0000 Subject: customer merging, RT#10247 --- httemplate/misc/cust_main-merge.html | 40 ++++++++++++++++++++ httemplate/misc/merge_cust.html | 72 ++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100755 httemplate/misc/cust_main-merge.html create mode 100644 httemplate/misc/merge_cust.html (limited to 'httemplate/misc') diff --git a/httemplate/misc/cust_main-merge.html b/httemplate/misc/cust_main-merge.html new file mode 100755 index 000000000..4decbef7a --- /dev/null +++ b/httemplate/misc/cust_main-merge.html @@ -0,0 +1,40 @@ +% if ( $error ) { +% $cgi->param('error', $error); +<% $cgi->redirect(popurl(1). "merge_cust.html?". $cgi->query_string ) %> +% } else { +<% include('/elements/header-popup.html', "Customer merged") %> + + + +% } +<%init> + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Merge customer'); + +my $error = ''; + +$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; +my $custnum = $1; + +my $new_custnum; +if ( $cgi->param('new_custnum') =~ /^(\d+)$/ ) { + $new_custnum = $1; + + my $cust_main = qsearchs( { + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $custnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, + } ); + die "No customer # $custnum" unless $cust_main; + + $error = $cust_main->merge($new_custnum); + +} else { + $error = 'Select a customer to merge into'; +} + + diff --git a/httemplate/misc/merge_cust.html b/httemplate/misc/merge_cust.html new file mode 100644 index 000000000..ad075be2f --- /dev/null +++ b/httemplate/misc/merge_cust.html @@ -0,0 +1,72 @@ +<% include('/elements/header-popup.html', 'Merge customer' ) %> + +<% include('/elements/error.html') %> + +
    + + + + + + + + + <% include('/elements/tr-search-cust_main.html', + 'label' => 'Merge into: ', + 'field' => 'new_custnum', + 'find_button' => 1, + 'curr_value' => scalar($cgi->param('new_custnum')), + ) + %> +
    + +

    +%#have merge button start out disabled and enable after you select a target cust +         + +

    + + + +<%init> + +$cgi->param('custnum') =~ /^(\d+)$/ or die 'illegal custnum'; +my $custnum = $1; + +my $curuser = $FS::CurrentUser::CurrentUser; + +die "access denied" unless $curuser->access_right('Merge customer'); + +my $cust_main = qsearchs( { + 'table' => 'cust_main', + 'hashref' => { 'custnum' => $custnum }, + 'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql, +} ); +die "No customer # $custnum" unless $cust_main; + + + -- cgit v1.2.1 From c22410950cebc97f35091753a6e84d577bc6c5f3 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 22 Oct 2010 18:03:47 +0000 Subject: add no_fuzzy_on_exact to RT customer search and our smart search boxes too, RT#10341 --- httemplate/misc/xmlhttp-cust_main-search.cgi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi index 615a4bb1e..481bea264 100644 --- a/httemplate/misc/xmlhttp-cust_main-search.cgi +++ b/httemplate/misc/xmlhttp-cust_main-search.cgi @@ -22,7 +22,9 @@ % } elsif ( $sub eq 'smart_search' ) { % % my $string = $cgi->param('arg'); -% my @cust_main = smart_search( 'search' => $string ); +% my @cust_main = smart_search( 'search' => $string, +% 'no_fuzzy_on_exact' => 1, #pref? +% ); % my $return = [ map [ $_->custnum, $_->name ], @cust_main ]; % <% objToJson($return) %> -- cgit v1.2.1 From 0a51b87d75f8c93de863f729ef1ca568ca227e32 Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 25 Oct 2010 22:22:42 +0000 Subject: summary display of bulk packages with many services, RT#9821 --- httemplate/misc/unprovision.cgi | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'httemplate/misc') diff --git a/httemplate/misc/unprovision.cgi b/httemplate/misc/unprovision.cgi index 4ab15fdc0..6f2c23815 100755 --- a/httemplate/misc/unprovision.cgi +++ b/httemplate/misc/unprovision.cgi @@ -1,6 +1,8 @@ %if ( $error ) { % errorpage($error); -%} else { +%} elsif ( $pkgnum ) { +<% $cgi->redirect(popurl(2)."search/cust_pkg_svc.html?svcpart=$svcpart;pkgnum=$pkgnum") %> +%} else { # $custnum should always exist <% $cgi->redirect(popurl(2)."view/cust_main.cgi?$custnum") %> %} <%init> @@ -9,18 +11,28 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Unprovision customer service'); #untaint svcnum -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/; -my $svcnum = $1; +my @svcnums; +my ($pkgnum, $svcpart, $custnum); +if( $cgi->param('svcnum') ) { + @svcnums = grep { $_ } map { /^(\d+)$/ && $1 } $cgi->param('svcnum'); + $pkgnum = $cgi->param('pkgnum'); + $svcpart = $cgi->param('svcpart'); + $custnum = $cgi->param('custnum'); +} +else { + @svcnums = map { /^(\d+)$/ && $1 } $cgi->keywords; +} -#my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum}); -#die "Unknown svcnum!" unless $svc_acct; +my $error = ''; +foreach my $svcnum (@svcnums) { -my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); -die "Unknown svcnum!" unless $cust_svc; + my $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum}); + die "Unknown svcnum!" unless $cust_svc; -my $custnum = $cust_svc->cust_pkg->custnum; + $custnum ||= $cust_svc->cust_pkg->custnum; -my $error = $cust_svc->cancel; + $error .= $cust_svc->cancel; + +} -- cgit v1.2.1