Serials Display Enhancement
authorJoshua Ferraro <jmf@liblime.com>
Thu, 26 Mar 2009 22:09:46 +0000 (17:09 -0500)
committerGalen Charlton <galen.charlton@liblime.com>
Fri, 3 Apr 2009 21:41:38 +0000 (16:41 -0500)
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@liblime.com>
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
17 files changed:
C4/Auth.pm
C4/Serials.pm
admin/systempreferences.pl
catalogue/detail.pl
installer/data/mysql/en/mandatory/sysprefs.sql
installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/includes/sysprefs-menu.inc
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tmpl
koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tmpl
koha-tmpl/opac-tmpl/prog/en/modules/opac-ISBDdetail.tmpl
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
kohaversion.pl
opac/opac-ISBDdetail.pl
opac/opac-detail.pl
serials/subscription-add.pl

index 874b870..1c82a1d 100644 (file)
@@ -307,6 +307,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 {
@@ -359,6 +360,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);
index b78453e..5bec265 100644 (file)
@@ -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);
index b8ce9f2..2733b91 100755 (executable)
@@ -321,6 +321,10 @@ $tabsysprefs{OPACGroupResults}     = "OPAC";
 $tabsysprefs{XSLTDetailsDisplay}   = "OPAC";
 $tabsysprefs{XSLTResultsDisplay}   = "OPAC";
 
+# Serials
+$tabsysprefs{OPACSerialIssueDisplayCount}  = "Serials";
+$tabsysprefs{StaffSerialIssueDisplayCount}  = "Serials";
+
 # LOGFeatures
 $tabsysprefs{CataloguingLog}  = "Logs";
 $tabsysprefs{BorrowersLog}    = "Logs";
index bdc935c..e0f5694 100755 (executable)
@@ -98,13 +98,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;
 }
 
index 715c07e..3d901be 100644 (file)
@@ -230,3 +230,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImageSize', 'MC', 'Choose the size of the Syndetics Cover Image to display on the OPAC detail page, MC is Medium, LC is Large','MC|LC','Choice');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AmazonCoverImages', '0', 'Display Cover Images in Staff Client from Amazon Web Services','','YesNo');
+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');
index 17d5f5a..74dfe01 100644 (file)
@@ -232,3 +232,5 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES (
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SyndeticsCoverImageSize', 'MC', 'Choose the size of the Syndetics Cover Image to display on the OPAC detail page, MC is Medium, LC is Large','MC|LC','Choice');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('OPACAmazonCoverImages', '0', 'Display cover images on OPAC from Amazon Web Services','','YesNo');
 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AmazonCoverImages', '0', 'Display Cover Images in Staff Client from Amazon Web Services','','YesNo');
+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');
index 13b469c..d96b556 100755 (executable)
@@ -2279,6 +2279,22 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     SetVersion ($DBversion);
 }
 
+$DBversion = "3.01.00.017";
+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)
 
index dc39eaa..b915d1d 100644 (file)
@@ -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>
index 194da80..f3ae4b9 100644 (file)
@@ -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>
index 60e09d7..760eceb 100644 (file)
@@ -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>
index 8f78e73..0e6b4c1 100644 (file)
@@ -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 -->
index fb0b647..2ab6756 100644 (file)
@@ -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 -->
index 14747e9..ab24ae1 100644 (file)
     <!-- 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>
index fc73c47..8cc018f 100644 (file)
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.016';
+    our $VERSION = '3.01.00.017';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
index 6479413..31bd32e 100755 (executable)
@@ -90,13 +90,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;
 }
 
index 1a48c54..f354b92 100755 (executable)
@@ -96,17 +96,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;
 }
 
index 39bd8ff..aeac684 100755 (executable)
@@ -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(",",@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");