From c1cabbc4cea2e0cfd9e1db668100b97069140cf5 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 26 Jul 2012 14:02:36 -0700 Subject: add anniversary date, RT#18631 --- httemplate/edit/process/cust_main.cgi | 5 ++++- 1 file changed, 4 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 5ee553b32..866452de1 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -112,9 +112,12 @@ $new->tagnum( [ $cgi->param('tagnum') ] ); my %usedatetime = ( 'birthdate' => 1, 'spouse_birthdate' => 1, + 'anniversary_date' => 1, ); -foreach my $dfield (qw( birthdate spouse_birthdate signupdate )) { +foreach my $dfield (qw( + signupdate birthdate spouse_birthdate anniversary_date +)) { if ( $cgi->param($dfield) && $cgi->param($dfield) =~ /^([ 0-9\-\/]{0,10})$/) { -- cgit v1.2.1 From 5a204201503f8e0db6087db6e53b84297cbc739a Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Fri, 10 Aug 2012 13:54:14 -0700 Subject: add national id # handling for my, RT#18543 --- httemplate/edit/process/cust_main.cgi | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 866452de1..622dd87c5 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -110,6 +110,36 @@ if ( $cgi->param('no_credit_limit') ) { $new->tagnum( [ $cgi->param('tagnum') ] ); +if ( my $id_country = $conf->config('national_id-country') ) { + if ( $id_country eq 'MY' ) { + + if ( $cgi->param('national_id1') =~ /\S/ ) { + my $nric = $cgi->param('national_id1'); + $nric =~ s/\s//g; + if ( $nric =~ /^(\d{6})\-?(\d{2})\-?(\d{4})$/ ) { + $new->national_id( "$1-$2-$3" ); + } else { + $error ||= "Illegal NRIC: ". $cgi->param('national_id1'); + } + } elsif ( $cgi->param('national_id2') =~ /\S/ ) { + my $oldic = $cgi->param('national_id2'); + $oldic =~ s/\s//g; + if ( $oldic =~ /^\w\d{9}$/ ) { + $new->national_id($oldic); + } else { + $error ||= "Illegal Old IC/Passport: ". $cgi->param('national_id2'); + } + } else { + $error ||= 'Either NRIC or Old IC/Passport is required'; + } + + } else { + warn "unknown national_id-country $id_country"; + } +} elsif ( $cgi->param('national_id0') ) { + $new->national_id( $cgi->param('national_id0') ); +} + my %usedatetime = ( 'birthdate' => 1, 'spouse_birthdate' => 1, 'anniversary_date' => 1, -- cgit v1.2.1 From 022c84a3d9c8a946d5e0b3f0fff73aa771461bc5 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 16 Aug 2012 01:27:03 -0700 Subject: FS/FS/cust_main/NationalID.pm --- httemplate/edit/process/cust_main.cgi | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index 622dd87c5..31ec4ab12 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -110,35 +110,7 @@ if ( $cgi->param('no_credit_limit') ) { $new->tagnum( [ $cgi->param('tagnum') ] ); -if ( my $id_country = $conf->config('national_id-country') ) { - if ( $id_country eq 'MY' ) { - - if ( $cgi->param('national_id1') =~ /\S/ ) { - my $nric = $cgi->param('national_id1'); - $nric =~ s/\s//g; - if ( $nric =~ /^(\d{6})\-?(\d{2})\-?(\d{4})$/ ) { - $new->national_id( "$1-$2-$3" ); - } else { - $error ||= "Illegal NRIC: ". $cgi->param('national_id1'); - } - } elsif ( $cgi->param('national_id2') =~ /\S/ ) { - my $oldic = $cgi->param('national_id2'); - $oldic =~ s/\s//g; - if ( $oldic =~ /^\w\d{9}$/ ) { - $new->national_id($oldic); - } else { - $error ||= "Illegal Old IC/Passport: ". $cgi->param('national_id2'); - } - } else { - $error ||= 'Either NRIC or Old IC/Passport is required'; - } - - } else { - warn "unknown national_id-country $id_country"; - } -} elsif ( $cgi->param('national_id0') ) { - $new->national_id( $cgi->param('national_id0') ); -} +$error ||= $new->set_national_id_from_cgi( $cgi ); my %usedatetime = ( 'birthdate' => 1, 'spouse_birthdate' => 1, -- cgit v1.2.1 From 51c3d90d07c9d5b3e33a1f002cf5a252ef65bb7b Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 16 Aug 2012 15:19:24 -0700 Subject: fix "Post manual (offline/POS) credit card refund", RT#18926 --- 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 f4cce6535..bde40727a 100755 --- a/httemplate/edit/process/cust_refund.cgi +++ b/httemplate/edit/process/cust_refund.cgi @@ -31,7 +31,7 @@ my $link = $cgi->param('popup') ? 'popup' : ''; my $payby = $cgi->param('payby'); my @rights = (); -push @rights, 'Post refund' if $payby =~ /^(BILL|CASH)$/; +push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD)$/; push @rights, 'Post check refund' if $payby eq 'BILL'; push @rights, 'Post cash refund ' if $payby eq 'CASH'; push @rights, 'Refund payment' if $payby =~ /^(CARD|CHEK)$/; -- cgit v1.2.1 From 7c9457296c5dd8985eda5a8325ba1254223ec953 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Thu, 30 Aug 2012 00:48:08 -0700 Subject: commissions per agent and package class, RT#18232 --- httemplate/edit/process/agent.cgi | 41 ++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/agent.cgi b/httemplate/edit/process/agent.cgi index e776d281c..034c4cc50 100755 --- a/httemplate/edit/process/agent.cgi +++ b/httemplate/edit/process/agent.cgi @@ -1,11 +1,12 @@ <% include( 'elements/process.html', - 'table' => 'agent', - 'viewall_dir' => 'browse', - 'viewall_ext' => 'cgi', - 'process_m2m' => { 'link_table' => 'access_groupagent', - 'target_table' => 'access_group', - }, - 'edit_ext' => 'cgi', + 'table' => 'agent', + 'viewall_dir' => 'browse', + 'viewall_ext' => 'cgi', + 'process_m2m' => { 'link_table' => 'access_groupagent', + 'target_table' => 'access_group', + }, + 'edit_ext' => 'cgi', + 'noerror_callback' => $process_agent_pkg_class, ) %> <%init> @@ -18,4 +19,30 @@ if ( FS::Conf->new->exists('disable_acl_changes') ) { die "shouldn't be reached"; } +my $process_agent_pkg_class = sub { + my( $cgi, $agent ) = @_; + + #surprising amount of false laziness w/ edit/agent.cgi + my @pkg_class = qsearch('pkg_class', { 'disabled'=>'' }); + foreach my $pkg_class ( '', @pkg_class ) { + my %agent_pkg_class = ( 'agentnum' => $agent->agentnum, + 'classnum' => $pkg_class ? $pkg_class->classnum : '' + ); + my $agent_pkg_class = + qsearchs( 'agent_pkg_class', \%agent_pkg_class ) + || new FS::agent_pkg_class \%agent_pkg_class; + + my $param = 'classnum'. $agent_pkg_class{classnum}; + + $agent_pkg_class->commission_percent( $cgi->param($param) ); + + my $method = $agent_pkg_class->agentpkgclassnum ? 'replace' : 'insert'; + + my $error = $agent_pkg_class->$method; + die $error if $error; #XXX push this down into agent.pm w/better/transactional error handling + + } + +}; + -- cgit v1.2.1 From 1ad547a47f16b4230762e752fbe48d460ed997e1 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 18 Sep 2012 02:18:04 -0700 Subject: export host selection per service, RT#17914 --- httemplate/edit/process/part_export.cgi | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/part_export.cgi b/httemplate/edit/process/part_export.cgi index 21150ef67..6432d6b15 100644 --- a/httemplate/edit/process/part_export.cgi +++ b/httemplate/edit/process/part_export.cgi @@ -28,6 +28,11 @@ my $new = new FS::part_export ( { } fields('part_export') } ); +if ( $cgi->param('svc_machine') eq 'Y' ) { + $new->machine('_SVC_MACHINE'); + $new->part_export_machine_textarea( $cgi->param('part_export_machine') ); +} + my $error; if ( $exportnum ) { #warn $old; -- cgit v1.2.1 From 36a1e9c1661fb552d368f2f675dcb0793d733748 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Sun, 23 Sep 2012 18:07:47 -0700 Subject: export host selection per service, RT#17914 --- httemplate/edit/process/svc_acct.cgi | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'httemplate/edit/process') diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index a7d5136fb..41aca65ee 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -56,13 +56,14 @@ my $new = new FS::svc_acct ( \%hash ); my $error = ''; +my $part_svc = $svcnum ? + $old->part_svc : + qsearchs( 'part_svc', + { 'svcpart' => $cgi->param('svcpart') } + ); + # google captcha auth if ( $cgi->param('captcha_response') ) { - my $part_svc = $svcnum ? - $old->part_svc : - qsearchs( 'part_svc', - { 'svcpart' => $cgi->param('svcpart') } - ); my ($export) = $part_svc->part_export('acct_google'); if ( $export and ! $export->captcha_auth($cgi->param('captcha_response')) ) { @@ -79,6 +80,18 @@ if ( $cgi->param('clear_password') eq '*HIDDEN*' } if ( ! $error ) { + + my $export_info = FS::part_export::export_info(); + + my @svc_export_machine = + map FS::svc_export_machine->new({ + 'svcnum' => $svcnum, + 'exportnum' => $_->exportnum, + 'machinenum' => scalar($cgi->param('exportnum'.$_->exportnum.'machinenum')), + }), + grep { $_->machine eq '_SVC_MACHINE' } + $part_svc->part_export; + if ( $svcnum ) { foreach ( grep { $old->$_ != $new->$_ } qw( seconds upbytes downbytes totalbytes ) @@ -92,9 +105,9 @@ if ( ! $error ) { $error ||= $new->set_usage(\%hash); #unoverlimit and trigger radius changes last; #once is enough } - $error ||= $new->replace($old); + $error ||= $new->replace($old, 'child_objects'=>\@svc_export_machine); } else { - $error ||= $new->insert; + $error ||= $new->insert('child_objects'=>\@svc_export_machine); $svcnum = $new->svcnum; } } -- cgit v1.2.1