[freeside-commits] branch FREESIDE_3_BRANCH updated. 8a31f9fec781bca37c15412928b9b4b16940d2fa
Mark Wells
mark at 420.am
Sat Jan 25 14:49:47 PST 2014
The branch, FREESIDE_3_BRANCH has been updated
via 8a31f9fec781bca37c15412928b9b4b16940d2fa (commit)
from 04192606902f3e675dcd040b489915eb4a40b635 (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 8a31f9fec781bca37c15412928b9b4b16940d2fa
Author: Mark Wells <mark at freeside.biz>
Date: Sat Jan 25 14:48:02 2014 -0800
more useful error messages when changing packages, related to #27194
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 4e55d03..12a0c40 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -1808,7 +1808,7 @@ sub change {
$error = $opt->{'cust_location'}->find_or_insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return "inserting cust_location (transaction rolled back): $error";
+ return "creating location record: $error";
}
$opt->{'locationnum'} = $opt->{'cust_location'}->locationnum;
}
@@ -1863,7 +1863,7 @@ sub change {
my $error = $cust_main->insert( @{ $opt->{cust_main_insert_args}||[] } );
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return "inserting cust_main (transaction rolled back): $error";
+ return "inserting customer record: $error";
}
}
$custnum = $cust_main->custnum;
@@ -1898,7 +1898,7 @@ sub change {
}
if ($error) {
$dbh->rollback if $oldAutoCommit;
- return $error;
+ return "inserting new package: $error";
}
# Transfer services and cancel old package.
@@ -1907,7 +1907,7 @@ sub change {
if ($error and $error == 0) {
# $old_pkg->transfer failed.
$dbh->rollback if $oldAutoCommit;
- return $error;
+ return "transferring $error";
}
if ( $error > 0 && $conf->exists('cust_pkg-change_svcpart') ) {
@@ -1916,7 +1916,7 @@ sub change {
if ($error and $error == 0) {
# $old_pkg->transfer failed.
$dbh->rollback if $oldAutoCommit;
- return $error;
+ return "converting $error";
}
}
@@ -1928,7 +1928,7 @@ sub change {
# Transfers were successful, but we still had services left on the old
# package. We can't change the package under this circumstances, so abort.
$dbh->rollback if $oldAutoCommit;
- return "Unable to transfer all services from package ". $self->pkgnum;
+ return "unable to transfer all services";
}
#reset usage if changing pkgpart
@@ -1943,7 +1943,7 @@ sub change {
if ($error) {
$dbh->rollback if $oldAutoCommit;
- return "Error setting usage values: $error";
+ return "setting usage values: $error";
}
} else {
# if NOT changing pkgpart, transfer any usage pools over
@@ -1952,7 +1952,7 @@ sub change {
$error = $usage->replace;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return "Error transferring usage pools: $error";
+ return "transferring usage pools: $error";
}
}
}
@@ -1969,7 +1969,7 @@ sub change {
$error = $new_discount->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return "Error transferring discounts: $error";
+ return "transferring discounts: $error";
}
}
}
@@ -1982,7 +1982,7 @@ sub change {
$error = $new_detail->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return "Error transferring package notes: $error";
+ return "transferring package notes: $error";
}
}
@@ -2061,7 +2061,7 @@ sub change {
);
if ($error) {
$dbh->rollback if $oldAutoCommit;
- return $error;
+ return "canceling old package: $error";
}
if ( $conf->exists('cust_pkg-change_pkgpart-bill_now') ) {
@@ -2071,7 +2071,7 @@ sub change {
);
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
- return $error;
+ return "billing new package: $error";
}
}
@@ -3568,13 +3568,14 @@ sub transfer {
}
foreach my $cust_svc ($self->cust_svc) {
+ my $svcnum = $cust_svc->svcnum;
if($target{$cust_svc->svcpart} > 0
or $FS::cust_svc::ignore_quantity) { # maybe should be a 'force' option
$target{$cust_svc->svcpart}--;
my $new = new FS::cust_svc { $cust_svc->hash };
$new->pkgnum($dest_pkgnum);
my $error = $new->replace($cust_svc);
- return $error if $error;
+ return "svcnum $svcnum: $error" if $error;
} elsif ( exists $opt{'change_svcpart'} && $opt{'change_svcpart'} ) {
if ( $DEBUG ) {
warn "looking for alternates for svcpart ". $cust_svc->svcpart. "\n";
@@ -3595,7 +3596,7 @@ sub transfer {
$new->svcpart($change_svcpart);
$new->pkgnum($dest_pkgnum);
my $error = $new->replace($cust_svc);
- return $error if $error;
+ return "svcnum $svcnum: $error" if $error;
} else {
$remaining++;
}
-----------------------------------------------------------------------
Summary of changes:
FS/FS/cust_pkg.pm | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
More information about the freeside-commits
mailing list