--- a/C4/CourseReserves.pm +++ a/C4/CourseReserves.pm @@ -52,7 +52,7 @@ BEGIN { %EXPORT_TAGS = ( 'all' => \@EXPORT_OK ); $DEBUG = 0; - @FIELDS = ( 'itype', 'ccode', 'holdingbranch', 'location' ); + @FIELDS = ( 'itype', 'ccode', 'homebranch', 'holdingbranch', 'location' ); } =head1 NAME --- a/course_reserves/add_items.pl +++ a/course_reserves/add_items.pl @@ -93,6 +93,7 @@ if ( $action eq 'lookup' and $item ) { itemnumber => scalar $cgi->param('itemnumber'), itype => scalar $cgi->param('itype'), ccode => scalar $cgi->param('ccode'), + homebranch => scalar $cgi->param('homebranch'), holdingbranch => scalar $cgi->param('holdingbranch'), location => scalar $cgi->param('location'), ); --- a/installer/data/mysql/atomicupdate/bug-22630.perl +++ a/installer/data/mysql/atomicupdate/bug-22630.perl @@ -0,0 +1,13 @@ +$DBversion = 'XXX'; +if (CheckVersion($DBversion)) { + if (!column_exists('course_items', 'homebranch')) { + $dbh->do(q{ + ALTER TABLE course_items + ADD COLUMN homebranch VARCHAR(10) NULL DEFAULT NULL AFTER ccode, + ADD CONSTRAINT course_items_ibfk_3 FOREIGN KEY (homebranch) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE + }); + } + + SetVersion($DBversion); + print "Upgrade to $DBversion done (Bug 22630 - Add course_items.homebranch)\n"; +} --- a/installer/data/mysql/kohastructure.sql +++ a/installer/data/mysql/kohastructure.sql @@ -3749,6 +3749,7 @@ CREATE TABLE `course_items` ( `itemnumber` int(11) NOT NULL, -- items.itemnumber for the item on reserve `itype` varchar(10) DEFAULT NULL, -- new itemtype for the item to have while on reserve (optional) `ccode` varchar(80) DEFAULT NULL, -- new category code for the item to have while on reserve (optional) + `homebranch` varchar(10) DEFAULT NULL, -- new home branch for the item to have while on reserve (optional) `holdingbranch` varchar(10) DEFAULT NULL, -- new holding branch for the item to have while on reserve (optional) `location` varchar(80) DEFAULT NULL, -- new shelving location for the item to have while on reseve (optional) `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' @@ -3762,6 +3763,7 @@ CREATE TABLE `course_items` ( -- Constraints for table `course_items` -- ALTER TABLE `course_items` + ADD CONSTRAINT `course_items_ibfk_3` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE, 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; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt @@ -83,6 +83,20 @@ +
  • + + +
  • +