---
 ...-permit_to_define_fine_days_in_issuing_rules.pl |   22 ++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100755 
installer/data/mysql/atomicupdate/0001-bug_2929-permit_to_define_fine_days_in_issuing_rules.pl

diff --git 
a/installer/data/mysql/atomicupdate/0001-bug_2929-permit_to_define_fine_days_in_issuing_rules.pl
 
b/installer/data/mysql/atomicupdate/0001-bug_2929-permit_to_define_fine_days_in_issuing_rules.pl
new file mode 100755
index 0000000..dfe3b6b
--- /dev/null
+++ 
b/installer/data/mysql/atomicupdate/0001-bug_2929-permit_to_define_fine_days_in_issuing_rules.pl
@@ -0,0 +1,22 @@
+#! /usr/bin/perl
+use strict;
+use warnings;
+use C4::Context;
+my $dbh=C4::Context->dbh;
+$dbh->do("ALTER TABLE issuingrules ADD 
+               COLUMN `finedays` int(11) default NULL AFTER `fine`,
+               COLUMN `renewalsallowed` smallint(6) default NULL, 
+               COLUMN `reservesallowed` smallint(6) default NULL,
+               ");
+$sth = $dbh->prepare("SELECT itemtype, renewalsallowed FROM itemtypes");
+$sth->execute();
+
+my $sthupd = $dbh->prepare("UPDATE issuingrules SET renewalsallowed = ? WHERE 
itemtype = ?");
+    
+while(my $row = $sth->fetchrow_hashref){
+      $sthupd->execute($row->{renewalsallowed}, $row->{itemtype});
+}
+    
+$dbh->do('ALTER TABLE itemtypes DROP COLUMN `renewalsallowed`;');
+    
+print "Upgrade done (Adding finedays renewalsallowed, and reservesallowed 
fields in issuingrules table)\n";
-- 
1.6.0.4

_______________________________________________
Koha-patches mailing list
Koha-patches@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-patches

Reply via email to