[freeside-commits] freeside/FS/FS Upgrade.pm, 1.46, 1.47 TicketSystem.pm, 1.3, 1.4
Mark Wells
mark at wavetail.420.am
Tue Nov 30 12:24:04 PST 2010
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv20332/FS/FS
Modified Files:
Upgrade.pm TicketSystem.pm
Log Message:
auto-insert CustomFieldChange scrip condition, from RT#10139
Index: TicketSystem.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/TicketSystem.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -w -d -r1.3 -r1.4
--- TicketSystem.pm 15 Oct 2005 11:29:53 -0000 1.3
+++ TicketSystem.pm 30 Nov 2010 20:24:02 -0000 1.4
@@ -3,7 +3,7 @@
use strict;
use vars qw( $conf $system $AUTOLOAD );
use FS::Conf;
-use FS::UID;
+use FS::UID qw( dbh driver_name );
FS::UID->install_callback( sub {
$conf = new FS::Conf;
@@ -27,4 +27,26 @@
$self->$sub(@_);
}
+sub _upgrade_data {
+ return if $system ne 'RT_Internal';
+
+ my ($class, %opts) = @_;
+ my ($t, $exec, @fields) = map { driver_name =~ /^mysql/i ? $_ : lc($_) }
+ (qw( ScripConditions ExecModule
+ Name Description ExecModule ApplicableTransTypes
+ Creator Created LastUpdatedBy LastUpdated));
+ my $count_sql = "SELECT COUNT(*) FROM $t WHERE $exec = 'CustomFieldChange'";
+ my $sth = dbh->prepare($count_sql) or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+ my $total = $sth->fetchrow_arrayref->[0];
+ return if $total > 0;
+
+ my $insert_sql = "INSERT INTO $t (".join(',', at fields).") VALUES (".
+ "'On Custom Field Change', 'When a custom field is changed to some value',
+ 'CustomFieldChange', 'Any', 1, CURRENT_DATE, 1, CURRENT_DATE )";
+ $sth = dbh->prepare($insert_sql) or die dbh->errstr;
+ $sth->execute or die $sth->errstr;
+ return;
+}
+
1;
Index: Upgrade.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Upgrade.pm,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -w -d -r1.46 -r1.47
--- Upgrade.pm 10 Nov 2010 19:18:31 -0000 1.46
+++ Upgrade.pm 30 Nov 2010 20:24:01 -0000 1.47
@@ -182,6 +182,9 @@
#return unprovisioned numbers to availability
'phone_avail' => [],
+ #insert scripcondition
+ 'TicketSystem' => [],
+
;
\%hash;
More information about the freeside-commits
mailing list