@@ -, +, @@ --- catalogue/detail.pl | 18 +- installer/data/mysql/sysprefs.sql | 2 + installer/data/mysql/updatedatabase.pl | 15 + .../en/modules/admin/preferences/cataloguing.pref | 13 +- .../prog/en/modules/catalogue/detail.tt | 291 +++++++++++--------- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 34 ++- opac/opac-detail.pl | 35 ++- 7 files changed, 260 insertions(+), 148 deletions(-) --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -175,15 +175,20 @@ $dat->{'hiddencount'} = scalar @all_items + @hostitems - scalar @items; my $shelflocations = GetKohaAuthorisedValues('items.location', $fw); my $collections = GetKohaAuthorisedValues('items.ccode' , $fw); my $copynumbers = GetKohaAuthorisedValues('items.copynumber', $fw); -my (@itemloop, %itemfields); +my (@itemloop, @otheritemloop, %itemfields); my $norequests = 1; my $authvalcode_items_itemlost = GetAuthValCode('items.itemlost',$fw); my $authvalcode_items_damaged = GetAuthValCode('items.damaged', $fw); my $analytics_flag; my $materials_flag; # set this if the items have anything in the materials field +my $currentbranch = C4::Context->userenv ? C4::Context->userenv->{branch} : undef; +if ($currentbranch and C4::Context->preference('SeparateHoldings')) { + $template->param(SeparateHoldings => 1); +} foreach my $item (@items) { + my $homebranchcode = $item->{homebranch}; $item->{homebranch} = GetBranchName($item->{homebranch}); # can place holds defaults to yes @@ -265,8 +270,16 @@ foreach my $item (@items) { } if (defined($item->{'materials'}) && $item->{'materials'} =~ /\S/){ $materials_flag = 1; + + if ($currentbranch and $currentbranch ne "NO_LIBRARY_SET" and C4::Context->preference('SeparateHoldings')) { + if ($homebranchcode and $homebranchcode eq $currentbranch) { + push @itemloop, $item; + } else { + push @otheritemloop, $item; + } + } else { + push @itemloop, $item; } - push @itemloop, $item; } $template->param( norequests => $norequests ); @@ -330,6 +343,7 @@ foreach ( keys %{$dat} ) { $template->param( AmazonTld => get_amazon_tld() ) if ( C4::Context->preference("AmazonCoverImages")); $template->param( itemloop => \@itemloop, + otheritemloop => \@otheritemloop, biblionumber => $biblionumber, ($analyze? 'analyze':'detailview') =>1, subscriptions => \@subs, --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -386,3 +386,5 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidy INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SeparateHoldings', '0', 'Separate current branch holdings from other holdings', NULL, 'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -5926,6 +5926,21 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do(" + INSERT INTO systempreferences (variable,value,explanation,options,type) + VALUES('SeparateHoldings', '0', 'Separate current branch holdings from other holdings', NULL, 'YesNo'); + "); + $dbh->do(" + INSERT INTO systempreferences (variable,value,explanation,options,type) + VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo'); + "); + + print "Upgrade to $DBversion done (Add systempreferences SeparateHoldings and OpacSeparateHoldings) \n"; + SetVersion ($DBversion); +} + $DBversion = "3.09.00.053"; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -156,4 +156,15 @@ Cataloging: - pref: OpacSuppressionByIPRange class: short - (Leave blank if not used. Define a range like 192.168..) - + - + - pref: SeparateHoldings + choices: + yes: "Separate" + no: "Don't separate" + - current branch holdings from other holdings at staff interface. + - + - pref: OpacSeparateHoldings + choices: + yes: "Separate" + no: "Don't separate" + - current branch holdings from other holdings at OPAC. --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -255,18 +255,22 @@ function verify_images() {
-