From 278c217034bee1d1efed44218fc0dff71f531fbe Mon Sep 17 00:00:00 2001 From: Maxime Pelletier 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 --- C4/Serials.pm | 17 +- installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 + .../prog/en/modules/serials/subscription-add.tt | 258 +++++++++++++++++++- .../prog/en/modules/serials/subscription-detail.tt | 52 ++++ serials/subscription-add.pl | 10 +- serials/subscription-detail.pl | 1 + 7 files changed, 334 insertions(+), 12 deletions(-) diff --git a/C4/Serials.pm b/C4/Serials.pm index bcb37e3..c1120e2 100644 --- a/C4/Serials.pm +++ b/C4/Serials.pm @@ -1385,7 +1385,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, $seriallifespan ) = @_; my $dbh = C4::Context->dbh; @@ -1398,7 +1398,8 @@ sub ModSubscription { callnumber=?, notes=?, letter=?, manualhistory=?, internalnotes=?, serialsadditems=?, staffdisplaycount=?, opacdisplaycount=?, graceperiod=?, location = ?, enddate=?, - skip_serialseq=? + skip_serialseq=?, + seriallifespan=? WHERE subscriptionid = ?"; my $sth = $dbh->prepare($query); @@ -1412,7 +1413,7 @@ sub ModSubscription { $letter, ($manualhistory ? $manualhistory : 0), $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $skip_serialseq, - $subscriptionid + $seriallifespan, $subscriptionid ); my $rows = $sth->rows; @@ -1444,7 +1445,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, $seriallifespan ) = @_; my $dbh = C4::Context->dbh; @@ -1457,8 +1458,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, + seriallifespan) + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) |; my $sth = $dbh->prepare($query); $sth->execute( @@ -1468,7 +1470,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, + $seriallifespan ); my $subscriptionid = $dbh->{'mysql_insertid'}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index b46dc6a..c15da18 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2099,6 +2099,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`), 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/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 3f1af57..5b8b082 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8603,6 +8603,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 62da614..b9d6d6c 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 @@ -460,9 +460,261 @@ $(document).ready(function() {

[% IF ( modify ) %] Modify subscription for [% bibliotitle |html %][% ELSE %]Add a new subscription[% END %] (1/2)

- [% IF ( modify ) %] - - + +[% IF ( modify ) %] + + +[% ELSE %] + +[% END %] + + + + +
+
+ Subscription details +
    + [% IF ( subscriptionid ) %] +
  1. Subscription # [% subscriptionid %]
  2. + [% END %] +
  3. + + () Search for a vendor +
  4. +
  5. + + + + () Required +
    Search for Biblio + [% IF ( CAN_user_editcatalogue ) %] + [% IF ( modify ) %] + | Edit biblio + [% ELSE %] + | Create Biblio + [% END %] + [% END %] +
    + +
  6. +
  7. + [% IF ( serialsadditems ) %] +

    +

    + [% ELSE %] +

    +

    + [% END %] +
  8. +
  9. + + +
    Set the subscription's serial lifespan. A serial will be considered "out of date" after the chosen time period.
    +
  10. +
  11. + + + (select a library) + +
  12. +
  13. + + +
  14. +
  15. + + +
  16. +
  17. + day(s) +
  18. +
  19. + + +
  20. +
  21. + + +
  22. +
  23. + + [% IF ( letterloop ) %] + + +
    Select a notice and subscribers will be notified when new issues are received.
    + [% ELSE %] + Patron notification: +
    To notify patrons of new serial issues, you must define a notice.
    + [% END %] +
  24. +
  25. + + +
  26. +
  27. + + +
  28. +
+
+
+ +
+ + +
+
+ Serials planning +
    +
  1. + + [% IF ( modify ) %] + [% ELSE %][% END %] +
  2. + [% IF ( modify ) %]
  3. + +
  4. [% END %] + +
  5. + + [% END %] 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..3b7dcf0 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,31 @@ $(document).ready(function() { [% IF ( numberlength ) %]
  6. Number of issues: [% numberlength %]
  7. [% END %] [% IF ( weeklength ) %]
  8. Number of weeks: [% weeklength %]
  9. [% END %] [% IF ( monthlength ) %]
  10. Number of months: [% monthlength %]
  11. [% END %] +
  12. Serial lifespan: + [% IF seriallifespan == -1 %] + Permanent + [% ELSIF ( seriallifespan == 1 ) %] + 1 year + [% ELSIF ( seriallifespan == 2 ) %] + 2 years + [% ELSIF ( seriallifespan == 3 ) %] + 3 years + [% ELSIF ( seriallifespan == 4 ) %] + 4 years + [% ELSIF ( seriallifespan == 5 ) %] + 5 years + [% ELSIF ( seriallifespan == 6 ) %] + 6 years + [% ELSIF ( seriallifespan == 7 ) %] + 7 years + [% ELSIF ( seriallifespan == 8 ) %] + 8 years + [% ELSIF ( seriallifespan == 9 ) %] + 9 years + [% ELSIF ( seriallifespan == 10 ) %] + 10 years + [% END %] +
@@ -246,6 +271,33 @@ $(document).ready(function() {
+

Serial issues

+

+ + [% IF seriallifespan == -1 %] + Permanent + [% ELSIF ( seriallifespan == 1 ) %] + 1 year + [% ELSIF ( seriallifespan == 2 ) %] + 2 years + [% ELSIF ( seriallifespan == 3 ) %] + 3 years + [% ELSIF ( seriallifespan == 4 ) %] + 4 years + [% ELSIF ( seriallifespan == 5 ) %] + 5 years + [% ELSIF ( seriallifespan == 6 ) %] + 6 years + [% ELSIF ( seriallifespan == 7 ) %] + 7 years + [% ELSIF ( seriallifespan == 8 ) %] + 8 years + [% ELSIF ( seriallifespan == 9 ) %] + 9 years + [% ELSIF ( seriallifespan == 10 ) %] + 10 years + [% END %] +

diff --git a/serials/subscription-add.pl b/serials/subscription-add.pl index b17fc60..165b8b4 100755 --- a/serials/subscription-add.pl +++ b/serials/subscription-add.pl @@ -106,6 +106,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, + "seriallifespan" => $subs->{'seriallifespan'}, firstacquiyear => substr($firstissuedate,0,4), ); @@ -322,6 +325,7 @@ sub redirect_add_subscription { 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')); + my $seriallifespan = $query->param('seriallifespan'); if(!defined $enddate || $enddate eq '') { if($subtype eq "issues") { $enddate = _guess_enddate($firstacquidate, $periodicity, $numberlength, $weeklength, $monthlength); @@ -338,8 +342,9 @@ sub redirect_add_subscription { join(";",@irregularity), $numberpattern, $locale, $callnumber, $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, - $skip_serialseq + $skip_serialseq, $seriallifespan ); + ModSubscriptionHistory ($subscriptionid,$histstartdate,$histenddate,$recievedlist,$missinglist,$opacnote,$librariannote); print $query->redirect("/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=$subscriptionid"); return; @@ -413,9 +418,10 @@ sub redirect_mod_subscription { $status, $biblionumber, $callnumber, $notes, $letter, $manualhistory, $internalnotes, $serialsadditems, $staffdisplaycount, $opacdisplaycount, $graceperiod, $location, $enddate, $subscriptionid, - $skip_serialseq + $skip_serialseq, $seiallifespan ); + 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 0cceb34..7a3f096 100755 --- a/serials/subscription-detail.pl +++ b/serials/subscription-detail.pl @@ -157,6 +157,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
Issue number