[Koha-patches] [PATCH] Serials Display Enhancement

Daniel Sweeney daniel.sweeney at liblime.com
Thu Mar 26 23:09:46 CET 2009


From: Joshua Ferraro <jmf at liblime.com>

Allows specification of how many issues of a subscription to display
at a global and subscription-specific level. Also adds a link to the
detail page to a specific subscription.

Signed-off-by: Daniel Sweeney <daniel.sweeney at liblime.com>
---
 C4/Auth.pm                                         |    2 ++
 C4/Serials.pm                                      |   20 +++++++++++---------
 admin/systempreferences.pl                         |    4 ++++
 catalogue/detail.pl                                |    6 +++++-
 installer/data/mysql/en/mandatory/sysprefs.sql     |    2 ++
 .../1-Obligatoire/unimarc_standard_systemprefs.sql |    2 ++
 installer/data/mysql/updatedatabase.pl             |   16 ++++++++++++++++
 .../prog/en/includes/sysprefs-menu.inc             |    1 +
 .../prog/en/modules/catalogue/detail.tmpl          |    3 ++-
 .../prog/en/modules/serials/subscription-add.tmpl  |   11 +++++++++++
 .../en/modules/serials/subscription-detail.tmpl    |    2 ++
 .../opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl |    2 +-
 .../opac-tmpl/prog/en/modules/opac-detail.tmpl     |    2 +-
 kohaversion.pl                                     |    2 +-
 opac/opac-ISBDdetail.pl                            |    6 +++++-
 opac/opac-detail.pl                                |    7 ++++++-
 serials/subscription-add.pl                        |    8 ++++++--
 17 files changed, 78 insertions(+), 18 deletions(-)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index ae7b2b2..6b6fab2 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -294,6 +294,7 @@ sub get_template_and_user {
             noItemTypeImages            => C4::Context->preference("noItemTypeImages"),
             suggestion                  => C4::Context->preference("suggestion"),
             virtualshelves              => C4::Context->preference("virtualshelves"),
+			StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"),
         );
     }
     else {
@@ -345,6 +346,7 @@ sub get_template_and_user {
             reviewson                 => C4::Context->preference("reviewson"),
             suggestion                => "" . C4::Context->preference("suggestion"),
             virtualshelves            => "" . C4::Context->preference("virtualshelves"),
+			OPACSerialIssueDisplayCount => C4::Context->preference("OPACSerialIssueDisplayCount"),
         );
     }
     return ( $template, $borrowernumber, $cookie, $flags);
diff --git a/C4/Serials.pm b/C4/Serials.pm
index b78453e..5bec265 100644
--- a/C4/Serials.pm
+++ b/C4/Serials.pm
@@ -1302,8 +1302,8 @@ sub ModSubscription {
         $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
         $numberingmethod, $status,       $biblionumber,   $callnumber,
         $notes,           $letter,       $hemisphere,     $manualhistory,
-        $internalnotes,   $serialsadditems,
-        $subscriptionid
+        $internalnotes,   $serialsadditems,$subscriptionid,
+        $staffdisplaycount,$opacdisplaycount
     ) = @_;
 #     warn $irregularity;
     my $dbh   = C4::Context->dbh;
