From e912b66753ec316663f02b0034149eb684c60d97 Mon Sep 17 00:00:00 2001 From: Maxime Pelletier Date: Mon, 22 Apr 2013 15:56:36 -0400 Subject: [PATCH] Bug 8587 - Add a serial lifespan field to serial subscriptions http://bugs.koha-community.org/show_bug.cgi?id=8587 Signed-off-by: Kyle M Hall --- C4/Serials.pm | 16 +++-- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 ++ .../prog/en/modules/serials/subscription-add.tt | 61 ++++++++++++++++++++ .../prog/en/modules/serials/subscription-detail.tt | 52 +++++++++++++++++ serials/subscription-add.pl | 27 +++++---- serials/subscription-detail.pl | 1 + 7 files changed, 146 insertions(+), 19 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 76d3fc7..f30bb48 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1260,7 +1260,8 @@ sub ModSubscription { $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, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid + $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid, + $seriallifespan ) = @_; # warn $irregularity; @@ -1274,7 +1275,7 @@ sub ModSubscription { numberingmethod=?, status=?, biblionumber=?, callnumber=?, notes=?, letter=?, hemisphere=?,manualhistory=?,internalnotes=?,serialsadditems=?, staffdisplaycount = ?,opacdisplaycount = ?, graceperiod = ?, location = ? - ,enddate=? + ,enddate=?, seriallifespan=? WHERE subscriptionid = ?"; #warn "query :".$query; @@ -1291,7 +1292,7 @@ sub ModSubscription { $numberingmethod, $status, $biblionumber, $callnumber, $notes, $letter, $hemisphere, ( $manualhistory ? $manualhistory : 0 ), $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, - $graceperiod, $location, $enddate, $subscriptionid + $graceperiod, $location, $enddate, $seriallifespan, $subscriptionid ); my $rows = $sth->rows; @@ -1317,12 +1318,13 @@ the id of this new subscription =cut sub NewSubscription { + my ($auser, $branchcode, $aqbooksellerid, $cost, $aqbudgetid, $biblionumber, $startdate, $periodicity, $dow, $numberlength, $weeklength, $monthlength, $add1, $every1, $whenmorethan1, $setto1, $lastvalue1, $innerloop1, $add2, $every2, $whenmorethan2, $setto2, $lastvalue2, $innerloop2, $add3, $every3, $whenmorethan3, $setto3, $lastvalue3, $innerloop3, $numberingmethod, $status, $notes, $letter, $firstacquidate, $irregularity, $numberpattern, $callnumber, $hemisphere, $manualhistory, - $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate + $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $seriallifespan ) = @_; my $dbh = C4::Context->dbh; @@ -1336,8 +1338,8 @@ sub NewSubscription { add3,every3,whenmorethan3,setto3,lastvalue3,innerloop3, numberingmethod, status, notes, letter,firstacquidate,irregularity, numberpattern, callnumber, hemisphere,manualhistory,internalnotes,serialsadditems, - staffdisplaycount,opacdisplaycount,graceperiod,location,enddate) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + staffdisplaycount,opacdisplaycount,graceperiod,location,enddate,seriallifespan) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |; my $sth = $dbh->prepare($query); $sth->execute( @@ -1346,7 +1348,7 @@ sub NewSubscription { $lastvalue1, $innerloop1, $add2, $every2, $whenmorethan2, $setto2, $lastvalue2, $innerloop2, $add3, $every3, $whenmorethan3, $setto3, $lastvalue3, $innerloop3, $numberingmethod, "$status", $notes, $letter, $firstacquidate, $irregularity, $numberpattern, $callnumber, $hemisphere, $manualhistory, - $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate + $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $seriallifespan ); my $subscriptionid = $dbh->{'mysql_insertid'}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index f5e1862..a9eb278 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2031,6 +2031,7 @@ CREATE TABLE `subscription` ( `enddate` date default NULL, `closed` INT(1) NOT NULL DEFAULT 0, `reneweddate` date default NULL, + `seriallifespan` TINYINT(1) DEFAULT -1, PRIMARY KEY (`subscriptionid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a6b0090..36e6343 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7017,6 +7017,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = 'XXX'; +if ( CheckVersion($DBversion) ) { + $dbh->do("ALTER TABLE subscription ADD `seriallifespan` TINYINT(1) DEFAULT -1"); + print "Upgrade to $DBversion done (Add seriallifespan to subscription)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt index 14f01ef..9168b76 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt @@ -1030,6 +1030,67 @@ $(document).ready(function() { [% END %]
  • + + +
    Set the subscription's serial lifespan. A serial will be considered "out of date" after the chosen time period.
    +
  • +