projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix sprintf error, mostly #31273
[freeside.git]
/
httemplate
/
edit
/
process
/
quick-cust_pkg.cgi
diff --git
a/httemplate/edit/process/quick-cust_pkg.cgi
b/httemplate/edit/process/quick-cust_pkg.cgi
index
2dadbcc
..
67cdb87
100644
(file)
--- a/
httemplate/edit/process/quick-cust_pkg.cgi
+++ b/
httemplate/edit/process/quick-cust_pkg.cgi
@@
-70,6
+70,12
@@
my $quantity = $1 || 1;
$cgi->param('refnum') =~ /^(\d*)$/
or die 'illegal refnum '. $cgi->param('refnum');
my $refnum = $1;
$cgi->param('refnum') =~ /^(\d*)$/
or die 'illegal refnum '. $cgi->param('refnum');
my $refnum = $1;
+$cgi->param('salesnum') =~ /^(\d*)$/
+ or die 'illegal salesnum '. $cgi->param('salesnum');
+my $salesnum = $1;
+$cgi->param('contactnum') =~ /^(\-?\d*)$/
+ or die 'illegal contactnum '. $cgi->param('contactnum');
+my $contactnum = $1;
$cgi->param('locationnum') =~ /^(\-?\d*)$/
or die 'illegal locationnum '. $cgi->param('locationnum');
my $locationnum = $1;
$cgi->param('locationnum') =~ /^(\-?\d*)$/
or die 'illegal locationnum '. $cgi->param('locationnum');
my $locationnum = $1;
@@
-104,11
+110,9
@@
my $error = '';
my %hash = (
'pkgpart' => $pkgpart,
'quantity' => $quantity,
my %hash = (
'pkgpart' => $pkgpart,
'quantity' => $quantity,
- 'start_date' => ( scalar($cgi->param('start_date'))
- ? parse_datetime($cgi->param('start_date'))
- : ''
- ),
+ 'salesnum' => $salesnum,
'refnum' => $refnum,
'refnum' => $refnum,
+ 'contactnum' => $contactnum,
'locationnum' => $locationnum,
'discountnum' => $discountnum,
#for the create a new discount case
'locationnum' => $locationnum,
'discountnum' => $discountnum,
#for the create a new discount case
@@
-125,6
+129,14
@@
my %hash = (
);
$hash{'custnum'} = $cust_main->custnum if $cust_main;
);
$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;
if ( $quotationnum ) {
$quotation_pkg = new FS::quotation_pkg \%hash;
@@
-132,7
+144,7
@@
if ( $quotationnum ) {
$quotation_pkg->prospectnum($prospect_main->prospectnum) if $prospect_main;
#XXX handle new location
$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 {
} else {
@@
-142,12
+154,22
@@
if ( $quotationnum ) {
my %opt = ( 'cust_pkg' => $cust_pkg );
my %opt = ( 'cust_pkg' => $cust_pkg );
+ if ( $contactnum == -1 ) {
+ my $contact = FS::contact->new({
+ 'custnum' => scalar($cgi->param('custnum')),
+ map { $_ => scalar($cgi->param("contactnum_$_")) } qw( first last )
+ });
+ $opt{'contact'} = $contact;
+ }
+
if ( $locationnum == -1 ) {
if ( $locationnum == -1 ) {
- my $cust_location =
new FS::cust_location
{
+ my $cust_location =
FS::cust_location->new(
{
map { $_ => scalar($cgi->param($_)) }
map { $_ => scalar($cgi->param($_)) }
-
qw( custnum address1 address2 city county state zip country geocode
)
- };
+
('custnum', FS::cust_main->location_fields
)
+ }
)
;
$opt{'cust_location'} = $cust_location;
$opt{'cust_location'} = $cust_location;
+ } else {
+ $opt{'locationnum'} = $locationnum;
}
$error = $cust_main->order_pkg( \%opt );
}
$error = $cust_main->order_pkg( \%opt );