View | Details | Raw Unified | Return to bug 12933
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_12933.sql (+5 lines)
Line 0 Link Here
1
INSERT INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type )
2
VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLIP', 'The following item(s) is/are currently overdue:
3
4
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
5
', 'print' );
(-)a/installer/data/mysql/de-DE/mandatory/sample_notices.sql (+6 lines)
Lines 137-139 Ihr Biblioheksteam' Link Here
137
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
137
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
138
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Benachrichtigung bei Zugang', 'Bestelltes Medium ist eingetroffen', 'Liebe/r <<borrowers.firstname>> <<borrowers.surname>>,\n\nDie Bestellung <<aqorders.ordernumber>> (<<biblio.title>>) ist eingetroffen und wird bearbeitet.\n\nIhr Bibliotheksteam', 'email'),
138
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Benachrichtigung bei Zugang', 'Bestelltes Medium ist eingetroffen', 'Liebe/r <<borrowers.firstname>> <<borrowers.surname>>,\n\nDie Bestellung <<aqorders.ordernumber>> (<<biblio.title>>) ist eingetroffen und wird bearbeitet.\n\nIhr Bibliotheksteam', 'email'),
139
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
139
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
140
141
INSERT INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type )
142
VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLIP', 'The following item(s) is/are currently overdue:
143
144
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
145
', 'print' );
(-)a/installer/data/mysql/en/mandatory/sample_notices.sql (+6 lines)
Lines 156-158 Your library.' Link Here
156
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
156
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
157
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
157
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
158
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
158
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
159
160
INSERT INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type )
161
VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLIP', 'The following item(s) is/are currently overdue:
162
163
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
164
', 'print' );
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/sample_notices.sql (+6 lines)
Lines 152-154 Your library.' Link Here
152
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
152
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
153
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
153
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
154
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
154
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
155
156
INSERT INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type )
157
VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLIP', 'The following item(s) is/are currently overdue:
158
159
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
160
', 'print' );
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/sample_notices.sql (+6 lines)
Lines 171-173 Your library.' Link Here
171
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
171
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
172
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
172
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
173
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
173
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
174
175
INSERT INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type )
176
VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLIP', 'The following item(s) is/are currently overdue:
177
178
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
179
', 'print' );
(-)a/installer/data/mysql/pl-PL/mandatory/sample_notices.sql (+6 lines)
Lines 149-151 Your library.' Link Here
149
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
149
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
150
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
150
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
151
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
151
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
152
153
INSERT INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type )
154
VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLIP', 'The following item(s) is/are currently overdue:
155
156
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
157
', 'print' );
(-)a/installer/data/mysql/ru-RU/mandatory/sample_notices.sql (+6 lines)
Lines 151-153 Your library.' Link Here
151
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
151
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
152
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
152
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
153
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
153
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
154
155
INSERT INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type )
156
VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLIP', 'The following item(s) is/are currently overdue:
157
158
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
159
', 'print' );
(-)a/installer/data/mysql/uk-UA/mandatory/sample_notices.sql (+6 lines)
Lines 150-152 Your library.' Link Here
150
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
150
INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
151
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
151
VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email'),
152
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
152
('members','MEMBERSHIP_EXPIRY','','Account expiration','Account expiration','Dear <<borrowers.title>> <<borrowers.firstname>> <<borrowers.surname>>,.\r\n\r\nYour library card will expire soon, on:\r\n\r\n<<borrowers.dateexpiry>>\r\n\r\nThank you,\r\n\r\nLibrarian\r\n\r\n<<branches.branchname>>','email');
153
154
INSERT INTO letter ( module, code, branchcode, name, is_html, title, content, message_transport_type )
155
VALUES ( 'circulation', 'OVERDUES_SLIP', '', 'Overdues Slip', '0', 'OVERDUES_SLIP', 'The following item(s) is/are currently overdue:
156
157
<item>"<<biblio.title>>" by <<biblio.author>>, <<items.itemcallnumber>>, Barcode: <<items.barcode>> Fine: <<items.fine>></item>
158
', 'print' );
(-)a/installer/data/mysql/updatedatabase.pl (-417 / +24 lines)
Lines 6-23 Link Here
6
# Parts copyright Catalyst IT 2011
6
# Parts copyright Catalyst IT 2011
7
7
8
# Part of the Koha Library Software www.koha-community.org
8
# Part of the Koha Library Software www.koha-community.org
9
# Koha is free software; you can redistribute it and/or modify it
9
# Koha is free software; you can redistribute it and/or modify it under the
10
# under the terms of the GNU General Public License as published by
10
# terms of the GNU General Public License as published by the Free Software
11
# the Free Software Foundation; either version 3 of the License, or
11
# Foundation; either version 2 of the License, or (at your option) any later
12
# (at your option) any later version.
12
# version.
13
#
13
#
14
# Koha is distributed in the hope that it will be useful, but
14
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15
# WITHOUT ANY WARRANTY; without even the implied warranty of
15
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
17
# GNU General Public License for more details.
18
#
17
#
19
# You should have received a copy of the GNU General Public License
18
# You should have received a copy of the GNU General Public License along
20
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
# with Koha; if not, write to the Free Software Foundation, Inc.,
20
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
#
21
#
22
22
23
# Bugs/ToDo:
23
# Bugs/ToDo:
Lines 37-44 use Getopt::Long; Link Here
37
use C4::Context;
37
use C4::Context;
38
use C4::Installer;
38
use C4::Installer;
39
use C4::Dates;
39
use C4::Dates;
40
use Koha::Database;
41
use Koha;
42
40
43
use MARC::Record;
41
use MARC::Record;
44
use MARC::File::XML ( BinaryEncoding => 'utf8' );
42
use MARC::File::XML ( BinaryEncoding => 'utf8' );
Lines 59-66 my ( Link Here
59
    $prefitem,          # preference item in systempreferences table
57
    $prefitem,          # preference item in systempreferences table
60
);
58
);
61
59
62
my $schema = Koha::Database->new()->schema();
63
64
my $silent;
60
my $silent;
65
GetOptions(
61
GetOptions(
66
    's' =>\$silent
62
    's' =>\$silent
Lines 3813-3820 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3813
    print "Upgrade to $DBversion done (3.2.0 general release)\n";
3809
    print "Upgrade to $DBversion done (3.2.0 general release)\n";
3814
    SetVersion ($DBversion);
3810
    SetVersion ($DBversion);
3815
}
3811
}
3816
# This is the point where 3.2.x and master diverged, we can use $original_version to make sure we don't
3817
3812
3813
# This is the point where 3.2.x and master diverged, we can use $original_version to make sure we don't
3818
# apply updates that have already been done
3814
# apply updates that have already been done
3819
3815
3820
$DBversion = "3.03.00.001";
3816
$DBversion = "3.03.00.001";
Lines 4945-4996 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4945
4941
4946
$DBversion = "3.07.00.029";
4942
$DBversion = "3.07.00.029";
4947
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4943
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4948
    $dbh->do(q{DROP TABLE IF EXISTS `oai_sets_descriptions`;});
