fix sprintf error, mostly #31273
[freeside.git] / httemplate / edit / process / quick-cust_pkg.cgi
index 7dcd232..67cdb87 100644 (file)
@@ -110,10 +110,6 @@ my $error = '';
 my %hash = (
     'pkgpart'              => $pkgpart,
     'quantity'             => $quantity,
-    'start_date'           => ( scalar($cgi->param('start_date'))
-                                  ? parse_datetime($cgi->param('start_date'))
-                                  : ''
-                              ),
     'salesnum'             => $salesnum,
     'refnum'               => $refnum,
     'contactnum'           => $contactnum,
@@ -133,6 +129,14 @@ my %hash = (
 );
 $hash{'custnum'} = $cust_main->custnum if $cust_main;
 
+if ( $cgi->param('start') eq 'on_hold' ) {
+  $hash{'susp'} = 'now';
+} elsif ( $cgi->param('start') eq 'on_date' ) {
+  $hash{'start_date'} = scalar($cgi->param('start_date'))
+                          ? parse_datetime($cgi->param('start_date'))
+                          : '';
+}
+
 if ( $quotationnum ) {
 
   $quotation_pkg = new FS::quotation_pkg \%hash;
@@ -140,7 +144,7 @@ if ( $quotationnum ) {
   $quotation_pkg->prospectnum($prospect_main->prospectnum) if $prospect_main;
 
   #XXX handle new location
-  $error = $quotation_pkg->insert;
+  $error = $quotation_pkg->insert || $quotation_pkg->estimate;
 
 } else {