[freeside-commits] freeside/FS/FS svc_Common.pm,1.56,1.57
Ivan,,,
ivan at wavetail.420.am
Mon Mar 1 13:56:57 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv28048/FS/FS
Modified Files:
svc_Common.pm
Log Message:
fix up editing services w/manual select from inventory, RT#7010
Index: svc_Common.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_Common.pm,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -w -d -r1.56 -r1.57
--- svc_Common.pm 1 Mar 2010 19:38:29 -0000 1.56
+++ svc_Common.pm 1 Mar 2010 21:56:55 -0000 1.57
@@ -401,7 +401,7 @@
local $FS::UID::AutoCommit = 0;
my $dbh = dbh;
- my $error = $new->set_auto_inventory;
+ my $error = $new->set_auto_inventory($old);
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
return $error;
@@ -694,6 +694,7 @@
sub set_auto_inventory {
my $self = shift;
+ my $old = @_ ? shift : '';
my $error =
$self->ut_numbern('svcnum')
@@ -762,6 +763,24 @@
return "Error provisioning inventory: $ierror";
}
+ if ( $old && $old->$field() && $old->$field() ne $self->$field() ) {
+ my $old_inv = qsearchs({
+ 'table' => 'inventory_item',
+ 'hashref' => { 'classnum' => $classnum,
+ 'svcnum' => $old->svcnum,
+ 'item' => $old->$field(),
+ },
+ });
+ if ( $old_inv ) {
+ $old_inv->svcnum('');
+ my $oerror = $old_inv->replace;
+ if ( $oerror ) {
+ $dbh->rollback if $oldAutoCommit;
+ return "Error unprovisioning inventory: $oerror";
+ }
+ }
+ }
+
}
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
More information about the freeside-commits
mailing list