[freeside-commits] freeside/FS/FS part_pkg.pm,1.120,1.121
Erik Levinson
levinse at wavetail.420.am
Thu Jun 16 19:48:46 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv13819/FS/FS
Modified Files:
part_pkg.pm
Log Message:
CDR rating: migrate use_disposition and use_disposition_taqua to disposition_in, RT10991
Index: part_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_pkg.pm,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -w -d -r1.120 -r1.121
--- part_pkg.pm 10 Jun 2011 03:33:43 -0000 1.120
+++ part_pkg.pm 17 Jun 2011 02:48:44 -0000 1.121
@@ -1484,6 +1484,40 @@
die $error if $error;
}
}
+
+ # migrate use_disposition_taqua and use_disposition to disposition_in
+ @part_pkg_option = qsearch('part_pkg_option',
+ { 'optionname' => { op => 'LIKE',
+ value => 'use_disposition%',
+ },
+ 'optionvalue' => 1,
+ });
+ my %newopts = map { $_->pkgpart => $_ }
+ qsearch('part_pkg_option', { 'optionname' => 'disposition_in', } );
+ foreach my $old_opt (@part_pkg_option) {
+ my $pkgpart = $old_opt->pkgpart;
+ my $newval = $old_opt->optionname eq 'use_disposition_taqua' ? '100'
+ : 'ANSWERED';
+ my $error = $old_opt->delete;
+ die $error if $error;
+
+ if ( exists($newopts{$pkgpart}) ) {
+ my $opt = $newopts{$pkgpart};
+ $opt->optionvalue($opt->optionvalue.",$newval");
+ $error = $opt->replace;
+ die $error if $error;
+ } else {
+ my $new_opt = new FS::part_pkg_option {
+ 'pkgpart' => $pkgpart,
+ 'optionname' => 'disposition_in',
+ 'optionvalue' => $newval,
+ };
+ $error = $new_opt->insert;
+ die $error if $error;
+ $newopts{$pkgpart} = $new_opt;
+ }
+ }
+
}
=item curuser_pkgs_sql
More information about the freeside-commits
mailing list