4944
    my $installer = C4::Installer->new();
4949
    $dbh->do(q{DROP TABLE IF EXISTS `oai_sets_mappings`;});
4945
    my $full_path = C4::Context->config('intranetdir') . "/installer/data/$installer->{dbms}/atomicupdate/oai_sets.sql";
4950
    $dbh->do(q{DROP TABLE IF EXISTS `oai_sets_biblios`;});
4946
    my $error     = $installer->load_sql($full_path);
4951
    $dbh->do(q{DROP TABLE IF EXISTS `oai_sets`;});
4947
    warn $error if $error;
4952
4953
    $dbh->do(q{
4954
        CREATE TABLE `oai_sets` (
4955
          `id` int(11) NOT NULL auto_increment,
4956
          `spec` varchar(80) NOT NULL UNIQUE,
4957
          `name` varchar(80) NOT NULL,
4958
          PRIMARY KEY (`id`)
4959
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4960
    });
4961
4962
    $dbh->do(q{
4963
        CREATE TABLE `oai_sets_descriptions` (
4964
          `set_id` int(11) NOT NULL,
4965
          `description` varchar(255) NOT NULL,
4966
          CONSTRAINT `oai_sets_descriptions_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4967
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4968
    });
4969
4970
    $dbh->do(q{
4971
        CREATE TABLE `oai_sets_mappings` (
4972
          `set_id` int(11) NOT NULL,
4973
          `marcfield` char(3) NOT NULL,
4974
          `marcsubfield` char(1) NOT NULL,
4975
          `marcvalue` varchar(80) NOT NULL,
4976
          CONSTRAINT `oai_sets_mappings_ibfk_1` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4977
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4978
    });
4979
4980
    $dbh->do(q{
4981
        CREATE TABLE `oai_sets_biblios` (
4982
          `biblionumber` int(11) NOT NULL,
4983
          `set_id` int(11) NOT NULL,
4984
          PRIMARY KEY (`biblionumber`, `set_id`),
4985
          CONSTRAINT `oai_sets_biblios_ibfk_1` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4986
          CONSTRAINT `oai_sets_biblios_ibfk_2` FOREIGN KEY (`set_id`) REFERENCES `oai_sets` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
4987
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
4988
    });
4989
4990
    $dbh->do(q{
4991
        INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OAI-PMH:AutoUpdateSets','0','Automatically update OAI sets when a bibliographic record is created or updated','','YesNo');
4992
    });
4993
4994
    print "Upgrade to $DBversion done (Atomic update for OAI-PMH sets management)\n";
4948
    print "Upgrade to $DBversion done (Atomic update for OAI-PMH sets management)\n";
4995
    SetVersion($DBversion);
4949
    SetVersion($DBversion);
4996
}
4950
}
Lines 5006-5012 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5006
    $dbh->do("ALTER TABLE default_branch_item_rules ADD
4960
    $dbh->do("ALTER TABLE default_branch_item_rules ADD
5007
            COLUMN `returnbranch` varchar(15) default NULL AFTER `holdallowed`");
4961
            COLUMN `returnbranch` varchar(15) default NULL AFTER `holdallowed`");
5008
    # set the default rule to the current value of HomeOrHoldingBranchReturn (default to 'homebranch' if need be)
4962
    # set the default rule to the current value of HomeOrHoldingBranchReturn (default to 'homebranch' if need be)
5009
    my $homeorholdingbranchreturn = C4::Context->preference('HomeOrHoldingBranchReturn') || 'homebranch';
4963
    my $homeorholdingbranchreturn = C4::Context->prefernce('HomeOrHoldingBranchReturn') || 'homebranch';
5010
    $dbh->do("UPDATE default_circ_rules SET returnbranch = '$homeorholdingbranchreturn'");
4964
    $dbh->do("UPDATE default_circ_rules SET returnbranch = '$homeorholdingbranchreturn'");
5011
    print "Upgrade to $DBversion done (Atomic update for OAI-PMH sets management)\n";
4965
    print "Upgrade to $DBversion done (Atomic update for OAI-PMH sets management)\n";
5012
    SetVersion($DBversion);
4966
    SetVersion($DBversion);
Lines 9668-9674 if ( CheckVersion($DBversion) ) { Link Here
9668
                DROP INDEX userid ,
9622
                DROP INDEX userid ,
9669
                ADD UNIQUE userid (userid)
9623
                ADD UNIQUE userid (userid)
9670
        });
9624
        });
9671
        print "Upgrade to $DBversion done (Bug 1861: Unique patrons logins not (totally) enforced)\n";
9625
        print "Upgrade to $DBversion done (Bug 1861 - Unique patrons logins not (totally) enforced)\n";
9672
    }
9626
    }
9673
9627
9674
    SetVersion($DBversion);
9628
    SetVersion($DBversion);
Lines 9698-10063 if(CheckVersion($DBversion)) { Link Here
9698
        ALTER TABLE borrower_attribute_types MODIFY COLUMN authorised_value_category VARCHAR(32) DEFAULT NULL
9652
        ALTER TABLE borrower_attribute_types MODIFY COLUMN authorised_value_category VARCHAR(32) DEFAULT NULL
9699
    });
9653
    });
9700
9654
9701
    print "Upgrade to $DBversion done (Bug 13379: Modify authorised_values.category to varchar(32))\n";
9655
    print "Upgrade to $DBversion done (Bug 13379 - Modify authorised_values.category to varchar(32))\n";
9702
    SetVersion($DBversion);
9656
    SetVersion($DBversion);
9703
}
9657
}
9704
9658
9705
$DBversion = "3.19.00.006";
9659
$DBversion = "3.19.00.006";
9706
if ( CheckVersion($DBversion) ) {
9660
if ( CheckVersion($DBversion) ) {
9707
    $dbh->do(q|SET foreign_key_checks = 0|);
9661
    $dbh->do(q|SET foreign_key_checks = 0|);;
9708
    my $sth = $dbh->table_info( '','','','TABLE' );
9662
    my @tables = $dbh->tables();
9709
    my ( $cat, $schema, $name, $type, $remarks );
9663
    for my $table ( @tables ) {
9710
    while ( ( $cat, $schema, $name, $type, $remarks ) = $sth->fetchrow_array ) {
9664
        $dbh->do(qq|ALTER TABLE $table CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci|);
9711
        my $table_sth = $dbh->prepare(qq|SHOW CREATE TABLE $name|);
9712
        $table_sth->execute;
9713
        my @table = $table_sth->fetchrow_array;
9714
        unless ( $table[1] =~ /COLLATE=utf8mb4_unicode_ci/ ) { #catches utf8mb4 collated tables
9715
            if ( $name eq 'marc_subfield_structure' ) {
9716
                $dbh->do(q|
9717
                    ALTER TABLE marc_subfield_structure
9718
                    MODIFY COLUMN tagfield varchar(3) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
9719
                    MODIFY COLUMN tagsubfield varchar(1) COLLATE utf8_bin NOT NULL DEFAULT '',
9720
                    MODIFY COLUMN liblibrarian varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
9721
                    MODIFY COLUMN libopac varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
9722
                    MODIFY COLUMN kohafield varchar(40) COLLATE utf8_unicode_ci DEFAULT NULL,
9723
                    MODIFY COLUMN authorised_value varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
9724
                    MODIFY COLUMN authtypecode varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL,
9725
                    MODIFY COLUMN value_builder varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL,
9726
                    MODIFY COLUMN frameworkcode varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
9727
                    MODIFY COLUMN seealso varchar(1100) COLLATE utf8_unicode_ci DEFAULT NULL,
9728
                    MODIFY COLUMN link varchar(80) COLLATE utf8_unicode_ci DEFAULT NULL
9729
                |);
9730
            }
9731
            else {
9732
                $dbh->do(qq|ALTER TABLE $name CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci|);
9733
            }
9734
        }
9735
    }
9665
    }
9736
    $dbh->do(q|SET foreign_key_checks = 1|);;
9666
    $dbh->do(q|SET foreign_key_checks = 1|);;
9737
9667
9738
    print "Upgrade to $DBversion done (Bug 11944: Convert DB tables to utf8_unicode_ci)\n";
9668
    print "Upgrade to $DBversion done (Bug 11944 - Convert DB tables to utf8_unicode_ci)\n";
9739
    SetVersion($DBversion);
9740
}
9741
9742
$DBversion = "3.19.00.007";
9743
if ( CheckVersion($DBversion) ) {
9744
    my $orphan_budgets = $dbh->selectall_arrayref(q|
9745
        SELECT budget_id, budget_name, budget_code
9746
        FROM aqbudgets
9747
        WHERE   budget_parent_id IS NOT NULL
9748
            AND budget_parent_id NOT IN (
9749
                SELECT DISTINCT budget_id FROM aqbudgets
9750
            )
9751
    |, { Slice => {} } );
9752
9753
    if ( @$orphan_budgets ) {
9754
        for my $b ( @$orphan_budgets ) {
9755
            print "Fund $b->{budget_name} (code:$b->{budget_code}, id:$b->{budget_id}) does not have a parent, it may cause problem\n";
9756
        }
9757
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: FAIL)\n";
9758
    } else {
9759
        print "Upgrade to $DBversion done (Bug 12905: Check budget integrity: OK)\n";
9760
    }
9761
    SetVersion($DBversion);
9762
}
9763
9764
$DBversion = "3.19.00.008";
9765
if ( CheckVersion($DBversion) ) {
9766
    my $number_of_orders_not_linked = $dbh->selectcol_arrayref(q|
9767
        SELECT COUNT(*)
9768
        FROM aqorders o
9769
        WHERE NOT EXISTS (
9770
            SELECT NULL
9771
            FROM aqbudgets b
9772
            WHERE b.budget_id = o.budget_id
9773
        );
9774
    |);
9775
9776
    if ( $number_of_orders_not_linked->[0] > 0 ) {
9777
        $dbh->do(q|
9778
            INSERT INTO aqbudgetperiods(budget_period_startdate, budget_period_enddate, budget_period_active, budget_period_description, budget_period_total) VALUES ( CAST(NOW() AS date), CAST(NOW() AS date), 0, "WARNING: This budget has been automatically created by the updatedatabase script, please see bug 12601 for more information", 0)
9779
        |);
9780
        my $budget_period_id = $dbh->last_insert_id( undef, undef, 'aqbudgetperiods', undef );
9781
        $dbh->do(qq|
9782
            INSERT INTO aqbudgets(budget_code, budget_name, budget_amount, budget_period_id) VALUES ( "BACKUP_TMP", "WARNING: fund created by the updatedatabase script, please see bug 12601", 0, $budget_period_id );
9783
        |);
9784
        my $budget_id = $dbh->last_insert_id( undef, undef, 'aqbudgets', undef );
9785
        $dbh->do(qq|
9786
            UPDATE aqorders o
9787
            SET budget_id = $budget_id
9788
            WHERE NOT EXISTS (
9789
                SELECT NULL
9790
                FROM aqbudgets b
9791
                WHERE b.budget_id = o.budget_id
9792
            )
9793
        |);
9794
    }
9795
9796
    $dbh->do(q|
9797
        ALTER TABLE aqorders
9798
        ADD CONSTRAINT aqorders_budget_id_fk FOREIGN KEY (budget_id) REFERENCES aqbudgets(budget_id) ON DELETE CASCADE ON UPDATE CASCADE
9799
    |);
9800
9801
    print "Upgrade to $DBversion done (Bug 12601: Add new foreign key aqorders.budget_id" . ( ( $number_of_orders_not_linked->[0] > 0 )  ? ' WARNING: temporary budget and fund have been created (search for "BACKUP_TMP"). At least one of your order was not linked to a budget' : '' ) . ")\n";
9802
    SetVersion($DBversion);
9803
}
9804
9805
$DBversion = "3.19.00.009";
9806
if ( CheckVersion($DBversion) ) {
9807
    $dbh->do(q|
9808
        UPDATE suggestions s SET s.budgetid = NULL
9809
        WHERE NOT EXISTS (
9810
            SELECT NULL
9811
            FROM aqbudgets b
9812
            WHERE b.budget_id = s.budgetid
9813
        );
9814
    |);
9815
9816
    $dbh->do(q|
9817
        ALTER TABLE suggestions
9818
        ADD CONSTRAINT suggestions_budget_id_fk FOREIGN KEY (budgetid) REFERENCES aqbudgets(budget_id) ON DELETE SET NULL ON UPDATE CASCADE
9819
    |);
9820
9821
    print "Upgrade to $DBversion done (Bug 13007: Add new foreign key suggestions.budgetid)\n";
9822
    SetVersion($DBversion);
9823
}
9824
9825
$DBversion = "3.19.00.010";
9826
if ( CheckVersion($DBversion) ) {
9827
    $dbh->do(q|
9828
        INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type)
9829
        VALUES('SessionRestrictionByIP','1','Check for Change in  Remote IP address for Session Security. Disable when remote ip address changes frequently.','','YesNo')
9830
    |);
9831
    print "Upgrade to $DBversion done (Bug 5511: SessionRestrictionByIP)\n";
9832
    SetVersion ($DBversion);
9833
}
9834
9835
$DBversion = "3.19.00.011";
9836
if ( CheckVersion($DBversion) ) {
9837
    $dbh->do(q|
9838
        INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES
9839
        (20, 'lists', 'Lists', 0)
9840
    |);
9841
    $dbh->do(q|
9842
        INSERT INTO permissions (module_bit, code, description) VALUES
9843
        (20, 'delete_public_lists', 'Delete public lists')
9844
    |);
9845
    print "Upgrade to $DBversion done (Bug 13417: Add permission to delete public lists)\n";
9846
    SetVersion ($DBversion);
9847
}
9848
9849
$DBversion = "3.19.00.012";
9850
if(CheckVersion($DBversion)) {
9851
    $dbh->do(q{
9852
        ALTER TABLE biblioitems MODIFY COLUMN marcxml longtext
9853
    });
9854
9855
    $dbh->do(q{
9856
        ALTER TABLE deletedbiblioitems MODIFY COLUMN marcxml longtext
9857
    });
9858
9859
    print "Upgrade to $DBversion done (Bug 13523 Remove NOT NULL restriction on field marcxml due to mysql STRICT_TRANS_TABLES)\n";
9860
    SetVersion ($DBversion);
9861
}
9862
9863
$DBversion = "3.19.00.013";
9864
if ( CheckVersion($DBversion) ) {
9865
    $dbh->do(q|
9866
        INSERT INTO permissions (module_bit, code, description) VALUES
9867
          (13, 'records_batchmod', 'Perform batch modification of records (biblios or authorities)')
9868
    |);
9869
    print "Upgrade to $DBversion done (Bug 11395: Add permission tools_records_batchmod)\n";
9870
    SetVersion($DBversion);
9871
}
9872
9873
$DBversion = "3.19.00.014";
9874
if ( CheckVersion($DBversion) ) {
9875
    $dbh->do(q|
9876
        CREATE TABLE aqorder_users (
9877
            ordernumber int(11) NOT NULL,
9878
            borrowernumber int(11) NOT NULL,
9879
            PRIMARY KEY (ordernumber, borrowernumber),
9880
            CONSTRAINT aqorder_users_ibfk_1 FOREIGN KEY (ordernumber) REFERENCES aqorders (ordernumber) ON DELETE CASCADE ON UPDATE CASCADE,
9881
            CONSTRAINT aqorder_users_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE
9882
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
9883
    |);
9884
9885
    $dbh->do(q|
9886
        INSERT INTO letter(module, code, branchcode, name, title, content, message_transport_type)
9887
        VALUES ('acquisition', 'ACQ_NOTIF_ON_RECEIV', '', 'Notification on receiving', 'Order received', 'Dear <<borrowers.firstname>> <<borrowers.surname>>,\n\n The order <<aqorders.ordernumber>> (<<biblio.title>>) has been received.\n\nYour library.', 'email')
9888
    |);
9889
    print "Upgrade to $DBversion done (Bug 12648: Add letter ACQ_NOTIF_ON_RECEIV )\n";
9890
    SetVersion ($DBversion);
9891
}
9892
9893
$DBversion = "3.19.00.015";
9894
if ( CheckVersion($DBversion) ) {
9895
    $dbh->do(q|
9896
        ALTER TABLE search_history ADD COLUMN id INT(11) NOT NULL AUTO_INCREMENT FIRST, ADD PRIMARY KEY(id);
9897
    |);
9898
    print "Upgrade to $DBversion done (Bug 11430: Add primary key for search_history)\n";
9899
    SetVersion($DBversion);
9900
}
9901
9902
$DBversion = "3.19.00.016";
9903
if(CheckVersion($DBversion)) {
9904
    my @order_cancellation_reason = $dbh->selectrow_array("SELECT count(*) FROM authorised_values WHERE category='ORDER_CANCELLATION_REASON'");
9905
    if ($order_cancellation_reason[0] == 0) {
9906
        $dbh->do(q{
9907
            INSERT INTO authorised_values (category, authorised_value, lib) VALUES
9908
             ('ORDER_CANCELLATION_REASON', 0, 'No reason provided'),
9909
             ('ORDER_CANCELLATION_REASON', 1, 'Out of stock'),
9910
             ('ORDER_CANCELLATION_REASON', 2, 'Restocking')
9911
        });
9912
9913
        my $already_existing_reasons = $dbh->selectcol_arrayref(q{
9914
            SELECT DISTINCT( cancellationreason )
9915
            FROM aqorders;
9916
        }, { Slice => {} });
9917
9918
        my $update_orders_sth = $dbh->prepare(q{
9919
            UPDATE aqorders
9920
            SET cancellationreason = ?
9921
            WHERE cancellationreason = ?
9922
        });
9923
9924
        my $insert_av_sth = $dbh->prepare(q{
9925
            INSERT INTO authorised_values (category, authorised_value, lib) VALUES
9926
             ('ORDER_CANCELLATION_REASON', ?, ?)
9927
        });
9928
        my $i = 3;
9929
        for my $reason ( @$already_existing_reasons ) {
9930
            next unless $reason;
9931
            $insert_av_sth->execute( $i, $reason );
9932
            $update_orders_sth->execute( $i, $reason );
9933
            $i++;
9934
        }
9935
        print "Upgrade to $DBversion done (Bug 13380: Add the ORDER_CANCELLATION_REASON authorised value)\n";
9936
    }
9937
    else {
9938
        print "Upgrade to $DBversion done (Bug 13380: ORDER_CANCELLATION_REASON authorised value already existed from earlier update!)\n";
9939
    }
9940
9941
    SetVersion($DBversion);
9942
}
9943
9944
$DBversion = '3.19.00.017';
9945
if ( CheckVersion($DBversion) ) {
9946
    # First create the column
9947
    $dbh->do("ALTER TABLE issuingrules ADD onshelfholds tinyint(1) default 0 NOT NULL");
9948
    # Now update the column
9949
    if (C4::Context->preference("AllowOnShelfHolds")){
9950
        # Pref is on, set allow for all rules
9951
        $dbh->do("UPDATE issuingrules SET onshelfholds=1");
9952
    } else {
9953
        # If the preference is not set, leave off
9954
        $dbh->do("UPDATE issuingrules SET onshelfholds=0");
9955
    }
9956
    # Remove from the systempreferences table
9957
    $dbh->do("DELETE FROM systempreferences WHERE variable = 'AllowOnShelfHolds'");
9958
9959
    # First create the column
9960
    $dbh->do("ALTER TABLE issuingrules ADD opacitemholds char(1) DEFAULT 'N' NOT NULL");
9961
    # Now update the column
9962
    my $opacitemholds = C4::Context->preference("OPACItemHolds") || '';
9963
    if (lc ($opacitemholds) eq 'force') {
9964
        $opacitemholds = 'F';
9965
    }
9966
    else {
9967
        $opacitemholds = $opacitemholds ? 'Y' : 'N';
9968
    }
9969
    # Set allow for all rules
9970
    $dbh->do("UPDATE issuingrules SET opacitemholds='$opacitemholds'");
9971
9972
    # Remove from the systempreferences table
9973
    $dbh->do("DELETE FROM systempreferences WHERE variable = 'OPACItemHolds'");
9974
9975
    print "Upgrade to $DBversion done (Bug 5786: Move AllowOnShelfHolds to circulation matrix; Move OPACItemHolds system preference to circulation matrix)\n";
9976
    SetVersion ($DBversion);
9977
}
9978
9979
9980
$DBversion = "3.19.00.018";
9981
if ( CheckVersion($DBversion) ) {
9982
    $dbh->do(q|
9983
        UPDATE systempreferences set variable="OpacAdditionalStylesheet" WHERE variable="opaccolorstylesheet"
9984
    |);
9985
    print "Upgrade to $DBversion done (Bug 10328: Rename opaccolorstylesheet to OpacAdditionalStylesheet\n";
9986
    SetVersion ($DBversion);
9987
}
9988
9989
$DBversion = "3.19.00.019";
9990
if ( CheckVersion($DBversion) ) {
9991
    $dbh->do(q{
9992
        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
9993
        VALUES('Coce','0', 'If on, enables cover retrieval from the configured Coce server', NULL, 'YesNo')
9994
    });
9995
    $dbh->do(q{
9996
        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
9997
        VALUES('CoceHost', NULL, 'Coce server URL', NULL,'Free')
9998
    });
9999
    $dbh->do(q{
10000
        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
10001
        VALUES('CoceProviders', NULL, 'Coce providers', 'aws,gb,ol', 'multiple')
10002
    });
10003
    print "Upgrade to $DBversion done (Bug 9580: Cover image from Coce, a remote image URL cache)\n";
10004
    SetVersion($DBversion);
10005
}
10006
10007
$DBversion = "3.19.00.020";
10008
if ( CheckVersion($DBversion) ) {
10009
    $dbh->do(q|
10010
        ALTER TABLE aqorders DROP COLUMN supplierreference;
10011
    |);
10012
10013
    print "Upgrade to $DBversion done (Bug 11008: DROP column aqorders.supplierreference)\n";
10014
    SetVersion($DBversion);
10015
}
10016
10017
$DBversion = "3.19.00.021";
10018
if ( CheckVersion($DBversion) ) {
10019
    $dbh->do(q|
10020
        ALTER TABLE issues DROP COLUMN issuingbranch
10021
    |);
10022
    $dbh->do(q|
10023
        ALTER TABLE old_issues DROP COLUMN issuingbranch
10024
    |);
10025
    print "Upgrade to $DBversion done (Bug 2806: Remove issuingbranch columns)\n";
10026
    SetVersion ($DBversion);
10027
}
10028
10029
$DBversion = '3.19.00.022';
10030
if ( CheckVersion($DBversion) ) {
10031
    $dbh->do(q{
10032
        ALTER TABLE suggestions DROP COLUMN mailoverseeing;
10033
    });
10034
    print "Upgrade to $DBversion done (Bug 13006: Drop column suggestion.mailoverseeing)\n";
10035
    SetVersion($DBversion);
10036
}
10037
10038
$DBversion = "3.19.00.023";
10039
if ( CheckVersion($DBversion) ) {
10040
    $dbh->do(q|
10041
        DELETE FROM systempreferences where variable = 'AddPatronLists'
10042
    |);
10043
    print "Upgrade to $DBversion done (Bug 13497: Remove the AddPatronLists system preferences)\n";
10044
    SetVersion ($DBversion);
10045
}
10046
10047
$DBversion = "3.19.00.024";
10048
if ( CheckVersion($DBversion) ) {
10049
    $dbh->do(qq|DROP table patroncards;|);
10050
    print "Upgrade to $DBversion done (Bug 13539: Remove table patroncards from database as it's no longer in use)\n";
10051
    SetVersion ($DBversion);
10052
}
10053
10054
$DBversion = "3.19.00.025";
10055
if ( CheckVersion($DBversion) ) {
10056
    $dbh->do(q|
10057
        INSERT INTO systempreferences ( variable, value, options, explanation, type ) VALUES
10058
        ('SearchWithISBNVariations','0',NULL,'If enabled, search on all variations of the ISBN','YesNo')
10059
    |);
10060
    print "Upgrade to $DBversion done (Bug 13528: Add the SearchWithISBNVariations syspref)\n";
10061
    SetVersion ($DBversion);
9669
    SetVersion ($DBversion);
10062
}
9670
}
10063
9671
Lines 11214-11220 sub CheckVersion { Link Here
11214
    return 1 if ( $proposed_version =~ m/XXX/ );
10822
    return 1 if ( $proposed_version =~ m/XXX/ );
11215
10823
11216
    if ( C4::Context->preference("Version") < $version_number
10824
    if ( C4::Context->preference("Version") < $version_number
11217
        && $version_number <= TransformToNum( $Koha::VERSION ) )
10825
        && $version_number <= TransformToNum( C4::Context->final_linear_version ) )
11218
    {
10826
    {
11219
        return 1;
10827
        return 1;
11220
    }
10828
    }
11221
- 

Return to bug 12933