From 65ddce02f2079df5661485306564a0f075437622 Mon Sep 17 00:00:00 2001 From: Joshua Ferraro Date: Thu, 26 Mar 2009 17:09:46 -0500 Subject: [PATCH] Serials Display Enhancement 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 Signed-off-by: Galen Charlton --- C4/Auth.pm | 2 ++ C4/Serials.pm | 20 ++++++++++--------- admin/systempreferences.pl | 4 ++++ catalogue/detail.pl | 6 +++++- .../data/mysql/en/mandatory/sysprefs.sql | 2 ++ .../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 ++- .../en/modules/serials/subscription-add.tmpl | 11 ++++++++++ .../modules/serials/subscription-detail.tmpl | 2 ++ .../prog/en/modules/opac-ISBDdetail.tmpl | 2 +- .../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 874b870d2c..1c82a1d5d1 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -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); diff --git a/C4/Serials.pm b/C4/Serials.pm index b78453ef83..5bec265771 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 b8ce9f2f33..2733b91b95 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -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"; diff --git a/catalogue/detail.pl b/catalogue/detail.pl index bdc935c20a..e0f5694cf9 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -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; } diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql index 715c07ed8c..3d901be4e7 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -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'); 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 17d5f5af41..74dfe01dbb 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 @@ -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'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 13b469cfd5..d96b55627f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -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) 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 dc39eaac9f..b915d1d3f9 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 @@
  • OPAC
  • Patrons
  • Searching
  • +
  • Serials
  • Staff Client
  • Local Use
  • 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 194da801ff..f3ae4b9e4b 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() {

    -

    The three latest issues related to this subscription:

    +

    The latest issues related to this subscription:

    @@ -402,6 +402,7 @@ function verify_images() {
    Issue #
    + ">Subscription Details 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 60e09d7e1e..760eceb24b 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() {
    To notify patrons of new serial issues, you must define a notice.
    +
  • + +

    + + " size="4"/> +

    +

    + + " size="4"/> +

    +
  • Note: 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 8f78e73fe5..0e6b4c1b31 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) {
  • Serial receipt does not create an item record.
  • Call Number:  
  • +
  • Number of issues to display to staff 
  • +
  • Number of issues to display to the public 
  • Patron alert with:  
  • Notes:
  • Management Notes:
  • 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 fb0b647137..2ab6756eb6 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 @@

    At library:

    -

    Below is a list of the three latest issues :

    +

    Below is a list of the latest issues :

    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 14747e96ec..ab24ae168a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl @@ -481,7 +481,7 @@

    At branch:

    -

    The three latest issues for this subscription:

    +

    The latest issues for this subscription:

    diff --git a/kohaversion.pl b/kohaversion.pl index fc73c47b48..8cc018f247 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -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 diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 647941339f..31bd32eee4 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -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; } diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 1a48c5446c..f354b92b23 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -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; } diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index 39bd8ff8d5..aeac6840d7 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(",",@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"); -- 2.39.5
    Issue #