[Koha-patches] [PATCH] Bug 6195 : Opac user should not have serial manage tab

Colin Campbell colin.campbell at ptfs-europe.com
Fri Apr 15 13:41:32 CEST 2011


PrepareSerialData adds a year of 'manage' for staff display
Opac should not see this
Would be better if it returned a cleaner data structure and
let the template engine handle the display
---
 .../prog/en/modules/opac-full-serial-issues.tt     |    7 +++++--
 opac/opac-serial-issues.pl                         |   13 ++++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-full-serial-issues.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-full-serial-issues.tt
index 9cb5629..a74a4b5 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-full-serial-issues.tt
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-full-serial-issues.tt
@@ -164,8 +164,11 @@ function showlayer(numlayer){
     </div>
 
     [% FOREACH year IN years %]
-  [% IF ( year.first ) %]  
-    <div class="yeardata tabsub" id="show[% year.year %]" style="display:block">[% ELSE %]<div class="yeardata tabsub" id="show[% year.year %]" style="display:none">[% END %]
+        [% IF loop.first %]
+           <div class="yeardata tabsub" id="show[% year.year %]" style="display:block">
+        [% ELSE %]
+           <div class="yeardata tabsub" id="show[% year.year %]" style="display:none">
+        [% END %]
         <table class="subscriptionstclass">
 	    <thead>
 		<tr>
diff --git a/opac/opac-serial-issues.pl b/opac/opac-serial-issues.pl
index 7b956f7..b534974 100755
--- a/opac/opac-serial-issues.pl
+++ b/opac/opac-serial-issues.pl
@@ -54,6 +54,13 @@ if ( $selectview eq "full" ) {
     );
     my $subscriptions = GetFullSubscriptionsFromBiblionumber($biblionumber);
     my $subscriptioninformation=PrepareSerialsData($subscriptions);
+    # PrepareSerialsData does some bogus stuff that the template could handle
+    # But at least it sorts the array by the year field so we dont have to
+    # find 'manage' if its there
+    if ($subscriptioninformation->[0]->{year} eq 'manage') {
+        shift @{$subscriptioninformation};
+    }
+
     # now, check is there is an alert subscription for one of the subscriptions
     foreach (@$subscriptions) {
         if (getalert($loggedinuser,'issue',$_->{subscriptionid})) {
@@ -61,9 +68,9 @@ if ( $selectview eq "full" ) {
         }
     }
 
-    my $title   = $subscriptions->[0]{bibliotitle};
-    my $yearmin = $subscriptions->[0]{year};
-    my $yearmax = $subscriptions->[ scalar(@$subscriptions) - 1 ]{year};
+    my $title   = $subscriptions->[0]->{bibliotitle};
+    my $yearmin = $subscriptions->[0]->{year};
+    my $yearmax = $subscriptions->[ -1 ]->{year};
 
 
     # replace CR by <br> in librarian note
-- 
1.7.4.2



More information about the Koha-patches mailing list