MT 2050, Follow-up, Fast Cataloging
[koha.git] / installer / data / mysql / updatedatabase.pl
index 7dba9d5..ea7f84a 100755 (executable)
@@ -2467,56 +2467,42 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     print "Upgrade to $DBversion done (added FilterBeforeOverdueReport syspref and new index on authorised_values)\n";
 }
 
-$DBversion = '3.01.00.038';
+$DBversion = "3.01.00.038";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    $dbh->do('ALTER TABLE issuingrules DROP FOREIGN KEY issuingrules_ibfk_1');
-    $dbh->do('ALTER TABLE issuingrules DROP FOREIGN KEY issuingrules_ibfk_2');
+    # update branches table
+    # 
+    $dbh->do("ALTER TABLE branches ADD `branchzip` varchar(25) default NULL AFTER `branchaddress3`");
+    $dbh->do("ALTER TABLE branches ADD `branchcity` mediumtext AFTER `branchzip`");
+    $dbh->do("ALTER TABLE branches ADD `branchcountry` text AFTER `branchcity`");
+    $dbh->do("ALTER TABLE branches ADD `branchurl` mediumtext AFTER `branchemail`");
+    $dbh->do("ALTER TABLE branches ADD `branchnotes` mediumtext AFTER `branchprinter`");
+    print "Upgrade to $DBversion done (add ZIP, city, country, URL, and notes column to branches)\n";
     SetVersion ($DBversion);
-    print "Upgrade to $DBversion done (deleting contraints in issuingrules)\n";
 }
 
 $DBversion = '3.01.00.039';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    $dbh->do('ALTER TABLE issuingrules ADD COLUMN `renewalsallowed` smallint(6) NOT NULL default "0" AFTER `issuelength`;');