@@ -1313,9 +1313,9 @@ sub ModSubscription {
                         add1=?,every1=?,whenmorethan1=?,setto1=?,lastvalue1=?,innerloop1=?,
                         add2=?,every2=?,whenmorethan2=?,setto2=?,lastvalue2=?,innerloop2=?,
                         add3=?,every3=?,whenmorethan3=?,setto3=?,lastvalue3=?,innerloop3=?,
-                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?
+                        numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?,staffdisplaycount = ?,opacdisplaycount = ?
                     WHERE subscriptionid = ?";
-#     warn "query :".$query;
+     #warn "query :".$query;
     my $sth = $dbh->prepare($query);
     $sth->execute(
         $auser,           $branchcode,   $aqbooksellerid, $cost,
@@ -1329,8 +1329,8 @@ sub ModSubscription {
         $numberingmethod, $status,       $biblionumber,   $callnumber,
         $notes,           $letter,       $hemisphere,     ($manualhistory?$manualhistory:0),
         $internalnotes,   $serialsadditems,
-        $subscriptionid
-    );
+        $staffdisplaycount, $opacdisplaycount, $subscriptionid
+    ); warn "$staffdisplaycount, $opacdisplaycount";
     my $rows=$sth->rows;
     $sth->finish;
     
@@ -1370,7 +1370,7 @@ sub NewSubscription {
         $lastvalue3,    $innerloop3,   $numberingmethod, $status,
         $notes,         $letter,       $firstacquidate,  $irregularity,
         $numberpattern, $callnumber,   $hemisphere,      $manualhistory,
-        $internalnotes, $serialsadditems,
+        $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount
     ) = @_;
     my $dbh = C4::Context->dbh;
 
@@ -1383,8 +1383,8 @@ sub NewSubscription {
             add2,every2,whenmorethan2,setto2,lastvalue2,innerloop2,
             add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3,
             numberingmethod, status, notes, letter,firstacquidate,irregularity,
-            numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems)
-        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
+            numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems,staffdisplaycount,opacdisplaycount)
+        VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
         |;
     my $sth = $dbh->prepare($query);
     $sth->execute(
@@ -1409,6 +1409,7 @@ sub NewSubscription {
         $numberpattern,                 $callnumber,
         $hemisphere,                    $manualhistory,
         $internalnotes,                 $serialsadditems,
+		$staffdisplaycount,				$opacdisplaycount
     );
 
     #then create the 1st waited number
@@ -1802,6 +1803,7 @@ sub HasSubscriptionExpired {
       my $sth = $dbh->prepare($query);
       $sth->execute($subscriptionid);
       my ($res) = $sth->fetchrow  ;
+	  return 0 unless $res;
       my @res=split (/-/,$res);
 # warn "date expiration :$expirationdate";
       my @endofsubscriptiondate=split(/-/,$expirationdate);
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 806afc3..9071f27 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -301,6 +301,10 @@ $tabsysprefs{OPACGroupResults}     = "OPAC";
 $tabsysprefs{XSLTDetailsDisplay}   = "OPAC";
 $tabsysprefs{XSLTResultsDisplay}   = "OPAC";
 
+# Serials
+$tabsysprefs{OPACSerialIssueDisplayCount}  = "Serials";
+$tabsysprefs{StaffSerialIssueDisplayCount}  = "Serials";
+
 # LOGFeatures
 $tabsysprefs{CataloguingLog}  = "Logs";
 $tabsysprefs{BorrowersLog}    = "Logs";
diff --git a/catalogue/detail.pl b/catalogue/detail.pl
index 393ec16..7ad9ec7 100755
--- a/catalogue/detail.pl
+++ b/catalogue/detail.pl
@@ -83,13 +83,17 @@ my @subs;
 $dat->{'serial'}=1 if $subscriptionsnumber;
 foreach my $subscription (@subscriptions) {
     my %cell;
+	my $serials_to_display;
     $cell{subscriptionid}    = $subscription->{subscriptionid};
     $cell{subscriptionnotes} = $subscription->{notes};
 	$cell{branchcode}        = $subscription->{branchcode};
 	$cell{hasalert}          = $subscription->{hasalert};
     #get the three latest serials.
+	$serials_to_display = $subscription->{staffdisplaycount};
+	$serials_to_display = C4::Context->preference('StaffSerialIssueDisplayCount') unless $serials_to_display;
+	$cell{staffdisplaycount} = $serials_to_display;
     $cell{latestserials} =
-      GetLatestSerials( $subscription->{subscriptionid}, 3 );
+      GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display );
     push @subs, \%cell;
 }
 
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index c79a727..ff1b032 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -215,3 +215,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'UseBranchTransferLimits', '0', '', 'If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldPolicyOverride', '0', 'Allow staff to override hold policies when placing holds',NULL,'YesNo');
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'BranchTransferLimitsType', 'ccode', 'itemtype|ccode', 'When using branch transfer limits, choose whether to limit by itemtype or collection code.', 'Choice');
+INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'StaffSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the Staff client', 'free');
+INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'OPACSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the OPAC', 'free');
diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
index 3469106..e80e1d5 100644
--- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
+++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
@@ -217,3 +217,5 @@ INSERT INTO `systempreferences` (variable,value,options,explanation,type) VALUES
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'UseBranchTransferLimits', '0', '', 'If ON, Koha will will use the rules defined in branch_transfer_limits to decide if an item transfer should be allowed.', 'YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldPolicyOverride', '0', "Autorise le personnel á outrepasser la politique de réservation au moment d'une réservation",NULL,'YesNo');
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ('BranchTransferLimitsType', 'ccode', 'itemtype|ccode', 'When using branch transfer limits, choose whether to limit by itemtype or collection code.', 'Choice');
+INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'StaffSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the Staff client', 'free');
+INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'OPACSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the OPAC', 'free');
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index 8be1225..4846e98 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -2234,6 +2234,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.01.00.015";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("ALTER TABLE `subscription` ADD `staffdisplaycount` VARCHAR(10) NULL;");
+    $dbh->do("ALTER TABLE `subscription` ADD `opacdisplaycount` VARCHAR(10) NULL;");
+    $dbh->do("INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` )
+    VALUES (
+    'StaffSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the Staff client', 'free'
+    );");
+	$dbh->do("INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` )
+    VALUES (
+    'OPACSerialIssueDisplayCount', '3', '', 'Number of serial issues to display per subscription in the OPAC', 'free'
+    );");
+
+    print "Upgrade to $DBversion done ( Updated table for Branch Transfer Limits)\n";
+    SetVersion ($DBversion);
+}
 
 =item DropAllForeignKeys($table)
 
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc
index dc39eaa..b915d1d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc
@@ -12,6 +12,7 @@
 <!-- TMPL_IF NAME="OPAC" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Online Public Access Catalog" href="/cgi-bin/koha/admin/systempreferences.pl?tab=OPAC">OPAC</a></li>
 <!-- TMPL_IF NAME="Patrons" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Patrons" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Patrons">Patrons</a></li>
 <!-- TMPL_IF NAME="Searching" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Searching" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Searching">Searching</a></li>
+<!-- TMPL_IF NAME="Serials" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Serials" href="/cgi-bin/koha/admin/systempreferences.pl?tab=Serials">Serials</a></li>
 <!-- TMPL_IF NAME="StaffClient" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a title="Staff Client" href="/cgi-bin/koha/admin/systempreferences.pl?tab=StaffClient">Staff Client</a></li>
 <!-- TMPL_IF NAME="" --><li class="active"><!-- TMPL_ELSE --><li><!-- /TMPL_IF --><a href="/cgi-bin/koha/admin/systempreferences.pl">Local Use</a></li>
 </ul>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
index eed7536..a2fd90c 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
@@ -371,7 +371,7 @@ function verify_images() {
     <!-- TMPL_LOOP Name="subscriptions" -->
             <!-- TMPL_IF NAME="subscriptionnotes" --><p><!--TMPL_VAR NAME="subscriptionnotes"--> </p><!-- /TMPL_IF -->
             <!--TMPL_IF NAME="latestserials"-->
-            <p> The three latest issues related to this subscription:</p>
+            <p> The <!-- TMPL_VAR NAME="staffdisplaycount" --> latest issues related to this subscription:</p>
             <table>
                 <tr>
                     <th>Issue #</th>
@@ -402,6 +402,7 @@ function verify_images() {
             <!--/TMPL_LOOP -->
             </table>
             <!-- /TMPL_IF -->
+			<a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=<!-- TMPL_VAR NAME="subscriptionid" -->">Subscription Details</a>
     <!-- /TMPL_LOOP -->
 </div>
 </div>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl
index 60e09d7..760eceb 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl
@@ -1026,6 +1026,17 @@ $('#numberpattern').change( function() {
 				<div class="hint">To notify patrons of new serial issues, you must <a href="/cgi-bin/koha/tools/letter.pl">define a notice</a>.</div>
 				<!-- /TMPL_IF -->
         </li>
+		<li class="radio">
+			<label for="displaycount">Staff and Public Display</label>
+			<p>
+			 <label for="staffdisplaycount">Number of issues to display to staff: </label>
+			 <input type="text" name="staffdisplaycount" id="staffdisplaycount" value="<!-- TMPL_VAR NAME="staffdisplaycount" -->" size="4"/>
+			</p>
+			<p>
+			<label for="opacdisplaycount">Number of issues to display to the public: </label>
+			<input type="text" name="opacdisplaycount" id="opacdisplaycount" value="<!-- TMPL_VAR NAME="opacdisplaycount" -->" size="4"/>
+			</p>
+		</li>
 	</ol>
 
             <div style="float:left;clear:left;margin:1em;"><strong>Note:</strong>
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl
index 8f78e73..0e6b4c1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl
@@ -67,6 +67,8 @@ function popup(subscriptionid) {
             <li>Serial receipt does not create an item record.</li>
         <!-- /TMPL_IF -->
         <!-- TMPL_IF name="callnumber" --><li><span class="label">Call Number:</span> <!-- TMPL_VAR name="callnumber" -->&nbsp;</li><!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="staffdisplaycount" --><li><span class="label">Number of issues to display to staff</span>:&nbsp;<!-- TMPL_VAR NAME="staffdisplaycount" -->&nbsp;</li><!-- /TMPL_IF -->
+		<!-- TMPL_IF NAME="opacdisplaycount" --><li><span class="label">Number of issues to display to the public</span>:&nbsp;<!-- TMPL_VAR NAME="opacdisplaycount" -->&nbsp;</li><!-- /TMPL_IF -->
         <!-- TMPL_IF name="letter" --><li><span class="label">Patron alert with:</span> <!-- TMPL_VAR name="letter" -->&nbsp;</li><!-- /TMPL_IF -->
         <!-- TMPL_IF name="notes" --><li><span class="label">Notes:</span> <!-- TMPL_VAR name="notes" --></li><!-- /TMPL_IF -->
         <!-- TMPL_IF name="internalnotes" --><li><span class="label">Management Notes:</span> <!-- TMPL_VAR name="internalnotes" --></li><!-- /TMPL_IF -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
index a48ef1c..4ab51a1 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
@@ -40,7 +40,7 @@
 	        </h2>
 	        <!-- TMPL_LOOP Name="subscriptions" -->
 	            <h3>At library: <!-- TMPL_VAR name="branchcode" --> <!-- TMPL_VAR name="notes" --></h3>
-	            <p>Below is a list of the three latest issues :</p>
+	            <p>Below is a list of the <!-- TMPL_VAR NAME="opacdisplaycount" --> latest issues :</p>
 	            <!-- TMPL_IF name="subscriptionnotes"-->
 	                <p><!--TMPL_VAR Name="subscriptionnotes"--> </p>
 	            <!-- /TMPL_IF -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
index 73fdeca..0cc5d34 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
@@ -384,7 +384,7 @@
     <!-- TMPL_IF name="branchcode" --><h3>At branch: <!-- TMPL_VAR NAME="branchcode" --></h3><!-- /TMPL_IF -->
     <!-- TMPL_IF NAME="subscriptionnotes" --><p><!--TMPL_VAR NAME="subscriptionnotes"--> </p><!-- /TMPL_IF -->
     <!--TMPL_IF NAME="latestserials"-->
-    <p> The three latest issues for this subscription:</p>
+    <p> The <!-- TMPL_VAR NAME="opacdisplaycount" --> latest issues for this subscription:</p>
     <table>
         <tr>
             <th>Issue #</th>
diff --git a/kohaversion.pl b/kohaversion.pl
index 592bb0c..a0c6437 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.014';
+    our $VERSION = '3.01.00.015';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl
index bb3b570..d8e3159 100755
--- a/opac/opac-ISBDdetail.pl
+++ b/opac/opac-ISBDdetail.pl
@@ -73,13 +73,17 @@ my @subscriptions       =
 my @subs;
 foreach my $subscription (@subscriptions) {
     my %cell;
+	my $serials_to_display;
     $cell{subscriptionid}    = $subscription->{subscriptionid};
     $cell{subscriptionnotes} = $subscription->{notes};
     $cell{branchcode}        = $subscription->{branchcode};
 
     #get the three latest serials.
+	$serials_to_display = $subscription->{opacdisplaycount};
+	$serials_to_display = C4::Context->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
+	$cell{opacdisplaycount} = $serials_to_display;
     $cell{latestserials} =
-      GetLatestSerials( $subscription->{subscriptionid}, 3 );
+      GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display );
     push @subs, \%cell;
 }
 
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index 24f59b0..96649a9 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -95,17 +95,22 @@ my $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}
 #coping with subscriptions
 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
 my @subscriptions       = GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );
+
 my @subs;
 $dat->{'serial'}=1 if $subscriptionsnumber;
 foreach my $subscription (@subscriptions) {
+    my $serials_to_display;
     my %cell;
     $cell{subscriptionid}    = $subscription->{subscriptionid};
     $cell{subscriptionnotes} = $subscription->{notes};
     $cell{branchcode}        = $subscription->{branchcode};
     $cell{hasalert}          = $subscription->{hasalert};
     #get the three latest serials.
+    $serials_to_display = $subscription->{opacdisplaycount};
+    $serials_to_display = C4::Context->preference('OPACSerialIssueDisplayCount') unless $serials_to_display;
+	$cell{opacdisplaycount} = $serials_to_display;
     $cell{latestserials} =
-      GetLatestSerials( $subscription->{subscriptionid}, 3 );
+      GetLatestSerials( $subscription->{subscriptionid}, $serials_to_display );
     push @subs, \%cell;
 }
 
diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl
index 39bd8ff..aeac684 100755
--- a/serials/subscription-add.pl
+++ b/serials/subscription-add.pl
@@ -213,6 +213,8 @@ if ($op eq 'addsubscription') {
     # ## BugFIX : hdl doesnot know what innerloops or letter stand for but it seems necessary. So he adds them.
     my $manualhistory = $query->param('manualhist');
     my $serialsadditems = $query->param('serialsadditems');
+	my $staffdisplaycount = $query->param('staffdisplaycount');
+	my $opacdisplaycount = $query->param('opacdisplaycount');
 	my $subscriptionid = NewSubscription($auser,$branchcode,$aqbooksellerid,$cost,$aqbudgetid,$biblionumber,
 					$startdate,$periodicity,$dow,$numberlength,$weeklength,$monthlength,
 					$add1,$every1,$whenmorethan1,$setto1,$lastvalue1,$innerloop1,
@@ -220,7 +222,7 @@ if ($op eq 'addsubscription') {
 					$add3,$every3,$whenmorethan3,$setto3,$lastvalue3,$innerloop3,
 					$numberingmethod, $status, $notes,$letter,$firstacquidate,join(",", at irregularity),
                     $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes,
-                    $serialsadditems,
+                    $serialsadditems,$staffdisplaycount,$opacdisplaycount
 				);
 
     print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
@@ -287,6 +289,8 @@ if ($op eq 'addsubscription') {
     my $opacnote = $query->param('opacnote');
     my $librariannote = $query->param('librariannote');
     my $history_only = $query->param('history_only');
+	my $staffdisplaycount = $query->param('staffdisplaycount');
+	my $opacdisplaycount = $query->param('opacdisplaycount');
 	#  If it's  a mod, we need to check the current 'expected' issue, and mod it in the serials table if necessary.
     if ( $nextacquidate ne $nextexpected->{planneddate}->output('iso') ) {
         ModNextExpected($subscriptionid,C4::Dates->new($nextacquidate,'iso'));
@@ -308,7 +312,7 @@ if ($op eq 'addsubscription') {
             $whenmorethan3,   $setto3,       $lastvalue3,     $innerloop3,
             $numberingmethod, $status,       $biblionumber,   $callnumber,
             $notes,           $letter,       $hemisphere,     $manualhistory,$internalnotes,
-            $serialsadditems, $subscriptionid,
+            $serialsadditems, $subscriptionid,$staffdisplaycount,$opacdisplaycount
         );
     }
     print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid");
-- 
1.5.6.5




More information about the Koha-patches mailing list