diff options
| author | mark <mark> | 2010-09-04 02:19:03 +0000 | 
|---|---|---|
| committer | mark <mark> | 2010-09-04 02:19:03 +0000 | 
| commit | 48e3f879908a13cb87786e32e158ff8a8bf18fbb (patch) | |
| tree | 9a284a69b1963efacc2a8a4b8e49675927518d31 /httemplate/misc/cust_main-cancel.cgi | |
| parent | 6fc2d87a0e37976a97580055e1ea0cdff0c86143 (diff) | |
set expire date for customer packages, RT#9697
Diffstat (limited to 'httemplate/misc/cust_main-cancel.cgi')
| -rwxr-xr-x | httemplate/misc/cust_main-cancel.cgi | 31 | 
1 files changed, 25 insertions, 6 deletions
| diff --git a/httemplate/misc/cust_main-cancel.cgi b/httemplate/misc/cust_main-cancel.cgi index 009a7d41b..44be20c8a 100755 --- a/httemplate/misc/cust_main-cancel.cgi +++ b/httemplate/misc/cust_main-cancel.cgi @@ -1,4 +1,4 @@ -<% header("Customer cancelled") %> +<% include('/elements/header.html', "Customer cancelled") %>    <SCRIPT TYPE="text/javascript">      window.top.location.reload();    </SCRIPT> @@ -11,9 +11,11 @@ die "access denied"  my $custnum;  my $ban = ''; +my $expire = '';  if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {    $custnum = $1;    $ban = $cgi->param('ban'); +  $expire = $cgi->param('expire');  } else {    my($query) = $cgi->keywords;    $query =~ /^(\d+)$/ || die "Illegal custnum"; @@ -42,11 +44,28 @@ my $cust_main = qsearchs( {    'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,  } ); -warn "cancelling $cust_main"; -my @errors = $cust_main->cancel( -  'ban'    => $ban, -  'reason' => $reasonnum, -); +my @errors; +if($cgi->param('now_or_later')) { +  $expire = parse_datetime($expire); +  if($expire) { +    #warn "setting expire dates on custnum#$custnum\n"; +    my @pkgs = $cust_main->ncancelled_pkgs; +    @errors = grep {$_} map { $_->cancel( +      'reason'  => $reasonnum, +      'date'    => $expire, +    ) } @pkgs; +  } +  else { +    @errors = ("error parsing expire date: ".$cgi->param('expire')); +  } +} +else { +  warn "cancelling $cust_main"; +  @errors = $cust_main->cancel( +    'ban'    => $ban, +    'reason' => $reasonnum, +  ); +}  my $error = join(' / ', @errors) if scalar(@errors);  if ( $error ) { | 
