From 32f3d7625f1077f8122637a774d936aee825658e Mon Sep 17 00:00:00 2001 From: remi Date: Tue, 28 Jul 2015 10:43:44 -0400 Subject: [PATCH] Bug 8587 - Add a serial lifespan field to serial subscriptions Adds a serial lifespan field to serial subscriptions. Allows a serial subscription to be considered "out of date" after the chosen time period. This version should now be both cleanly applicable and properly working. Test plan: 1) Apply patch 2) Run ./installer/data/mysql/updatedatabase.pl 3) Create subscription using the field "Serial lifespan" --- C4/Serials.pm | 17 ++++++----- .../atomicupdate/subscription_seriallifespan.sql | 1 + installer/data/mysql/kohastructure.sql | 1 + .../en/modules/help/serials/subscription-add.tt | 1 + .../prog/en/modules/serials/subscription-add.tt | 32 ++++++++++++++++++++ .../prog/en/modules/serials/subscription-detail.tt | 20 ++++++++++++ serials/subscription-add.pl | 9 ++++-- serials/subscription-detail.pl | 1 + 8 files changed, 73 insertions(+), 9 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/subscription_seriallifespan.sql diff --git a/C4/Serials.pm b/C4/Serials.pm index 3fcc4a3..970dcce 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1284,7 +1284,7 @@ sub ModSubscription { $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status, $biblionumber, $callnumber, $notes, $letter, $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, - $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq + $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, $serial_lifespan ) = @_; my $dbh = C4::Context->dbh; @@ -1297,7 +1297,8 @@ sub ModSubscription { callnumber=?, notes=?, letter=?, manualhistory=?, internalnotes=?, serialsadditems=?, staffdisplaycount=?, opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, - skip_serialseq=? + skip_serialseq=?, + serial_lifespan=? WHERE subscriptionid = ?"; my $sth = $dbh->prepare($query); @@ -1311,7 +1312,7 @@ sub ModSubscription { $letter, ($manualhistory ? $manualhistory : 0), $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, - $subscriptionid + $serial_lifespan, $subscriptionid ); my $rows = $sth->rows; @@ -1343,7 +1344,7 @@ sub NewSubscription { $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, - $location, $enddate, $skip_serialseq + $location, $enddate, $skip_serialseq, $serial_lifespan ) = @_; my $dbh = C4::Context->dbh; @@ -1356,8 +1357,9 @@ sub NewSubscription { lastvalue3, innerloop3, status, notes, letter, firstacquidate, irregularity, numberpattern, locale, callnumber, manualhistory, internalnotes, serialsadditems, staffdisplaycount, - opacdisplaycount, graceperiod, location, enddate, skip_serialseq) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + opacdisplaycount, graceperiod, location, enddate, skip_serialseq, + serial_lifespan) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |; my $sth = $dbh->prepare($query); $sth->execute( @@ -1367,7 +1369,8 @@ sub NewSubscription { $lastvalue3, $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, - $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq + $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, + $serial_lifespan ); my $subscriptionid = $dbh->{'mysql_insertid'}; diff --git a/installer/data/mysql/atomicupdate/subscription_seriallifespan.sql b/installer/data/mysql/atomicupdate/subscription_seriallifespan.sql new file mode 100644 index 0000000..a2b3c4f --- /dev/null +++ b/installer/data/mysql/atomicupdate/subscription_seriallifespan.sql @@ -0,0 +1 @@ +ALTER TABLE subscription ADD `serial_lifespan` TINYINT(1) DEFAULT -1; \ No newline at end of file diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 2409bc2..1db9902 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2123,6 +2123,7 @@ CREATE TABLE `subscription` ( -- information related to the subscription `enddate` date default NULL, -- subscription end date `closed` INT(1) NOT NULL DEFAULT 0, -- yes / no if the subscription is closed `reneweddate` date default NULL, -- date of last renewal for the subscription + `serial_lifespan` TINYINT(1) DEFAULT -1, -- lifespan of serial subscriptions PRIMARY KEY (`subscriptionid`), CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt index 0a4b54a..aafd56f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt @@ -42,6 +42,7 @@
  • If no values are entered in these fields, they will use the OPACSerialIssueDisplayCount and StaffSerialIssueDisplayCount system preference values
  • +
  • Serial lifespan: A serial will be considered "out of date" after the chosen time period. This field is not tied to any functionality, and is only used in reports.
  • In 'First issue publication date' you want to enter the date of the issue you have in your hand, the date from which the prediction pattern will start
  • There are several pre-defined options for the 'Frequency' of publication