[freeside-commits] branch FREESIDE_4_BRANCH updated. 569c8e243c450b46cc4d28d513a4e83d6128d03c
Ivan
ivan at 420.am
Tue Nov 1 16:21:02 PDT 2016
The branch, FREESIDE_4_BRANCH has been updated
via 569c8e243c450b46cc4d28d513a4e83d6128d03c (commit)
from f54d295490980875e4762ee008b9de7c6471ec77 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 569c8e243c450b46cc4d28d513a4e83d6128d03c
Author: Ivan Kohler <ivan at freeside.biz>
Date: Tue Nov 1 16:21:00 2016 -0700
fix adding a new location on a quotation, RT#73236
diff --git a/FS/FS/quotation_pkg.pm b/FS/FS/quotation_pkg.pm
index 9854c45..3f6742c 100644
--- a/FS/FS/quotation_pkg.pm
+++ b/FS/FS/quotation_pkg.pm
@@ -121,6 +121,22 @@ sub insert {
my $oldAutoCommit = $FS::UID::AutoCommit;
local $FS::UID::AutoCommit = 0;
+ #false laziness w/cust_main::Packages::order_pkg
+ if ( $options{'locationnum'} and $options{'locationnum'} != -1 ) {
+
+ $self->locationnum($options{'locationnum'});
+
+ } elsif ( $options{'cust_location'} ) {
+
+ my $error = $options{'cust_location'}->find_or_insert;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "inserting cust_location (transaction rolled back): $error";
+ }
+ $self->locationnum($options{'cust_location'}->locationnum);
+
+ }
+
my $error = $self->SUPER::insert;
if ( !$error and ($self->setup_discountnum || $self->recur_discountnum) ) {
diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi
index da5afe4..6a346e0 100644
--- a/httemplate/edit/process/quick-cust_pkg.cgi
+++ b/httemplate/edit/process/quick-cust_pkg.cgi
@@ -189,7 +189,18 @@ if ( $quotationnum ) {
)
: ();
- #XXX handle new location
+ if ( $locationnum == -1 ) {
+ my $cust_location = FS::cust_location->new({
+ 'custnum' => $custnum,
+ 'prospectnum' => $prospectnum,
+ map { $_ => scalar($cgi->param($_)) }
+ FS::cust_main->location_fields
+ });
+ $opt{'cust_location'} = $cust_location;
+ } else {
+ $opt{'locationnum'} = $locationnum;
+ }
+
$error = $quotation_pkg->insert(%opt);
} else {
-----------------------------------------------------------------------
Summary of changes:
FS/FS/quotation_pkg.pm | 16 ++++++++++++++++
httemplate/edit/process/quick-cust_pkg.cgi | 13 ++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
More information about the freeside-commits
mailing list