Bugzilla – Attachment 11513 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]
Patch that passes tests
0001-seriallifespan.patch (text/plain), 16.19 KB, created by
Maxime Pelletier
on 2012-08-09 19:54:41 UTC
(
hide
)
Description:
Patch that passes tests
Filename:
MIME Type:
Creator:
Maxime Pelletier
Created:
2012-08-09 19:54:41 UTC
Size:
16.19 KB
patch
obsolete
>@@ -, +, @@ >--- > 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(-) >--- a/C4/Serials.pm >+++ a/C4/Serials.pm >@@ -1156,7 +1156,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; >@@ -1170,7 +1171,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; >@@ -1187,7 +1188,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; > >@@ -1213,12 +1214,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; > >@@ -1232,8 +1234,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( >@@ -1242,7 +1244,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'}; >--- a/installer/data/mysql/kohastructure.sql >+++ a/installer/data/mysql/kohastructure.sql >@@ -1884,6 +1884,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; > >--- a/installer/data/mysql/updatedatabase.pl >+++ a/installer/data/mysql/updatedatabase.pl >@@ -5249,6 +5249,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) >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-add.tt >@@ -1017,6 +1017,67 @@ $(document).ready(function() { > [% END %] > </li> > <li> >+ <label for="seriallifespan">Serial lifespan:</label> >+ <select name="seriallifespan" id="seriallifespan"> >+ [% IF ( seriallifespan == -1 ) %] >+ <option value="-1" selected="selected">Immortal</option> >+ [% ELSE %] >+ <option value="-1">Immortal</option> >+ [% END %] >+ [% IF ( seriallifespan == 1 ) %] >+ <option value="1" selected="selected">1 year</option> >+ [% ELSE %] >+ <option value="1">1 year</option> >+ [% END %] >+ [% IF ( seriallifespan == 2 ) %] >+ <option value="2" selected="selected">2 years</option> >+ [% ELSE %] >+ <option value="2">2 years</option> >+ [% END %] >+ [% IF ( seriallifespan == 3 ) %] >+ <option value="3" selected="selected">3 years</option> >+ [% ELSE %] >+ <option value="3">3 years</option> >+ [% END %] >+ [% IF ( seriallifespan == 4 ) %] >+ <option value="4" selected="selected">4 years</option> >+ [% ELSE %] >+ <option value="4">4 years</option> >+ [% END %] >+ [% IF ( seriallifespan == 5 ) %] >+ <option value="5" selected="selected">5 years</option> >+ [% ELSE %] >+ <option value="5">5 years</option> >+ [% END %] >+ [% IF ( seriallifespan == 6 ) %] >+ <option value="6" selected="selected">6 years</option> >+ [% ELSE %] >+ <option value="6">6 years</option> >+ [% END %] >+ [% IF ( seriallifespan == 7 ) %] >+ <option value="7" selected="selected">7 years</option> >+ [% ELSE %] >+ <option value="7">7 years</option> >+ [% END %] >+ [% IF ( seriallifespan == 8 ) %] >+ <option value="8" selected="selected">8 years</option> >+ [% ELSE %] >+ <option value="8">8 years</option> >+ [% END %] >+ [% IF ( seriallifespan == 9 ) %] >+ <option value="9" selected="selected">9 years</option> >+ [% ELSE %] >+ <option value="9">9 years</option> >+ [% END %] >+ [% IF ( seriallifespan == 10 ) %] >+ <option value="10" selected="selected">10 years</option> >+ [% ELSE %] >+ <option value="10">10 years</option> >+ [% END %] >+ </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;"> >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt >@@ -251,6 +251,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> >@@ -317,6 +342,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> >--- a/serials/subscription-add.pl >+++ a/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), > ); > } >@@ -257,15 +258,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"); >@@ -332,13 +335,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, >@@ -350,8 +353,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; >--- a/serials/subscription-detail.pl >+++ a/serials/subscription-detail.pl >@@ -138,6 +138,7 @@ $template->param( > intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'), > irregular_issues => scalar @irregular_issues, > default_bib_view => $default_bib_view, >+ "seriallifespan" => $subs->{'seriallifespan'}, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >--
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