-    $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`;');
-    
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '<itemcallnumber><copynumber>', '30|10', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.', 'Textarea')");
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo')");
     SetVersion ($DBversion);
-    print "Upgrade to $DBversion done (Moving allowed renewals from itemtypes to issuingrule)\n";
+    print "Upgrade to $DBversion done (added SpineLabelFormat and SpineLabelAutoPrint sysprefs)\n";
 }
 
 $DBversion = '3.01.00.040';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    $dbh->do('ALTER TABLE issuingrules ADD COLUMN `reservesallowed` smallint(6) NOT NULL default "0" AFTER `renewalsallowed`;');
-    
-    my $maxreserves = C4::Context->preference('maxreserves');
-    $sth = $dbh->prepare('UPDATE issuingrules SET reservesallowed = ?;');
-    $sth->execute($maxreserves);
-    
-    $dbh->do('DELETE FROM systempreferences WHERE variable = "maxreserves";');
-
-    $dbh->do("INSERT INTO systempreferences (variable,value, options, explanation, type) VALUES('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice')");
-    
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('AllowHoldDateInFuture','0','If set a date field is displayed on the Hold screen of the Staff Interface, allowing the hold date to be set in the future.','','YesNo')");
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('OPACAllowHoldDateInFuture','0','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','','YesNo')");
     SetVersion ($DBversion);
-    print "Upgrade to $DBversion done (Moving max allowed reserves from system preference to issuingrule)\n";
+    print "Upgrade to $DBversion done (AllowHoldDateInFuture and OPACAllowHoldDateInFuture sysprefs)\n";
 }
 
-$DBversion = "3.01.00.041";
+$DBversion = '3.01.00.041';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
-    $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 13, 'batchmod', 'Perform batch modification of items')");
-    $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 13, 'batchdel', 'Perform batch deletion of items')");
-    print "Upgrade to $DBversion done (added permissions for batch modification and deletion)\n";
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSPrivateKey','','See:  http://aws.amazon.com.  Note that this is required after 2009/08/15 in order to retrieve any enhanced content other than book covers from Amazon.','','free')");
+    SetVersion ($DBversion);
+    print "Upgrade to $DBversion done (added AWSPrivateKey syspref - note that if you use enhanced content from Amazon, this should be set right away.)\n";
 }
 
-
 $DBversion = '3.01.00.042';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACFineNoRenewals','99999','Fine Limit above which user canmot renew books via OPAC','','Integer')");
@@ -2692,7 +2678,132 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 $DBversion = "3.01.00.062";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 13, 'manage_csv_profiles', 'Manage CSV export profiles')");
-    print "Upgrade to $DBversion done (added permissions for csv export profiles)\n";
+    $dbh->do(q/
+       CREATE TABLE `export_format` (
+         `export_format_id` int(11) NOT NULL auto_increment,
+         `profile` varchar(255) NOT NULL,
+         `description` mediumtext NOT NULL,
+         `marcfields` mediumtext NOT NULL,
+         PRIMARY KEY  (`export_format_id`)
+       ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Used for CSV export';
+    /);
+    print "Upgrade to $DBversion done (added csv export profiles)\n";
+}
+
+$DBversion = "3.01.00.063";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("
+        CREATE TABLE `fieldmapping` (
+          `id` int(11) NOT NULL auto_increment,
+          `field` varchar(255) NOT NULL,
+          `frameworkcode` char(4) NOT NULL default '',
+          `fieldcode` char(3) NOT NULL,
+          `subfieldcode` char(1) NOT NULL,
+          PRIMARY KEY  (`id`)
+        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+             ");
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.01.00.064';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do('ALTER TABLE issuingrules DROP FOREIGN KEY issuingrules_ibfk_1');
+    $dbh->do('ALTER TABLE issuingrules DROP FOREIGN KEY issuingrules_ibfk_2');
+    SetVersion ($DBversion);
+    print "Upgrade to $DBversion done (deleting contraints in issuingrules)\n";
+}
+
+$DBversion = '3.01.00.065';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do('ALTER TABLE issuingrules ADD COLUMN `renewalsallowed` smallint(6) NOT NULL default "0" AFTER `issuelength`;');
+    $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`;');
+    
+    SetVersion ($DBversion);
+    print "Upgrade to $DBversion done (Moving allowed renewals from itemtypes to issuingrule)\n";
+}
+
+$DBversion = '3.01.00.066';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do('ALTER TABLE issuingrules ADD COLUMN `reservesallowed` smallint(6) NOT NULL default "0" AFTER `renewalsallowed`;');
+    
+    my $maxreserves = C4::Context->preference('maxreserves');
+    $sth = $dbh->prepare('UPDATE issuingrules SET reservesallowed = ?;');
+    $sth->execute($maxreserves);
+    
+    $dbh->do('DELETE FROM systempreferences WHERE variable = "maxreserves";');
+
+    $dbh->do("INSERT INTO systempreferences (variable,value, options, explanation, type) VALUES('ReservesControlBranch','PatronLibrary','ItemHomeLibrary|PatronLibrary','Branch checked for members reservations rights','Choice')");
+    
+    SetVersion ($DBversion);
+    print "Upgrade to $DBversion done (Moving max allowed reserves from system preference to issuingrule)\n";
+}
+
+$DBversion = "3.01.00.067";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 13, 'batchmod', 'Perform batch modification of items')");
+    $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 13, 'batchdel', 'Perform batch deletion of items')");
+    print "Upgrade to $DBversion done (added permissions for batch modification and deletion)\n";
+}
+
+$DBversion = "3.01.00.068";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $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,
+                       ");
+       my $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";
+}
+
+
+$DBversion = "3.01.00.069";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do("INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('EnableOpacSearchHistory', '1', '', 'Enable or disable opac search history', 'YesNo')");
+
+       my $create = <<SEARCHHIST;
+CREATE TABLE IF NOT EXISTS `search_history` (
+  `userid` int(11) NOT NULL,
+  `sessionid` varchar(32) NOT NULL,
+  `query_desc` varchar(255) NOT NULL,
+  `query_cgi` varchar(255) NOT NULL,
+  `total` int(11) NOT NULL,
+  `time` timestamp NOT NULL default CURRENT_TIMESTAMP,
+  KEY `userid` (`userid`),
+  KEY `sessionid` (`sessionid`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Opac search history results';
+SEARCHHIST
+       $dbh->do($create);
+
+       print "Upgrade done (added OPAC search history preference and table)\n";
+}
+
+$DBversion = "3.01.00.071";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do("ALTER TABLE authorised_values ADD COLUMN `lib_opac` VARCHAR(80) default NULL AFTER `lib`");
+       print "Upgrade done (Added a lib_opac field in authorised_values table)\n";
+}
+
+$DBversion = "3.01.00.071";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do("ALTER TABLE `subscription` ADD `enddate` date default NULL");
+       $dbh->do("ALTER TABLE subscriptionhistory CHANGE enddate histenddate DATE default NULL");
+       print "Upgrade to $DBversion done ( Adding enddate to subscription)\n";
 }
 
 =item
@@ -2709,7 +2820,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     # fill AnonymousPatron with AnonymousSuggestion value (copy)
     my $sth=$dbh->prepare("SELECT value FROM systempreferences WHERE variable='AnonSuggestions'");
     $sth->execute;
