From 991d0abd5e4eb4410756fd13c6458f489efe4d94 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia <aleishaamohia@hotmail.com> Date: Tue, 16 Apr 2019 02:30:04 +0000 Subject: [PATCH] Bug 15516: (follow-up) Fixing modal view and more Fixing - modal view - missed changes from 'reserve group' to 'hold group' - updating atomic update to perl - utf8mb4 Signed-off-by: Michal Denar <black23@gmail.com> --- installer/data/mysql/atomicupdate/bug_15516.sql | 11 ------- .../atomicupdate/bug_15516_-_hold_group_table.perl | 34 ++++++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 +- .../prog/en/includes/hold-group-modal.inc | 6 ++-- .../prog/en/modules/circ/circulation.tt | 2 +- reserve/placerequest.pl | 2 +- 6 files changed, 40 insertions(+), 17 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_15516.sql create mode 100644 installer/data/mysql/atomicupdate/bug_15516_-_hold_group_table.perl diff --git a/installer/data/mysql/atomicupdate/bug_15516.sql b/installer/data/mysql/atomicupdate/bug_15516.sql deleted file mode 100644 index bc2c0598f3..0000000000 --- a/installer/data/mysql/atomicupdate/bug_15516.sql +++ /dev/null @@ -1,11 +0,0 @@ -DROP TABLE IF EXISTS hold_group; -CREATE TABLE hold_group ( - hold_group_id int unsigned NOT NULL AUTO_INCREMENT, - PRIMARY KEY (hold_group_id) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; - -ALTER TABLE reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL; -ALTER TABLE reserves ADD CONSTRAINT reserves_ibfk_6 FOREIGN KEY (hold_group_id) REFERENCES hold_group (hold_group_id) ON DELETE SET NULL ON UPDATE CASCADE; - -ALTER TABLE old_reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL; -ALTER TABLE old_reserves ADD CONSTRAINT old_reserves_ibfk_5 FOREIGN KEY (hold_group_id) REFERENCES hold_group (hold_group_id) ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/installer/data/mysql/atomicupdate/bug_15516_-_hold_group_table.perl b/installer/data/mysql/atomicupdate/bug_15516_-_hold_group_table.perl new file mode 100644 index 0000000000..a968ea601b --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_15516_-_hold_group_table.perl @@ -0,0 +1,34 @@ +$DBversion = 'XXX'; +if( CheckVersion( $DBversion ) ) { + + if( TableExists( 'hold_group' ) ){ + $dbh->do(q{UPDATE reserves SET hold_group_id = NULL}); + $dbh->do(q{UPDATE old_reserves SET hold_group_id = NULL}); + + $dbh->do(q{ALTER TABLE reserves DROP FOREIGN KEY reserves_ibfk_6}); + $dbh->do(q{ALTER TABLE old_reserves DROP FOREIGN KEY old_reserves_ibfk_5}); + + $dbh->do(q{DROP TABLE hold_group}); + $dbh->do(q{CREATE TABLE hold_group ( + hold_group_id int unsigned NOT NULL AUTO_INCREMENT, + PRIMARY KEY (hold_group_id) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci}); + } + + unless( column_exists( 'reserves', 'hold_group_id' ) ){ + $dbh->do(q{ALTER TABLE reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL}); + } + unless( column_exists( 'old_reserves', 'hold_group_id') ){ + $dbh->do(q{ALTER TABLE old_reserves ADD COLUMN hold_group_id int unsigned NULL DEFAULT NULL}); + } + + unless( foreign_key_exists( 'reserves', 'reserves_ibfk_6' ) ){ + $dbh->do(q{ALTER TABLE reserves ADD CONSTRAINT reserves_ibfk_6 FOREIGN KEY (hold_group_id) REFERENCES hold_group (hold_group_id) ON DELETE SET NULL ON UPDATE CASCADE}); + } + unless( foreign_key_exists( 'old_reserves', 'old_reserves_ibfk_5' ) ){ + $dbh->do(q{ALTER TABLE old_reserves ADD CONSTRAINT old_reserves_ibfk_5 FOREIGN KEY (hold_group_id) REFERENCES hold_group (hold_group_id) ON DELETE SET NULL ON UPDATE CASCADE}); + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 15516 - Adding hold group table)\n"; +} diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 058f838c52..c21b0d19e7 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1885,7 +1885,7 @@ CREATE TABLE `old_reserves` ( -- this table holds all holds/reserves that have b ON DELETE SET NULL ON UPDATE SET NULL, CONSTRAINT `old_reserves_ibfk_4` FOREIGN KEY (`itemtype`) REFERENCES `itemtypes` (`itemtype`) ON DELETE SET NULL ON UPDATE SET NULL, - CONSTRAINT `old_reserves_ibfk_5` FOREIGN KEY (hold_group_id) REFERENCES hold_group (hold_group_id) + CONSTRAINT `old_reserves_ibfk_5` FOREIGN KEY (`hold_group_id`) REFERENCES `hold_group` (`hold_group_id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/hold-group-modal.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/hold-group-modal.inc index 2590b9db80..fcd45c99f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/hold-group-modal.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/hold-group-modal.inc @@ -1,15 +1,15 @@ -<div id="hold-group-modal" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="hold-group-modal-label" aria-hidden="true"> +<div id="hold-group-modal" class="modal fade" tabindex="-1" role="dialog"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> - <h3 id="hold-group-modal-label">Hold group</h3> + <h4 class="modal-title">Hold group</h3> </div> <div class="modal-body"> <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/loading-small.gif" alt="" /> Loading </div> </div> <div class="modal-footer"> - <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> + <button type="button" class="btn btn-default deny" data-dismiss="modal">Close</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index 152966f4b4..acca23e415 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1101,7 +1101,7 @@ [% Asset.js("js/checkouts.js") | $raw %] [% Asset.js("js/holds.js") | $raw %] [% Asset.js("js/circ-patron-search-results.js") | $raw %] - [% Asset.js("js/hold-group.js" | $raw %] + [% Asset.js("js/hold-group.js") | $raw %] <script> columns_settings_issues_table = [% TablesSettings.GetColumns( 'circ', 'circulation', 'issues-table', 'json' ) | $raw %] columns_settings_borrowers_table = [% TablesSettings.GetColumns( 'circ', 'circulation', 'table_borrowers', 'json' ) | $raw %] diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl index 888a8fb57c..768c713f9f 100755 --- a/reserve/placerequest.pl +++ b/reserve/placerequest.pl @@ -144,7 +144,7 @@ if ( $type eq 'str8' && $borrower ) { found => $found, itemtype => $itemtype, non_priority => $non_priority, - reserve_group_id => $reserve_group_id, + hold_group_id => $hold_group_id, } ); } -- 2.11.0