From c1bb4ddb71147d0571bd301a6d8c452fdf0e1bc9 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 31 Jan 2006 04:26:54 +0000 Subject: move header() to include(/elements/header.html) so it can be changed in one place, thanks to Scott Edwards --- httemplate/edit/process/prepay_credit.cgi | 2 +- httemplate/edit/process/reg_code.cgi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi index 25ecbe079..ca7472432 100644 --- a/httemplate/edit/process/prepay_credit.cgi +++ b/httemplate/edit/process/prepay_credit.cgi @@ -29,7 +29,7 @@ unless ( ref($error) ) { $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) %><% } else { %> -<%= header( "$num prepaid cards generated". +<%= include("/elements/header.html", "$num prepaid cards generated". ( $agent ? ' for '.$agent->agent : '' ), menubar( 'Main menu' => popurl(3) ) ) diff --git a/httemplate/edit/process/reg_code.cgi b/httemplate/edit/process/reg_code.cgi index 4658257f3..a86c7383a 100644 --- a/httemplate/edit/process/reg_code.cgi +++ b/httemplate/edit/process/reg_code.cgi @@ -28,7 +28,7 @@ unless ( ref($error) ) { $cgi->redirect(popurl(3). "edit/reg_code.cgi?". $cgi->query_string ) %><% } else { %> -<%= header("$num registration codes generated for ". $agent->agent, menubar( +<%= include("/elements/header.html","$num registration codes generated for ". $agent->agent, menubar( 'Main menu' => popurl(3), 'View all agents' => popurl(3). 'browse/agent.cgi', ) ) %> -- cgit v1.2.1 From 860e628d3d0d2ba432d401de5c9d4784c918be54 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 5 Feb 2006 12:27:20 +0000 Subject: payment gateway editing --- httemplate/edit/process/payment_gateway.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/payment_gateway.html b/httemplate/edit/process/payment_gateway.html index b9e4d47da..42205a02d 100644 --- a/httemplate/edit/process/payment_gateway.html +++ b/httemplate/edit/process/payment_gateway.html @@ -17,7 +17,7 @@ my %options = @options; my $error; if ( $gatewaynum ) { - $error=$new->replace($old); + $error=$new->replace($old, \%options); } else { $error=$new->insert(\%options); $gatewaynum=$new->getfield('gatewaynum'); -- cgit v1.2.1 From 600a0939e7e7e589dae4f4f5bfef3650728940b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 8 Mar 2006 10:05:01 +0000 Subject: Add a new table for inventory with for DIDs/serials/etc., and an additional new table for inventory category (i.e. to distinguish DIDs, serials, MACs, etc.) --- httemplate/edit/process/elements/process.html | 46 +++++++++++++++++++++++++++ httemplate/edit/process/inventory_class.html | 4 +++ 2 files changed, 50 insertions(+) create mode 100644 httemplate/edit/process/elements/process.html create mode 100644 httemplate/edit/process/inventory_class.html (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html new file mode 100644 index 000000000..52c876720 --- /dev/null +++ b/httemplate/edit/process/elements/process.html @@ -0,0 +1,46 @@ +<% + + # options example... + # + # 'table' => + # #? 'primary_key' => #required when the dbdef doesn't know...??? + # #? 'fields' => [] + + my(%opt) = @_; + + #false laziness w/edit.html + my $table = $opt{'table'}; + my $class = "FS::$table"; + my $pkey = dbdef->table($table)->primary_key; #? $opt{'primary_key'} || + my $fields = $opt{'fields'} + #|| [ grep { $_ ne $pkey } dbdef->table($table)->columns ]; + || [ fields($table) ]; + + my $pkeyvalue = $cgi->param($pkey); + + my $old = qsearchs( $table, { $pkey => $pkeyvalue } ) if $pkeyvalue; + + my $new = $class->new( { + map { + $_, scalar($cgi->param($_)); + } @$fields + } ); + + my $error; + if ( $pkeyvalue ) { + $error = $new->replace($old); + } else { + warn $new; + $error = $new->insert; + warn $error; + $pkeyvalue = $new->getfield($pkey); + } + + if ( $error ) { + $cgi->param('error', $error); + print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); + } else { + print $cgi->redirect(popurl(3). "search/$table.html"); + } + +%> diff --git a/httemplate/edit/process/inventory_class.html b/httemplate/edit/process/inventory_class.html new file mode 100644 index 000000000..e30e74e7b --- /dev/null +++ b/httemplate/edit/process/inventory_class.html @@ -0,0 +1,4 @@ +<%= include( 'elements/process.html', + 'table' => 'inventory_class', + ) +%> -- cgit v1.2.1 From 1a033848671cad2cbe7687b37fc718b3b2a68b83 Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 22 Apr 2006 00:58:40 +0000 Subject: start of package class web UI (add/edit package classes, package class selection in package def edit) --- httemplate/edit/process/elements/process.html | 6 +++++- httemplate/edit/process/inventory_class.html | 3 ++- httemplate/edit/process/pkg_class.html | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 httemplate/edit/process/pkg_class.html (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 52c876720..83ff6f728 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -5,6 +5,7 @@ # 'table' => # #? 'primary_key' => #required when the dbdef doesn't know...??? # #? 'fields' => [] + # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' my(%opt) = @_; @@ -40,7 +41,10 @@ $cgi->param('error', $error); print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); } else { - print $cgi->redirect(popurl(3). "search/$table.html"); + print $cgi->redirect( popurl(3). + ( $opt{'viewall_dir'} || 'search' ). + "/$table.html" + ); } %> diff --git a/httemplate/edit/process/inventory_class.html b/httemplate/edit/process/inventory_class.html index e30e74e7b..ab9efef48 100644 --- a/httemplate/edit/process/inventory_class.html +++ b/httemplate/edit/process/inventory_class.html @@ -1,4 +1,5 @@ <%= include( 'elements/process.html', - 'table' => 'inventory_class', + 'table' => 'inventory_class', + 'viewall_dir' => 'browse', ) %> diff --git a/httemplate/edit/process/pkg_class.html b/httemplate/edit/process/pkg_class.html new file mode 100644 index 000000000..48e2b8009 --- /dev/null +++ b/httemplate/edit/process/pkg_class.html @@ -0,0 +1,5 @@ +<%= include( 'elements/process.html', + 'table' => 'pkg_class', + 'viewall_dir' => 'browse', + ) +%> -- cgit v1.2.1 From 2c757d7db4cb6a7b9655de13206fcc84fb7ce61f Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 14 May 2006 16:47:31 +0000 Subject: first part of ACL and re-skinning work and some other small stuff --- httemplate/edit/process/access_group.html | 5 ++++ httemplate/edit/process/access_user.html | 8 ++++++ httemplate/edit/process/agent_type.cgi | 39 +++++++-------------------- httemplate/edit/process/cust_bill_pay.cgi | 16 ++++++++--- httemplate/edit/process/cust_credit.cgi | 17 +++++++++--- httemplate/edit/process/cust_credit_bill.cgi | 16 ++++++++--- httemplate/edit/process/elements/process.html | 19 +++++++++++-- 7 files changed, 77 insertions(+), 43 deletions(-) create mode 100644 httemplate/edit/process/access_group.html create mode 100644 httemplate/edit/process/access_user.html (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/access_group.html b/httemplate/edit/process/access_group.html new file mode 100644 index 000000000..e8c6d07b1 --- /dev/null +++ b/httemplate/edit/process/access_group.html @@ -0,0 +1,5 @@ +<%= include( 'elements/process.html', + 'table' => 'access_group', + 'viewall_dir' => 'browse', + ) +%> diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html new file mode 100644 index 000000000..a6c2a36b1 --- /dev/null +++ b/httemplate/edit/process/access_user.html @@ -0,0 +1,8 @@ +<%= include( 'elements/process.html', + 'table' => 'access_user', + 'viewall_dir' => 'browse', + 'process_m2m' => { 'link_table' => 'access_usergroup', + 'target_table' => 'access_group', + }, + ) +%> diff --git a/httemplate/edit/process/agent_type.cgi b/httemplate/edit/process/agent_type.cgi index 516594573..fd8ca8833 100755 --- a/httemplate/edit/process/agent_type.cgi +++ b/httemplate/edit/process/agent_type.cgi @@ -11,43 +11,24 @@ my $new = new FS::agent_type ( { my $error; if ( $typenum ) { - $error=$new->replace($old); + $error = $new->replace($old); } else { - $error=$new->insert; - $typenum=$new->getfield('typenum'); + $error = $new->insert; + $typenum = $new->getfield('typenum'); } +#$error ||= $new->process_m2m( ); if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string ); } else { - #false laziness w/ edit/process/part_svc.cgi - foreach my $part_pkg (qsearch('part_pkg',{})) { - my($pkgpart)=$part_pkg->getfield('pkgpart'); - - my($type_pkgs)=qsearchs('type_pkgs',{ - 'typenum' => $typenum, - 'pkgpart' => $pkgpart, - }); - if ( $type_pkgs && ! $cgi->param("pkgpart$pkgpart") ) { - my($d_type_pkgs)=$type_pkgs; #need to save $type_pkgs for below. - $error=$d_type_pkgs->delete; - die $error if $error; - - } elsif ( $cgi->param("pkgpart$pkgpart") - && ! $type_pkgs - ) { - #ok to clobber it now (but bad form nonetheless?) - $type_pkgs=new FS::type_pkgs ({ - 'typenum' => $typenum, - 'pkgpart' => $pkgpart, - }); - $error= $type_pkgs->insert; - die $error if $error; - } - - } + my $error = $new->process_m2m( + 'link_table' => 'type_pkgs', + 'target_table' => 'part_pkg', + 'params' => scalar($cgi->Vars) + ); + die $error if $error; print $cgi->redirect(popurl(3). "browse/agent_type.cgi"); } diff --git a/httemplate/edit/process/cust_bill_pay.cgi b/httemplate/edit/process/cust_bill_pay.cgi index 0025b16b5..fc668bb07 100755 --- a/httemplate/edit/process/cust_bill_pay.cgi +++ b/httemplate/edit/process/cust_bill_pay.cgi @@ -33,11 +33,19 @@ if ($cgi->param('invnum') =~ /^Refund$/) { my $error = $new->insert; if ( $error ) { + $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ); + %><%= $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ) %><% + } else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Payment application sucessful') %> + + + -%> +<% } %> diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index 85bfd4489..6a4ef194a 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -13,14 +13,23 @@ my $error = $new->insert; if ( $error ) { $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ); + + %><%= $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ) %><% + } else { + if ( $cgi->param('apply') eq 'yes' ) { my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) or die "unknown custnum $custnum"; $cust_main->apply_credits; } - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Credit sucessful') %> + + + -%> +<% } %> diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index 28f892f62..3b759536f 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -34,11 +34,19 @@ if ($cgi->param('invnum') =~ /^Refund$/) { my $error = $new->insert; if ( $error ) { + $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ); + %><%= $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ) %><% + } else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} + #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); + + %><%= header('Credit application sucessful') %> + + + -%> +<% } %> diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 83ff6f728..59ad35ee4 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -2,10 +2,21 @@ # options example... # + ### + ##req + ## # 'table' => + # # #? 'primary_key' => #required when the dbdef doesn't know...??? # #? 'fields' => [] + # + ### + ##opt + ### # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + # 'process_m2m' => { 'link_table' => 'link_table_name', + # 'target_table' => 'target_table_name', + # }. my(%opt) = @_; @@ -31,12 +42,16 @@ if ( $pkeyvalue ) { $error = $new->replace($old); } else { - warn $new; $error = $new->insert; - warn $error; $pkeyvalue = $new->getfield($pkey); } + if ( !$error && $opt{'process_m2m'} ) { + $error = $new->process_m2m( %{ $opt{'process_m2m'} }, + 'params' => scalar($cgi->Vars), + ); + } + if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); -- cgit v1.2.1 From c738a3c4923774b64960aa87fa58bd0751487edb Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 18 Jun 2006 12:54:49 +0000 Subject: ACLs: finish group edit (agents + rights) & browse --- httemplate/edit/process/access_group.html | 10 ++++++++++ httemplate/edit/process/elements/process.html | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/access_group.html b/httemplate/edit/process/access_group.html index e8c6d07b1..9bb9d1dda 100644 --- a/httemplate/edit/process/access_group.html +++ b/httemplate/edit/process/access_group.html @@ -1,5 +1,15 @@ <%= include( 'elements/process.html', 'table' => 'access_group', 'viewall_dir' => 'browse', + 'process_m2m' => { 'link_table' => 'access_groupagent', + 'target_table' => 'agent', + }, + 'process_m2name' => { + 'link_table' => 'access_right', + 'link_static' => { 'righttype' => 'FS::access_group', }, + 'num_col' => 'rightobjnum', + 'name_col' => 'rightname', + 'names_list' => [ FS::AccessRight->rights() ], + }, ) %> diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 59ad35ee4..a6e3b50e3 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -16,7 +16,14 @@ # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' # 'process_m2m' => { 'link_table' => 'link_table_name', # 'target_table' => 'target_table_name', - # }. + # }, + # 'process_m2name' => { 'link_table' => 'link_table_name', + # 'link_static' => { 'column' => 'value' }, + # 'num_col' => 'column', #if column name is different in + # #link_table than source_table + # 'name_col' => 'name_column', + # 'names_list' => [ 'list', 'names' ], + # }, my(%opt) = @_; @@ -52,6 +59,12 @@ ); } + if ( !$error && $opt{'process_m2name'} ) { + $error = $new->process_m2name( %{ $opt{'process_m2name'} }, + 'params' => scalar($cgi->Vars), + ); + } + if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); -- cgit v1.2.1 From 1053db7f76169cbbc87840539959a4c362aff242 Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 12 Jul 2006 00:20:23 +0000 Subject: svc_phone service and CDR billing from imported CDRs --- httemplate/edit/process/elements/process.html | 15 ++++++++++++++- httemplate/edit/process/elements/svc_Common.html | 14 ++++++++++++++ httemplate/edit/process/svc_phone.html | 4 ++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 httemplate/edit/process/elements/svc_Common.html create mode 100644 httemplate/edit/process/svc_phone.html (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index a6e3b50e3..7cae78bfc 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -5,6 +5,7 @@ ### ##req ## + # # 'table' => # # #? 'primary_key' => #required when the dbdef doesn't know...??? @@ -13,7 +14,14 @@ ### ##opt ### + # # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + # OR + # 'redirect' => 'view/table.cgi?', # value of primary key is appended + # + # 'edit_ext' => 'html', #defaults to 'html', you might want 'cgi' while the + # #naming is still inconsistent + # # 'process_m2m' => { 'link_table' => 'link_table_name', # 'target_table' => 'target_table_name', # }, @@ -65,9 +73,14 @@ ); } + # XXX print?!?! + if ( $error ) { $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); + my $edit_ext = $opt{'edit_ext'} || 'html'; + print $cgi->redirect(popurl(2). "$table.$edit_ext?". $cgi->query_string ); + } elsif ( $opt{'redirect'} ) { + print $cgi->redirect( $opt{'redirect'}. $pkeyvalue ); } else { print $cgi->redirect( popurl(3). ( $opt{'viewall_dir'} || 'search' ). diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html new file mode 100644 index 000000000..1f8f8315e --- /dev/null +++ b/httemplate/edit/process/elements/svc_Common.html @@ -0,0 +1,14 @@ +<% + + my %opt = @_; + my $table = $opt{'table'}; + $opt{'fields'} ||= [ fields($table) ]; + push @{ $opt{'fields'} }, qw( pkgnum svcpart ); + +%><%= include( 'process.html', + 'edit_ext' => 'cgi', + 'redirect' => popurl(3)."view/$table.cgi?", + %opt, + ) +%> + diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html new file mode 100644 index 000000000..c1d4b7547 --- /dev/null +++ b/httemplate/edit/process/svc_phone.html @@ -0,0 +1,4 @@ +<%= include( 'elements/svc_Common.html', + 'table' => 'svc_phone', + ) +%> -- cgit v1.2.1 From ad18fd616d98b80945b455ca170ba02089723873 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 6 Aug 2006 20:07:13 +0000 Subject: this should fix the barfing about default radius groups on the new customer screen... --- httemplate/edit/process/cust_main.cgi | 2 -- 1 file changed, 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 09a42544c..4ba30c435 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -103,8 +103,6 @@ if ( $new->custnum eq '' ) { 'popnum' => $cgi->param('popnum'), } ); - my $y = $svc_acct->setdefault; # arguably should be in new method - $error ||= $y unless ref($y); #and just in case you were silly $svc_acct->svcpart($svcpart); $svc_acct->username($cgi->param('username')); -- cgit v1.2.1 From 264ad081e68057c7bc30a8b2ad741b783e1342ff Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 10 Aug 2006 11:55:50 +0000 Subject: agent-virtualize advertising sources --- httemplate/edit/process/part_referral.cgi | 28 ---------------------------- httemplate/edit/process/part_referral.html | 5 +++++ 2 files changed, 5 insertions(+), 28 deletions(-) delete mode 100755 httemplate/edit/process/part_referral.cgi create mode 100755 httemplate/edit/process/part_referral.html (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/part_referral.cgi b/httemplate/edit/process/part_referral.cgi deleted file mode 100755 index fd2c01506..000000000 --- a/httemplate/edit/process/part_referral.cgi +++ /dev/null @@ -1,28 +0,0 @@ -<% - -my $refnum = $cgi->param('refnum'); - -my $new = new FS::part_referral ( { - map { - $_, scalar($cgi->param($_)); - } fields('part_referral') -} ); - -my $error; -if ( $refnum ) { - my $old = qsearchs( 'part_referral', { 'refnum' =>$ refnum } ); - die "(Old) Record not found!" unless $old; - $error = $new->replace($old); -} else { - $error = $new->insert; -} -$refnum=$new->refnum; - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "part_referral.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/part_referral.cgi"); -} - -%> diff --git a/httemplate/edit/process/part_referral.html b/httemplate/edit/process/part_referral.html new file mode 100755 index 000000000..0b5d959a0 --- /dev/null +++ b/httemplate/edit/process/part_referral.html @@ -0,0 +1,5 @@ +<%= include( 'elements/process.html', + 'table' => 'part_referral', + 'viewall_dir' => 'browse', + ) +%> -- cgit v1.2.1 From 8e3dfb380406e145494a5fffa7a0e4aab7b38253 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 13 Aug 2006 10:25:58 +0000 Subject: customer view work: DONE 1. add status and balance to top DONE 2. add some sort of oldest date thing so the history doesn't get too big (# years and a link to "show older") 3. make the rest of the action links into js popups? maybe later, weird IENess when closing em DONE (finished) - so revert out or finish/commit the Enter check payment one - Process page can wait until another day.. it should be more of an *action* DONE 4. Ticket list config knobs for wtxs (grid it too) DONE 5. grid the package list --- httemplate/edit/process/cust_pay.cgi | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index 87d6011e7..cecccb59e 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -4,15 +4,16 @@ $cgi->param('linknum') =~ /^(\d+)$/ or die "Illegal linknum: ". $cgi->param('linknum'); my $linknum = $1; -$cgi->param('link') =~ /^(custnum|invnum)$/ +$cgi->param('link') =~ /^(custnum|invnum|popup)$/ or die "Illegal link: ". $cgi->param('link'); -my $link = $1; +my $field = my $link = $1; +$field = 'custnum' if $field eq 'popup'; my $_date = str2time($cgi->param('_date')); my $new = new FS::cust_pay ( { - $link => $linknum, - _date => $_date, + $field => $linknum, + _date => $_date, map { $_, scalar($cgi->param($_)); } qw(paid payby payinfo paybatch) @@ -24,19 +25,30 @@ my $error = $new->insert; if ($error) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string ); -} elsif ( $link eq 'invnum' ) { +} elsif ( $field eq 'invnum' ) { print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum"); -} elsif ( $link eq 'custnum' ) { +} elsif ( $field eq 'custnum' ) { if ( $cgi->param('apply') eq 'yes' ) { my $cust_main = qsearchs('cust_main', { 'custnum' => $linknum }) or die "unknown custnum $linknum"; $cust_main->apply_payments; } - if ( $cgi->param('quickpay') eq 'yes' ) { - print $cgi->redirect(popurl(3). "search/cust_main-quickpay.html"); - } else { + if ( $link eq 'popup' ) { + + %><%= header('Payment entered') %> + + + + <% + + } elsif ( $link eq 'custnum' ) { print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum"); + } else { + die "unknown link $link"; } + } %> -- cgit v1.2.1 From 3ce7691203a7737406bf2d4442f7fd84b81f847e Mon Sep 17 00:00:00 2001 From: ivan Date: Wed, 23 Aug 2006 22:25:39 +0000 Subject: Will things ever be the same again? It's the final masonize --- httemplate/edit/process/REAL_cust_pkg.cgi | 67 ++--- httemplate/edit/process/access_group.html | 2 +- httemplate/edit/process/access_user.html | 2 +- httemplate/edit/process/addr_block/add.cgi | 39 +-- httemplate/edit/process/addr_block/allocate.cgi | 49 ++-- httemplate/edit/process/addr_block/deallocate.cgi | 47 ++-- httemplate/edit/process/addr_block/split.cgi | 37 +-- httemplate/edit/process/agent.cgi | 55 ++-- httemplate/edit/process/agent_payment_gateway.html | 51 ++-- httemplate/edit/process/agent_type.cgi | 71 ++--- httemplate/edit/process/bulk-cust_svc.cgi | 7 +- httemplate/edit/process/cust_bill_pay.cgi | 93 ++++--- httemplate/edit/process/cust_credit.cgi | 61 +++-- httemplate/edit/process/cust_credit_bill.cgi | 95 +++---- httemplate/edit/process/cust_main.cgi | 305 +++++++++++---------- .../edit/process/cust_main_county-collapse.cgi | 69 ++--- .../edit/process/cust_main_county-expand.cgi | 115 ++++---- httemplate/edit/process/cust_main_county.cgi | 59 ++-- httemplate/edit/process/cust_pay.cgi | 98 +++---- httemplate/edit/process/cust_pkg.cgi | 85 +++--- httemplate/edit/process/cust_refund.cgi | 83 +++--- httemplate/edit/process/cust_svc.cgi | 60 ++-- httemplate/edit/process/domain_record.cgi | 64 ++--- httemplate/edit/process/elements/process.html | 181 ++++++------ httemplate/edit/process/elements/svc_Common.html | 17 +- httemplate/edit/process/generic.cgi | 139 +++++----- httemplate/edit/process/inventory_class.html | 2 +- httemplate/edit/process/msgcat.cgi | 39 +-- httemplate/edit/process/part_bill_event.cgi | 105 +++---- httemplate/edit/process/part_export.cgi | 77 +++--- httemplate/edit/process/part_pkg.cgi | 121 ++++---- httemplate/edit/process/part_referral.html | 2 +- httemplate/edit/process/part_svc.cgi | 7 +- httemplate/edit/process/payment_gateway.html | 65 ++--- httemplate/edit/process/pkg_class.html | 2 +- httemplate/edit/process/prepay_credit.cgi | 78 +++--- httemplate/edit/process/quick-charge.cgi | 76 ++--- httemplate/edit/process/quick-cust_pkg.cgi | 44 +-- httemplate/edit/process/rate.cgi | 7 +- httemplate/edit/process/rate_region.cgi | 101 +++---- httemplate/edit/process/reg_code.cgi | 70 ++--- httemplate/edit/process/router.cgi | 133 ++++----- httemplate/edit/process/svc_acct.cgi | 97 +++---- httemplate/edit/process/svc_acct_pop.cgi | 55 ++-- httemplate/edit/process/svc_broadband.cgi | 71 ++--- httemplate/edit/process/svc_domain.cgi | 61 +++-- httemplate/edit/process/svc_external.cgi | 57 ++-- httemplate/edit/process/svc_forward.cgi | 57 ++-- httemplate/edit/process/svc_phone.html | 2 +- httemplate/edit/process/svc_www.cgi | 71 ++--- 50 files changed, 1707 insertions(+), 1644 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/REAL_cust_pkg.cgi b/httemplate/edit/process/REAL_cust_pkg.cgi index 84d0cc129..26e234fb0 100755 --- a/httemplate/edit/process/REAL_cust_pkg.cgi +++ b/httemplate/edit/process/REAL_cust_pkg.cgi @@ -1,34 +1,35 @@ -<% +% +% +%my $pkgnum = $cgi->param('pkgnum') or die; +%my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); +%my %hash = $old->hash; +%$hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : ''; +%$hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : ''; +%$hash{'last_bill'} = +% $cgi->param('last_bill') ? str2time($cgi->param('last_bill')) : ''; +%$hash{'expire'} = $cgi->param('expire') ? str2time($cgi->param('expire')) : ''; +% +%my $new; +%my $error; +%if ( $hash{'bill'} != $old->bill # if the next bill date was changed +% && $hash{'bill'} < time # to a date in the past +% && ! $cgi->param('bill_areyousure') # and it wasn't confirmed +% ) +%{ +% $error = '_bill_areyousure'; +%} else { +% $new = new FS::cust_pkg \%hash; +% $error = $new->replace($old); +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "REAL_cust_pkg.cgi?". $cgi->query_string ); +%} else { +% my $custnum = $new->custnum; +% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum". +% "#cust_pkg$pkgnum" ); +%} +% +% -my $pkgnum = $cgi->param('pkgnum') or die; -my $old = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); -my %hash = $old->hash; -$hash{'setup'} = $cgi->param('setup') ? str2time($cgi->param('setup')) : ''; -$hash{'bill'} = $cgi->param('bill') ? str2time($cgi->param('bill')) : ''; -$hash{'last_bill'} = - $cgi->param('last_bill') ? str2time($cgi->param('last_bill')) : ''; -$hash{'expire'} = $cgi->param('expire') ? str2time($cgi->param('expire')) : ''; - -my $new; -my $error; -if ( $hash{'bill'} != $old->bill # if the next bill date was changed - && $hash{'bill'} < time # to a date in the past - && ! $cgi->param('bill_areyousure') # and it wasn't confirmed - ) -{ - $error = '_bill_areyousure'; -} else { - $new = new FS::cust_pkg \%hash; - $error = $new->replace($old); -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "REAL_cust_pkg.cgi?". $cgi->query_string ); -} else { - my $custnum = $new->custnum; - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum". - "#cust_pkg$pkgnum" ); -} - -%> diff --git a/httemplate/edit/process/access_group.html b/httemplate/edit/process/access_group.html index 9bb9d1dda..c80311586 100644 --- a/httemplate/edit/process/access_group.html +++ b/httemplate/edit/process/access_group.html @@ -1,4 +1,4 @@ -<%= include( 'elements/process.html', +<% include( 'elements/process.html', 'table' => 'access_group', 'viewall_dir' => 'browse', 'process_m2m' => { 'link_table' => 'access_groupagent', diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index a6c2a36b1..78857c525 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -1,4 +1,4 @@ -<%= include( 'elements/process.html', +<% include( 'elements/process.html', 'table' => 'access_user', 'viewall_dir' => 'browse', 'process_m2m' => { 'link_table' => 'access_usergroup', diff --git a/httemplate/edit/process/addr_block/add.cgi b/httemplate/edit/process/addr_block/add.cgi index 34d799ccd..85780c678 100755 --- a/httemplate/edit/process/addr_block/add.cgi +++ b/httemplate/edit/process/addr_block/add.cgi @@ -1,20 +1,21 @@ -<% +% +% +%my $error = ''; +%my $ip_gateway = $cgi->param('ip_gateway'); +%my $ip_netmask = $cgi->param('ip_netmask'); +% +%my $new = new FS::addr_block { +% ip_gateway => $ip_gateway, +% ip_netmask => $ip_netmask, +% routernum => 0 }; +% +%$error = $new->insert; +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); +%} +% -my $error = ''; -my $ip_gateway = $cgi->param('ip_gateway'); -my $ip_netmask = $cgi->param('ip_netmask'); - -my $new = new FS::addr_block { - ip_gateway => $ip_gateway, - ip_netmask => $ip_netmask, - routernum => 0 }; - -$error = $new->insert; - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); -} -%> diff --git a/httemplate/edit/process/addr_block/allocate.cgi b/httemplate/edit/process/addr_block/allocate.cgi index 85b0d7a7a..a94c0320f 100755 --- a/httemplate/edit/process/addr_block/allocate.cgi +++ b/httemplate/edit/process/addr_block/allocate.cgi @@ -1,25 +1,26 @@ -<% -my $error = ''; -my $blocknum = $cgi->param('blocknum'); -my $routernum = $cgi->param('routernum'); +% +%my $error = ''; +%my $blocknum = $cgi->param('blocknum'); +%my $routernum = $cgi->param('routernum'); +% +%my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); +%my $router = qsearchs('router', { routernum => $routernum }); +% +%if($addr_block) { +% if ($router) { +% $error = $addr_block->allocate($router); +% } else { +% $error = "Cannot find router with routernum $routernum"; +% } +%} else { +% $error = "Cannot find block with blocknum $blocknum"; +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(4). "browse/addr_block.cgi?" . $cgi->query_string); +%} else { +% print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); +%} +% -my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); -my $router = qsearchs('router', { routernum => $routernum }); - -if($addr_block) { - if ($router) { - $error = $addr_block->allocate($router); - } else { - $error = "Cannot find router with routernum $routernum"; - } -} else { - $error = "Cannot find block with blocknum $blocknum"; -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(4). "browse/addr_block.cgi?" . $cgi->query_string); -} else { - print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); -} -%> diff --git a/httemplate/edit/process/addr_block/deallocate.cgi b/httemplate/edit/process/addr_block/deallocate.cgi index cfb7ed04d..494c19f75 100755 --- a/httemplate/edit/process/addr_block/deallocate.cgi +++ b/httemplate/edit/process/addr_block/deallocate.cgi @@ -1,24 +1,25 @@ -<% -my $error = ''; -my $blocknum = $cgi->param('blocknum'); +% +%my $error = ''; +%my $blocknum = $cgi->param('blocknum'); +% +%my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); +% +%if($addr_block) { +% my $router = $addr_block->router; +% if ($router) { +% $error = $addr_block->deallocate($router); +% } else { +% $error = "Block is not allocated to a router"; +% } +%} else { +% $error = "Cannot find block with blocknum $blocknum"; +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(4). "browse/addr_block.cgi?" . $cgi->query_string); +%} else { +% print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); +%} +% -my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); - -if($addr_block) { - my $router = $addr_block->router; - if ($router) { - $error = $addr_block->deallocate($router); - } else { - $error = "Block is not allocated to a router"; - } -} else { - $error = "Cannot find block with blocknum $blocknum"; -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(4). "browse/addr_block.cgi?" . $cgi->query_string); -} else { - print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); -} -%> diff --git a/httemplate/edit/process/addr_block/split.cgi b/httemplate/edit/process/addr_block/split.cgi index bb6d4ba3e..617c3f8ce 100755 --- a/httemplate/edit/process/addr_block/split.cgi +++ b/httemplate/edit/process/addr_block/split.cgi @@ -1,19 +1,20 @@ -<% -my $error = ''; -my $blocknum = $cgi->param('blocknum'); -my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); +% +%my $error = ''; +%my $blocknum = $cgi->param('blocknum'); +%my $addr_block = qsearchs('addr_block', { blocknum => $blocknum }); +% +%if ( $addr_block) { +% $error = $addr_block->split_block; +%} else { +% $error = "Unknown blocknum: $blocknum"; +%} +% +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); +%} +% -if ( $addr_block) { - $error = $addr_block->split_block; -} else { - $error = "Unknown blocknum: $blocknum"; -} - - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(4). "browse/addr_block.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(4). "browse/addr_block.cgi"); -} -%> diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi index 182eeab41..5128d7ae8 100755 --- a/httemplate/edit/process/agent.cgi +++ b/httemplate/edit/process/agent.cgi @@ -1,28 +1,29 @@ -<% +% +% +%my $agentnum = $cgi->param('agentnum'); +% +%my $old = qsearchs('agent',{'agentnum'=>$agentnum}) if $agentnum; +% +%my $new = new FS::agent ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('agent') +%} ); +% +%my $error; +%if ( $agentnum ) { +% $error=$new->replace($old); +%} else { +% $error=$new->insert; +% $agentnum=$new->getfield('agentnum'); +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "browse/agent.cgi"); +%} +% +% -my $agentnum = $cgi->param('agentnum'); - -my $old = qsearchs('agent',{'agentnum'=>$agentnum}) if $agentnum; - -my $new = new FS::agent ( { - map { - $_, scalar($cgi->param($_)); - } fields('agent') -} ); - -my $error; -if ( $agentnum ) { - $error=$new->replace($old); -} else { - $error=$new->insert; - $agentnum=$new->getfield('agentnum'); -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/agent.cgi"); -} - -%> diff --git a/httemplate/edit/process/agent_payment_gateway.html b/httemplate/edit/process/agent_payment_gateway.html index c306bfa3f..436317ec4 100644 --- a/httemplate/edit/process/agent_payment_gateway.html +++ b/httemplate/edit/process/agent_payment_gateway.html @@ -1,25 +1,26 @@ -<% - -$cgi->param('agentnum') =~ /(\d+)$/ or die "illegal agentnum"; -my $agent = qsearchs('agent', { 'agentnum' => $1 } ); -die "agentnum $1 not found" unless $agent; - -#my $old - -my @new = map { - my $cardtype = $_; - new FS::agent_payment_gateway { - ( map { $_ => scalar($cgi->param($_)) } - fields('agent_payment_gateway') - ), - 'cardtype' => $cardtype, - }; - } - $cgi->param('cardtype'); - -foreach my $new (@new) { - my $error = $new->insert; - die $error if $error; -} - -%><%= $cgi->redirect(popurl(3). "browse/agent.cgi") %> +% +% +%$cgi->param('agentnum') =~ /(\d+)$/ or die "illegal agentnum"; +%my $agent = qsearchs('agent', { 'agentnum' => $1 } ); +%die "agentnum $1 not found" unless $agent; +% +%#my $old +% +%my @new = map { +% my $cardtype = $_; +% new FS::agent_payment_gateway { +% ( map { $_ => scalar($cgi->param($_)) } +% fields('agent_payment_gateway') +% ), +% 'cardtype' => $cardtype, +% }; +% } +% $cgi->param('cardtype'); +% +%foreach my $new (@new) { +% my $error = $new->insert; +% die $error if $error; +%} +% +% +<% $cgi->redirect(popurl(3). "browse/agent.cgi") %> diff --git a/httemplate/edit/process/agent_type.cgi b/httemplate/edit/process/agent_type.cgi index fd8ca8833..b8d03705c 100755 --- a/httemplate/edit/process/agent_type.cgi +++ b/httemplate/edit/process/agent_type.cgi @@ -1,36 +1,37 @@ -<% +% +% +%my $typenum = $cgi->param('typenum'); +%my $old = qsearchs('agent_type',{'typenum'=>$typenum}) if $typenum; +% +%my $new = new FS::agent_type ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('agent_type') +%} ); +% +%my $error; +%if ( $typenum ) { +% $error = $new->replace($old); +%} else { +% $error = $new->insert; +% $typenum = $new->getfield('typenum'); +%} +%#$error ||= $new->process_m2m( ); +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string ); +%} else { +% +% my $error = $new->process_m2m( +% 'link_table' => 'type_pkgs', +% 'target_table' => 'part_pkg', +% 'params' => scalar($cgi->Vars) +% ); +% die $error if $error; +% +% print $cgi->redirect(popurl(3). "browse/agent_type.cgi"); +%} +% +% -my $typenum = $cgi->param('typenum'); -my $old = qsearchs('agent_type',{'typenum'=>$typenum}) if $typenum; - -my $new = new FS::agent_type ( { - map { - $_, scalar($cgi->param($_)); - } fields('agent_type') -} ); - -my $error; -if ( $typenum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $typenum = $new->getfield('typenum'); -} -#$error ||= $new->process_m2m( ); - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "agent_type.cgi?". $cgi->query_string ); -} else { - - my $error = $new->process_m2m( - 'link_table' => 'type_pkgs', - 'target_table' => 'part_pkg', - 'params' => scalar($cgi->Vars) - ); - die $error if $error; - - print $cgi->redirect(popurl(3). "browse/agent_type.cgi"); -} - -%> diff --git a/httemplate/edit/process/bulk-cust_svc.cgi b/httemplate/edit/process/bulk-cust_svc.cgi index dd9d1dbd2..ad4d67307 100644 --- a/httemplate/edit/process/bulk-cust_svc.cgi +++ b/httemplate/edit/process/bulk-cust_svc.cgi @@ -1,3 +1,4 @@ -<% - my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process_bulk_cust_svc', $cgi; -%><%= $server->process %> +% +% my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process_bulk_cust_svc', $cgi; +% +<% $server->process %> diff --git a/httemplate/edit/process/cust_bill_pay.cgi b/httemplate/edit/process/cust_bill_pay.cgi index fc668bb07..962fc4eb9 100755 --- a/httemplate/edit/process/cust_bill_pay.cgi +++ b/httemplate/edit/process/cust_bill_pay.cgi @@ -1,51 +1,54 @@ -<% - -$cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; -my $paynum = $1; - -my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ) - or die "No such paynum"; - -my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pay->custnum } ) - or die "Bogus credit: not attached to customer"; - -my $custnum = $cust_main->custnum; - -my $new; -if ($cgi->param('invnum') =~ /^Refund$/) { - $new = new FS::cust_refund ( { - 'reason' => 'Refunding payment', #enter reason in UI - 'refund' => $cgi->param('amount'), - 'payby' => 'BILL', - #'_date' => $cgi->param('_date'), - 'payinfo' => 'Cash', #enter payinfo in UI - 'paynum' => $paynum, - } ); -} else { - $new = new FS::cust_bill_pay ( { - map { - $_, scalar($cgi->param($_)); - #} qw(custnum _date amount invnum) - } fields('cust_bill_pay') - } ); -} - -my $error = $new->insert; - -if ( $error ) { - - $cgi->param('error', $error); - %><%= $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ) %><% - -} else { - - #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); - - %><%= header('Payment application sucessful') %> +% +% +%$cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; +%my $paynum = $1; +% +%my $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } ) +% or die "No such paynum"; +% +%my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_pay->custnum } ) +% or die "Bogus credit: not attached to customer"; +% +%my $custnum = $cust_main->custnum; +% +%my $new; +%if ($cgi->param('invnum') =~ /^Refund$/) { +% $new = new FS::cust_refund ( { +% 'reason' => 'Refunding payment', #enter reason in UI +% 'refund' => $cgi->param('amount'), +% 'payby' => 'BILL', +% #'_date' => $cgi->param('_date'), +% 'payinfo' => 'Cash', #enter payinfo in UI +% 'paynum' => $paynum, +% } ); +%} else { +% $new = new FS::cust_bill_pay ( { +% map { +% $_, scalar($cgi->param($_)); +% #} qw(custnum _date amount invnum) +% } fields('cust_bill_pay') +% } ); +%} +% +%my $error = $new->insert; +% +%if ( $error ) { +% +% $cgi->param('error', $error); +% +<% $cgi->redirect(popurl(2). "cust_bill_pay.cgi?". $cgi->query_string ) %> +% +% +%} else { +% +% #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +% +% +<% header('Payment application sucessful') %> +% } -<% } %> diff --git a/httemplate/edit/process/cust_credit.cgi b/httemplate/edit/process/cust_credit.cgi index 6a4ef194a..19faca47a 100755 --- a/httemplate/edit/process/cust_credit.cgi +++ b/httemplate/edit/process/cust_credit.cgi @@ -1,35 +1,38 @@ -<% - -$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; -my $custnum = $1; - -my $new = new FS::cust_credit ( { - map { - $_, scalar($cgi->param($_)); - } fields('cust_credit') -} ); - -my $error = $new->insert; - -if ( $error ) { - $cgi->param('error', $error); - - %><%= $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ) %><% - -} else { - - if ( $cgi->param('apply') eq 'yes' ) { - my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) - or die "unknown custnum $custnum"; - $cust_main->apply_credits; - } - #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); - - %><%= header('Credit sucessful') %> +% +% +%$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; +%my $custnum = $1; +% +%my $new = new FS::cust_credit ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('cust_credit') +%} ); +% +%my $error = $new->insert; +% +%if ( $error ) { +% $cgi->param('error', $error); +% +% +<% $cgi->redirect(popurl(2). "cust_credit.cgi?". $cgi->query_string ) %> +% +% +%} else { +% +% if ( $cgi->param('apply') eq 'yes' ) { +% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum }) +% or die "unknown custnum $custnum"; +% $cust_main->apply_credits; +% } +% #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +% +% +<% header('Credit sucessful') %> +% } -<% } %> diff --git a/httemplate/edit/process/cust_credit_bill.cgi b/httemplate/edit/process/cust_credit_bill.cgi index 3b759536f..7509a3f02 100755 --- a/httemplate/edit/process/cust_credit_bill.cgi +++ b/httemplate/edit/process/cust_credit_bill.cgi @@ -1,52 +1,55 @@ -<% - -$cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!"; -my $crednum = $1; - -my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ) - or die "No such crednum"; - -my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_credit->custnum } ) - or die "Bogus credit: not attached to customer"; - -my $custnum = $cust_main->custnum; - -my $new; -if ($cgi->param('invnum') =~ /^Refund$/) { - $new = new FS::cust_refund ( { - 'reason' => ( $cust_credit->reason || 'refund from credit' ), - 'refund' => $cgi->param('amount'), - 'payby' => 'BILL', - #'_date' => $cgi->param('_date'), - #'payinfo' => 'Cash', - 'payinfo' => 'Refund', - 'crednum' => $crednum, - } ); -} else { - $new = new FS::cust_credit_bill ( { - map { - $_, scalar($cgi->param($_)); - #} qw(custnum _date amount invnum) - } fields('cust_credit_bill') - } ); -} - -my $error = $new->insert; - -if ( $error ) { - - $cgi->param('error', $error); - %><%= $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ) %><% - -} else { - - #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); - - %><%= header('Credit application sucessful') %> +% +% +%$cgi->param('crednum') =~ /^(\d*)$/ or die "Illegal crednum!"; +%my $crednum = $1; +% +%my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } ) +% or die "No such crednum"; +% +%my $cust_main = qsearchs('cust_main', { 'custnum' => $cust_credit->custnum } ) +% or die "Bogus credit: not attached to customer"; +% +%my $custnum = $cust_main->custnum; +% +%my $new; +%if ($cgi->param('invnum') =~ /^Refund$/) { +% $new = new FS::cust_refund ( { +% 'reason' => ( $cust_credit->reason || 'refund from credit' ), +% 'refund' => $cgi->param('amount'), +% 'payby' => 'BILL', +% #'_date' => $cgi->param('_date'), +% #'payinfo' => 'Cash', +% 'payinfo' => 'Refund', +% 'crednum' => $crednum, +% } ); +%} else { +% $new = new FS::cust_credit_bill ( { +% map { +% $_, scalar($cgi->param($_)); +% #} qw(custnum _date amount invnum) +% } fields('cust_credit_bill') +% } ); +%} +% +%my $error = $new->insert; +% +%if ( $error ) { +% +% $cgi->param('error', $error); +% +<% $cgi->redirect(popurl(2). "cust_credit_bill.cgi?". $cgi->query_string ) %> +% +% +%} else { +% +% #print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +% +% +<% header('Credit application sucessful') %> +% } -<% } %> diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 4ba30c435..2d698c7b0 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -1,153 +1,154 @@ -<% +% +% +%my $error = ''; +% +%#unmunge stuff +% +%$cgi->param('tax','') unless defined $cgi->param('tax'); +% +%$cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); +% +%#my $payby = $cgi->param('payby'); +%my $payby = $cgi->param('select'); # XXX key +% +%my %noauto = ( +% 'CARD' => 'DCRD', +% 'CHEK' => 'DCHK', +%); +%$payby = $noauto{$payby} +% if ! $cgi->param('payauto') && exists $noauto{$payby}; +% +%$cgi->param('payby', $payby); +% +%if ( $payby ) { +% if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) { +% $cgi->param('payinfo', +% $cgi->param('payinfo1'). '@'. $cgi->param('payinfo2') ); +% } +% $cgi->param('paydate', +% $cgi->param( 'exp_month' ). '-'. $cgi->param( 'exp_year' ) ); +%} +% +%my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); +%push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); +%push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX'); +%$cgi->param('invoicing_list', join(',', @invoicing_list) ); +% +% +%#create new record object +% +%my $new = new FS::cust_main ( { +% map { +% $_, scalar($cgi->param($_)) +%# } qw(custnum agentnum last first ss company address1 address2 city county +%# state zip daytime night fax payby payinfo paydate payname tax +%# otaker refnum) +% } fields('cust_main') +%} ); +% +%if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { +% $new->setfield("ship_$_", '') foreach qw( +% last first company address1 address2 city county state zip +% country daytime night fax +% ); +%} +% +%$new->setfield('paid', $cgi->param('paid') ) +% if $cgi->param('paid'); +% +%#perhaps this stuff should go to cust_main.pm +%my $cust_pkg = ''; +%my $svc_acct = ''; +%if ( $new->custnum eq '' ) { +% +% if ( $cgi->param('pkgpart_svcpart') ) { +% my $x = $cgi->param('pkgpart_svcpart'); +% $x =~ /^(\d+)_(\d+)$/ or die "illegal pkgpart_svcpart $x\n"; +% my($pkgpart, $svcpart) = ($1, $2); +% #false laziness: copied from FS::cust_pkg::order (which should become a +% #FS::cust_main method) +% my(%part_pkg); +% # generate %part_pkg +% # $part_pkg{$pkgpart} is true iff $custnum may purchase $pkgpart +% my $agent = qsearchs('agent',{'agentnum'=> $new->agentnum }); +% #my($type_pkgs); +% #foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { +% # my($pkgpart)=$type_pkgs->pkgpart; +% # $part_pkg{$pkgpart}++; +% #} +% # $pkgpart_href->{PKGPART} is true iff $custnum may purchase $pkgpart +% my $pkgpart_href = $agent->pkgpart_hashref; +% #eslaf +% +% # this should wind up in FS::cust_pkg! +% $error ||= "Agent ". $new->agentnum. " (type ". $agent->typenum. ") can't ". +% "purchase pkgpart ". $pkgpart +% #unless $part_pkg{ $pkgpart }; +% unless $pkgpart_href->{ $pkgpart }; +% +% $cust_pkg = new FS::cust_pkg ( { +% #later 'custnum' => $custnum, +% 'pkgpart' => $pkgpart, +% } ); +% #$error ||= $cust_pkg->check; +% +% #$cust_svc = new FS::cust_svc ( { 'svcpart' => $svcpart } ); +% +% #$error ||= $cust_svc->check; +% +% $svc_acct = new FS::svc_acct ( { +% 'svcpart' => $svcpart, +% 'username' => $cgi->param('username'), +% '_password' => $cgi->param('_password'), +% 'popnum' => $cgi->param('popnum'), +% } ); +% +% #and just in case you were silly +% $svc_acct->svcpart($svcpart); +% $svc_acct->username($cgi->param('username')); +% $svc_acct->_password($cgi->param('_password')); +% $svc_acct->popnum($cgi->param('popnum')); +% +% #$error ||= $svc_acct->check; +% +% } elsif ( $cgi->param('username') ) { #good thing to catch +% $error = "Can't assign username without a package!"; +% } +% +% use Tie::RefHash; +% tie my %hash, 'Tie::RefHash'; +% %hash = ( $cust_pkg => [ $svc_acct ] ) if $cust_pkg; +% $error ||= $new->insert( \%hash, \@invoicing_list ); +% +% my $conf = new FS::Conf; +% if ( $conf->exists('backend-realtime') && ! $error ) { +% +% my $berror = $new->bill; +% $new->apply_payments; +% $new->apply_credits; +% $berror ||= $new->collect; +% warn "Warning, error billing during backend-realtime: $berror" if $berror; +% +% } +% +%} else { #create old record object +% +% my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } ); +% $error ||= "Old record not found!" unless $old; +% if ( defined dbdef->table('cust_main')->column('paycvv') +% && length($old->paycvv) +% && $new->paycvv =~ /^\s*\*+\s*$/ ) { +% $new->paycvv($old->paycvv); +% } +% $error ||= $new->replace($old, \@invoicing_list); +% +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "cust_main.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/cust_main.cgi?". $new->custnum); +%} +% -my $error = ''; - -#unmunge stuff - -$cgi->param('tax','') unless defined $cgi->param('tax'); - -$cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); - -#my $payby = $cgi->param('payby'); -my $payby = $cgi->param('select'); # XXX key - -my %noauto = ( - 'CARD' => 'DCRD', - 'CHEK' => 'DCHK', -); -$payby = $noauto{$payby} - if ! $cgi->param('payauto') && exists $noauto{$payby}; - -$cgi->param('payby', $payby); - -if ( $payby ) { - if ( $payby eq 'CHEK' || $payby eq 'DCHK' ) { - $cgi->param('payinfo', - $cgi->param('payinfo1'). '@'. $cgi->param('payinfo2') ); - } - $cgi->param('paydate', - $cgi->param( 'exp_month' ). '-'. $cgi->param( 'exp_year' ) ); -} - -my @invoicing_list = split( /\s*\,\s*/, $cgi->param('invoicing_list') ); -push @invoicing_list, 'POST' if $cgi->param('invoicing_list_POST'); -push @invoicing_list, 'FAX' if $cgi->param('invoicing_list_FAX'); -$cgi->param('invoicing_list', join(',', @invoicing_list) ); - - -#create new record object - -my $new = new FS::cust_main ( { - map { - $_, scalar($cgi->param($_)) -# } qw(custnum agentnum last first ss company address1 address2 city county -# state zip daytime night fax payby payinfo paydate payname tax -# otaker refnum) - } fields('cust_main') -} ); - -if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { - $new->setfield("ship_$_", '') foreach qw( - last first company address1 address2 city county state zip - country daytime night fax - ); -} - -$new->setfield('paid', $cgi->param('paid') ) - if $cgi->param('paid'); - -#perhaps this stuff should go to cust_main.pm -my $cust_pkg = ''; -my $svc_acct = ''; -if ( $new->custnum eq '' ) { - - if ( $cgi->param('pkgpart_svcpart') ) { - my $x = $cgi->param('pkgpart_svcpart'); - $x =~ /^(\d+)_(\d+)$/ or die "illegal pkgpart_svcpart $x\n"; - my($pkgpart, $svcpart) = ($1, $2); - #false laziness: copied from FS::cust_pkg::order (which should become a - #FS::cust_main method) - my(%part_pkg); - # generate %part_pkg - # $part_pkg{$pkgpart} is true iff $custnum may purchase $pkgpart - my $agent = qsearchs('agent',{'agentnum'=> $new->agentnum }); - #my($type_pkgs); - #foreach $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { - # my($pkgpart)=$type_pkgs->pkgpart; - # $part_pkg{$pkgpart}++; - #} - # $pkgpart_href->{PKGPART} is true iff $custnum may purchase $pkgpart - my $pkgpart_href = $agent->pkgpart_hashref; - #eslaf - - # this should wind up in FS::cust_pkg! - $error ||= "Agent ". $new->agentnum. " (type ". $agent->typenum. ") can't ". - "purchase pkgpart ". $pkgpart - #unless $part_pkg{ $pkgpart }; - unless $pkgpart_href->{ $pkgpart }; - - $cust_pkg = new FS::cust_pkg ( { - #later 'custnum' => $custnum, - 'pkgpart' => $pkgpart, - } ); - #$error ||= $cust_pkg->check; - - #$cust_svc = new FS::cust_svc ( { 'svcpart' => $svcpart } ); - - #$error ||= $cust_svc->check; - - $svc_acct = new FS::svc_acct ( { - 'svcpart' => $svcpart, - 'username' => $cgi->param('username'), - '_password' => $cgi->param('_password'), - 'popnum' => $cgi->param('popnum'), - } ); - - #and just in case you were silly - $svc_acct->svcpart($svcpart); - $svc_acct->username($cgi->param('username')); - $svc_acct->_password($cgi->param('_password')); - $svc_acct->popnum($cgi->param('popnum')); - - #$error ||= $svc_acct->check; - - } elsif ( $cgi->param('username') ) { #good thing to catch - $error = "Can't assign username without a package!"; - } - - use Tie::RefHash; - tie my %hash, 'Tie::RefHash'; - %hash = ( $cust_pkg => [ $svc_acct ] ) if $cust_pkg; - $error ||= $new->insert( \%hash, \@invoicing_list ); - - my $conf = new FS::Conf; - if ( $conf->exists('backend-realtime') && ! $error ) { - - my $berror = $new->bill; - $new->apply_payments; - $new->apply_credits; - $berror ||= $new->collect; - warn "Warning, error billing during backend-realtime: $berror" if $berror; - - } - -} else { #create old record object - - my $old = qsearchs( 'cust_main', { 'custnum' => $new->custnum } ); - $error ||= "Old record not found!" unless $old; - if ( defined dbdef->table('cust_main')->column('paycvv') - && length($old->paycvv) - && $new->paycvv =~ /^\s*\*+\s*$/ ) { - $new->paycvv($old->paycvv); - } - $error ||= $new->replace($old, \@invoicing_list); - -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_main.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?". $new->custnum); -} -%> diff --git a/httemplate/edit/process/cust_main_county-collapse.cgi b/httemplate/edit/process/cust_main_county-collapse.cgi index 5da9dea80..4bcaf1de3 100755 --- a/httemplate/edit/process/cust_main_county-collapse.cgi +++ b/httemplate/edit/process/cust_main_county-collapse.cgi @@ -1,35 +1,36 @@ -<% +% +% +%my($query) = $cgi->keywords; +%$query =~ /^(\d+)$/ or die "Illegal taxnum!"; +%my $taxnum = $1; +%my $cust_main_county = qsearchs('cust_main_county', { 'taxnum' => $taxnum } ) +% or die "Unknown taxnum $taxnum"; +% +%#really should do this in a .pm & start transaction +% +%foreach my $delete ( qsearch('cust_main_county', { +% 'country' => $cust_main_county->country, +% 'state' => $cust_main_county->state +% } ) ) { +%# unless ( qsearch('cust_main',{ +%# 'state' => $cust_main_county->getfield('state'), +%# 'county' => $cust_main_county->getfield('county'), +%# 'country' => $cust_main_county->getfield('country'), +%# } ) ) { +% my $error = $delete->delete; +% die $error if $error; +%# } else { +% #should really fix the $cust_main record +%# } +% +%} +% +%$cust_main_county->taxnum(''); +%$cust_main_county->county(''); +%my $error = $cust_main_county->insert; +%die $error if $error; +% +%print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); +% +% -my($query) = $cgi->keywords; -$query =~ /^(\d+)$/ or die "Illegal taxnum!"; -my $taxnum = $1; -my $cust_main_county = qsearchs('cust_main_county', { 'taxnum' => $taxnum } ) - or die "Unknown taxnum $taxnum"; - -#really should do this in a .pm & start transaction - -foreach my $delete ( qsearch('cust_main_county', { - 'country' => $cust_main_county->country, - 'state' => $cust_main_county->state - } ) ) { -# unless ( qsearch('cust_main',{ -# 'state' => $cust_main_county->getfield('state'), -# 'county' => $cust_main_county->getfield('county'), -# 'country' => $cust_main_county->getfield('country'), -# } ) ) { - my $error = $delete->delete; - die $error if $error; -# } else { - #should really fix the $cust_main record -# } - -} - -$cust_main_county->taxnum(''); -$cust_main_county->county(''); -my $error = $cust_main_county->insert; -die $error if $error; - -print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); - -%> diff --git a/httemplate/edit/process/cust_main_county-expand.cgi b/httemplate/edit/process/cust_main_county-expand.cgi index a452711c1..e550e8b4a 100755 --- a/httemplate/edit/process/cust_main_county-expand.cgi +++ b/httemplate/edit/process/cust_main_county-expand.cgi @@ -1,58 +1,59 @@ -<% +% +% +%$cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!"; +%my $taxnum = $1; +%my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) +% or die ("Unknown taxnum!"); +% +%my @expansion; +%if ( $cgi->param('delim') eq 'n' ) { +% @expansion=split(/\n/,$cgi->param('expansion')); +%} elsif ( $cgi->param('delim') eq 's' ) { +% @expansion=split(' ',$cgi->param('expansion')); +%} else { +% die "Illegal delim!"; +%} +% +%@expansion=map { +% unless ( /^\s*([\w\- ]+)\s*$/ ) { +% $cgi->param('error', "Illegal item in expansion"); +% print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string ); +% myexit(); +% } +% $1; +%} @expansion; +% +%foreach ( @expansion) { +% my(%hash)=$cust_main_county->hash; +% my($new)=new FS::cust_main_county \%hash; +% $new->setfield('taxnum',''); +% if ( $cgi->param('taxclass') ) { +% $new->setfield('taxclass', $_); +% } elsif ( ! $cust_main_county->state ) { +% $new->setfield('state',$_); +% } else { +% $new->setfield('county',$_); +% } +% #if (datasrc =~ m/Pg/) +% #{ +% # $new->setfield('tax',0.0); +% #} +% my($error)=$new->insert; +% die $error if $error; +%} +% +%unless ( qsearch( 'cust_main', { +% 'state' => $cust_main_county->state, +% 'county' => $cust_main_county->county, +% 'country' => $cust_main_county->country, +% } ) +% || ! @expansion +%) { +% my($error)=($cust_main_county->delete); +% die $error if $error; +%} +% +%print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); +% +% -$cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!"; -my $taxnum = $1; -my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum}) - or die ("Unknown taxnum!"); - -my @expansion; -if ( $cgi->param('delim') eq 'n' ) { - @expansion=split(/\n/,$cgi->param('expansion')); -} elsif ( $cgi->param('delim') eq 's' ) { - @expansion=split(' ',$cgi->param('expansion')); -} else { - die "Illegal delim!"; -} - -@expansion=map { - unless ( /^\s*([\w\- ]+)\s*$/ ) { - $cgi->param('error', "Illegal item in expansion"); - print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string ); - myexit(); - } - $1; -} @expansion; - -foreach ( @expansion) { - my(%hash)=$cust_main_county->hash; - my($new)=new FS::cust_main_county \%hash; - $new->setfield('taxnum',''); - if ( $cgi->param('taxclass') ) { - $new->setfield('taxclass', $_); - } elsif ( ! $cust_main_county->state ) { - $new->setfield('state',$_); - } else { - $new->setfield('county',$_); - } - #if (datasrc =~ m/Pg/) - #{ - # $new->setfield('tax',0.0); - #} - my($error)=$new->insert; - die $error if $error; -} - -unless ( qsearch( 'cust_main', { - 'state' => $cust_main_county->state, - 'county' => $cust_main_county->county, - 'country' => $cust_main_county->country, - } ) - || ! @expansion -) { - my($error)=($cust_main_county->delete); - die $error if $error; -} - -print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); - -%> diff --git a/httemplate/edit/process/cust_main_county.cgi b/httemplate/edit/process/cust_main_county.cgi index 9287ed150..2c3ebe866 100755 --- a/httemplate/edit/process/cust_main_county.cgi +++ b/httemplate/edit/process/cust_main_county.cgi @@ -1,30 +1,31 @@ -<% +% +% +%foreach ( grep { /^tax\d+$/ } $cgi->param ) { +% /^tax(\d+)$/ or die "Illegal form $_!"; +% my $taxnum = $1; +% my $old = qsearchs('cust_main_county', { 'taxnum' => $taxnum }) +% or die "Couldn't find taxnum $taxnum!"; +% next unless $old->tax != $cgi->param("tax$taxnum") +% || $old->exempt_amount != $cgi->param("exempt_amount$taxnum") +% || $old->taxname ne $cgi->param("taxname$taxnum") +% || $old->setuptax ne $cgi->param("setuptax$taxnum") +% || $old->recurtax ne $cgi->param("recurtax$taxnum"); +% my %hash = $old->hash; +% $hash{tax} = $cgi->param("tax$taxnum"); +% $hash{exempt_amount} = $cgi->param("exempt_amount$taxnum"); +% $hash{taxname} = $cgi->param("taxname$taxnum"); +% $hash{setuptax} = $cgi->param("setuptax$taxnum"); +% $hash{recurtax} = $cgi->param("recurtax$taxnum"); +% my $new = new FS::cust_main_county \%hash; +% my $error = $new->replace($old); +% if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "cust_main_county.cgi?". $cgi->query_string ); +% myexit(); +% } +%} +% +%print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); +% +% -foreach ( grep { /^tax\d+$/ } $cgi->param ) { - /^tax(\d+)$/ or die "Illegal form $_!"; - my $taxnum = $1; - my $old = qsearchs('cust_main_county', { 'taxnum' => $taxnum }) - or die "Couldn't find taxnum $taxnum!"; - next unless $old->tax != $cgi->param("tax$taxnum") - || $old->exempt_amount != $cgi->param("exempt_amount$taxnum") - || $old->taxname ne $cgi->param("taxname$taxnum") - || $old->setuptax ne $cgi->param("setuptax$taxnum") - || $old->recurtax ne $cgi->param("recurtax$taxnum"); - my %hash = $old->hash; - $hash{tax} = $cgi->param("tax$taxnum"); - $hash{exempt_amount} = $cgi->param("exempt_amount$taxnum"); - $hash{taxname} = $cgi->param("taxname$taxnum"); - $hash{setuptax} = $cgi->param("setuptax$taxnum"); - $hash{recurtax} = $cgi->param("recurtax$taxnum"); - my $new = new FS::cust_main_county \%hash; - my $error = $new->replace($old); - if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_main_county.cgi?". $cgi->query_string ); - myexit(); - } -} - -print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi"); - -%> diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index cecccb59e..68342ee04 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -1,54 +1,56 @@ -<% - -$cgi->param('linknum') =~ /^(\d+)$/ - or die "Illegal linknum: ". $cgi->param('linknum'); -my $linknum = $1; - -$cgi->param('link') =~ /^(custnum|invnum|popup)$/ - or die "Illegal link: ". $cgi->param('link'); -my $field = my $link = $1; -$field = 'custnum' if $field eq 'popup'; - -my $_date = str2time($cgi->param('_date')); - -my $new = new FS::cust_pay ( { - $field => $linknum, - _date => $_date, - map { - $_, scalar($cgi->param($_)); - } qw(paid payby payinfo paybatch) - #} fields('cust_pay') -} ); - -my $error = $new->insert; - -if ($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string ); -} elsif ( $field eq 'invnum' ) { - print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum"); -} elsif ( $field eq 'custnum' ) { - if ( $cgi->param('apply') eq 'yes' ) { - my $cust_main = qsearchs('cust_main', { 'custnum' => $linknum }) - or die "unknown custnum $linknum"; - $cust_main->apply_payments; - } - if ( $link eq 'popup' ) { - - %><%= header('Payment entered') %> +% +% +%$cgi->param('linknum') =~ /^(\d+)$/ +% or die "Illegal linknum: ". $cgi->param('linknum'); +%my $linknum = $1; +% +%$cgi->param('link') =~ /^(custnum|invnum|popup)$/ +% or die "Illegal link: ". $cgi->param('link'); +%my $field = my $link = $1; +%$field = 'custnum' if $field eq 'popup'; +% +%my $_date = str2time($cgi->param('_date')); +% +%my $new = new FS::cust_pay ( { +% $field => $linknum, +% _date => $_date, +% map { +% $_, scalar($cgi->param($_)); +% } qw(paid payby payinfo paybatch) +% #} fields('cust_pay') +%} ); +% +%my $error = $new->insert; +% +%if ($error) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). 'cust_pay.cgi?'. $cgi->query_string ); +%} elsif ( $field eq 'invnum' ) { +% print $cgi->redirect(popurl(3). "view/cust_bill.cgi?$linknum"); +%} elsif ( $field eq 'custnum' ) { +% if ( $cgi->param('apply') eq 'yes' ) { +% my $cust_main = qsearchs('cust_main', { 'custnum' => $linknum }) +% or die "unknown custnum $linknum"; +% $cust_main->apply_payments; +% } +% if ( $link eq 'popup' ) { +% +% +<% header('Payment entered') %> - <% - - } elsif ( $link eq 'custnum' ) { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum"); - } else { - die "unknown link $link"; - } - -} +% +% +% } elsif ( $link eq 'custnum' ) { +% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$linknum"); +% } else { +% die "unknown link $link"; +% } +% +%} +% +% -%> diff --git a/httemplate/edit/process/cust_pkg.cgi b/httemplate/edit/process/cust_pkg.cgi index df8471c27..817c88087 100755 --- a/httemplate/edit/process/cust_pkg.cgi +++ b/httemplate/edit/process/cust_pkg.cgi @@ -1,43 +1,44 @@ -<% +% +% +%my $error = ''; +% +%#untaint custnum +%$cgi->param('custnum') =~ /^(\d+)$/; +%my $custnum = $1; +% +%my @remove_pkgnums = map { +% /^(\d+)$/ or die "Illegal remove_pkg value!"; +% $1; +%} $cgi->param('remove_pkg'); +% +%my $error_redirect; +%my @pkgparts; +%if ( $cgi->param('new_pkgpart') =~ /^(\d+)$/ ) { #came from misc/change_pkg.cgi +% $error_redirect = "misc/change_pkg.cgi"; +% @pkgparts = ($1); +%} else { #came from edit/cust_pkg.cgi +% $error_redirect = "edit/cust_pkg.cgi"; +% foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { +% if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) { +% my $num_pkgs = $1; +% while ( $num_pkgs-- ) { +% push @pkgparts,$pkgpart; +% } +% } else { +% $error = "Illegal quantity"; +% last; +% } +% } +%} +% +%$error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums); +% +%if ($error) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(3). $error_redirect. '?'. $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +%} +% +% -my $error = ''; - -#untaint custnum -$cgi->param('custnum') =~ /^(\d+)$/; -my $custnum = $1; - -my @remove_pkgnums = map { - /^(\d+)$/ or die "Illegal remove_pkg value!"; - $1; -} $cgi->param('remove_pkg'); - -my $error_redirect; -my @pkgparts; -if ( $cgi->param('new_pkgpart') =~ /^(\d+)$/ ) { #came from misc/change_pkg.cgi - $error_redirect = "misc/change_pkg.cgi"; - @pkgparts = ($1); -} else { #came from edit/cust_pkg.cgi - $error_redirect = "edit/cust_pkg.cgi"; - foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) { - if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) { - my $num_pkgs = $1; - while ( $num_pkgs-- ) { - push @pkgparts,$pkgpart; - } - } else { - $error = "Illegal quantity"; - last; - } - } -} - -$error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums); - -if ($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(3). $error_redirect. '?'. $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} - -%> diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index 7055d8ea6..fadfffb62 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -1,42 +1,43 @@ -<% +% +% +%$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; +%my $custnum = $1; +%my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) +% or die "unknown custnum $custnum"; +% +%my $error = ''; +%if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) { +% my %payby2bop = ( +% 'CARD' => 'CC', +% 'CHEK' => 'ECHECK', +% ); +% my $bop = $payby2bop{$1}; +% $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/ +% or die "illegal refund amount ". $cgi->param('refund'); +% my $refund = "$1$2"; +% $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; +% my $paynum = $1; +% my $reason = $cgi->param('reason'); +% $error = $cust_main->realtime_refund_bop( $bop, 'amount' => $refund, +% 'paynum' => $paynum, +% 'reason' => $reason, ); +%} else { +% die 'unimplemented'; +% #my $new = new FS::cust_refund ( { +% # map { +% # $_, scalar($cgi->param($_)); +% # } ( fields('cust_refund'), 'paynum' ) +% #} ); +% #$error = $new->insert; +%} +% +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "cust_refund.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +%} +% +% -$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; -my $custnum = $1; -my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) - or die "unknown custnum $custnum"; - -my $error = ''; -if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) { - my %payby2bop = ( - 'CARD' => 'CC', - 'CHEK' => 'ECHECK', - ); - my $bop = $payby2bop{$1}; - $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/ - or die "illegal refund amount ". $cgi->param('refund'); - my $refund = "$1$2"; - $cgi->param('paynum') =~ /^(\d*)$/ or die "Illegal paynum!"; - my $paynum = $1; - my $reason = $cgi->param('reason'); - $error = $cust_main->realtime_refund_bop( $bop, 'amount' => $refund, - 'paynum' => $paynum, - 'reason' => $reason, ); -} else { - die 'unimplemented'; - #my $new = new FS::cust_refund ( { - # map { - # $_, scalar($cgi->param($_)); - # } ( fields('cust_refund'), 'paynum' ) - #} ); - #$error = $new->insert; -} - - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "cust_refund.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} - -%> diff --git a/httemplate/edit/process/cust_svc.cgi b/httemplate/edit/process/cust_svc.cgi index 187ede5e5..3a07d1e7a 100644 --- a/httemplate/edit/process/cust_svc.cgi +++ b/httemplate/edit/process/cust_svc.cgi @@ -1,30 +1,30 @@ -<% - -my $svcnum = $cgi->param('svcnum'); - -my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}) if $svcnum; - -my $new = new FS::cust_svc ( { - map { - $_, scalar($cgi->param($_)); - } fields('cust_svc') -} ); - -my $error; -if ( $svcnum ) { - $error=$new->replace($old); -} else { - $error=$new->insert; - $svcnum=$new->getfield('svcnum'); -} - -if ( $error ) { - #$cgi->param('error', $error); - #print $cgi->redirect(popurl(2). "cust_svc.cgi?". $cgi->query_string ); - eidiot($error); -} else { - my $svcdb = $new->part_svc->svcdb; - print $cgi->redirect(popurl(3). "view/$svcdb.cgi?$svcnum"); -} - - +% +% +%my $svcnum = $cgi->param('svcnum'); +% +%my $old = qsearchs('cust_svc',{'svcnum'=>$svcnum}) if $svcnum; +% +%my $new = new FS::cust_svc ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('cust_svc') +%} ); +% +%my $error; +%if ( $svcnum ) { +% $error=$new->replace($old); +%} else { +% $error=$new->insert; +% $svcnum=$new->getfield('svcnum'); +%} +% +%if ( $error ) { +% #$cgi->param('error', $error); +% #print $cgi->redirect(popurl(2). "cust_svc.cgi?". $cgi->query_string ); +% eidiot($error); +%} else { +% my $svcdb = $new->part_svc->svcdb; +% print $cgi->redirect(popurl(3). "view/$svcdb.cgi?$svcnum"); +%} +% +% diff --git a/httemplate/edit/process/domain_record.cgi b/httemplate/edit/process/domain_record.cgi index b8c3f62a1..87bdf6835 100755 --- a/httemplate/edit/process/domain_record.cgi +++ b/httemplate/edit/process/domain_record.cgi @@ -1,34 +1,36 @@ -<% +% +% +%my $recnum = $cgi->param('recnum'); +% +%my $old = qsearchs('agent',{'recnum'=>$recnum}) if $recnum; +% +%my $new = new FS::domain_record ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('domain_record') +%} ); +% +%my $error; +%if ( $recnum ) { +% $error=$new->replace($old); +%} else { +% $error=$new->insert; +% $recnum=$new->getfield('recnum'); +%} +% +%if ( $error ) { +%# $cgi->param('error', $error); +%# print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); +% #no edit screen to send them back to +% -my $recnum = $cgi->param('recnum'); - -my $old = qsearchs('agent',{'recnum'=>$recnum}) if $recnum; - -my $new = new FS::domain_record ( { - map { - $_, scalar($cgi->param($_)); - } fields('domain_record') -} ); - -my $error; -if ( $recnum ) { - $error=$new->replace($old); -} else { - $error=$new->insert; - $recnum=$new->getfield('recnum'); -} - -if ( $error ) { -# $cgi->param('error', $error); -# print $cgi->redirect(popurl(2). "agent.cgi?". $cgi->query_string ); - #no edit screen to send them back to -%> -<% - eidiot($error); -} else { - my $svcnum = $new->svcnum; - print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); -} +% +% eidiot($error); +%} else { +% my $svcnum = $new->svcnum; +% print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); +%} +% +% -%> diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 7cae78bfc..96d568754 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -1,91 +1,92 @@ -<% +% +% +% # options example... +% # +% ### +% ##req +% ## +% # +% # 'table' => +% # +% # #? 'primary_key' => #required when the dbdef doesn't know...??? +% # #? 'fields' => [] +% # +% ### +% ##opt +% ### +% # +% # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' +% # OR +% # 'redirect' => 'view/table.cgi?', # value of primary key is appended +% # +% # 'edit_ext' => 'html', #defaults to 'html', you might want 'cgi' while the +% # #naming is still inconsistent +% # +% # 'process_m2m' => { 'link_table' => 'link_table_name', +% # 'target_table' => 'target_table_name', +% # }, +% # 'process_m2name' => { 'link_table' => 'link_table_name', +% # 'link_static' => { 'column' => 'value' }, +% # 'num_col' => 'column', #if column name is different in +% # #link_table than source_table +% # 'name_col' => 'name_column', +% # 'names_list' => [ 'list', 'names' ], +% # }, +% +% my(%opt) = @_; +% +% #false laziness w/edit.html +% my $table = $opt{'table'}; +% my $class = "FS::$table"; +% my $pkey = dbdef->table($table)->primary_key; #? $opt{'primary_key'} || +% my $fields = $opt{'fields'} +% #|| [ grep { $_ ne $pkey } dbdef->table($table)->columns ]; +% || [ fields($table) ]; +% +% my $pkeyvalue = $cgi->param($pkey); +% +% my $old = qsearchs( $table, { $pkey => $pkeyvalue } ) if $pkeyvalue; +% +% my $new = $class->new( { +% map { +% $_, scalar($cgi->param($_)); +% } @$fields +% } ); +% +% my $error; +% if ( $pkeyvalue ) { +% $error = $new->replace($old); +% } else { +% $error = $new->insert; +% $pkeyvalue = $new->getfield($pkey); +% } +% +% if ( !$error && $opt{'process_m2m'} ) { +% $error = $new->process_m2m( %{ $opt{'process_m2m'} }, +% 'params' => scalar($cgi->Vars), +% ); +% } +% +% if ( !$error && $opt{'process_m2name'} ) { +% $error = $new->process_m2name( %{ $opt{'process_m2name'} }, +% 'params' => scalar($cgi->Vars), +% ); +% } +% +% # XXX print?!?! +% +% if ( $error ) { +% $cgi->param('error', $error); +% my $edit_ext = $opt{'edit_ext'} || 'html'; +% print $cgi->redirect(popurl(2). "$table.$edit_ext?". $cgi->query_string ); +% } elsif ( $opt{'redirect'} ) { +% print $cgi->redirect( $opt{'redirect'}. $pkeyvalue ); +% } else { +% print $cgi->redirect( popurl(3). +% ( $opt{'viewall_dir'} || 'search' ). +% "/$table.html" +% ); +% } +% +% - # options example... - # - ### - ##req - ## - # - # 'table' => - # - # #? 'primary_key' => #required when the dbdef doesn't know...??? - # #? 'fields' => [] - # - ### - ##opt - ### - # - # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' - # OR - # 'redirect' => 'view/table.cgi?', # value of primary key is appended - # - # 'edit_ext' => 'html', #defaults to 'html', you might want 'cgi' while the - # #naming is still inconsistent - # - # 'process_m2m' => { 'link_table' => 'link_table_name', - # 'target_table' => 'target_table_name', - # }, - # 'process_m2name' => { 'link_table' => 'link_table_name', - # 'link_static' => { 'column' => 'value' }, - # 'num_col' => 'column', #if column name is different in - # #link_table than source_table - # 'name_col' => 'name_column', - # 'names_list' => [ 'list', 'names' ], - # }, - - my(%opt) = @_; - - #false laziness w/edit.html - my $table = $opt{'table'}; - my $class = "FS::$table"; - my $pkey = dbdef->table($table)->primary_key; #? $opt{'primary_key'} || - my $fields = $opt{'fields'} - #|| [ grep { $_ ne $pkey } dbdef->table($table)->columns ]; - || [ fields($table) ]; - - my $pkeyvalue = $cgi->param($pkey); - - my $old = qsearchs( $table, { $pkey => $pkeyvalue } ) if $pkeyvalue; - - my $new = $class->new( { - map { - $_, scalar($cgi->param($_)); - } @$fields - } ); - - my $error; - if ( $pkeyvalue ) { - $error = $new->replace($old); - } else { - $error = $new->insert; - $pkeyvalue = $new->getfield($pkey); - } - - if ( !$error && $opt{'process_m2m'} ) { - $error = $new->process_m2m( %{ $opt{'process_m2m'} }, - 'params' => scalar($cgi->Vars), - ); - } - - if ( !$error && $opt{'process_m2name'} ) { - $error = $new->process_m2name( %{ $opt{'process_m2name'} }, - 'params' => scalar($cgi->Vars), - ); - } - - # XXX print?!?! - - if ( $error ) { - $cgi->param('error', $error); - my $edit_ext = $opt{'edit_ext'} || 'html'; - print $cgi->redirect(popurl(2). "$table.$edit_ext?". $cgi->query_string ); - } elsif ( $opt{'redirect'} ) { - print $cgi->redirect( $opt{'redirect'}. $pkeyvalue ); - } else { - print $cgi->redirect( popurl(3). - ( $opt{'viewall_dir'} || 'search' ). - "/$table.html" - ); - } - -%> diff --git a/httemplate/edit/process/elements/svc_Common.html b/httemplate/edit/process/elements/svc_Common.html index 1f8f8315e..8e8c99a42 100644 --- a/httemplate/edit/process/elements/svc_Common.html +++ b/httemplate/edit/process/elements/svc_Common.html @@ -1,11 +1,12 @@ -<% - - my %opt = @_; - my $table = $opt{'table'}; - $opt{'fields'} ||= [ fields($table) ]; - push @{ $opt{'fields'} }, qw( pkgnum svcpart ); - -%><%= include( 'process.html', +% +% +% my %opt = @_; +% my $table = $opt{'table'}; +% $opt{'fields'} ||= [ fields($table) ]; +% push @{ $opt{'fields'} }, qw( pkgnum svcpart ); +% +% +<% include( 'process.html', 'edit_ext' => 'cgi', 'redirect' => popurl(3)."view/$table.cgi?", %opt, diff --git a/httemplate/edit/process/generic.cgi b/httemplate/edit/process/generic.cgi index 9c54feb1d..82137c177 100644 --- a/httemplate/edit/process/generic.cgi +++ b/httemplate/edit/process/generic.cgi @@ -1,70 +1,71 @@ -<% +% +% +%# Welcome to generic.cgi. +%# +%# This script provides a generic edit/process/ backend for simple table +%# editing. All it knows how to do is take the values entered into +%# the script and insert them into the table specified by $cgi->param('table'). +%# If there's an existing record with the same primary key, it will be +%# replaced. (Deletion will be added in the future.) +%# +%# Special cgi params for this script: +%# table: the name of the table to be edited. The script will die horribly +%# if it can't find the table. +%# redirect_ok: URL to be displayed after a successful edit. The value of +%# the record's primary key will be passed as a keyword. +%# Defaults to (freeside root)/view/$table.cgi. +%# redirect_error: URL to be displayed if there's an error. The original +%# query string, plus the error message, will be passed. +%# Defaults to $cgi->referer() (i.e. go back where you +%# came from). +% +% +%use FS::Record qw(qsearchs dbdef); +%use DBIx::DBSchema; +%use DBIx::DBSchema::Table; +% +% +%my $error; +%my $p2 = popurl(2); +%my $p3 = popurl(3); +%my $table = $cgi->param('table'); +%my $dbdef = dbdef or die "Cannot fetch dbdef!"; +% +%my $dbdef_table = $dbdef->table($table) or die "Cannot fetch schema for $table"; +% +%my $pkey = $dbdef_table->primary_key or die "Cannot fetch pkey for $table"; +%my $pkey_val = $cgi->param($pkey); +% +% +%#warn "new FS::Record ( $table, (hashref) )"; +%my $new = FS::Record::new ( "FS::$table", { +% map { $_, scalar($cgi->param($_)) } fields($table) +%} ); +% +%#warn 'created $new of class '.ref($new); +% +%if($pkey_val and (my $old = qsearchs($table, { $pkey, $pkey_val} ))) { +% # edit +% $error = $new->replace($old); +%} else { +% #add +% $error = $new->insert; +% $pkey_val = $new->getfield($pkey); +% # New records usually don't have their primary keys set until after +% # they've been checked/inserted, so grab the new $pkey_val so we can +% # redirect to it. +%} +% +%my $redirect_ok = (($cgi->param('redirect_ok')) ? +% $cgi->param('redirect_ok') : $p3."browse/generic.cgi?$table"); +%my $redirect_error = (($cgi->param('redirect_error')) ? +% $cgi->param('redirect_error') : $cgi->referer()); +% +%if($error) { +% $cgi->param('error', $error); +% print $cgi->redirect($redirect_error . '?' . $cgi->query_string); +%} else { +% print $cgi->redirect($redirect_ok); +%} +% -# Welcome to generic.cgi. -# -# This script provides a generic edit/process/ backend for simple table -# editing. All it knows how to do is take the values entered into -# the script and insert them into the table specified by $cgi->param('table'). -# If there's an existing record with the same primary key, it will be -# replaced. (Deletion will be added in the future.) -# -# Special cgi params for this script: -# table: the name of the table to be edited. The script will die horribly -# if it can't find the table. -# redirect_ok: URL to be displayed after a successful edit. The value of -# the record's primary key will be passed as a keyword. -# Defaults to (freeside root)/view/$table.cgi. -# redirect_error: URL to be displayed if there's an error. The original -# query string, plus the error message, will be passed. -# Defaults to $cgi->referer() (i.e. go back where you -# came from). - - -use FS::Record qw(qsearchs dbdef); -use DBIx::DBSchema; -use DBIx::DBSchema::Table; - - -my $error; -my $p2 = popurl(2); -my $p3 = popurl(3); -my $table = $cgi->param('table'); -my $dbdef = dbdef or die "Cannot fetch dbdef!"; - -my $dbdef_table = $dbdef->table($table) or die "Cannot fetch schema for $table"; - -my $pkey = $dbdef_table->primary_key or die "Cannot fetch pkey for $table"; -my $pkey_val = $cgi->param($pkey); - - -#warn "new FS::Record ( $table, (hashref) )"; -my $new = FS::Record::new ( "FS::$table", { - map { $_, scalar($cgi->param($_)) } fields($table) -} ); - -#warn 'created $new of class '.ref($new); - -if($pkey_val and (my $old = qsearchs($table, { $pkey, $pkey_val} ))) { - # edit - $error = $new->replace($old); -} else { - #add - $error = $new->insert; - $pkey_val = $new->getfield($pkey); - # New records usually don't have their primary keys set until after - # they've been checked/inserted, so grab the new $pkey_val so we can - # redirect to it. -} - -my $redirect_ok = (($cgi->param('redirect_ok')) ? - $cgi->param('redirect_ok') : $p3."browse/generic.cgi?$table"); -my $redirect_error = (($cgi->param('redirect_error')) ? - $cgi->param('redirect_error') : $cgi->referer()); - -if($error) { - $cgi->param('error', $error); - print $cgi->redirect($redirect_error . '?' . $cgi->query_string); -} else { - print $cgi->redirect($redirect_ok); -} -%> diff --git a/httemplate/edit/process/inventory_class.html b/httemplate/edit/process/inventory_class.html index ab9efef48..c7be9e8dd 100644 --- a/httemplate/edit/process/inventory_class.html +++ b/httemplate/edit/process/inventory_class.html @@ -1,4 +1,4 @@ -<%= include( 'elements/process.html', +<% include( 'elements/process.html', 'table' => 'inventory_class', 'viewall_dir' => 'browse', ) diff --git a/httemplate/edit/process/msgcat.cgi b/httemplate/edit/process/msgcat.cgi index 1f94f6668..9711143d6 100644 --- a/httemplate/edit/process/msgcat.cgi +++ b/httemplate/edit/process/msgcat.cgi @@ -1,20 +1,21 @@ -<% +% +% +%my $error; +%foreach my $param ( grep { /^\d+$/ } $cgi->param ) { +% my $old = qsearchs('msgcat', { msgnum=>$param } ); +% next if $old->msg eq $cgi->param($param); #no need to update identical records +% my $new = new FS::msgcat { $old->hash }; +% $new->msg($cgi->param($param)); +% $error = $new->replace($old); +% last if $error; +%} +% +%if ( $error ) { +% $cgi->param('error',$error); +% print $cgi->redirect($p. "msgcat.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "browse/msgcat.cgi"); +%} +% +% -my $error; -foreach my $param ( grep { /^\d+$/ } $cgi->param ) { - my $old = qsearchs('msgcat', { msgnum=>$param } ); - next if $old->msg eq $cgi->param($param); #no need to update identical records - my $new = new FS::msgcat { $old->hash }; - $new->msg($cgi->param($param)); - $error = $new->replace($old); - last if $error; -} - -if ( $error ) { - $cgi->param('error',$error); - print $cgi->redirect($p. "msgcat.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/msgcat.cgi"); -} - -%> diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index 77dcd242a..4811d9c9b 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -1,54 +1,55 @@ -<% +% +% +%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 = ''; +% 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); +% +% my $new = new FS::part_bill_event ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('part_bill_event'), +% } ); +% +% if ( $eventpart ) { +% $error = $new->replace($old); +% } else { +% $error = $new->insert; +% $eventpart = $new->getfield('eventpart'); +% } +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "part_bill_event.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3)."browse/part_bill_event.cgi"); +%} +% +% -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 = ''; - 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); - - my $new = new FS::part_bill_event ( { - map { - $_, scalar($cgi->param($_)); - } fields('part_bill_event'), - } ); - - if ( $eventpart ) { - $error = $new->replace($old); - } else { - $error = $new->insert; - $eventpart = $new->getfield('eventpart'); - } -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "part_bill_event.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3)."browse/part_bill_event.cgi"); -} - -%> diff --git a/httemplate/edit/process/part_export.cgi b/httemplate/edit/process/part_export.cgi index fa009edbb..0dd9eabae 100644 --- a/httemplate/edit/process/part_export.cgi +++ b/httemplate/edit/process/part_export.cgi @@ -1,39 +1,40 @@ -<% +% +% +%my $exportnum = $cgi->param('exportnum'); +% +%my $old = qsearchs('part_export', { 'exportnum'=>$exportnum } ) if $exportnum; +% +%#fixup options +%#warn join('-', split(',',$cgi->param('options'))); +%my %options = map { +% my $value = $cgi->param($_); +% $value =~ s/\r\n/\n/g; #browsers? (textarea) +% $_ => $value; +%} split(',', $cgi->param('options')); +% +%my $new = new FS::part_export ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('part_export') +%} ); +% +%my $error; +%if ( $exportnum ) { +% #warn $old; +% #warn $exportnum; +% #warn $new->machine; +% $error = $new->replace($old,\%options); +%} else { +% $error = $new->insert(\%options); +%# $exportnum = $new->exportnum; +%} +% +%if ( $error ) { +% $cgi->param('error', $error ); +% print $cgi->redirect(popurl(2). "part_export.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "browse/part_export.cgi"); +%} +% +% -my $exportnum = $cgi->param('exportnum'); - -my $old = qsearchs('part_export', { 'exportnum'=>$exportnum } ) if $exportnum; - -#fixup options -#warn join('-', split(',',$cgi->param('options'))); -my %options = map { - my $value = $cgi->param($_); - $value =~ s/\r\n/\n/g; #browsers? (textarea) - $_ => $value; -} split(',', $cgi->param('options')); - -my $new = new FS::part_export ( { - map { - $_, scalar($cgi->param($_)); - } fields('part_export') -} ); - -my $error; -if ( $exportnum ) { - #warn $old; - #warn $exportnum; - #warn $new->machine; - $error = $new->replace($old,\%options); -} else { - $error = $new->insert(\%options); -# $exportnum = $new->exportnum; -} - -if ( $error ) { - $cgi->param('error', $error ); - print $cgi->redirect(popurl(2). "part_export.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/part_export.cgi"); -} - -%> diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 0d0a13491..204c751d9 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -1,61 +1,62 @@ -<% +% +% +%my $dbh = dbh; +% +%my $pkgpart = $cgi->param('pkgpart'); +% +%my $old = qsearchs('part_pkg',{'pkgpart'=>$pkgpart}) if $pkgpart; +% +%#fixup plandata +%my $plandata = $cgi->param('plandata'); +%my @plandata = split(',', $plandata); +%$cgi->param('plandata', +% join('', map { "$_=". join(', ', $cgi->param($_)). "\n" } @plandata ) +%); +% +%foreach (qw( setuptax recurtax disabled )) { +% $cgi->param($_, '') unless defined $cgi->param($_); +%} +% +%my $new = new FS::part_pkg ( { +% map { +% $_ => scalar($cgi->param($_)); +% } fields('part_pkg') +%} ); +% +%my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_")) } +% map { $_->svcpart } +% qsearch('part_svc', {} ); +% +%my $error; +%my $custnum = ''; +%if ( $cgi->param('taxclass') eq '(select)' ) { +% +% $error = 'Must select a tax class'; +% +%} elsif ( $pkgpart ) { +% +% $error = $new->replace( $old, +% pkg_svc => \%pkg_svc, +% primary_svc => scalar($cgi->param('pkg_svc_primary')), +% ); +%} else { +% +% $error = $new->insert( pkg_svc => \%pkg_svc, +% primary_svc => scalar($cgi->param('pkg_svc_primary')), +% cust_pkg => $cgi->param('pkgnum'), +% custnum_ref => \$custnum, +% ); +% $pkgpart = $new->pkgpart; +%} +% +%if ( $error ) { +% $cgi->param('error', $error ); +% print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string ); +%} elsif ( $custnum ) { +% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); +%} else { +% print $cgi->redirect(popurl(3). "browse/part_pkg.cgi"); +%} +% +% -my $dbh = dbh; - -my $pkgpart = $cgi->param('pkgpart'); - -my $old = qsearchs('part_pkg',{'pkgpart'=>$pkgpart}) if $pkgpart; - -#fixup plandata -my $plandata = $cgi->param('plandata'); -my @plandata = split(',', $plandata); -$cgi->param('plandata', - join('', map { "$_=". join(', ', $cgi->param($_)). "\n" } @plandata ) -); - -foreach (qw( setuptax recurtax disabled )) { - $cgi->param($_, '') unless defined $cgi->param($_); -} - -my $new = new FS::part_pkg ( { - map { - $_ => scalar($cgi->param($_)); - } fields('part_pkg') -} ); - -my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_")) } - map { $_->svcpart } - qsearch('part_svc', {} ); - -my $error; -my $custnum = ''; -if ( $cgi->param('taxclass') eq '(select)' ) { - - $error = 'Must select a tax class'; - -} elsif ( $pkgpart ) { - - $error = $new->replace( $old, - pkg_svc => \%pkg_svc, - primary_svc => scalar($cgi->param('pkg_svc_primary')), - ); -} else { - - $error = $new->insert( pkg_svc => \%pkg_svc, - primary_svc => scalar($cgi->param('pkg_svc_primary')), - cust_pkg => $cgi->param('pkgnum'), - custnum_ref => \$custnum, - ); - $pkgpart = $new->pkgpart; -} - -if ( $error ) { - $cgi->param('error', $error ); - print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string ); -} elsif ( $custnum ) { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); -} else { - print $cgi->redirect(popurl(3). "browse/part_pkg.cgi"); -} - -%> diff --git a/httemplate/edit/process/part_referral.html b/httemplate/edit/process/part_referral.html index 0b5d959a0..14c1b7001 100755 --- a/httemplate/edit/process/part_referral.html +++ b/httemplate/edit/process/part_referral.html @@ -1,4 +1,4 @@ -<%= include( 'elements/process.html', +<% include( 'elements/process.html', 'table' => 'part_referral', 'viewall_dir' => 'browse', ) diff --git a/httemplate/edit/process/part_svc.cgi b/httemplate/edit/process/part_svc.cgi index b92b62739..97abc5baf 100755 --- a/httemplate/edit/process/part_svc.cgi +++ b/httemplate/edit/process/part_svc.cgi @@ -1,3 +1,4 @@ -<% - my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process', $cgi; -%><%= $server->process %> +% +% my $server = new FS::UI::Web::JSRPC 'FS::part_svc::process', $cgi; +% +<% $server->process %> diff --git a/httemplate/edit/process/payment_gateway.html b/httemplate/edit/process/payment_gateway.html index 42205a02d..0b7e31395 100644 --- a/httemplate/edit/process/payment_gateway.html +++ b/httemplate/edit/process/payment_gateway.html @@ -1,33 +1,34 @@ -<% +% +% +%my $gatewaynum = $cgi->param('gatewaynum'); +% +%my $old = qsearchs('payment_gateway',{'gatewaynum'=>$gatewaynum}) if $gatewaynum; +% +%my $new = new FS::payment_gateway ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('payment_gateway') +%} ); +% +%my @options = split(/\r?\n/, $cgi->param('gateway_options') ); +%pop @options +% if scalar(@options) % 2 && $options[-1] =~ /^\s*$/; +%my %options = @options; +% +%my $error; +%if ( $gatewaynum ) { +% $error=$new->replace($old, \%options); +%} else { +% $error=$new->insert(\%options); +% $gatewaynum=$new->getfield('gatewaynum'); +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "payment_gateway.html?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "browse/payment_gateway.html"); +%} +% +% -my $gatewaynum = $cgi->param('gatewaynum'); - -my $old = qsearchs('payment_gateway',{'gatewaynum'=>$gatewaynum}) if $gatewaynum; - -my $new = new FS::payment_gateway ( { - map { - $_, scalar($cgi->param($_)); - } fields('payment_gateway') -} ); - -my @options = split(/\r?\n/, $cgi->param('gateway_options') ); -pop @options - if scalar(@options) % 2 && $options[-1] =~ /^\s*$/; -my %options = @options; - -my $error; -if ( $gatewaynum ) { - $error=$new->replace($old, \%options); -} else { - $error=$new->insert(\%options); - $gatewaynum=$new->getfield('gatewaynum'); -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "payment_gateway.html?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/payment_gateway.html"); -} - -%> diff --git a/httemplate/edit/process/pkg_class.html b/httemplate/edit/process/pkg_class.html index 48e2b8009..183da805c 100644 --- a/httemplate/edit/process/pkg_class.html +++ b/httemplate/edit/process/pkg_class.html @@ -1,4 +1,4 @@ -<%= include( 'elements/process.html', +<% include( 'elements/process.html', 'table' => 'pkg_class', 'viewall_dir' => 'browse', ) diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi index ca7472432..fb15fd8e4 100644 --- a/httemplate/edit/process/prepay_credit.cgi +++ b/httemplate/edit/process/prepay_credit.cgi @@ -1,51 +1,57 @@ +% +%my $hashref = {}; +% +%my $agent = ''; +%if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { +% $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } ); +%} +% +%my $error = ''; +% +%my $num = 0; +%if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { +% $num = $1; +%} else { +% $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); +%} +% +%$hashref->{amount} = $cgi->param('amount'); +%$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); +% +%$error ||= FS::prepay_credit::generate( $num, +% scalar($cgi->param('type')), +% $hashref +% ); +% +%unless ( ref($error) ) { +% $cgi->param('error', $error ); +% <% -my $hashref = {}; - -my $agent = ''; -if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) { - $agent = qsearchs('agent', { 'agentnum' => $hashref->{agentnum}=$1 } ); -} - -my $error = ''; - -my $num = 0; -if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { - $num = $1; -} else { - $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); -} - -$hashref->{amount} = $cgi->param('amount'); -$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); - -$error ||= FS::prepay_credit::generate( $num, - scalar($cgi->param('type')), - $hashref - ); - -unless ( ref($error) ) { - $cgi->param('error', $error ); -%><%= $cgi->redirect(popurl(3). "edit/prepay_credit.cgi?". $cgi->query_string ) -%><% } else { %> +%> +% } else { + -<%= include("/elements/header.html", "$num prepaid cards generated". +<% include("/elements/header.html", "$num prepaid cards generated". ( $agent ? ' for '.$agent->agent : '' ), menubar( 'Main menu' => popurl(3) ) ) %> -<% foreach my $card ( @$error ) { %> - <%= $card %> +% foreach my $card ( @$error ) { + + <% $card %> - - <%= $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %> - <%= $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %> - <%= $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %> + <% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %> + <% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %> + <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %>
-<% } %> +% } +
-<% } %> +% } + diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index 928e3daad..70778c1cc 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -1,41 +1,43 @@ -<% +% +% +%#untaint custnum +%$cgi->param('custnum') =~ /^(\d+)$/ +% or die 'illegal custnum '. $cgi->param('custnum'); +%my $custnum = $1; +% +%$cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ +% or die 'illegal amount '. $cgi->param('amount'); +%my $amount = $1; +% +%my( $error, $cust_main); +%if ( $cgi->param('taxclass') eq '(select)' ) { +% +% +% $error = 'Must select a tax class'; +%} else { +% +% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) +% or die "unknown custnum $custnum"; +% +% $error = $cust_main->charge( +% $amount, +% $cgi->param('pkg'), +% '$'. sprintf("%.2f",$amount), +% $cgi->param('taxclass') +% ); +% +%} +% +%if ($error) { +% -#untaint custnum -$cgi->param('custnum') =~ /^(\d+)$/ - or die 'illegal custnum '. $cgi->param('custnum'); -my $custnum = $1; - -$cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ - or die 'illegal amount '. $cgi->param('amount'); -my $amount = $1; - -my( $error, $cust_main); -if ( $cgi->param('taxclass') eq '(select)' ) { - - - $error = 'Must select a tax class'; -} else { - - my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) - or die "unknown custnum $custnum"; - - $error = $cust_main->charge( - $amount, - $cgi->param('pkg'), - '$'. sprintf("%.2f",$amount), - $cgi->param('taxclass') - ); - -} - -if ($error) { -%> -<% - eidiot($error); -} else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" ); -} +% +% eidiot($error); +%} else { +% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" ); +%} +% +% -%> diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index fd9e59472..7afc9f2bb 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -1,25 +1,27 @@ -<% +% +% +%#untaint custnum +%$cgi->param('custnum') =~ /^(\d+)$/ +% or die 'illegal custnum '. $cgi->param('custnum'); +%my $custnum = $1; +%$cgi->param('pkgpart') =~ /^(\d+)$/ +% or die 'illegal pkgpart '. $cgi->param('pkgpart'); +%my $pkgpart = $1; +% +%my @cust_pkg = (); +%my $error = FS::cust_pkg::order($custnum, [ $pkgpart ], [], \@cust_pkg, ); +% +%if ($error) { +% -#untaint custnum -$cgi->param('custnum') =~ /^(\d+)$/ - or die 'illegal custnum '. $cgi->param('custnum'); -my $custnum = $1; -$cgi->param('pkgpart') =~ /^(\d+)$/ - or die 'illegal pkgpart '. $cgi->param('pkgpart'); -my $pkgpart = $1; - -my @cust_pkg = (); -my $error = FS::cust_pkg::order($custnum, [ $pkgpart ], [], \@cust_pkg, ); - -if ($error) { -%> -<% - eidiot($error); -} else { - print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum". - "#cust_pkg". $cust_pkg[0]->pkgnum ); -} +% +% eidiot($error); +%} else { +% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum". +% "#cust_pkg". $cust_pkg[0]->pkgnum ); +%} +% +% -%> diff --git a/httemplate/edit/process/rate.cgi b/httemplate/edit/process/rate.cgi index 87c082d64..c81f883b7 100755 --- a/httemplate/edit/process/rate.cgi +++ b/httemplate/edit/process/rate.cgi @@ -1,3 +1,4 @@ -<% - my $server = new FS::UI::Web::JSRPC 'FS::rate::process', $cgi; -%><%= $server->process %> +% +% my $server = new FS::UI::Web::JSRPC 'FS::rate::process', $cgi; +% +<% $server->process %> diff --git a/httemplate/edit/process/rate_region.cgi b/httemplate/edit/process/rate_region.cgi index 09d3d2c42..753224565 100755 --- a/httemplate/edit/process/rate_region.cgi +++ b/httemplate/edit/process/rate_region.cgi @@ -1,51 +1,52 @@ -<% +% +% +%my $regionnum = $cgi->param('regionnum'); +% +%my $old = qsearchs('rate_region', { 'regionnum' => $regionnum } ) if $regionnum; +% +%my $new = new FS::rate_region ( { +% map { +% $_, scalar($cgi->param($_)); +% } ( fields('rate_region') ) +%} ); +% +%my $countrycode = $cgi->param('countrycode'); +%my @npa = split(/\s*,\s*/, $cgi->param('npa')); +%$npa[0] = '' unless @npa; +%my @rate_prefix = map { +% new FS::rate_prefix { +% 'countrycode' => $countrycode, +% 'npa' => $_, +% } +% } @npa; +% +%my @dest_detail = map { +% my $ratenum = $_->ratenum; +% new FS::rate_detail { +% 'ratenum' => $ratenum, +% map { $_ => $cgi->param("$_$ratenum") } +% qw( min_included min_charge sec_granularity ) +% }; +%} qsearch('rate', {} ); +% +% +%my $error; +%if ( $regionnum ) { +% $error = $new->replace($old, 'rate_prefix' => \@rate_prefix, +% 'dest_detail' => \@dest_detail, ); +%} else { +% $error = $new->insert( 'rate_prefix' => \@rate_prefix, +% 'dest_detail' => \@dest_detail, ); +% $regionnum = $new->getfield('regionnum'); +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "rate_region.cgi?". $cgi->query_string ); +%} else { +% #print $cgi->redirect(popurl(3). "browse/rate_region.cgi"); +% print $cgi->redirect(popurl(3). "browse/rate.cgi"); +%} +% +% -my $regionnum = $cgi->param('regionnum'); - -my $old = qsearchs('rate_region', { 'regionnum' => $regionnum } ) if $regionnum; - -my $new = new FS::rate_region ( { - map { - $_, scalar($cgi->param($_)); - } ( fields('rate_region') ) -} ); - -my $countrycode = $cgi->param('countrycode'); -my @npa = split(/\s*,\s*/, $cgi->param('npa')); -$npa[0] = '' unless @npa; -my @rate_prefix = map { - new FS::rate_prefix { - 'countrycode' => $countrycode, - 'npa' => $_, - } - } @npa; - -my @dest_detail = map { - my $ratenum = $_->ratenum; - new FS::rate_detail { - 'ratenum' => $ratenum, - map { $_ => $cgi->param("$_$ratenum") } - qw( min_included min_charge sec_granularity ) - }; -} qsearch('rate', {} ); - - -my $error; -if ( $regionnum ) { - $error = $new->replace($old, 'rate_prefix' => \@rate_prefix, - 'dest_detail' => \@dest_detail, ); -} else { - $error = $new->insert( 'rate_prefix' => \@rate_prefix, - 'dest_detail' => \@dest_detail, ); - $regionnum = $new->getfield('regionnum'); -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "rate_region.cgi?". $cgi->query_string ); -} else { - #print $cgi->redirect(popurl(3). "browse/rate_region.cgi"); - print $cgi->redirect(popurl(3). "browse/rate.cgi"); -} - -%> diff --git a/httemplate/edit/process/reg_code.cgi b/httemplate/edit/process/reg_code.cgi index a86c7383a..4fdea60fc 100644 --- a/httemplate/edit/process/reg_code.cgi +++ b/httemplate/edit/process/reg_code.cgi @@ -1,44 +1,50 @@ +% +% +%$cgi->param('agentnum') =~ /^(\d+)$/ +% or eidiot 'illegal agentnum '. $cgi->param('agentnum'); +%my $agentnum = $1; +%my $agent = qsearchs('agent', { 'agentnum' => $agentnum } ); +% +%my $error = ''; +% +%my $num = 0; +%if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { +% $num = $1; +%} else { +% $error = 'Illegal number of codes: '. $cgi->param('num'); +%} +% +%my @pkgparts = +% map { /^pkgpart(.*)$/; $1 } +% grep { $cgi->param($_) } +% grep { /^pkgpart/ } +% $cgi->param; +% +%$error ||= $agent->generate_reg_codes($num, \@pkgparts); +% +%unless ( ref($error) ) { +% $cgi->param('error'. $error ); +% <% - -$cgi->param('agentnum') =~ /^(\d+)$/ - or eidiot 'illegal agentnum '. $cgi->param('agentnum'); -my $agentnum = $1; -my $agent = qsearchs('agent', { 'agentnum' => $agentnum } ); - -my $error = ''; - -my $num = 0; -if ( $cgi->param('num') =~ /^\s*(\d+)\s*$/ ) { - $num = $1; -} else { - $error = 'Illegal number of codes: '. $cgi->param('num'); -} - -my @pkgparts = - map { /^pkgpart(.*)$/; $1 } - grep { $cgi->param($_) } - grep { /^pkgpart/ } - $cgi->param; - -$error ||= $agent->generate_reg_codes($num, \@pkgparts); - -unless ( ref($error) ) { - $cgi->param('error'. $error ); -%><%= $cgi->redirect(popurl(3). "edit/reg_code.cgi?". $cgi->query_string ) -%><% } else { %> +%> +% } else { + -<%= include("/elements/header.html","$num registration codes generated for ". $agent->agent, menubar( +<% include("/elements/header.html","$num registration codes generated for ". $agent->agent, menubar( 'Main menu' => popurl(3), 'View all agents' => popurl(3). 'browse/agent.cgi', ) ) %>

-<% foreach my $code ( @$error ) { %>
-  <%= $code %>
-<% } %>
+% foreach my $code ( @$error ) { 
+
+  <% $code %>
+% } 
+
 
 
-<% } %> +% } + diff --git a/httemplate/edit/process/router.cgi b/httemplate/edit/process/router.cgi index a2fa46dd9..c69114ea4 100644 --- a/httemplate/edit/process/router.cgi +++ b/httemplate/edit/process/router.cgi @@ -1,67 +1,68 @@ -<% +% +% +%local $FS::UID::AutoCommit=0; +% +%sub check { +% my $error = shift; +% if($error) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(3) . "edit/router.cgi?". $cgi->query_string); +% dbh->rollback; +% exit; +% } +%} +% +%my $error = ''; +%my $routernum = $cgi->param('routernum'); +%my $routername = $cgi->param('routername'); +%my $old = qsearchs('router', { routernum => $routernum }); +%my @old_psr; +% +%my $new = new FS::router { +% map { +% ($_, scalar($cgi->param($_))); +% } fields('router') +%}; +% +%if($old) { +% $error = $new->replace($old); +%} else { +% $error = $new->insert; +% $routernum = $new->routernum; +%} +% +%check($error); +% +%if ($old) { +% @old_psr = $old->part_svc_router; +% foreach my $psr (@old_psr) { +% if($cgi->param('svcpart_'.$psr->svcpart) eq 'ON') { +% # do nothing +% } else { +% $error = $psr->delete; +% } +% } +% check($error); +%} +% +%foreach($cgi->param) { +% if($cgi->param($_) eq 'ON' and /^svcpart_(\d+)$/) { +% my $svcpart = $1; +% if(grep {$_->svcpart == $svcpart} @old_psr) { +% # do nothing +% } else { +% my $new_psr = new FS::part_svc_router { svcpart => $svcpart, +% routernum => $routernum }; +% $error = $new_psr->insert; +% } +% check($error); +% } +%} +% +% +%# Yay, everything worked! +%dbh->commit or die dbh->errstr; +%print $cgi->redirect(popurl(3). "browse/router.cgi"); +% +% -local $FS::UID::AutoCommit=0; - -sub check { - my $error = shift; - if($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(3) . "edit/router.cgi?". $cgi->query_string); - dbh->rollback; - exit; - } -} - -my $error = ''; -my $routernum = $cgi->param('routernum'); -my $routername = $cgi->param('routername'); -my $old = qsearchs('router', { routernum => $routernum }); -my @old_psr; - -my $new = new FS::router { - map { - ($_, scalar($cgi->param($_))); - } fields('router') -}; - -if($old) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $routernum = $new->routernum; -} - -check($error); - -if ($old) { - @old_psr = $old->part_svc_router; - foreach my $psr (@old_psr) { - if($cgi->param('svcpart_'.$psr->svcpart) eq 'ON') { - # do nothing - } else { - $error = $psr->delete; - } - } - check($error); -} - -foreach($cgi->param) { - if($cgi->param($_) eq 'ON' and /^svcpart_(\d+)$/) { - my $svcpart = $1; - if(grep {$_->svcpart == $svcpart} @old_psr) { - # do nothing - } else { - my $new_psr = new FS::part_svc_router { svcpart => $svcpart, - routernum => $routernum }; - $error = $new_psr->insert; - } - check($error); - } -} - - -# Yay, everything worked! -dbh->commit or die dbh->errstr; -print $cgi->redirect(popurl(3). "browse/router.cgi"); - -%> diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 950a8602f..247a5b446 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -1,49 +1,50 @@ -<% +% +% +%$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +%my $svcnum = $1; +% +%my $old; +%if ( $svcnum ) { +% $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } ) +% or die "fatal: can't find account (svcnum $svcnum)!"; +%} else { +% $old = ''; +%} +% +%#unmunge popnum +%$cgi->param('popnum', (split(/:/, $cgi->param('popnum') ))[0] ); +% +%#unmunge passwd +%if ( $cgi->param('_password') eq '*HIDDEN*' ) { +% die "fatal: no previous account to recall hidden password from!" unless $old; +% $cgi->param('_password',$old->getfield('_password')); +%} +% +%#unmunge usergroup +%$cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] ); +% +%my $new = new FS::svc_acct ( { +% map { +% $_, scalar($cgi->param($_)); +% #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir +% # shell quota slipip) +% } ( fields('svc_acct'), qw( pkgnum svcpart usergroup ) ) +%} ); +% +%my $error; +%if ( $svcnum ) { +% $error = $new->replace($old); +%} else { +% $error = $new->insert; +% $svcnum = $new->svcnum; +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "svc_acct.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/svc_acct.cgi?" . $svcnum ); +%} +% +% -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum = $1; - -my $old; -if ( $svcnum ) { - $old = qsearchs('svc_acct', { 'svcnum' => $svcnum } ) - or die "fatal: can't find account (svcnum $svcnum)!"; -} else { - $old = ''; -} - -#unmunge popnum -$cgi->param('popnum', (split(/:/, $cgi->param('popnum') ))[0] ); - -#unmunge passwd -if ( $cgi->param('_password') eq '*HIDDEN*' ) { - die "fatal: no previous account to recall hidden password from!" unless $old; - $cgi->param('_password',$old->getfield('_password')); -} - -#unmunge usergroup -$cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] ); - -my $new = new FS::svc_acct ( { - map { - $_, scalar($cgi->param($_)); - #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir - # shell quota slipip) - } ( fields('svc_acct'), qw( pkgnum svcpart usergroup ) ) -} ); - -my $error; -if ( $svcnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $svcnum = $new->svcnum; -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "svc_acct.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/svc_acct.cgi?" . $svcnum ); -} - -%> diff --git a/httemplate/edit/process/svc_acct_pop.cgi b/httemplate/edit/process/svc_acct_pop.cgi index 46ad74d62..9e9df7bf0 100755 --- a/httemplate/edit/process/svc_acct_pop.cgi +++ b/httemplate/edit/process/svc_acct_pop.cgi @@ -1,28 +1,29 @@ -<% +% +% +%my $popnum = $cgi->param('popnum'); +% +%my $old = qsearchs('svc_acct_pop',{'popnum'=>$popnum}) if $popnum; +% +%my $new = new FS::svc_acct_pop ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('svc_acct_pop') +%} ); +% +%my $error = ''; +%if ( $popnum ) { +% $error = $new->replace($old); +%} else { +% $error = $new->insert; +% $popnum=$new->getfield('popnum'); +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "svc_acct_pop.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "browse/svc_acct_pop.cgi"); +%} +% +% -my $popnum = $cgi->param('popnum'); - -my $old = qsearchs('svc_acct_pop',{'popnum'=>$popnum}) if $popnum; - -my $new = new FS::svc_acct_pop ( { - map { - $_, scalar($cgi->param($_)); - } fields('svc_acct_pop') -} ); - -my $error = ''; -if ( $popnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $popnum=$new->getfield('popnum'); -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "svc_acct_pop.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "browse/svc_acct_pop.cgi"); -} - -%> diff --git a/httemplate/edit/process/svc_broadband.cgi b/httemplate/edit/process/svc_broadband.cgi index a009ba218..cf4604639 100644 --- a/httemplate/edit/process/svc_broadband.cgi +++ b/httemplate/edit/process/svc_broadband.cgi @@ -1,36 +1,37 @@ -<% +% +% +%$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +%my $svcnum = $1; +% +%my $old; +%if ( $svcnum ) { +% $old = qsearchs('svc_broadband', { 'svcnum' => $svcnum } ) +% or die "fatal: can't find broadband service (svcnum $svcnum)!"; +%} else { +% $old = ''; +%} +% +%my $new = new FS::svc_broadband ( { +% map { +% ($_, scalar($cgi->param($_))); +% } ( fields('svc_broadband'), qw( pkgnum svcpart ) ) +%} ); +% +%my $error; +%if ( $svcnum ) { +% $error = $new->replace($old); +%} else { +% $error = $new->insert; +% $svcnum = $new->svcnum; +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% $cgi->param('ip_addr', $new->ip_addr); +% print $cgi->redirect(popurl(2). "svc_broadband.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/svc_broadband.cgi?" . $svcnum ); +%} +% +% -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum = $1; - -my $old; -if ( $svcnum ) { - $old = qsearchs('svc_broadband', { 'svcnum' => $svcnum } ) - or die "fatal: can't find broadband service (svcnum $svcnum)!"; -} else { - $old = ''; -} - -my $new = new FS::svc_broadband ( { - map { - ($_, scalar($cgi->param($_))); - } ( fields('svc_broadband'), qw( pkgnum svcpart ) ) -} ); - -my $error; -if ( $svcnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $svcnum = $new->svcnum; -} - -if ( $error ) { - $cgi->param('error', $error); - $cgi->param('ip_addr', $new->ip_addr); - print $cgi->redirect(popurl(2). "svc_broadband.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/svc_broadband.cgi?" . $svcnum ); -} - -%> diff --git a/httemplate/edit/process/svc_domain.cgi b/httemplate/edit/process/svc_domain.cgi index 19f8eb4f8..773143fe3 100755 --- a/httemplate/edit/process/svc_domain.cgi +++ b/httemplate/edit/process/svc_domain.cgi @@ -1,31 +1,32 @@ -<% +% +% +%#remove this to actually test the domains! +%$FS::svc_domain::whois_hack = 1; +% +%$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +%my $svcnum = $1; +% +%my $new = new FS::svc_domain ( { +% map { +% $_, scalar($cgi->param($_)); +% #} qw(svcnum pkgnum svcpart domain action purpose) +% } ( fields('svc_domain'), qw( pkgnum svcpart action purpose ) ) +%} ); +% +%my $error = ''; +%if ($cgi->param('svcnum')) { +% $error="Can't modify a domain!"; +%} else { +% $error=$new->insert; +% $svcnum=$new->svcnum; +%} +% +%if ($error) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "svc_domain.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); +%} +% +% -#remove this to actually test the domains! -$FS::svc_domain::whois_hack = 1; - -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum = $1; - -my $new = new FS::svc_domain ( { - map { - $_, scalar($cgi->param($_)); - #} qw(svcnum pkgnum svcpart domain action purpose) - } ( fields('svc_domain'), qw( pkgnum svcpart action purpose ) ) -} ); - -my $error = ''; -if ($cgi->param('svcnum')) { - $error="Can't modify a domain!"; -} else { - $error=$new->insert; - $svcnum=$new->svcnum; -} - -if ($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "svc_domain.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/svc_domain.cgi?$svcnum"); -} - -%> diff --git a/httemplate/edit/process/svc_external.cgi b/httemplate/edit/process/svc_external.cgi index 728cd2189..97da6ba87 100755 --- a/httemplate/edit/process/svc_external.cgi +++ b/httemplate/edit/process/svc_external.cgi @@ -1,29 +1,30 @@ -<% +% +% +%$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +%my $svcnum =$1; +% +%my $old = qsearchs('svc_external',{'svcnum'=>$svcnum}) if $svcnum; +% +%my $new = new FS::svc_external ( { +% map { +% ($_, scalar($cgi->param($_))); +% } ( fields('svc_external'), qw( pkgnum svcpart ) ) +%} ); +% +%my $error = ''; +%if ( $svcnum ) { +% $error = $new->replace($old); +%} else { +% $error = $new->insert; +% $svcnum = $new->getfield('svcnum'); +%} +% +%if ($error) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "svc_external.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/svc_external.cgi?$svcnum"); +%} +% +% -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum =$1; - -my $old = qsearchs('svc_external',{'svcnum'=>$svcnum}) if $svcnum; - -my $new = new FS::svc_external ( { - map { - ($_, scalar($cgi->param($_))); - } ( fields('svc_external'), qw( pkgnum svcpart ) ) -} ); - -my $error = ''; -if ( $svcnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $svcnum = $new->getfield('svcnum'); -} - -if ($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "svc_external.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/svc_external.cgi?$svcnum"); -} - -%> diff --git a/httemplate/edit/process/svc_forward.cgi b/httemplate/edit/process/svc_forward.cgi index bb066d8a6..3205312f1 100755 --- a/httemplate/edit/process/svc_forward.cgi +++ b/httemplate/edit/process/svc_forward.cgi @@ -1,29 +1,30 @@ -<% +% +% +%$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +%my $svcnum =$1; +% +%my $old = qsearchs('svc_forward',{'svcnum'=>$svcnum}) if $svcnum; +% +%my $new = new FS::svc_forward ( { +% map { +% ($_, scalar($cgi->param($_))); +% } ( fields('svc_forward'), qw( pkgnum svcpart ) ) +%} ); +% +%my $error = ''; +%if ( $svcnum ) { +% $error = $new->replace($old); +%} else { +% $error = $new->insert; +% $svcnum = $new->getfield('svcnum'); +%} +% +%if ($error) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "svc_forward.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/svc_forward.cgi?$svcnum"); +%} +% +% -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum =$1; - -my $old = qsearchs('svc_forward',{'svcnum'=>$svcnum}) if $svcnum; - -my $new = new FS::svc_forward ( { - map { - ($_, scalar($cgi->param($_))); - } ( fields('svc_forward'), qw( pkgnum svcpart ) ) -} ); - -my $error = ''; -if ( $svcnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $svcnum = $new->getfield('svcnum'); -} - -if ($error) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "svc_forward.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/svc_forward.cgi?$svcnum"); -} - -%> diff --git a/httemplate/edit/process/svc_phone.html b/httemplate/edit/process/svc_phone.html index c1d4b7547..44235de63 100644 --- a/httemplate/edit/process/svc_phone.html +++ b/httemplate/edit/process/svc_phone.html @@ -1,4 +1,4 @@ -<%= include( 'elements/svc_Common.html', +<% include( 'elements/svc_Common.html', 'table' => 'svc_phone', ) %> diff --git a/httemplate/edit/process/svc_www.cgi b/httemplate/edit/process/svc_www.cgi index 40913145a..e9a52aff2 100644 --- a/httemplate/edit/process/svc_www.cgi +++ b/httemplate/edit/process/svc_www.cgi @@ -1,36 +1,37 @@ -<% +% +% +%$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +%my $svcnum = $1; +% +%my $old; +%if ( $svcnum ) { +% $old = qsearchs('svc_www', { 'svcnum' => $svcnum } ) +% or die "fatal: can't find website (svcnum $svcnum)!"; +%} else { +% $old = ''; +%} +% +%my $new = new FS::svc_www ( { +% map { +% ($_, scalar($cgi->param($_))); +% #} qw(svcnum pkgnum svcpart recnum usersvc) +% } ( fields('svc_www'), qw( pkgnum svcpart ) ) +%} ); +% +%my $error; +%if ( $svcnum ) { +% $error = $new->replace($old); +%} else { +% $error = $new->insert; +% $svcnum = $new->svcnum; +%} +% +%if ( $error ) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). "svc_www.cgi?". $cgi->query_string ); +%} else { +% print $cgi->redirect(popurl(3). "view/svc_www.cgi?" . $svcnum ); +%} +% +% -$cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; -my $svcnum = $1; - -my $old; -if ( $svcnum ) { - $old = qsearchs('svc_www', { 'svcnum' => $svcnum } ) - or die "fatal: can't find website (svcnum $svcnum)!"; -} else { - $old = ''; -} - -my $new = new FS::svc_www ( { - map { - ($_, scalar($cgi->param($_))); - #} qw(svcnum pkgnum svcpart recnum usersvc) - } ( fields('svc_www'), qw( pkgnum svcpart ) ) -} ); - -my $error; -if ( $svcnum ) { - $error = $new->replace($old); -} else { - $error = $new->insert; - $svcnum = $new->svcnum; -} - -if ( $error ) { - $cgi->param('error', $error); - print $cgi->redirect(popurl(2). "svc_www.cgi?". $cgi->query_string ); -} else { - print $cgi->redirect(popurl(3). "view/svc_www.cgi?" . $svcnum ); -} - -%> -- cgit v1.2.1 From 6af1b1bfa25e5ececef5e0dcd38b55917121cee2 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 26 Aug 2006 23:15:14 +0000 Subject: batch refactor continued --- httemplate/edit/process/cust_main.cgi | 3 ++- httemplate/edit/process/cust_refund.cgi | 8 ++------ 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 2d698c7b0..20c051b92 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -126,7 +126,7 @@ % my $berror = $new->bill; % $new->apply_payments; % $new->apply_credits; -% $berror ||= $new->collect; +% $berror ||= $new->collect 'realtime' => 1; % warn "Warning, error billing during backend-realtime: $berror" if $berror; % % } @@ -152,3 +152,4 @@ %} % + diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index fadfffb62..3a58d9aa5 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -1,4 +1,4 @@ -% + % % %$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; %my $custnum = $1; @@ -7,11 +7,7 @@ % %my $error = ''; %if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) { -% my %payby2bop = ( -% 'CARD' => 'CC', -% 'CHEK' => 'ECHECK', -% ); -% my $bop = $payby2bop{$1}; +% my $bop = FS::payby::$payby2bop{$1}; % $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/ % or die "illegal refund amount ". $cgi->param('refund'); % my $refund = "$1$2"; -- cgit v1.2.1 From b3b8c2e07e661046fe940ac083488d57a32f2c20 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 28 Aug 2006 13:52:31 +0000 Subject: parameters to method calls require ( ), arrgh --- httemplate/edit/process/cust_main.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 20c051b92..1aaed2890 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -126,7 +126,7 @@ % my $berror = $new->bill; % $new->apply_payments; % $new->apply_credits; -% $berror ||= $new->collect 'realtime' => 1; +% $berror ||= $new->collect( 'realtime' => 1 ); % warn "Warning, error billing during backend-realtime: $berror" if $berror; % % } -- cgit v1.2.1 From 31ce194a3315d3a5a69869b11947d63fc135d9a0 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 Sep 2006 16:27:19 +0000 Subject: fix FS::payby::payby2bop usage --- httemplate/edit/process/cust_refund.cgi | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index 3a58d9aa5..8f63c1f78 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -1,5 +1,3 @@ - % -% %$cgi->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; %my $custnum = $1; %my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) @@ -7,7 +5,7 @@ % %my $error = ''; %if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) { -% my $bop = FS::payby::$payby2bop{$1}; +% my $bop = FS::payby::payby2bop->{$1}; % $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/ % or die "illegal refund amount ". $cgi->param('refund'); % my $refund = "$1$2"; @@ -34,6 +32,3 @@ %} else { % print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum"); %} -% -% - -- cgit v1.2.1 From 77002640e60f0b47cf05ed8e173a0f0bcf66e655 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 5 Sep 2006 16:44:51 +0000 Subject: fix refunds, really --- httemplate/edit/process/cust_refund.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_refund.cgi b/httemplate/edit/process/cust_refund.cgi index 8f63c1f78..a579a02d8 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -5,7 +5,7 @@ % %my $error = ''; %if ( $cgi->param('payby') =~ /^(CARD|CHEK)$/ ) { -% my $bop = FS::payby::payby2bop->{$1}; +% my $bop = $FS::payby::payby2bop{$1}; % $cgi->param('refund') =~ /^(\d*)(\.\d{2})?$/ % or die "illegal refund amount ". $cgi->param('refund'); % my $refund = "$1$2"; -- cgit v1.2.1 From e417b8d8579f2ba08391cdace5d88f2120b8e722 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 14 Sep 2006 19:30:28 +0000 Subject: pointer to elements/process.html, fwiw --- httemplate/edit/process/generic.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/generic.cgi b/httemplate/edit/process/generic.cgi index 82137c177..e3ac113ae 100644 --- a/httemplate/edit/process/generic.cgi +++ b/httemplate/edit/process/generic.cgi @@ -1,5 +1,3 @@ -% -% %# Welcome to generic.cgi. %# %# This script provides a generic edit/process/ backend for simple table @@ -8,6 +6,10 @@ %# If there's an existing record with the same primary key, it will be %# replaced. (Deletion will be added in the future.) %# +%# also see elements/process.html, newer and somewhat along the same lines, +%# though it still makes you setup a process file for the table. +%# perhaps safer, perhaps more of a pain in the ass. +%# %# Special cgi params for this script: %# table: the name of the table to be edited. The script will die horribly %# if it can't find the table. -- cgit v1.2.1 From 30c3ff2acf90e1386fae00759078899c859faf36 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 3 Oct 2006 22:44:28 +0000 Subject: Enhanced customer notes --- httemplate/edit/process/cust_main_note.cgi | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 httemplate/edit/process/cust_main_note.cgi (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main_note.cgi b/httemplate/edit/process/cust_main_note.cgi new file mode 100755 index 000000000..d9251f042 --- /dev/null +++ b/httemplate/edit/process/cust_main_note.cgi @@ -0,0 +1,34 @@ +% +% +%$cgi->param('custnum') =~ /^(\d+)$/ +% or die "Illegal custnum: ". $cgi->param('custnum'); +%my $custnum = $1; +% +%my $otaker = $FS::CurrentUser::CurrentUser->name; +%$otaker = $FS::CurrentUser::CurrentUser->username +% if ($otaker eq "User, Legacy"); +% +%my $new = new FS::cust_main_note ( { +% custnum => $custnum, +% _date => time, +% otaker => $otaker, +% comments => $cgi->param('comment'), +%} ); +% +%my $error = $new->insert; +% +%if ($error) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). 'cust_main_note.cgi?'. $cgi->query_string ); +%} +% +% +<% header('Note added') %> + + + +% +% + -- cgit v1.2.1 From 64de1cc0535da3e6c31866c9ed046b43d1da01d3 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 9 Oct 2006 04:27:17 +0000 Subject: more BoD --- httemplate/edit/process/cust_main.cgi | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 1aaed2890..33f7bb895 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -53,6 +53,10 @@ % ); %} % +%if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/ ) { +% $new->setfield('birthdate', str2time($1)); +%} +% %$new->setfield('paid', $cgi->param('paid') ) % if $cgi->param('paid'); % -- cgit v1.2.1 From 52281cbeaf8d4e02345eca3c1aa0500133823558 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 18 Oct 2006 23:07:08 +0000 Subject: suspension and cancellation reasons --- httemplate/edit/process/part_bill_event.cgi | 57 +++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 12 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index 4811d9c9b..dd5cd0c8e 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -1,5 +1,4 @@ % -% %my $eventpart = $cgi->param('eventpart'); % %my $old = qsearchs('part_bill_event',{'eventpart'=>$eventpart}) if $eventpart; @@ -29,17 +28,51 @@ % $cgi->param('eventcode', $eventcode); % $cgi->param('plandata', $plandata); % -% my $new = new FS::part_bill_event ( { -% map { -% $_, scalar($cgi->param($_)); -% } fields('part_bill_event'), -% } ); -% -% if ( $eventpart ) { -% $error = $new->replace($old); -% } else { -% $error = $new->insert; -% $eventpart = $new->getfield('eventpart'); +% my $rnum; +% my $rtype; +% my $reasonm; +% if ($eventcode =~ /cancel/) { +% $cgi->param('creason') =~ /^(-?\d+)$/ || die "Invalid creason"; +% $rnum = $1; +% if ($rnum == -1) { +% $cgi->param('newcreasonT') =~ /^(\d+)$/ || die "Invalid newcreasonT"; +% $rtype = $1; +% $cgi->param('newcreason') =~ /^([\s\w]+)$/ || die "Invalid newcreasonT"; +% $reasonm = $1; +% } +% } +% if ($eventcode =~ /suspend/) { +% $cgi->param('sreason') =~ /^(-?\d+)$/ || die "Invalid sreason"; +% $rnum = $1; +% if ($rnum == -1) { +% $cgi->param('newsreasonT') =~ /^(\d+)$/ || die "Invalid newsreasonT"; +% $rtype = $1; +% $cgi->param('newsreason') =~ /^([\s\w]+)$/ || die "Invalid newsreasonT"; +% $reasonm = $1; +% } +% } +% +% if ($rnum == -1 && !$error) { +% my $reason = new FS::reason ({ 'reason' => $reasonm, +% 'reason_type' => $rtype, +% }); +% $error = $reason->insert or $rnum = $reason->reasonnum; +% } +% +% unless($error){ +% my $new = new FS::part_bill_event ( { +% map { +% $_, scalar($cgi->param($_)); +% } fields('part_bill_event'), +% } ); +% $new->setfield('reason', $rnum); +% +% if ( $eventpart ) { +% $error = $new->replace($old); +% } else { +% $error = $new->insert; +% $eventpart = $new->getfield('eventpart'); +% } % } %} % -- cgit v1.2.1 From ce98306f315a53f2ac4b8c010341c4f84bf728a8 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 19 Oct 2006 14:29:27 +0000 Subject: suspension and cancellation reasons --- httemplate/edit/process/reason.html | 6 ++++++ httemplate/edit/process/reason_type.html | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 httemplate/edit/process/reason.html create mode 100644 httemplate/edit/process/reason_type.html (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/reason.html b/httemplate/edit/process/reason.html new file mode 100644 index 000000000..55c1ea958 --- /dev/null +++ b/httemplate/edit/process/reason.html @@ -0,0 +1,6 @@ +<% include( 'elements/process.html', + 'table' => 'reason', + 'redirect' => popurl(3) . 'browse/reason.html?class=' . + $cgi->param('class') . '&', + ) +%> diff --git a/httemplate/edit/process/reason_type.html b/httemplate/edit/process/reason_type.html new file mode 100644 index 000000000..4ccccaddd --- /dev/null +++ b/httemplate/edit/process/reason_type.html @@ -0,0 +1,6 @@ +<% include( 'elements/process.html', + 'table' => 'reason_type', + 'redirect' => popurl(3) . 'browse/reason_type.html?class=' . + $cgi->param('class') . '&', + ) +%> -- cgit v1.2.1 From 9811b8ce65909a293810ddbcd8c9b5ca963fba01 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 23 Oct 2006 04:21:04 +0000 Subject: events should attach reasons --- httemplate/edit/process/part_bill_event.cgi | 31 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index dd5cd0c8e..cedba1e9f 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -31,23 +31,19 @@ % my $rnum; % my $rtype; % my $reasonm; -% if ($eventcode =~ /cancel/) { -% $cgi->param('creason') =~ /^(-?\d+)$/ || die "Invalid creason"; +% 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('newcreasonT') =~ /^(\d+)$/ || die "Invalid newcreasonT"; +% $cgi->param("new${class}reasonT") =~ /^(\d+)$/ +% or $error = "Invalid new${class}reasonT"; % $rtype = $1; -% $cgi->param('newcreason') =~ /^([\s\w]+)$/ || die "Invalid newcreasonT"; -% $reasonm = $1; -% } -% } -% if ($eventcode =~ /suspend/) { -% $cgi->param('sreason') =~ /^(-?\d+)$/ || die "Invalid sreason"; -% $rnum = $1; -% if ($rnum == -1) { -% $cgi->param('newsreasonT') =~ /^(\d+)$/ || die "Invalid newsreasonT"; -% $rtype = $1; -% $cgi->param('newsreason') =~ /^([\s\w]+)$/ || die "Invalid newsreasonT"; +% $cgi->param("new${class}reason") =~ /^([\s\w]+)$/ +% or $error = "Invalid new${class}reason"; % $reasonm = $1; % } % } @@ -57,6 +53,11 @@ % 'reason_type' => $rtype, % }); % $error = $reason->insert or $rnum = $reason->reasonnum; +% unless ($error) { +% $cgi->param("${class}reason", $rnum); +% $cgi->param("new${class}reason", ''); +% $cgi->param("new${class}reasonT", ''); +% } % } % % unless($error){ @@ -84,5 +85,3 @@ %} % % - - -- cgit v1.2.1 From 576c6b48428aa95e0fd80db011fe73c0b728c88b Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 27 Oct 2006 17:01:31 +0000 Subject: editable notes --- httemplate/edit/process/cust_main_note.cgi | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main_note.cgi b/httemplate/edit/process/cust_main_note.cgi index d9251f042..b94d2271c 100755 --- a/httemplate/edit/process/cust_main_note.cgi +++ b/httemplate/edit/process/cust_main_note.cgi @@ -4,18 +4,33 @@ % or die "Illegal custnum: ". $cgi->param('custnum'); %my $custnum = $1; % +%$cgi->param('notenum') =~ /^(\d+)$/ +% or die "Illegal notenum: ". $cgi->param('notenum'); +%my $notenum = $1; +% %my $otaker = $FS::CurrentUser::CurrentUser->name; %$otaker = $FS::CurrentUser::CurrentUser->username % if ($otaker eq "User, Legacy"); % %my $new = new FS::cust_main_note ( { +% notenum => $notenum, % custnum => $custnum, % _date => time, % otaker => $otaker, % comments => $cgi->param('comment'), %} ); % -%my $error = $new->insert; +%my $error; +%if ($notenum){ +% my $old = qsearchs('cust_main_note', { 'notenum' => $notenum }); +% $error = "No such note: $notenum" unless $old; +% unless($error){ +% map { $new->$_($old->$_) } ('_date', 'otaker'); +% $error = $new->replace($old); +% } +%}else{ +% $error = $new->insert; +%} % %if ($error) { % $cgi->param('error', $error); @@ -23,7 +38,7 @@ %} % % -<% header('Note added') %> +<% header('Note ' . ($notenum ? 'updated' : 'added') ) %> -- cgit v1.2.1 From 9c119c252a4b5e3755426daf454f8d70ff7a7dd7 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 31 Oct 2006 16:57:30 +0000 Subject: ugh, too restrictive --- httemplate/edit/process/cust_main_note.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main_note.cgi b/httemplate/edit/process/cust_main_note.cgi index b94d2271c..2de9b7f57 100755 --- a/httemplate/edit/process/cust_main_note.cgi +++ b/httemplate/edit/process/cust_main_note.cgi @@ -4,7 +4,7 @@ % or die "Illegal custnum: ". $cgi->param('custnum'); %my $custnum = $1; % -%$cgi->param('notenum') =~ /^(\d+)$/ +%$cgi->param('notenum') =~ /^(\d*)$/ % or die "Illegal notenum: ". $cgi->param('notenum'); %my $notenum = $1; % -- cgit v1.2.1 From 7c1d5f4ce778b4ab56301a042076e7c1dce46152 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 16 Nov 2006 06:20:38 +0000 Subject: switch birthdate to DateTime --- httemplate/edit/process/cust_main.cgi | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 33f7bb895..d5d127b2d 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -54,7 +54,14 @@ %} % %if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/ ) { -% $new->setfield('birthdate', str2time($1)); +% eval "use DateTime::Format::Strptime;"; +% die $@ if $@; +% my $conf = new FS::Conf; +% my $format = $conf->config('date_format') || "%m/%d/%Y"; +% my $parser = DateTime::Format::Strptime->new(pattern => $format, +% time_zone => 'floating', +% ); +% $new->setfield('birthdate', $parser->parse_datetime($1)->epoch); %} % %$new->setfield('paid', $cgi->param('paid') ) -- cgit v1.2.1 From 2678ace9d79df1eb745f7a592cc0fc354e994504 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 16 Nov 2006 15:37:42 +0000 Subject: bug squishing --- httemplate/edit/process/part_bill_event.cgi | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/part_bill_event.cgi b/httemplate/edit/process/part_bill_event.cgi index cedba1e9f..af594f264 100755 --- a/httemplate/edit/process/part_bill_event.cgi +++ b/httemplate/edit/process/part_bill_event.cgi @@ -18,15 +18,6 @@ % $cgi->param('weight', $2); % my $eventcode = $3; % my $plandata = ''; -% 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); % % my $rnum; % my $rtype; @@ -52,14 +43,25 @@ % my $reason = new FS::reason ({ 'reason' => $reasonm, % 'reason_type' => $rtype, % }); -% $error = $reason->insert or $rnum = $reason->reasonnum; +% $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){ % my $new = new FS::part_bill_event ( { % map { -- cgit v1.2.1 From 88a07a3c2aac1fff33bd1f400ee5c0672ce716a0 Mon Sep 17 00:00:00 2001 From: jeff Date: Sun, 26 Nov 2006 23:06:37 +0000 Subject: more ajaxy customer notes --- httemplate/edit/process/cust_main_note.cgi | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main_note.cgi b/httemplate/edit/process/cust_main_note.cgi index 2de9b7f57..8b9105bd8 100755 --- a/httemplate/edit/process/cust_main_note.cgi +++ b/httemplate/edit/process/cust_main_note.cgi @@ -40,9 +40,12 @@ % <% header('Note ' . ($notenum ? 'updated' : 'added') ) %> - % % -- cgit v1.2.1 From dbb388836b7951a3db49deda05a1ff9ba5125c17 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 30 Nov 2006 02:27:57 +0000 Subject: prepaid download/upload tracking --- httemplate/edit/process/prepay_credit.cgi | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi index fb15fd8e4..ba4296900 100644 --- a/httemplate/edit/process/prepay_credit.cgi +++ b/httemplate/edit/process/prepay_credit.cgi @@ -15,8 +15,10 @@ % $error = 'Illegal number of prepaid cards: '. $cgi->param('num'); %} % -%$hashref->{amount} = $cgi->param('amount'); -%$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); +%$hashref->{amount} = $cgi->param('amount'); +%$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); +%$hashref->{upbytes} = $cgi->param('upbytes') * $cgi->param('upmultiplier'); +%$hashref->{downbytes} = $cgi->param('downbytes') * $cgi->param('downmultiplier'); % %$error ||= FS::prepay_credit::generate( $num, % scalar($cgi->param('type')), @@ -46,6 +48,8 @@ <% $hashref->{amount} ? sprintf('$%.2f', $hashref->{amount} ) : '' %> <% $hashref->{amount} && $hashref->{seconds} ? 'and' : '' %> <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %> + <% $hashref->{upbytes} ? FS::UI::Web::bytecount_unexact($hashref->{upbytes}) : '' %> + <% $hashref->{downbytes} ? FS::UI::Web::bytecount_unexact($hashref->{downbytes}) : '' %>
% } -- cgit v1.2.1 From bc392247350c4a124c8835f18dd19154ac343e9d Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 5 Dec 2006 02:37:14 +0000 Subject: editable service usage --- httemplate/edit/process/svc_acct.cgi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 247a5b446..30552c846 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -23,13 +23,13 @@ %#unmunge usergroup %$cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] ); % -%my $new = new FS::svc_acct ( { -% map { -% $_, scalar($cgi->param($_)); +%my %hash = $svcnum ? $old->hash : (); +%map { +% $hash{$_} = scalar($cgi->param($_)); % #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir % # shell quota slipip) -% } ( fields('svc_acct'), qw( pkgnum svcpart usergroup ) ) -%} ); +% } (fields('svc_acct'), qw ( pkgnum svcpart usergroup )); +%my $new = new FS::svc_acct ( \%hash ); % %my $error; %if ( $svcnum ) { -- cgit v1.2.1 From 6194551336a925ae5455cede68a7f73660b06bb6 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 7 Dec 2006 02:40:32 +0000 Subject: retouch bandwidth countdown --- httemplate/edit/process/prepay_credit.cgi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/prepay_credit.cgi b/httemplate/edit/process/prepay_credit.cgi index ba4296900..6bf46bf7c 100644 --- a/httemplate/edit/process/prepay_credit.cgi +++ b/httemplate/edit/process/prepay_credit.cgi @@ -19,6 +19,7 @@ %$hashref->{seconds} = $cgi->param('seconds') * $cgi->param('multiplier'); %$hashref->{upbytes} = $cgi->param('upbytes') * $cgi->param('upmultiplier'); %$hashref->{downbytes} = $cgi->param('downbytes') * $cgi->param('downmultiplier'); +%$hashref->{totalbytes} = $cgi->param('totalbytes') * $cgi->param('totalmultiplier'); % %$error ||= FS::prepay_credit::generate( $num, % scalar($cgi->param('type')), @@ -50,6 +51,7 @@ <% $hashref->{seconds} ? duration_exact($hashref->{seconds}) : '' %> <% $hashref->{upbytes} ? FS::UI::Web::bytecount_unexact($hashref->{upbytes}) : '' %> <% $hashref->{downbytes} ? FS::UI::Web::bytecount_unexact($hashref->{downbytes}) : '' %> + <% $hashref->{totalbytes} ? FS::UI::Web::bytecount_unexact($hashref->{totalbytes}) : '' %>
% } -- cgit v1.2.1 From d8c39492e9192d9c66858d21c6c69b069968eec7 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 8 Dec 2006 13:36:07 +0000 Subject: some javascript validation magic to give one-time charges better UI --- httemplate/edit/process/quick-charge.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index 70778c1cc..cb2654bb5 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -5,7 +5,7 @@ % or die 'illegal custnum '. $cgi->param('custnum'); %my $custnum = $1; % -%$cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ +%$cgi->param('amount') =~ /^\s*\$?\s*(\d+(\.\d{1,2})?)\s*$/ % or die 'illegal amount '. $cgi->param('amount'); %my $amount = $1; % -- cgit v1.2.1 From dcdf657e77ec7b46dc69e19a849a9c133123db7c Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 14 Dec 2006 06:00:46 +0000 Subject: encryption fixes from huntsberg & jayce --- httemplate/edit/process/cust_main.cgi | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index d5d127b2d..789f29522 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -46,6 +46,9 @@ % } fields('cust_main') %} ); % +% delete( $new->hashref->{'agent_custid'} ) +% unless $new->hashref->{'agent_custid'}; +% %if ( defined($cgi->param('same')) && $cgi->param('same') eq "Y" ) { % $new->setfield("ship_$_", '') foreach qw( % last first company address1 address2 city county state zip @@ -151,6 +154,9 @@ % && $new->paycvv =~ /^\s*\*+\s*$/ ) { % $new->paycvv($old->paycvv); % } +% if ($new->payby =~ /CARD|DCRD|CHEK|DCHK/ && $new->payinfo =~ /xx/) { +% $new->payinfo($old->payinfo); +% } % $error ||= $new->replace($old, \@invoicing_list); % %} -- cgit v1.2.1 From ba1f19e48ec2f2ac293b07a41042de59e744db1e Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 15 Dec 2006 00:56:12 +0000 Subject: add DateTime as a proper rather than hidden dependency --- httemplate/edit/process/cust_main.cgi | 2 -- 1 file changed, 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 789f29522..752bc9502 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -57,8 +57,6 @@ %} % %if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/ ) { -% eval "use DateTime::Format::Strptime;"; -% die $@ if $@; % my $conf = new FS::Conf; % my $format = $conf->config('date_format') || "%m/%d/%Y"; % my $parser = DateTime::Format::Strptime->new(pattern => $format, -- cgit v1.2.1 From 02b9c53fb85b0a87d959e140dc30ae21cccb0902 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 15 Dec 2006 05:29:48 +0000 Subject: move use statements to handler.pl, do not show 1/1/70 for new birthdates, and improve error handling --- httemplate/edit/process/cust_main.cgi | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 752bc9502..38821c36a 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -56,13 +56,21 @@ % ); %} % -%if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/ ) { +%if ( $cgi->param('birthdate') && $cgi->param('birthdate') =~ /^([ 0-9\-\/]{0,10})$/) { % my $conf = new FS::Conf; % my $format = $conf->config('date_format') || "%m/%d/%Y"; % my $parser = DateTime::Format::Strptime->new(pattern => $format, % time_zone => 'floating', % ); -% $new->setfield('birthdate', $parser->parse_datetime($1)->epoch); +% my $dt = $parser->parse_datetime($1); +% if ($dt) { +% $new->setfield('birthdate', $dt->epoch); +% $cgi->param('birthdate', $dt->epoch); +% } else { +%# $error ||= $cgi->param('birthdate') . " is an invalid birthdate:" . $parser->errmsg; +% $error ||= "Invalid birthdate: " . $cgi->param('birthdate') . "."; +% $cgi->param('birthdate', ''); +% } %} % %$new->setfield('paid', $cgi->param('paid') ) -- cgit v1.2.1 From d60a734b5602b3a94164f17f7b0ee74d11443008 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Dec 2006 08:34:59 +0000 Subject: whitespace --- httemplate/edit/process/quick-charge.cgi | 2 -- 1 file changed, 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index cb2654bb5..2c5ac81b0 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -1,5 +1,3 @@ -% -% %#untaint custnum %$cgi->param('custnum') =~ /^(\d+)$/ % or die 'illegal custnum '. $cgi->param('custnum'); -- cgit v1.2.1 From 6cb5c702b17b98be46adea4539e15d5f312e5be1 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Dec 2006 08:41:21 +0000 Subject: slight pedanticism --- httemplate/edit/process/cust_main.cgi | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 38821c36a..505973dc7 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -1,5 +1,3 @@ -% -% %my $error = ''; % %#unmunge stuff @@ -160,7 +158,7 @@ % && $new->paycvv =~ /^\s*\*+\s*$/ ) { % $new->paycvv($old->paycvv); % } -% if ($new->payby =~ /CARD|DCRD|CHEK|DCHK/ && $new->payinfo =~ /xx/) { +% if ($new->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ && $new->payinfo =~ /xx/) { % $new->payinfo($old->payinfo); % } % $error ||= $new->replace($old, \@invoicing_list); @@ -173,6 +171,3 @@ %} else { % print $cgi->redirect(popurl(3). "view/cust_main.cgi?". $new->custnum); %} -% - - -- cgit v1.2.1 From 633c48448d9468690b7ad77eb6ff7c660a286658 Mon Sep 17 00:00:00 2001 From: ivan Date: Fri, 29 Dec 2006 08:51:34 +0000 Subject: service refactor! --- httemplate/edit/process/elements/process.html | 5 ++++- httemplate/edit/process/svc_Common.html | 13 +++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 httemplate/edit/process/svc_Common.html (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 96d568754..4b1d2c840 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -19,6 +19,8 @@ % # OR % # 'redirect' => 'view/table.cgi?', # value of primary key is appended % # +% # 'error_redirect' => popurl(2).'edit/table.cgi?', #query string appended +% # % # 'edit_ext' => 'html', #defaults to 'html', you might want 'cgi' while the % # #naming is still inconsistent % # @@ -78,7 +80,8 @@ % if ( $error ) { % $cgi->param('error', $error); % my $edit_ext = $opt{'edit_ext'} || 'html'; -% print $cgi->redirect(popurl(2). "$table.$edit_ext?". $cgi->query_string ); +% my $url = $opt{'error_redirect'} || popurl(2)."$table.$edit_ext?"; +% print $cgi->redirect($url. $cgi->query_string ); % } elsif ( $opt{'redirect'} ) { % print $cgi->redirect( $opt{'redirect'}. $pkeyvalue ); % } else { diff --git a/httemplate/edit/process/svc_Common.html b/httemplate/edit/process/svc_Common.html new file mode 100644 index 000000000..f5c869a12 --- /dev/null +++ b/httemplate/edit/process/svc_Common.html @@ -0,0 +1,13 @@ +<%init> + +$cgi->param('svcdb') =~ /^(svc_\w+)$/ or die "unparsable svcdb"; +my $table = $1; +require "FS/$table.pm"; + + +<% include( 'elements/svc_Common.html', + 'table' => $table, + 'redirect' => popurl(3)."view/svc_Common.html?svcdb=$table;svcnum=", + 'error_redirect' => popurl(3)."edit/svc_Common.html?svcdb=$table;", + ) +%> -- cgit v1.2.1 From 2a863bbb144830dfb8fca4afb3af76a84a647c76 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 12 Jan 2007 02:04:50 +0000 Subject: one-time charge enhancements --- httemplate/edit/process/quick-charge.cgi | 84 +++++++++++++++++--------------- 1 file changed, 45 insertions(+), 39 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index 2c5ac81b0..f614dd5cf 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -1,41 +1,47 @@ -%#untaint custnum -%$cgi->param('custnum') =~ /^(\d+)$/ -% or die 'illegal custnum '. $cgi->param('custnum'); -%my $custnum = $1; % -%$cgi->param('amount') =~ /^\s*\$?\s*(\d+(\.\d{1,2})?)\s*$/ -% or die 'illegal amount '. $cgi->param('amount'); -%my $amount = $1; -% -%my( $error, $cust_main); -%if ( $cgi->param('taxclass') eq '(select)' ) { -% -% -% $error = 'Must select a tax class'; -%} else { -% -% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) -% or die "unknown custnum $custnum"; -% -% $error = $cust_main->charge( -% $amount, -% $cgi->param('pkg'), -% '$'. sprintf("%.2f",$amount), -% $cgi->param('taxclass') -% ); -% -%} -% -%if ($error) { -% - - -% -% eidiot($error); -%} else { -% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" ); -%} -% -% - +% my $error = ''; +% my $param = $cgi->Vars; +% +% my @description = (); +% for ( my $row = 0; exists($param->{"description$row"}); $row++ ) { +% push @description, $param->{"description$row"}; +% } +% pop @description until ($description[$#description]); +% +% $param->{"custnum"} =~ /^(\d+)$/ +% or $error .= "Illegal customer number " . $param->{"custnum"} . " "; +% my $custnum = $1; +% +% $param->{"amount"} =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ +% or $error .= "Illegal amount " . $param->{"amount"} . " "; +% my $amount = $1; +% +% if ( $param->{'taxclass'} eq '(select)' ) { +% $error .= "Must select a tax class. "; +% } +% +% unless ( $error ) { +% my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) +% or $error .= "Unknown customer number $custnum. "; +% +% $error ||= $cust_main->charge({ 'amount' => $amount, +% 'pkg' => $cgi->param('pkg'), +% 'taxclass' => $cgi->param('taxclass'), +% 'additional' => \@description, +% } +% ); +% } +% +% if ( $error ) { +% +% $cgi->param('error', "$error" ); +% +<% $cgi->redirect($p.'quick-charge.html?'. $cgi->query_string) %> +% +% } +<% header("One-time charge added") %> + + -- cgit v1.2.1 From 810f6c351cbc38838daca5b795838ade12711999 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 15 Jan 2007 22:15:26 +0000 Subject: that was DUM --- httemplate/edit/process/quick-charge.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index f614dd5cf..a2eba3abc 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -6,7 +6,7 @@ % for ( my $row = 0; exists($param->{"description$row"}); $row++ ) { % push @description, $param->{"description$row"}; % } -% pop @description until ($description[$#description]); +% pop @description until (!@description || $description[$#description]); % % $param->{"custnum"} =~ /^(\d+)$/ % or $error .= "Illegal customer number " . $param->{"custnum"} . " "; -- cgit v1.2.1 From eab5690e7cd970706f709ac0ef4f1c3e317fcd7d Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 17 Jan 2007 00:40:57 +0000 Subject: employee edit (ticket 1412) --- httemplate/edit/process/access_user.html | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index 78857c525..ebbcdca17 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -1,8 +1,13 @@ -<% include( 'elements/process.html', - 'table' => 'access_user', - 'viewall_dir' => 'browse', - 'process_m2m' => { 'link_table' => 'access_usergroup', - 'target_table' => 'access_group', - }, - ) +% if ( $cgi->param('_password') ne $cgi->param('_password2') ) { +% $cgi->param('error', "The passwords do not match"); +% print $cgi->redirect(popurl(2) . "access_user.html?" . $cgi->query_string); +% } else { +<% include( 'elements/process.html', + 'table' => 'access_user', + 'viewall_dir' => 'browse', + 'process_m2m' => { 'link_table' => 'access_usergroup', + 'target_table' => 'access_group', + }, + ) %> +% } -- cgit v1.2.1 From a54aa62df5076e113134e06e11ba9776c3e60a36 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 19 Jan 2007 16:31:21 +0000 Subject: no password in html source on employee edit --- httemplate/edit/process/access_user.html | 1 + httemplate/edit/process/elements/process.html | 9 +++++++++ 2 files changed, 10 insertions(+) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index ebbcdca17..7aab79954 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -5,6 +5,7 @@ <% include( 'elements/process.html', 'table' => 'access_user', 'viewall_dir' => 'browse', + 'copy_on_empty' => [ '_password' ], 'process_m2m' => { 'link_table' => 'access_usergroup', 'target_table' => 'access_group', }, diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 4b1d2c840..5d40bba50 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -24,6 +24,8 @@ % # 'edit_ext' => 'html', #defaults to 'html', you might want 'cgi' while the % # #naming is still inconsistent % # +% # 'copy_on_empty' => [ old_field_name, another_old_field, ... ], +% # % # 'process_m2m' => { 'link_table' => 'link_table_name', % # 'target_table' => 'target_table_name', % # }, @@ -55,6 +57,13 @@ % } @$fields % } ); % +% if ($old && scalar($opt{'copy_on_empty'})) { +% foreach my $field (@{$opt{'copy_on_empty'}}) { +% $new->set($field, $old->get($field)) +% unless scalar($cgi->param($field)); +% } +% } +% % my $error; % if ( $pkeyvalue ) { % $error = $new->replace($old); -- cgit v1.2.1 From 32860d44e17b53f220cd98e041219d7d5b8a4619 Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 19 Jan 2007 22:02:21 +0000 Subject: blank password on error --- httemplate/edit/process/access_user.html | 1 + httemplate/edit/process/elements/process.html | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/access_user.html b/httemplate/edit/process/access_user.html index 7aab79954..9f7c4ddbf 100644 --- a/httemplate/edit/process/access_user.html +++ b/httemplate/edit/process/access_user.html @@ -6,6 +6,7 @@ 'table' => 'access_user', 'viewall_dir' => 'browse', 'copy_on_empty' => [ '_password' ], + 'clear_on_error' => [ '_password', '_password2' ], 'process_m2m' => { 'link_table' => 'access_usergroup', 'target_table' => 'access_group', }, diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 5d40bba50..fb5b352d2 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -24,7 +24,9 @@ % # 'edit_ext' => 'html', #defaults to 'html', you might want 'cgi' while the % # #naming is still inconsistent % # -% # 'copy_on_empty' => [ old_field_name, another_old_field, ... ], +% # 'copy_on_empty' => [ 'old_field_name', 'another_old_field', ... ], +% # +% # 'clear_on_error' => [ 'form_field1', 'form_field2', ... ], % # % # 'process_m2m' => { 'link_table' => 'link_table_name', % # 'target_table' => 'target_table_name', @@ -57,7 +59,7 @@ % } @$fields % } ); % -% if ($old && scalar($opt{'copy_on_empty'})) { +% if ($old && scalar(@{$opt{'copy_on_empty'}})) { % foreach my $field (@{$opt{'copy_on_empty'}}) { % $new->set($field, $old->get($field)) % unless scalar($cgi->param($field)); @@ -88,6 +90,11 @@ % % if ( $error ) { % $cgi->param('error', $error); +% if (scalar(@{$opt{'clear_on_error'}})) { +% foreach my $field (@{$opt{'clear_on_error'}}) { +% $cgi->param($field, '') +% } +% } % my $edit_ext = $opt{'edit_ext'} || 'html'; % my $url = $opt{'error_redirect'} || popurl(2)."$table.$edit_ext?"; % print $cgi->redirect($url. $cgi->query_string ); -- cgit v1.2.1 From bc85a6042dca1848a23623be5d6612e495121da5 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 20 Jan 2007 00:08:39 +0000 Subject: strip all blank lines, not just trailing ones --- httemplate/edit/process/quick-charge.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi index a2eba3abc..024a281e0 100644 --- a/httemplate/edit/process/quick-charge.cgi +++ b/httemplate/edit/process/quick-charge.cgi @@ -4,9 +4,9 @@ % % my @description = (); % for ( my $row = 0; exists($param->{"description$row"}); $row++ ) { -% push @description, $param->{"description$row"}; +% push @description, $param->{"description$row"} +% if ($param->{"description$row"} =~ /\S/); % } -% pop @description until (!@description || $description[$#description]); % % $param->{"custnum"} =~ /^(\d+)$/ % or $error .= "Illegal customer number " . $param->{"custnum"} . " "; -- cgit v1.2.1 From 05686487551e26418c9b2d6b92ea0d89bb100082 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 21 Jan 2007 21:45:29 +0000 Subject: Have lineitem-specific applications happen in all cases; add weightsto control --- httemplate/edit/process/cust_main.cgi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 505973dc7..26d6debcd 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -142,8 +142,7 @@ % if ( $conf->exists('backend-realtime') && ! $error ) { % % my $berror = $new->bill; -% $new->apply_payments; -% $new->apply_credits; +% $new->apply_payments_and_credits; % $berror ||= $new->collect( 'realtime' => 1 ); % warn "Warning, error billing during backend-realtime: $berror" if $berror; % -- cgit v1.2.1 From 43d3389061e5c2a428230792b67d42bbf6549a86 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 24 Jan 2007 05:33:37 +0000 Subject: squarely between shame in you and so close --- httemplate/edit/process/elements/process.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index fb5b352d2..e388c678b 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -59,7 +59,7 @@ % } @$fields % } ); % -% if ($old && scalar(@{$opt{'copy_on_empty'}})) { +% if ($old && exists($opt{'copy_on_empty'})) { % foreach my $field (@{$opt{'copy_on_empty'}}) { % $new->set($field, $old->get($field)) % unless scalar($cgi->param($field)); -- cgit v1.2.1 From a7ea8cde763b396d0f4ce48168c689d038263786 Mon Sep 17 00:00:00 2001 From: jeff Date: Wed, 31 Jan 2007 04:30:49 +0000 Subject: small change in payment receipt handling (ticket 1422) --- httemplate/edit/process/cust_pay.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index 68342ee04..a34c88aba 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -20,7 +20,7 @@ % #} fields('cust_pay') %} ); % -%my $error = $new->insert; +%my $error = $new->insert( 'manual' => 1 ); % %if ($error) { % $cgi->param('error', $error); -- cgit v1.2.1 From 83a6a677f62ca501011d9bac6371344dbb5a13b3 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 8 Feb 2007 01:46:45 +0000 Subject: agent type on package add/edit (ticket 1446) --- httemplate/edit/process/part_pkg.cgi | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 204c751d9..1158222b6 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -17,6 +17,12 @@ % $cgi->param($_, '') unless defined $cgi->param($_); %} % +%my @agents; +%foreach ($cgi->param('agent_type')) { +% /^(\d+)$/; +% push @agents, $1 if $1; +%} +% %my $new = new FS::part_pkg ( { % map { % $_ => scalar($cgi->param($_)); @@ -49,6 +55,13 @@ % $pkgpart = $new->pkgpart; %} % +%unless ($error) { +% my $error = $new->process_m2m( +% 'link_table' => 'type_pkgs', +% 'target_table' => 'agent_type', +% 'params' => \@agents, +% ); +%} %if ( $error ) { % $cgi->param('error', $error ); % print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string ); -- cgit v1.2.1 From 5f5d2124d615efbcdbb34eea691f2ca8724b3e47 Mon Sep 17 00:00:00 2001 From: jeff Date: Thu, 8 Feb 2007 09:13:21 +0000 Subject: hold off until 1.7.2 --- httemplate/edit/process/part_pkg.cgi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi index 1158222b6..55e7e05ae 100755 --- a/httemplate/edit/process/part_pkg.cgi +++ b/httemplate/edit/process/part_pkg.cgi @@ -55,7 +55,7 @@ % $pkgpart = $new->pkgpart; %} % -%unless ($error) { +%unless (1 || $error) { # after 1.7.2 % my $error = $new->process_m2m( % 'link_table' => 'type_pkgs', % 'target_table' => 'agent_type', -- cgit v1.2.1 From 43131261a1aa72d2a42b778f7fa0180bdef6d685 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 13 Feb 2007 22:08:35 +0000 Subject: use a domsvc when passed in, patch from Sean Hanson/S1 --- httemplate/edit/process/cust_main.cgi | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 26d6debcd..a4a70ca22 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -114,12 +114,16 @@ % % #$error ||= $cust_svc->check; % -% $svc_acct = new FS::svc_acct ( { -% 'svcpart' => $svcpart, -% 'username' => $cgi->param('username'), -% '_password' => $cgi->param('_password'), -% 'popnum' => $cgi->param('popnum'), -% } ); +% my %svc_acct = ( +% 'svcpart' => $svcpart, +% 'username' => $cgi->param('username'), +% '_password' => $cgi->param('_password'), +% 'popnum' => $cgi->param('popnum'), +% ); +% $svc_acct{'domsvc'} = $cgi->param('domsvc') +% if $cgi->param('domsvc'); +% +% $svc_acct = new FS::svc_acct \%svc_acct; % % #and just in case you were silly % $svc_acct->svcpart($svcpart); -- cgit v1.2.1