Bug 8977:replace unitialized directory var in printoverdues
[koha_fer] / installer / data / mysql / updatedatabase.pl
index f28995e..518f23a 100755 (executable)
@@ -5026,7 +5026,8 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     $dbh->do("ALTER TABLE old_issues CHANGE returndate returndate datetime");
     $dbh->do("ALTER TABLE old_issues CHANGE lastreneweddate lastreneweddate datetime");
     $dbh->do("ALTER TABLE old_issues CHANGE issuedate issuedate datetime");
-    print "Upgrade to $DBversion done (Setting up issues tables for hourly loans)\n";
+    $dbh->do("UPDATE accountlines SET description = CONCAT(description,' 23:59') WHERE accounttype='F' OR accounttype='FU'"); #BUG-8253
+    print "Upgrade to $DBversion done (Setting up issues and accountlines tables for hourly loans)\n";
     SetVersion($DBversion);
 }
 
@@ -5617,7 +5618,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
 
     $dbh->do("UPDATE systempreferences SET options = concat(options,'|EAN13'), explanation = concat(explanation,'; EAN13 - incremental') WHERE variable = 'autoBarcode' AND options NOT LIKE '%EAN13%'");
     print "Upgrade to $DBversion done ( Added EAN13 barcode autogeneration sequence )\n";
-
     SetVersion($DBversion);
 }
 
@@ -5769,7 +5769,6 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     SetVersion($DBversion);
 }
 
-
 $DBversion = '3.09.00.044';
 if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     $dbh->do("ALTER TABLE statistics ADD COLUMN ccode VARCHAR ( 10 ) NULL AFTER associatedborrower");
@@ -5928,6 +5927,134 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
 }
 
 
+$DBversion = "3.09.00.053";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do(
+    q|CREATE TABLE `import_auths` (
+        import_record_id int(11) NOT NULL,
+        matched_authid int(11) default NULL,
+        control_number varchar(25) default NULL,
+        authorized_heading varchar(128) default NULL,
+        original_source varchar(25) default NULL,
+        CONSTRAINT import_auths_ibfk_1 FOREIGN KEY (import_record_id)
+        REFERENCES import_records (import_record_id) ON DELETE CASCADE ON UPDATE CASCADE,
+        KEY matched_authid (matched_authid)
+        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;|
+    );
+    $dbh->do("ALTER TABLE import_batches
+                CHANGE COLUMN num_biblios num_records int(11) NOT NULL default 0,
+                ADD COLUMN record_type enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio'");
+    $dbh->do("UPDATE import_batches SET record_type='auth' WHERE import_batch_id IN
+                (SELECT import_batch_id FROM import_records WHERE record_type='auth')");
+    
+    print "Upgrade to $DBversion done (Added support for staging authorities)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.09.00.054";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("ALTER TABLE aqorders CHANGE COLUMN gst gstrate DECIMAL(6,4)  DEFAULT NULL");
+    print "Upgrade to $DBversion done (Change column name in aqorders gst --> gstrate)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.055";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("ALTER TABLE aqorders ADD discount float(6,4) DEFAULT NULL AFTER gstrate");
+    print "Upgrade to $DBversion done (Add discount field in aqorders table)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion ="3.09.00.056";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('AuthDisplayHierarchy','0','Display authority hierarchies','','YesNo')");
+    print "Upgrade to $DBversion done (Add system preference AuthDisplayHierarchy)\n";
+    SetVersion($DBversion);
+}
+
+
+$DBversion = "3.09.00.057";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("ALTER TABLE aqbasket ADD deliveryplace VARCHAR(10) default NULL AFTER basketgroupid;");
+    $dbh->do("ALTER TABLE aqbasket ADD billingplace VARCHAR(10) default NULL AFTER deliveryplace;");
+    print "Upgrade to $DBversion done (Bug 5356: Added billingplace, deliveryplace to the aqbasket table)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion ="3.09.00.058";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidyoumean',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free');");
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free');");
+    print "Upgrade to $DBversion done (Add Did You Mean? configuration)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion ="3.09.00.059";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo');");
+    print "Upgrade to $DBversion done (Add system preference BlockReturnOfWithdrawnItems)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.060";
+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer')");
+    print "Upgrade to $DBversion done (Added HoldsToPullStartDate syspref)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.09.00.061";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("UPDATE systempreferences set value=0 WHERE variable='OPACItemsResultsDisplay' AND value='statuses'");
+    $dbh->do("UPDATE systempreferences set value=1 WHERE variable='OPACItemsResultsDisplay' AND value='itemdetails'");
+    $dbh->do("UPDATE systempreferences SET explanation='If No, show only the status of items in result list. If Yes, show full location of items (branchlocation+callnumber) as in staff interface',options=NULL,type='YesNo' WHERE variable='OPACItemsResultsDisplay'");
+    print "Upgrade to $DBversion done (Fixes Bug 5409, Set the syspref value to 1 if it is itemdetails and 0 if it is statuses, leaving it alone if it is already 1 or 0 and change the type of the syspref to YesNo.)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.09.00.062";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+   $dbh->do("UPDATE systempreferences SET value=0 WHERE variable='NoZebra'");
+   $dbh->do("UPDATE systempreferences SET value=0 WHERE variable='QueryRemoveStopwords'");
+   print "Upgrade to $DBversion done (Disable obsolete NoZebra and QueryRemoveStopwords sysprefs)\n";
+   SetVersion ($DBversion);
+}
+
+$DBversion = "3.09.00.063";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    my $gst_booksellers = $dbh->selectcol_arrayref("SELECT DISTINCT(gstrate) FROM aqbooksellers");
+    my $gist_syspref = C4::Context->preference("gist");
+    # remove the undef values and construct and array with the syspref and the supplier values
+    my @gstrates = map { defined $_ ? $_ : () } @$gst_booksellers;
+    push @gstrates, split ('\|', $gist_syspref);
+    # we want to compare integer (or float)
+    $_ = $_ + 0 for @gstrates;
+    use List::MoreUtils qw/uniq/;
+    # remove duplicate values
+    @gstrates = uniq sort @gstrates;
+    my $new_syspref_value = join '|', @gstrates;
+    # update the syspref with the new values
+    my $sth = $dbh->prepare("UPDATE systempreferences set value=? WHERE variable='gist'");
+    $sth->execute( $new_syspref_value );
+
+    print "Upgrade to $DBversion done (Bug 8832, Set the syspref gist with the existing values)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.09.00.064";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+   $dbh->do('ALTER TABLE items ADD coded_location_qualifier varchar(10) default NULL AFTER itemcallnumber');
+   print "Upgrade to $DBversion done (Bug 6428: Added coded_location_qualifier to the items table)\n";
+   SetVersion ($DBversion);
+}
+
+$DBversion = "3.09.00.065";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+   $dbh->do('ALTER TABLE deleteditems ADD coded_location_qualifier varchar(10) default NULL AFTER itemcallnumber');
+   print "Upgrade to $DBversion done (Bug 6428: Added coded_location_qualifier to the deleteditems table)\n";
+   SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)