-    my ($value) = $sth->fetchrow();
+    my ($value) = $sth->fetchrow() || 0;
     $dbh->do("UPDATE systempreferences SET value='$value' WHERE variable='AnonymousPatron'");
     # set AnonymousSuggestion do YesNo
     # 1st, set the value (1/True if it had a borrowernumber)
@@ -2772,8 +2883,8 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
                          CONSTRAINT `aqbasketgroups_ibfk_1` FOREIGN KEY (`booksellerid`) REFERENCES `aqbooksellers` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
                          ) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     $dbh->do("ALTER TABLE aqbasket ADD COLUMN `basketgroupid` int(11)");
-    $dbh->do("ALTER TABLE aqbasket ADD FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE");
-    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('pdfformat','pdfformat/example.pl','Controls what script is used for printing (basketgroups)','','free')");
+    $dbh->do("ALTER TABLE aqbasket ADD FOREIGN KEY (`basketgroupid`) REFERENCES `aqbasketgroups` (`id`) ON UPDATE CASCADE ON DELETE SET NULL");
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('pdfformat','pdfformat::example','Controls what script is used for printing (basketgroups)','','free')");
     print "Upgrade to $DBversion done (adding basketgroups)\n";
     SetVersion ($DBversion);
 }
@@ -3006,28 +3117,19 @@ $DBversion = "3.01.00.114";
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do(<<SUGGESTIONS);
 ALTER table suggestions 
-       ADD budgetid INT(11),
-       ADD branchcode VARCHAR(10) default NULL,
-       ADD acceptedby INT(11) default NULL,
-       ADD acceptedon date default NULL,
-       ADD suggestedby INT(11) default NULL,
-       ADD suggestedon date default NULL,
-       ADD managedby INT(11) default NULL,
-       ADD managedon date default NULL,
-       ADD rejectedby INT(11) default NULL,
-       ADD rejectedon date default NULL,
-       ADD collectiontitle text default NULL,
-       ADD itemtype VARCHAR(30) default NULL,
-       ADD biblionumber INT(11) default NULL,
-       ADD sort1 VARCHAR(80) default NULL,
-       ADD sort2 VARCHAR(80) default NULL
-       ;
+    ADD budgetid INT(11),
+    ADD branchcode VARCHAR(10) default NULL,
+    ADD acceptedby INT(11) default NULL,
+    ADD accepteddate date default NULL,
+    ADD suggesteddate date default NULL,
+    ADD manageddate date default NULL,
+    ADD rejectedby INT(11) default NULL,
+    ADD rejecteddate date default NULL,
+    ADD collectiontitle text default NULL,
+    ADD itemtype VARCHAR(30) default NULL,
+    ;
 SUGGESTIONS
-
-    print <<COMMENT;
-Upgrade to $DBversion done  
-       Suggestions
-COMMENT
+    print "Upgrade to $DBversion done Suggestions";
     SetVersion ($DBversion);
 }
 
@@ -3038,7 +3140,168 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.01.00.116";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do(  qq# INSERT INTO `systempreferences` VALUES ('intranetbookbag','1','','If ON, enables display of Cart feature in the intranet','YesNo')  #);
+
+    print "Upgrade to $DBversion done (intranetbookbag syspref added)\n";
+    SetVersion ($DBversion);
+}
 
