Bugzilla – Attachment 19415 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]
Bug 8587 - Add a serial lifespan field to serial subscriptions
Bug-8587---Add-a-serial-lifespan-field-to-serial-s.patch (text/plain), 17.82 KB, created by
Kyle M Hall
on 2013-07-05 14:33:58 UTC
(
hide
)
Description:
Bug 8587 - Add a serial lifespan field to serial subscriptions
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2013-07-05 14:33:58 UTC
Size:
17.82 KB
patch
obsolete
>From e912b66753ec316663f02b0034149eb684c60d97 Mon Sep 17 00:00:00 2001 >From: Maxime Pelletier <maxime.pelletier@libeo.com> >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 <kyle@bywatersolutions.com> >--- > 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 %] > </li> > <li> >+ <label for="seriallifespan">Serial lifespan:</label> >+ <select name="seriallifespan" id="seriallifespan"> >+ [% IF ( seriallifespan == -1 ) %] >+ <option value="-1" selected="selected">Permanent</option> >+ [% ELSE %] >+ <option value="-1">Permanent</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;"> >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 959f14f..5907dc4 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 >@@ -261,6 +261,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>Permanent</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> >@@ -327,6 +352,33 @@ $(document).ready(function() { > </table> > </div> > <div id="subscription_issues"> >+ <h2>Serial issues</h2> >+ <p> >+ <label>Serial lifespan :</label> >+ [% IF seriallifespan == -1 %] >+ <span>Permanent</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 1959b23..79f2513 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -45,8 +45,7 @@ my @budgets; > # Permission needed otherwise (nothing or dup) : create_subscription > my $permission = ($op eq "modify") ? "edit_subscription" : "create_subscription"; > >-my ($template, $loggedinuser, $cookie) >-= get_template_and_user({template_name => "serials/subscription-add.tmpl", >+my ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "serials/subscription-add.tmpl", > query => $query, > type => "intranet", > authnotrequired => 0, >@@ -109,6 +108,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), > ); > } >@@ -256,15 +256,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"); >@@ -331,13 +333,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, >@@ -349,8 +351,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 fc57d89..9e0d922 100755 >--- a/serials/subscription-detail.pl >+++ b/serials/subscription-detail.pl >@@ -178,6 +178,7 @@ $template->param( > show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0, > basketno => $order->{basketno}, > %$tmpl_infos, >+ seriallifespan => $subs->{'seriallifespan'}, > ); > > output_html_with_http_headers $query, $cookie, $template->output; >-- >1.7.2.5
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