+ $cgi->param('svcpart') =~ /^(\-?\d*)$/
+ or die 'illegal svcpart '. $cgi->param('svcpart');
+ $svcpart = $1;
+ $part_svc = qsearchs('part_svc', { 'svcpart' => $svcpart } )
+ or die "unknown svcpart $svcpart";
+}
+
+my $qualnum = '';
+if ( $cgi->param('qualnum') =~ /^(\d+)$/ ) {
+ $qualnum = $1;
+}
+my $quotationnum = '';
+if ( $cgi->param('quotationnum') =~ /^(\d+)$/ ) {
+ $quotationnum = $1;
+}
+# verify this quotation is visible to this user
+
+my $cust_pkg = '';
+my $quotation_pkg = '';
+my $error = '';
+
+my %hash = (
+ 'pkgpart' => $pkgpart,
+ 'quantity' => $quantity,
+ 'salesnum' => $salesnum,
+ 'refnum' => $refnum,
+ 'contactnum' => $contactnum,
+ 'locationnum' => $locationnum,
+ 'discountnum' => $discountnum,
+ #for the create a new discount case
+ 'discountnum__type' => scalar($cgi->param('discountnum__type')),
+ 'discountnum_amount' => scalar($cgi->param('discountnum_amount')),
+ 'discountnum_percent' => scalar($cgi->param('discountnum_percent')),
+ 'discountnum_months' => scalar($cgi->param('discountnum_months')),
+ 'discountnum_setup' => scalar($cgi->param('discountnum_setup')),
+ 'contract_end' => ( scalar($cgi->param('contract_end'))
+ ? parse_datetime($cgi->param('contract_end'))
+ : ''
+ ),
+ 'waive_setup' => ( $cgi->param('waive_setup') eq 'Y' ? 'Y' : '' ),
+);
+$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'))
+ : '';