Bugzilla – Attachment 11437 Details for
Bug 8587
Add a serial lifespan to serial subscriptions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
8587 Add serial subscript lifespan
8587-Add-serial-subscript-lifespan.patch (text/plain), 16.24 KB, created by
Chris Cormack
on 2012-08-08 08:17:44 UTC
(
hide
)
Description:
8587 Add serial subscript lifespan
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-08-08 08:17:44 UTC
Size:
16.24 KB
patch
obsolete
>From 5c4dbed748b08e3dbf290166b129f25850ead2ab Mon Sep 17 00:00:00 2001 >From: Maxime Pelletier <maxime.pelletier@libeo.com> >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 <chris@bigballofwax.co.nz> >--- > 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 %] > </li> > <li> >+ <label for="seriallifespan">Serial lifespan:</label> >+ <select name="seriallifespan" id="seriallifespan"> >+ <option value="-1" [% IF ( seriallifespan == -1 ) %]selected="selected"[% END %]>Immortal</option> >+ <option value="1" [% IF ( seriallifespan == 1 ) %]selected="selected"[% END %]>1 year</option> >+ <option value="2" [% IF ( seriallifespan == 2 ) %]selected="selected"[% END %]>2 years</option> >+ <option value="3" [% IF ( seriallifespan == 3 ) %]selected="selected"[% END %]>3 years</option> >+ <option value="4" [% IF ( seriallifespan == 4 ) %]selected="selected"[% END %]>4 years</option> >+ <option value="5" [% IF ( seriallifespan == 5 ) %]selected="selected"[% END %]>5 years</option> >+ <option value="6" [% IF ( seriallifespan == 6 ) %]selected="selected"[% END %]>6 years</option> >+ <option value="7" [% IF ( seriallifespan == 7 ) %]selected="selected"[% END %]>7 years</option> >+ <option value="8" [% IF ( seriallifespan == 8 ) %]selected="selected"[% END %]>8 years</option> >+ <option value="9" [% IF ( seriallifespan == 9 ) %]selected="selected"[% END %]>9 years</option> >+ <option value="10" [% IF ( seriallifespan == 10 ) %]selected="selected"[% END %]>10 years</option> >+ </select> >+ <div class="hint">Set the subscription's serial lifespan. A serial will be considered "out of date" after the chosen time period.</div> >+ </li> >+ <li> > <label for="branchcode">Library:</label> > > <select name="branchcode" id="branchcode" style="width: 20em;"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >index 1afd0c1..baaf0ae 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >@@ -255,6 +255,31 @@ $(document).ready(function() { > [% IF ( numberlength ) %]<li><span class="label">Number of issues:</span> [% numberlength %]</li>[% END %] > [% IF ( weeklength ) %]<li><span class="label">Number of weeks:</span> [% weeklength %]</li>[% END %] > [% IF ( monthlength ) %]<li><span class="label">Number of months:</span> [% monthlength %]</li>[% END %] >+ <li><span class="label">Serial lifespan:</span> >+ [% IF seriallifespan == -1 %] >+ <span>Immortal</span> >+ [% ELSIF ( seriallifespan == 1 ) %] >+ <span>1 year</span> >+ [% ELSIF ( seriallifespan == 2 ) %] >+ <span>2 years</span> >+ [% ELSIF ( seriallifespan == 3 ) %] >+ <span>3 years</span> >+ [% ELSIF ( seriallifespan == 4 ) %] >+ <span>4 years</span> >+ [% ELSIF ( seriallifespan == 5 ) %] >+ <span>5 years</span> >+ [% ELSIF ( seriallifespan == 6 ) %] >+ <span>6 years</span> >+ [% ELSIF ( seriallifespan == 7 ) %] >+ <span>7 years</span> >+ [% ELSIF ( seriallifespan == 8 ) %] >+ <span>8 years</span> >+ [% ELSIF ( seriallifespan == 9 ) %] >+ <span>9 years</span> >+ [% ELSIF ( seriallifespan == 10 ) %] >+ <span>10 years</span> >+ [% END %] >+ </li> > </ol> > </div> > </div> >@@ -321,6 +346,33 @@ $(document).ready(function() { > </table> > </div> > <div id="subscription_issues"> >+ <h2>Serial issues</h2> >+ <p> >+ <label>Serial lifespan :</label> >+ [% IF seriallifespan == -1 %] >+ <span>Immortal</span> >+ [% ELSIF ( seriallifespan == 1 ) %] >+ <span>1 year</span> >+ [% ELSIF ( seriallifespan == 2 ) %] >+ <span>2 years</span> >+ [% ELSIF ( seriallifespan == 3 ) %] >+ <span>3 years</span> >+ [% ELSIF ( seriallifespan == 4 ) %] >+ <span>4 years</span> >+ [% ELSIF ( seriallifespan == 5 ) %] >+ <span>5 years</span> >+ [% ELSIF ( seriallifespan == 6 ) %] >+ <span>6 years</span> >+ [% ELSIF ( seriallifespan == 7 ) %] >+ <span>7 years</span> >+ [% ELSIF ( seriallifespan == 8 ) %] >+ <span>8 years</span> >+ [% ELSIF ( seriallifespan == 9 ) %] >+ <span>9 years</span> >+ [% ELSIF ( seriallifespan == 10 ) %] >+ <span>10 years</span> >+ [% END %] >+ </p> > <table> > <tr> > <th>Issue number</th> >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index a3306ea..fa4c4e4 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -109,6 +109,7 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { > history => ($op eq 'modify'), > "periodicity".$subs->{'periodicity'} => 1, > "numberpattern".$subs->{'numberpattern'} => 1, >+ "seriallifespan" => $subs->{'seriallifespan'}, > firstacquiyear => substr($firstissuedate,0,4), > ); > } >@@ -258,15 +259,17 @@ sub redirect_add_subscription { > my $missinglist = $query->param('missinglist'); > my $opacnote = $query->param('opacnote'); > my $librariannote = $query->param('librariannote'); >+ my $seriallifespan = $query->param('seriallifespan'); > my $subscriptionid = NewSubscription($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,join(",",@irregularity), >- $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes, >- $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate >- ); >+ $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,join(",",@irregularity), >+ $numberpattern, $callnumber, $hemisphere,($manualhistory?$manualhistory:0),$internalnotes, >+ $serialsadditems,$staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$seriallifespan >+ ); >+ > ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote); > > print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); >@@ -333,13 +336,13 @@ sub redirect_mod_subscription { > my $graceperiod = $query->param('graceperiod') || 0; > my $location = $query->param('location'); > my $nextexpected = GetNextExpected($subscriptionid); >+ my $seriallifespan = $query->param('seriallifespan'); > # 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')); > # if we have not received any issues yet, then we also must change the firstacquidate for the subs. > $firstissuedate = $nextacquidate if($nextexpected->{isfirstissue}); > } >- > ModSubscription( > $auser, $branchcode, $aqbooksellerid, $cost, > $aqbudgetid, $startdate, $periodicity, $firstissuedate, >@@ -351,8 +354,9 @@ sub redirect_mod_subscription { > $whenmorethan3, $setto3, $lastvalue3, $innerloop3, > $numberingmethod, $status, $biblionumber, $callnumber, > $notes, $letter, $hemisphere, $manualhistory,$internalnotes, >- $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid >+ $serialsadditems, $staffdisplaycount,$opacdisplaycount,$graceperiod,$location,$enddate,$subscriptionid,$seriallifespan > ); >+ > ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote); > print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); > return; >diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl >index ae85c51..61869f5 100755 >--- a/serials/subscription-detail.pl >+++ b/serials/subscription-detail.pl >@@ -139,6 +139,7 @@ $template->param( > irregular_issues => scalar @irregular_issues, > default_bib_view => $default_bib_view, > (uc(C4::Context->preference("marcflavour"))) => 1 >+ "seriallifespan" => $subs->{'seriallifespan'}, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8587
:
11424
|
11437
|
11447
|
11513
|
17600
|
19415
|
19416
|
30636
|
30637
|
30953
|
41217