X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2FREAL_cust_pkg.cgi;h=99e911ae5999fb39c6a0892de03e766a12a3c2a5;hb=ac272d7302249e13fbf07084087ae642059d63a0;hp=fe6984673d179e4408b54137b079a9257e869804;hpb=49d37cfcbe366b28de81944ebe28e4f768942ec1;p=freeside.git diff --git a/httemplate/edit/REAL_cust_pkg.cgi b/httemplate/edit/REAL_cust_pkg.cgi index fe6984673..99e911ae5 100755 --- a/httemplate/edit/REAL_cust_pkg.cgi +++ b/httemplate/edit/REAL_cust_pkg.cgi @@ -2,7 +2,6 @@ %#, menubar( %# "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum", -%# 'Main Menu' => popurl(2) %#)); @@ -10,12 +9,38 @@ +
+% # raw error from below % if ( $error ) { Error: <% $error %> % } +% #or, regular error handler +<% include('/elements/error.html') %> <% ntable("#cccccc",2) %> @@ -26,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 |h %> @@ -39,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 @@ -81,12 +139,15 @@ + submit_fields.push('<%$column%>'); + + +% } <%def .row_display> @@ -94,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 %> +% } + % } @@ -106,46 +173,47 @@
- +
<% include('/elements/footer.html') %> +<%shared> -<%once> - -#my $format = "%c %z (%Z)"; -my $format = "%m/%d/%Y %T %z (%Z)"; +my $conf = new FS::Conf; +my $date_format = $conf->config('date_format') || '%m/%d/%Y'; -#false laziness w/view/cust_main/packages.html -#my( $billed_or_prepaid, +my $format = $date_format. ' %T'; # %z (%Z)'; - + <%init> +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right('Edit customer package dates'); + + my $error = ''; my( $pkgnum, $cust_pkg ); if ( $cgi->param('error') ) { - $error = $cgi->param('error'); $pkgnum = $cgi->param('pkgnum'); - if ( $error eq '_bill_areyousure' ) { - if ( $cgi->param('bill') =~ /^([\s\d\/\:\-\(\w\)]*)$/ ) { - my $bill = $1; - $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 { @@ -174,4 +242,3 @@ unless ( $part_pkg->is_prepaid ) { } -