cust_attachment improvement, RT#4964 and #6225
[freeside.git] / httemplate / edit / REAL_cust_pkg.cgi
index fe69846..5752c8d 100755 (executable)
@@ -2,7 +2,6 @@
 
 %#, menubar(
 %#  "View this customer (#$custnum)" => popurl(2). "view/cust_main.cgi?$custnum",
-%#  'Main Menu' => popurl(2)
 %#));
 
 <LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2">
 <FORM NAME="formname" ACTION="process/REAL_cust_pkg.cgi" METHOD="POST">
 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
 
+% # raw error from below
 % if ( $error ) { 
   <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error %></FONT>
 % } 
+% #or, regular error handler
+<% include('/elements/error.html') %>
 
 <% ntable("#cccccc",2) %>
 
 
   <TR>
     <TD ALIGN="right">Package</TD>
-    <TD BGCOLOR="#ffffff"><% $cust_pkg->pkg %></TD>
+    <TD BGCOLOR="#ffffff"><% $part_pkg->pkg %></TD>
+  </TR>
+
+  <TR>
+    <TD ALIGN="right">Custom</TD>
+    <TD BGCOLOR="#ffffff"><% $part_pkg->custom %></TD>
   </TR>
 
   <TR>
     <TD ALIGN="right">Comment</TD>
-    <TD BGCOLOR="#ffffff"><% $cust_pkg->comment %></TD>
+    <TD BGCOLOR="#ffffff"><% $part_pkg->comment %></TD>
   </TR>
 
   <TR>
     <TD BGCOLOR="#ffffff"><% $cust_pkg->otaker %></TD>
   </TR>
 
+  <& .row_edit, cust_pkg=>$cust_pkg, column=>'start_date', label=>'Start' &>
   <& .row_edit, cust_pkg=>$cust_pkg, column=>'setup',     label=>'Setup' &>
   <& .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 <b>suspend</b> this package when the date is reached)' &>
+  <& .row_display, cust_pkg=>$cust_pkg, column=>'adjourn',   label=>'Adjournment', note=>'(will <b>suspend</b> 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 <b>cancel</b> this package when the date is reached)' &>
+  <& .row_display, cust_pkg=>$cust_pkg, column=>'expire',   label=>'Expiration', note=>'(will <b>cancel</b> this package when the date is reached)' &>
   <& .row_display, cust_pkg=>$cust_pkg, column=>'cancel',   label=>'Cancellation' &>
 
 <%def .row_edit>
   $cust_pkg
   $column
   $label
+  $note => ''
 </%args>
 % if ( $cust_pkg->get($column) ) { 
     <TR>
       <TD ALIGN="right"><% $label %> date</TD>
-      <TD BGCOLOR="#ffffff"><% time2str($format,$cust_pkg->get($column)) %></TD>
+      <TD BGCOLOR="#ffffff"><% time2str($format,$cust_pkg->get($column)) %>
+%       if ( $note ) {
+          <BR><FONT SIZE=-1><% $note %></FONT>
+%       }
+      </TD>
     </TR>
 % } 
 </%def>
@@ -122,16 +135,19 @@ my $format = "%m/%d/%Y %T %z (%Z)";
 </%once>
 <%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('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? ".
@@ -174,4 +190,3 @@ unless ( $part_pkg->is_prepaid ) {
 }
 
 </%init>
-