Bugzilla – Attachment 12246 Details for
Bug 8215
Add Course Reserves
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 8215 - Add Course Reserves - QA Followup 2
Bug-8215---Add-Course-Reserves---QA-Followup-2.patch (text/plain), 8.17 KB, created by
Kyle M Hall (khall)
on 2012-09-14 16:13:31 UTC
(
hide
)
Description:
Bug 8215 - Add Course Reserves - QA Followup 2
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-09-14 16:13:31 UTC
Size:
8.17 KB
patch
obsolete
>From d91cd8c9f17b2b9404916c3837355ea7f28b5de2 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 14 Sep 2012 11:55:56 -0400 >Subject: [PATCH] Bug 8215 - Add Course Reserves - QA Followup 2 >Content-Type: text/plain; charset="utf-8" > >* Remove GetItemTypesFlat >* Remove update copywrite info >* Add foreign keys >* psuedo_key typo >--- > C4/Koha.pm | 32 +++++++++++++++++--------------- > course_reserves/add_items.pl | 2 +- > course_reserves/mod_course.pl | 6 +----- > installer/data/mysql/kohastructure.sql | 25 +++++++++++++++++++++++-- > installer/data/mysql/updatedatabase.pl | 23 +++++++++++++++++++++-- > 5 files changed, 63 insertions(+), 25 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index c20a670..9ea1785 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -41,7 +41,6 @@ BEGIN { > &subfield_is_koha_internal_p > &GetPrinters &GetPrinter > &GetItemTypes &getitemtypeinfo >- &GetItemTypesFlat > &GetCcodes > &GetSupportName &GetSupportList > &get_itemtypeinfos_of >@@ -205,10 +204,15 @@ sub GetSupportList{ > } > =head2 GetItemTypes > >- $itemtypes = &GetItemTypes(); >+ $itemtypes = &GetItemTypes( style => $style ); > > Returns information about existing itemtypes. > >+Params: >+ style: either 'array' or 'hash', defaults to 'hash'. >+ 'array' returns an arrayref, >+ 'hash' return a hashref with the itemtype value as the key >+ > build a HTML select with the following code : > > =head3 in PERL SCRIPT >@@ -241,7 +245,9 @@ build a HTML select with the following code : > =cut > > sub GetItemTypes { >- >+ my ( %params ) = @_; >+ my $style = defined( $params{'style'} ) ? $params{'style'} : 'hash'; >+ > # returns a reference to a hash of references to itemtypes... > my %itemtypes; > my $dbh = C4::Context->dbh; >@@ -251,19 +257,15 @@ sub GetItemTypes { > |; > my $sth = $dbh->prepare($query); > $sth->execute; >- while ( my $IT = $sth->fetchrow_hashref ) { >- $itemtypes{ $IT->{'itemtype'} } = $IT; >+ >+ if ( $style eq 'hash' ) { >+ while ( my $IT = $sth->fetchrow_hashref ) { >+ $itemtypes{ $IT->{'itemtype'} } = $IT; >+ } >+ return ( \%itemtypes ); >+ } else { >+ return $sth->fetchall_arrayref({}); > } >- return ( \%itemtypes ); >-} >- >-sub GetItemTypesFlat { >- my $dbh = C4::Context->dbh; >- my $query = "SELECT * FROM itemtypes ORDER BY description"; >- my $sth = $dbh->prepare($query); >- $sth->execute; >- >- return $sth->fetchall_arrayref({}); > } > > sub get_itemtypeinfos_of { >diff --git a/course_reserves/add_items.pl b/course_reserves/add_items.pl >index f9f1c97..bbf67d5 100755 >--- a/course_reserves/add_items.pl >+++ b/course_reserves/add_items.pl >@@ -72,7 +72,7 @@ if ( $action eq 'lookup' ) { > > ccodes => GetAuthorisedValues('CCODE'), > locations => GetAuthorisedValues('LOC'), >- itypes => GetItemTypesFlat(), >+ itypes => GetItemTypes( style => 'array' ), > branches => GetBranchesLoop(), > ); > >diff --git a/course_reserves/mod_course.pl b/course_reserves/mod_course.pl >index 6ef787b..0df85f3 100755 >--- a/course_reserves/mod_course.pl >+++ b/course_reserves/mod_course.pl >@@ -1,10 +1,6 @@ > #!/usr/bin/perl > >-#script to modify reserves/requests >-#written 2/1/00 by chris@katipo.oc.nz >-#last update 27/1/2000 by chris@katipo.co.nz >- >-# Copyright 2000-2002 Katipo Communications >+# Copyright 2012 ByWater Solutions > # > # This file is part of Koha. > # >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 2254932..f198218 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -505,6 +505,13 @@ CREATE TABLE `course_instructors` ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > -- >+-- Constraints for table `course_instructors` >+-- >+ALTER TABLE `course_instructors` >+ ADD CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`), >+ ADD CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE; >+ >+-- > -- Table structure for table `course_items` > -- > >@@ -523,10 +530,18 @@ CREATE TABLE `course_items` ( > `enabled` enum('yes','no') NOT NULL DEFAULT 'no', -- If at least one enabled course has this item on reseve, this field will be 'yes', otherwise it will be 'no' > `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > PRIMARY KEY (`ci_id`), >- UNIQUE KEY `itemnumber` (`itemnumber`) >+ UNIQUE KEY `itemnumber` (`itemnumber`), >+ KEY `holdingbranch` (`holdingbranch`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > -- >+-- Constraints for table `course_items` >+-- >+ALTER TABLE `course_items` >+ ADD CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >+ ADD CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE; >+ >+-- > -- Table structure for table `course_reserves` > -- > >@@ -542,11 +557,17 @@ CREATE TABLE `course_reserves` ( > `public_note` mediumtext, -- Public, OPAC visible note > `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > PRIMARY KEY (`cr_id`), >- UNIQUE KEY `psuedo_key` (`course_id`,`ci_id`), >+ UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`), > KEY `course_id` (`course_id`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > > -- >+-- Constraints for table `course_reserves` >+-- >+ALTER TABLE `course_reserves` >+ ADD CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`); >+ >+-- > -- Table structure for table `borrower_branch_circ_rules` > -- > >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 315afc5..e687564 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5728,6 +5728,12 @@ CREATE TABLE `course_instructors` ( > "); > > $dbh->do(" >+ALTER TABLE `course_instructors` >+ ADD CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`), >+ ADD CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE; >+"); >+ >+$dbh->do(" > CREATE TABLE `course_items` ( > `ci_id` int(11) NOT NULL AUTO_INCREMENT, > `itemnumber` int(11) NOT NULL, >@@ -5738,11 +5744,18 @@ CREATE TABLE `course_items` ( > `enabled` enum('yes','no') NOT NULL DEFAULT 'no', > `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > PRIMARY KEY (`ci_id`), >- UNIQUE KEY `itemnumber` (`itemnumber`) >+ UNIQUE KEY `itemnumber` (`itemnumber`), >+ KEY `holdingbranch` (`holdingbranch`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > "); > > $dbh->do(" >+ALTER TABLE `course_items` >+ ADD CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, >+ ADD CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE; >+"); >+ >+$dbh->do(" > CREATE TABLE `course_reserves` ( > `cr_id` int(11) NOT NULL AUTO_INCREMENT, > `course_id` int(11) NOT NULL, >@@ -5751,12 +5764,17 @@ CREATE TABLE `course_reserves` ( > `public_note` mediumtext, > `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, > PRIMARY KEY (`cr_id`), >- UNIQUE KEY `psuedo_key` (`course_id`,`ci_id`), >+ UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`), > KEY `course_id` (`course_id`) > ) ENGINE=InnoDB DEFAULT CHARSET=utf8; > "); > > $dbh->do(" >+ALTER TABLE `course_reserves` >+ ADD CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`); >+"); >+ >+$dbh->do(" > INSERT INTO permissions (module_bit, code, description) VALUES > (18, 'manage_courses', 'Add, edit and delete courses'), > (18, 'add_reserves', 'Add course reserves'), >@@ -5764,6 +5782,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES > ; > "); > >+ > print "Upgrade to $DBversion done (Add Course Reserves ( system preference UseCourseReserves ))\n"; > SetVersion($DBversion); > } >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8215
:
9990
|
10181
|
10224
|
11131
|
11612
|
11657
|
11677
|
11678
|
11679
|
11680
|
11681
|
11682
|
11683
|
11860
|
11861
|
11862
|
11865
|
11875
|
11881
|
11882
|
11980
|
12039
|
12120
|
12128
|
12188
|
12189
|
12192
|
12246
|
12361
|
12400
|
12413
|
12414
|
12593
|
12627
|
13496
|
13497
|
13498
|
13499
|
15195
|
15196
|
15197
|
15198
|
15199
|
16228
|
16229
|
16251
|
16252
|
16532
|
16533
|
16534
|
16536
|
16537
|
16545
|
16567
|
16568
|
16587
|
16588
|
16599
|
16621
|
16623
|
16634
|
17333
|
17334
|
17335
|
17336
|
17337
|
17377
|
17378
|
17379
|
17894
|
17895
|
17896
|
17897
|
17898
|
17899
|
18274
|
18275
|
18276
|
18277
|
18278
|
18279
|
18282
|
18283
|
18284
|
18285
|
18286
|
18287
|
18288
|
18289
|
18290
|
18291
|
18292
|
18293
|
21885
|
23264