From 1c15222e0a22d57856b206442d3f39baa55274de Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 21 Sep 2012 11:36:44 +0200 Subject: [PATCH] Bug 7674: Separate items in two tabs (catalogue/detail.pl) Two tabs: "My holdings" / "Other holdings" "My holdings" tab contains items whose homebranch is the current branch. "Other holdings" tab contains all other items. If current branch is not set (connected with mysql user), the display is unchanged (1 tab "Holdings") --- catalogue/detail.pl | 21 +- .../prog/en/modules/catalogue/detail.tt | 291 +++++++++++--------- 2 files changed, 181 insertions(+), 131 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 7126257..991e5f0 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -173,15 +173,17 @@ $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; foreach my $item (@items) { + my $homebranchcode = $item->{homebranch}; $item->{homebranch} = GetBranchName($item->{homebranch}); # can place holds defaults to yes @@ -261,10 +263,20 @@ foreach my $item (@items) { $analytics_flag=1; $item->{countanalytics} = $countanalytics; } - if ($item->{'materials'} ne ''){ - $materials_flag = 1; + if ($item->{materials} and $item->{'materials'} ne ''){ + $materials_flag = 1; + } + + if ($currentbranch and $currentbranch ne "NO_LIBRARY_SET") { + $template->param(SeparateHoldings => 1); + if ($homebranchcode and $homebranchcode eq $currentbranch) { + push @itemloop, $item; + } else { + push @otheritemloop, $item; + } + } else { + push @itemloop, $item; } - push @itemloop, $item; } $template->param( norequests => $norequests ); @@ -328,6 +340,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, diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 22f7908..1b88118 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -255,18 +255,22 @@ function verify_images() {
-