X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2FREAL_cust_pkg.cgi;h=4bcf55c443cc7ef863039696a878ace8f03dff67;hb=1df8ca6e580bffa11c412b8ae59cd98028ed6470;hp=fea85456f540212e1b26946d9f7ce162700e50aa;hpb=5e05724a635a22776f1b973f5d7e77989da4e048;p=freeside.git diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index fea85456f..4bcf55c44 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -9,6 +9,29 @@ +
@@ -28,12 +51,26 @@ Package - <% $cust_pkg->pkg %> + <% $part_pkg->pkg %> + + +% if ( $cust_pkg->main_pkgnum ) { +% my $main_pkg = $cust_pkg->main_pkg; + + Supplemental to + Package #<% $cust_pkg->main_pkgnum%>: \ + <% $main_pkg->part_pkg->pkg %> + + +% } + + Custom + <% $part_pkg->custom %> Comment - <% $cust_pkg->comment %> + <% $part_pkg->comment %> @@ -41,25 +78,44 @@ <% $cust_pkg->otaker %> - <& .row_edit, cust_pkg=>$cust_pkg, column=>'setup', label=>'Setup' &> + <& .row_display, cust_pkg=>$cust_pkg, column=>'order_date', label=>'Order' &> +% if ( $cust_pkg->setup && ! $cust_pkg->start_date ) { + <& .row_display, cust_pkg=>$cust_pkg, column=>'start_date', label=>'Start' &> +% } else { + <& .row_edit, cust_pkg=>$cust_pkg, column=>'start_date', label=>'Start', if_primary=>1 &> +% } + + <& .row_edit, cust_pkg=>$cust_pkg, column=>'setup', label=>'Setup', if_primary=>1 &> <& .row_edit, cust_pkg=>$cust_pkg, column=>'last_bill', label=>$last_bill_or_renewed &> <& .row_edit, cust_pkg=>$cust_pkg, column=>'bill', label=>$next_bill_or_prepaid_until &> - <& .row_edit, cust_pkg=>$cust_pkg, column=>'adjourn', label=>'Adjournment', note=>'(will suspend this package when the date is reached)' &> - <& .row_display, cust_pkg=>$cust_pkg, column=>'susp', label=>'Suspension' &> - - <& .row_edit, cust_pkg=>$cust_pkg, column=>'expire', label=>'Expiration', note=>'(will cancel this package when the date is reached)' &> +%#if ( $cust_pkg->contract_end or $part_pkg->option('contract_end_months',1) ) { + <& .row_edit, cust_pkg=>$cust_pkg, column=>'contract_end',label=>'Contract end', if_primary=>1 &> +%#} + <& .row_display, cust_pkg=>$cust_pkg, column=>'adjourn', label=>'Adjournment', note=>'(will suspend this package when the date is reached)' &> + <& .row_display, cust_pkg=>$cust_pkg, column=>'susp', label=>'Suspension' &> + <& .row_display, cust_pkg=>$cust_pkg, column=>'resume', label=>'Resumption', note=> '(will unsuspend this package when the date is reached' &> + + <& .row_display, cust_pkg=>$cust_pkg, column=>'expire', label=>'Expiration', note=>'(will cancel this package when the date is reached)' &> <& .row_display, cust_pkg=>$cust_pkg, column=>'cancel', label=>'Cancellation' &> + <%def .row_edit> <%args> $cust_pkg $column $label $note => '' + $if_primary => 0 % my $value = $cust_pkg->get($column); % $value = $value ? time2str($format, $value) : ""; - +% +% # if_primary for the dates that can't be edited on supplemental packages +% if ($if_primary and $cust_pkg->main_pkgnum) { + + + <& .row_display, %ARGS &> +% } else { <% $label %> date @@ -83,12 +139,15 @@ + submit_fields.push('<%$column%>'); + + +% } <%def .row_display> @@ -96,11 +155,17 @@ $cust_pkg $column $label + $note => '' + $is_primary => 0 #ignored % if ( $cust_pkg->get($column) ) { <% $label %> date - <% time2str($format,$cust_pkg->get($column)) %> + <% time2str($format,$cust_pkg->get($column)) %> +% if ( $note ) { +
<% $note %> +% } + % } @@ -108,49 +173,47 @@
- +
<% include('/elements/footer.html') %> +<%shared> -<%once> +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -#my $format = "%c %z (%Z)"; -my $format = "%m/%d/%Y %T %z (%Z)"; +my $format = $date_format. ' %T'; # %z (%Z)'; -#false laziness w/view/cust_main/packages.html -#my( $billed_or_prepaid, - - + <%init> die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates'); + my $error = ''; my( $pkgnum, $cust_pkg ); if ( $cgi->param('error') ) { $pkgnum = $cgi->param('pkgnum'); - if ( $cgi->param('error') eq '_bill_areyousure' ) { - if ( $cgi->param('bill') =~ /^([\s\d\/\:\-\(\w\)]*)$/ ) { - my $bill = $1; - $cgi->param('error', ''); - $error = "You are attempting to set the next bill date to $bill, which is - in the past. This will charge the customer for the interval - from $bill until now. Are you sure you want to do this? ". - ''; - } + + if ( $cgi->param('error') =~ /^_/ ) { + + my @errors = (); + my %errors = map { $_=>1 } split(',', $cgi->param('error')); + $cgi->param('error', ''); + $error = join('

', @errors ); + } #get package record $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum}); die "No package!" unless $cust_pkg; - foreach my $col (qw( setup last_bill bill adjourn expire )) { + foreach my $col (qw( start_date setup last_bill bill )) { my $value = $cgi->param($col); - $cust_pkg->set( $col, $value ? str2time($value) : '' ); + $cust_pkg->set( $col, $value ? parse_datetime($value) : '' ); } } else {