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/process/cust_pkg-import.html | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 httemplate/misc/process/cust_pkg-import.html (limited to 'httemplate/misc/process') 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 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/process') 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/process') 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 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/process/cust_main-import_charges.cgi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'httemplate/misc/process') 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/process/cust_main_note-import.cgi | 1 + 1 file changed, 1 insertion(+) (limited to 'httemplate/misc/process') 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 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/process/email-customers.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/misc/process') 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/process/batch-cust_pay.cgi | 13 +++++++------ httemplate/misc/process/payment.cgi | 26 +++++++++++++++++--------- 2 files changed, 24 insertions(+), 15 deletions(-) (limited to 'httemplate/misc/process') 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; -- 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 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'httemplate/misc/process') 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"}, -- 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/process') 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