From b1b1f8f9153ebbd3f79369f875b8416818d9bad3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 23 Feb 2015 16:39:08 +0100 Subject: [PATCH] Bug 2806: Remove issuingbranch columns This column is not in used in the Koha code and could be removed. Test plan: Verify the branch is correctly displayed on the circulation history (members/readingrec.pl) and that both reports Most-cisulated items (cat_issues_top.pl) and Avg checkout (issues_avg_stats.pl) work as before. Signed-off-by: Bernardo Gonzalez Kriegel No problems found. Fixed wrong table name on updatedatabase.pl and a tab char. Signed-off-by: Katrin Fischer Passes tests and QA script. Checked issues and returns are still working correctly. There is no mention of issuingbranch in the codebase. Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/kohastructure.sql | 4 ---- installer/data/mysql/updatedatabase.pl | 12 ++++++++++++ .../prog/en/modules/members/readingrec.tt | 3 ++- .../prog/en/modules/reports/cat_issues_top.tt | 2 +- .../prog/en/modules/reports/issues_avg_stats.tt | 8 -------- members/readingrec.pl | 3 --- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index de105743a4..2cedc938d3 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1144,7 +1144,6 @@ CREATE TABLE `issues` ( -- information related to check outs or issues `itemnumber` int(11), -- foreign key, linking this to the items table for the item that was checked out `date_due` datetime default NULL, -- datetime the item is due (yyyy-mm-dd hh:mm::ss) `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out - `issuingbranch` varchar(18) default NULL, `returndate` datetime default NULL, -- date the item was returned, will be NULL until moved to old_issues `lastreneweddate` datetime default NULL, -- date the item was last renewed `return` varchar(4) default NULL, @@ -1156,7 +1155,6 @@ CREATE TABLE `issues` ( -- information related to check outs or issues KEY `issuesborridx` (`borrowernumber`), KEY `itemnumber_idx` (`itemnumber`), KEY `branchcode_idx` (`branchcode`), - KEY `issuingbranch_idx` (`issuingbranch`), KEY `bordate` (`borrowernumber`,`timestamp`), CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE RESTRICT ON UPDATE CASCADE, CONSTRAINT `issues_ibfk_2` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE RESTRICT ON UPDATE CASCADE @@ -1620,7 +1618,6 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r `itemnumber` int(11) default NULL, -- foreign key, linking this to the items table for the item that was checked out `date_due` datetime default NULL, -- date the item is due (yyyy-mm-dd) `branchcode` varchar(10) default NULL, -- foreign key, linking to the branches table for the location the item was checked out - `issuingbranch` varchar(18) default NULL, `returndate` datetime default NULL, -- date the item was returned `lastreneweddate` datetime default NULL, -- date the item was last renewed `return` varchar(4) default NULL, @@ -1632,7 +1629,6 @@ CREATE TABLE `old_issues` ( -- lists items that were checked out and have been r KEY `old_issuesborridx` (`borrowernumber`), KEY `old_issuesitemidx` (`itemnumber`), KEY `branchcode_idx` (`branchcode`), - KEY `issuingbranch_idx` (`issuingbranch`), KEY `old_bordate` (`borrowernumber`,`timestamp`), CONSTRAINT `old_issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE SET NULL ON UPDATE SET NULL, diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index bdc3abfaf1..6f8ce22eed 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9988,6 +9988,18 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.19.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q| + ALTER TABLE issues DROP COLUMN issuingbranch + |); + $dbh->do(q| + ALTER TABLE old_issues DROP COLUMN issuingbranch + |); + print "Upgrade to $DBversion done (Bug 2806: Remove issuingbranch columns)\n"; + SetVersion ($DBversion); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt index 6fd1ad17f7..71e2888f73 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt @@ -1,5 +1,6 @@ [% USE KohaDates %] [% USE Koha %] +[% USE Branches %] [% INCLUDE 'doc-head-open.inc' %] Circulation History for [% INCLUDE 'patron-title.inc' %] [% INCLUDE 'doc-head-close.inc' %] @@ -108,7 +109,7 @@ [% issue.issuedate |$KohaDates with_hours => 1 %] - [% issue.issuingbranch %] + [% Branches.GetName( issue.branchcode ) %] [% IF issue.date_due %] [% issue.date_due |$KohaDates with_hours => 1 %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt index c7e45bd8df..c76fba7b31 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/cat_issues_top.tt @@ -152,7 +152,7 @@
  • - - [% IF ( hassort1 ) %] Sort1 diff --git a/members/readingrec.pl b/members/readingrec.pl index de2baec7c8..7f6d271585 100755 --- a/members/readingrec.pl +++ b/members/readingrec.pl @@ -74,9 +74,6 @@ if ( $borrowernumber eq C4::Context->preference('AnonymousPatron') ){ } my $branches = GetBranches(); -foreach my $issue ( @{$issues} ) { - $issue->{issuingbranch} = $branches->{ $issue->{branchcode} }->{branchname}; -} # barcode export if ( $op eq 'export_barcodes' ) { -- 2.39.5