+$DBversion = "3.01.00.117";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do(  qq# ALTER TABLE authorised_values ADD COLUMN `lib_opac` VARCHAR(80) default NULL AFTER `lib` #);
+
+    print "Upgrade to $DBversion done (opac authorised values added)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.118";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+$dbh->do("
+       INSERT INTO `permissions` (`module_bit`, `code`, `description`) VALUES
+               (16, 'execute_reports', 'Execute SQL reports'),
+               (16, 'create_reports', 'Create SQL Reports')
+       ");
+
+    print "Upgrade to $DBversion done (granular permissions for guided reports added)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.119";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+$dbh->do("
+       UPDATE `systempreferences` SET `options` = 'holdings|serialcollection|subscriptions'
+       WHERE `systempreferences`.`variable` = 'opacSerialDefaultTab' LIMIT 1 
+       ");
+
+    print "Upgrade to $DBversion done (opac-detail default tag updated)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.120";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    if (C4::Context->preference("opaclanguages") =~ /fr/) {
+       $dbh->do(qq{
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingListAddReserves','1','Si activé, des reservations sont automatiquement créées pour chaque lecteur de la liste de circulation d''un numéro de périodique','','YesNo');
+       });
+       }else{
+       $dbh->do(qq{
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('RoutingListAddReserves','1','If ON the patrons on routing lists are automatically added to holds on the issue.','','YesNo');
+       });
+       }
+    print "Upgrade to $DBversion done (Added RoutingListAddReserves syspref)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.121";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do(qq{
+       ALTER TABLE biblioitems ADD INDEX issn_idx (issn);
+       });
+    print "Upgrade to $DBversion done (added index to ISSN)\n";
+    SetVersion ($DBversion);
+}
+
+=item
+
+    Deal with branches
+
+=cut
+
+my $DBversion = "3.01.00.0122";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    # update branches table
+    # 
+    $dbh->do("ALTER TABLE branches ADD `branchzip` varchar(25) default NULL AFTER `branchaddress3`");
+    $dbh->do("ALTER TABLE branches ADD `branchcity` mediumtext AFTER `branchzip`");
+    $dbh->do("ALTER TABLE branches ADD `branchcountry` text AFTER `branchcity`");
+    $dbh->do("ALTER TABLE branches ADD `branchurl` mediumtext AFTER `branchemail`");
+    $dbh->do("ALTER TABLE branches ADD `branchnotes` mediumtext AFTER `branchprinter`");
+    print "Upgrade to $DBversion done (branches)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.123";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do(qq{
+       ALTER TABLE aqbasketgroups ADD deliveryplace VARCHAR(10) default NULL, ADD deliverycomment VARCHAR(255) default NULL;
+       });
+       
+    print "Upgrade to $DBversion done (adding deliveryplace deliverycomment to basketgroups)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.124";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do(qq{
+       ALTER TABLE items ADD stocknumber VARCHAR(32) DEFAULT NULL COMMENT "stores the inventory number";
+       });
+       $dbh->do(qq{
+       ALTER TABLE items ADD UNIQUE INDEX itemsstocknumberidx (stocknumber);
+       });
+       $dbh->do(qq{
+       ALTER TABLE deleteditems ADD stocknumber VARCHAR(32) DEFAULT NULL COMMENT "stores the inventory number of deleted items";
+       });
+       $dbh->do(qq{
+       ALTER TABLE deleteditems ADD UNIQUE INDEX deleteditemsstocknumberidx (stocknumber);
+       });
+       if (C4::Context->preference('marcflavour') eq 'UNIMARC'){
+               $dbh->do(qq{
+       INSERT IGNORE INTO marc_subfield_structure (frameworkcode,tagfield, tagsubfield, tab, repeatable, mandatory,kohafield) 
+       SELECT DISTINCT (frameworkcode),995,"j",10,0,0,"items.stocknumber" from biblio_framework ;
+               });
+               #Previously, copynumber was used as stocknumber
+               $dbh->do(qq{
+       UPDATE items set stocknumber=copynumber;
+               });
+               $dbh->do(qq{
+       UPDATE items set copynumber=NULL;
+               });
+       }       
+    print "Upgrade to $DBversion done (stocknumber field added)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.125";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OrderPdfTemplate','','Uploads a PDF template to use for printing baskets','NULL','Upload')");
+    $dbh->do("UPDATE systempreferences SET variable='OrderPdfFormat' WHERE variable='pdfformat'");
+    print "Upgrade to $DBversion done (PDF orders system preferences added and updated)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.127";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do(qq{
+       ALTER TABLE aqbasketgroups ADD billingplace VARCHAR(10) NOT NULL AFTER deliverycomment;
+       });
+       
+    print "Upgrade to $DBversion done (Adding billingplace to aqbasketgroups)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.128";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do(qq{
+       ALTER TABLE auth_subfield_structure MODIFY frameworkcode VARCHAR(10) NULL;
+       });
+       
+    print "Upgrade to $DBversion done (changing frameworkcode length in auth_subfield_structure)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.01.00.128";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+       $dbh->do(qq{
+               INSERT INTO `permissions` (`module_bit`, `code`, `description`) VALUES
+                (9, 'edit_catalogue', 'Edit catalogue'),
+               (9, 'fast_cataloging', 'Fast cataloging')
+       });
+       
+    print "Upgrade to $DBversion done (granular permissions for cataloging added)\n";
+    SetVersion ($DBversion);
+}
 
 =item DropAllForeignKeys($table)
 
@@ -3046,6 +3309,7 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 
 =cut
 
+
 sub DropAllForeignKeys {
     my ($table) = @_;
     # get the table description