Bugzilla – Attachment 41217 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), 13.90 KB, created by
Rémi Mayrand-Provencher
on 2015-07-28 15:16:27 UTC
(
hide
)
Description:
Bug 8587 - Add a serial lifespan field to serial subscriptions
Filename:
MIME Type:
Creator:
Rémi Mayrand-Provencher
Created:
2015-07-28 15:16:27 UTC
Size:
13.90 KB
patch
obsolete
>From 32f3d7625f1077f8122637a774d936aee825658e Mon Sep 17 00:00:00 2001 >From: remi <remi.mayrand-provencher@inLibro.com> >Date: Tue, 28 Jul 2015 10:43:44 -0400 >Subject: [PATCH] Bug 8587 - Add a serial lifespan field to serial > subscriptions > >Adds a serial lifespan field to serial subscriptions. >Allows a serial subscription to be considered "out of date" after the chosen time period. >This version should now be both cleanly applicable and properly working. > >Test plan: >1) Apply patch >2) Run ./installer/data/mysql/updatedatabase.pl >3) Create subscription using the field "Serial lifespan" >--- > C4/Serials.pm | 17 ++++++----- > .../atomicupdate/subscription_seriallifespan.sql | 1 + > installer/data/mysql/kohastructure.sql | 1 + > .../en/modules/help/serials/subscription-add.tt | 1 + > .../prog/en/modules/serials/subscription-add.tt | 32 ++++++++++++++++++++ > .../prog/en/modules/serials/subscription-detail.tt | 20 ++++++++++++ > serials/subscription-add.pl | 9 ++++-- > serials/subscription-detail.pl | 1 + > 8 files changed, 73 insertions(+), 9 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/subscription_seriallifespan.sql > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index 3fcc4a3..970dcce 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -1284,7 +1284,7 @@ sub ModSubscription { > $lastvalue2, $innerloop2, $lastvalue3, $innerloop3, $status, > $biblionumber, $callnumber, $notes, $letter, $manualhistory, > $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, >- $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq >+ $graceperiod, $location, $enddate, $subscriptionid, $skip_serialseq, $serial_lifespan > ) = @_; > > my $dbh = C4::Context->dbh; >@@ -1297,7 +1297,8 @@ sub ModSubscription { > callnumber=?, notes=?, letter=?, manualhistory=?, > internalnotes=?, serialsadditems=?, staffdisplaycount=?, > opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, >- skip_serialseq=? >+ skip_serialseq=?, >+ serial_lifespan=? > WHERE subscriptionid = ?"; > > my $sth = $dbh->prepare($query); >@@ -1311,7 +1312,7 @@ sub ModSubscription { > $letter, ($manualhistory ? $manualhistory : 0), > $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, > $graceperiod, $location, $enddate, $skip_serialseq, >- $subscriptionid >+ $serial_lifespan, $subscriptionid > ); > my $rows = $sth->rows; > >@@ -1343,7 +1344,7 @@ sub NewSubscription { > $innerloop3, $status, $notes, $letter, $firstacquidate, $irregularity, > $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, > $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, >- $location, $enddate, $skip_serialseq >+ $location, $enddate, $skip_serialseq, $serial_lifespan > ) = @_; > my $dbh = C4::Context->dbh; > >@@ -1356,8 +1357,9 @@ sub NewSubscription { > lastvalue3, innerloop3, status, notes, letter, firstacquidate, > irregularity, numberpattern, locale, callnumber, > manualhistory, internalnotes, serialsadditems, staffdisplaycount, >- opacdisplaycount, graceperiod, location, enddate, skip_serialseq) >- VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) >+ opacdisplaycount, graceperiod, location, enddate, skip_serialseq, >+ serial_lifespan) >+ VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) > |; > my $sth = $dbh->prepare($query); > $sth->execute( >@@ -1367,7 +1369,8 @@ sub NewSubscription { > $lastvalue3, $innerloop3, $status, $notes, $letter, > $firstacquidate, $irregularity, $numberpattern, $locale, $callnumber, > $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, >- $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq >+ $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, >+ $serial_lifespan > ); > > my $subscriptionid = $dbh->{'mysql_insertid'}; >diff --git a/installer/data/mysql/atomicupdate/subscription_seriallifespan.sql b/installer/data/mysql/atomicupdate/subscription_seriallifespan.sql >new file mode 100644 >index 0000000..a2b3c4f >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/subscription_seriallifespan.sql >@@ -0,0 +1 @@ >+ALTER TABLE subscription ADD `serial_lifespan` TINYINT(1) DEFAULT -1; >\ No newline at end of file >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 2409bc2..1db9902 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -2123,6 +2123,7 @@ CREATE TABLE `subscription` ( -- information related to the subscription > `enddate` date default NULL, -- subscription end date > `closed` INT(1) NOT NULL DEFAULT 0, -- yes / no if the subscription is closed > `reneweddate` date default NULL, -- date of last renewal for the subscription >+ `serial_lifespan` TINYINT(1) DEFAULT -1, -- lifespan of serial subscriptions > PRIMARY KEY (`subscriptionid`), > CONSTRAINT subscription_ibfk_1 FOREIGN KEY (periodicity) REFERENCES subscription_frequencies (id) ON DELETE SET NULL ON UPDATE CASCADE, > CONSTRAINT subscription_ibfk_2 FOREIGN KEY (numberpattern) REFERENCES subscription_numberpatterns (id) ON DELETE SET NULL ON UPDATE CASCADE >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt >index 0a4b54a..aafd56f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/help/serials/subscription-add.tt >@@ -42,6 +42,7 @@ > <li>If no values are entered in these fields, they will use the OPACSerialIssueDisplayCount and StaffSerialIssueDisplayCount system preference values</li> > </ul> > </li> >+ <li>Serial lifespan: A serial will be considered "out of date" after the chosen time period. This field is not tied to any functionality, and is only used in reports.</li> > <li>In 'First issue publication date' you want to enter the date of the issue you have in your hand, the date from which the prediction pattern will start</li> > <li>There are several pre-defined options for the 'Frequency' of publication > <ul> >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 12fc1f2..3767156 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 >@@ -445,6 +445,22 @@ $(document).ready(function() { > if($("#numberpattern").val() != ""){ > numberpatternload(); > } >+ $("#lifespan_type").change(function(){ >+ if($(this).val() > 0){ >+ $("#serial_lifespan").show(); >+ [% IF serial_lifespan > 0 %] >+ $("#serial_lifespan").val([% serial_lifespan %]); >+ [% ELSE %] >+ $("#serial_lifespan").val(1); >+ [% END %] >+ >+ } >+ else{ >+ $("#serial_lifespan").hide(); >+ $("#serial_lifespan").val(-1); >+ } >+ }); >+ $("#lifespan_type").change(); > > var node; > [% FOREACH field IN dont_export_field_loop %] >@@ -632,6 +648,22 @@ $(document).ready(function() { > <legend>Serials planning</legend> > <ol> > <li> >+ <label for="serial_lifespan">Serial lifespan:</label> >+ <select id="lifespan_type"> >+ [% IF ( !serial_lifespan || serial_lifespan < 1 ) %] >+ <option value="-1" selected="selected">Permanent</option> >+ <option value="1">Years</option> >+ [% ELSE %] >+ <option value="-1">Permanent</option> >+ <option value="1" selected="selected">Years</option> >+ [% END %] >+ </select> >+ >+ <input name="serial_lifespan" id="serial_lifespan" type="number" min="1" >+ value="[% IF serial_lifespan %][% serial_lifespan %][% ELSE %]-1[% END %]"/> >+ <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="firstacquidate" class="required">First issue publication date:</label> > [% UNLESS (more_than_one_serial) %] > <input type="text" size="10" id="acqui_date" name="firstacquidate" value="[% firstacquidate | $KohaDates %]" class="datepicker required" required="required" /> >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 b684e5e..1c6436c 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 >@@ -180,6 +180,15 @@ $(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 serial_lifespan == -1 %] >+ <span>Permanent</span> >+ [% ELSIF serial_lifespan == 1%] >+ <span>[% serial_lifespan %] year</span> >+ [% ELSE %] >+ <span>[% serial_lifespan %] years</span> >+ [% END %] >+ </li> > </ol> > </div> > </div> >@@ -246,6 +255,17 @@ $(document).ready(function() { > </table> > </div> > <div id="subscription_issues"> >+ <h2>Serial issues</h2> >+ <p> >+ <label>Serial lifespan :</label> >+ [% IF serial_lifespan == -1 %] >+ <span>Permanent</span> >+ [% ELSIF serial_lifespan == 1%] >+ <span>[% serial_lifespan %] year</span> >+ [% ELSE %] >+ <span>[% serial_lifespan %] years</span> >+ [% END %] >+ </p> > <table> > <tr> > <th>Issue number</th> >diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl >index ce6f91d..46eb91f 100755 >--- a/serials/subscription-add.pl >+++ b/serials/subscription-add.pl >@@ -104,6 +104,9 @@ if ($op eq 'modify' || $op eq 'dup' || $op eq 'modsubscription') { > "subtype_$sub_on" => 1, > sublength =>$sub_length, > history => ($op eq 'modify'), >+ "periodicity".$subs->{'periodicity'} => 1, >+ "numberpattern".$subs->{'numberpattern'} => 1, >+ "serial_lifespan" => $subs->{'serial_lifespan'}, > firstacquiyear => substr($firstissuedate,0,4), > ); > >@@ -311,6 +314,7 @@ sub redirect_add_subscription { > my $opacdisplaycount = $query->param('opacdisplaycount'); > my $location = $query->param('location'); > my $skip_serialseq = $query->param('skip_serialseq'); >+ my $serial_lifespan = $query->param('serial_lifespan'); > my $startdate = format_date_in_iso( $query->param('startdate') ); > my $enddate = format_date_in_iso( $query->param('enddate') ); > my $firstacquidate = format_date_in_iso($query->param('firstacquidate')); >@@ -330,7 +334,7 @@ sub redirect_add_subscription { > join(";",@irregularity), $numberpattern, $locale, $callnumber, > $manualhistory, $internalnotes, $serialsadditems, > $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, >- $skip_serialseq >+ $skip_serialseq, $serial_lifespan > ); > > print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); >@@ -379,6 +383,7 @@ sub redirect_mod_subscription { > my $graceperiod = $query->param('graceperiod') || 0; > my $location = $query->param('location'); > my $skip_serialseq = $query->param('skip_serialseq'); >+ my $serial_lifespan = $query->param('serial_lifespan'); > > # Guess end date > if(!defined $enddate || $enddate eq '') { >@@ -405,7 +410,7 @@ sub redirect_mod_subscription { > $status, $biblionumber, $callnumber, $notes, $letter, > $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, > $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid, >- $skip_serialseq >+ $skip_serialseq, $serial_lifespan > ); > > print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); >diff --git a/serials/subscription-detail.pl b/serials/subscription-detail.pl >index 1453306..9483db6 100755 >--- a/serials/subscription-detail.pl >+++ b/serials/subscription-detail.pl >@@ -159,6 +159,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.9.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