From 5c4dbed748b08e3dbf290166b129f25850ead2ab Mon Sep 17 00:00:00 2001 From: Maxime Pelletier Date: Fri, 30 Sep 2011 12:45:32 -0400 Subject: [PATCH] 8587 Add serial subscript lifespan Add lifespan to serial subscriptions Sponsored-by: CCSR ( http://www.ccsr.qc.ca ) Signed-off-by: Chris Cormack --- C4/Serials.pm | 16 +++--- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++ .../prog/en/modules/serials/subscription-add.tt | 17 +++++++ .../prog/en/modules/serials/subscription-detail.tt | 52 ++++++++++++++++++++ serials/subscription-add.pl | 24 +++++---- serials/subscription-detail.pl | 1 + 7 files changed, 101 insertions(+), 17 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index 98660e9..8cedebf 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1171,7 +1171,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; @@ -1185,7 +1186,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; @@ -1202,7 +1203,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; @@ -1228,12 +1229,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; @@ -1247,8 +1249,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( @@ -1257,7 +1259,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 69304e1..489311a 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -1893,6 +1893,7 @@ CREATE TABLE `subscription` ( `opacdisplaycount` VARCHAR(10) NULL, `graceperiod` int(11) NOT NULL default '0', `enddate` 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 ed0c674..06d8856 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5635,6 +5635,13 @@ if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = 'XXX'; +if (C4::Context->preference("Version") < TransformToNum($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 4ab5c11..3204df5 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,23 @@ $(document).ready(function() { [% END %]
  • + + +
    Set the subscription's serial lifespan. A serial will be considered "out of date" after the chosen time period.
    +
  • +