[freeside-commits] freeside/httemplate/edit REAL_cust_pkg.cgi, 1.20, 1.20.2.1

Ivan,,, ivan at wavetail.420.am
Sun Nov 29 16:04:25 PST 2009


Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv22389

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	REAL_cust_pkg.cgi 
Log Message:
UI changes to make it impossible to add a start date to a package that already has a setup fee (can still remove an existing start date causing problems), RT#6712

Index: REAL_cust_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/REAL_cust_pkg.cgi,v
retrieving revision 1.20
retrieving revision 1.20.2.1
diff -u -d -r1.20 -r1.20.2.1
--- REAL_cust_pkg.cgi	30 Jun 2009 12:28:37 -0000	1.20
+++ REAL_cust_pkg.cgi	30 Nov 2009 00:04:22 -0000	1.20.2.1
@@ -46,7 +46,12 @@
     <TD BGCOLOR="#ffffff"><% $cust_pkg->otaker %></TD>
   </TR>
 
+% if ( $cust_pkg->setup && ! $cust_pkg->start_date ) {
+  <& .row_display, cust_pkg=>$cust_pkg, column=>'start',   label=>'Start' &>
+% } else {
   <& .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 &>
@@ -144,15 +149,39 @@
 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? ".
-               '<INPUT TYPE="checkbox" NAME="bill_areyousure" VALUE="1">';
+
+  if ( $cgi->param('error') =~ /^_/ ) {
+
+    my @errors = ();
+    my %errors = map { $_=>1 } split(',', $cgi->param('error'));
+    $cgi->param('error', '');
+
+    if ( $errors{'_bill_areyousure'} ) {
+      if ( $cgi->param('bill') =~ /^([\s\d\/\:\-\(\w\)]*)$/ ) {
+        my $bill = $1;
+        push @errors,
+          "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? ".
+          '<INPUT TYPE="checkbox" NAME="bill_areyousure" VALUE="1">';
+      }
+    }
+
+    if ( $errors{'_setup_areyousure'} ) {
+      push @errors,
+        "You are attempting to remove the setup date.  This will re-charge the
+         customer for the setup fee. Are you sure you want to do this? ".
+        '<INPUT TYPE="checkbox" NAME="setup_areyousure" VALUE="1">';
     }
+
+    if ( $errors{'_start'} ) {
+      push @errors,
+        "You are attempting to add a start date to a package that has already
+         started billing.";
+    }
+
+    $error = join('<BR><BR>', @errors );
+
   }
 
   #get package record



More information about the freeside-commits mailing list