Koha/serials/checkexpiration.pl
Jonathan Druart c39380ed4e Bug 8782: Close a subscription
If a subscription is no longer enough published (or we are not waiting
for a new periodical) we are allowed to close it.
If a subscription is closed, we are not able to receive or generate a
new serial.

On the serial module, we can now
- close a subscriptionn
- reopen a closed subscription

On serial search 2 tabs is displayed (opened and closed subscriptions).

This patch adds:
- a new field subscription.closed in DB
- a new status for serials (8 = stopped)

Test plan:
- search subscriptions
- close a subscription and check that you cannot receive or generate a
  new serial
- launch another search and check that the closed serial is into the "closed"
  tab.
- You are allowed to reopen a subscription on the subscription detail
  page and on the subscription result page. A javascript alert ask you
  if are certain to do this operation.
- Check the serial status "stopped" everywhere the status is
  displayed (catalogue/detail.pl, serials/claims.pl,
  serials/serial-issues-full.pl, serials/serials-collection.pl,
  serials/serials-edit.pl, serials/serials-recieve.pl,
  serials/subscription-detail.pl and opac-full-serial-issues.pl)
- The report statistics does not include the closed subscriptions if you
  don't check the "Include expired subscriptions" checkbox.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Bug 8782: Followup: add some minor modifications

- Show 'closed' information in biblio detail page
- Add a column in serials report table
- Search subscriptions on title words instead of string
- Prevent serials editing when subscription is closed
- Don't change status of "disabled" serials

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Bug 8782 - Close a subscription - Followup - Fix updatedatabase.pl

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
2012-11-30 08:14:24 -05:00

103 lines
3 KiB
Perl
Executable file

#!/usr/bin/perl
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
=head1 NAME
checkexpiration.pl
=head1 DESCRIPTION
This script check what subscription will expire before C<$datenumber $datelimit>
=head1 PARAMETERS
=over 4
=item title
To filter subscription on title
=item issn
To filter subscription on issn
=item date
The date to filter on.
=back
=cut
use strict;
use warnings;
use CGI;
use C4::Auth;
use C4::Serials; # GetExpirationDate
use C4::Output;
use C4::Context;
use C4::Dates qw/format_date format_date_in_iso/;
use Date::Calc qw/Today Date_to_Days/;
my $query = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
{
template_name => "serials/checkexpiration.tmpl",
query => $query,
type => "intranet",
authnotrequired => 0,
flagsrequired => { serials => 'check_expiration' },
debug => 1,
}
);
my $title = $query->param('title');
my $issn = $query->param('issn');
my $date = format_date_in_iso($query->param('date'));
if ($date) {
my @subscriptions = GetSubscriptions( $title, $issn );
my @subscriptions_loop;
foreach my $subscription ( @subscriptions ) {
my $subscriptionid = $subscription->{'subscriptionid'};
my $expirationdate = GetExpirationDate($subscriptionid);
$subscription->{expirationdate} = $expirationdate;
next if $expirationdate !~ /\d{4}-\d{2}-\d{2}/; # next if not in ISO format.
next if $subscription->{closed};
if ( Date_to_Days(split "-",$expirationdate) < Date_to_Days(split "-",$date) &&
Date_to_Days(split "-",$expirationdate) > Date_to_Days(&Today) ) {
$subscription->{expirationdate}=format_date($subscription->{expirationdate});
push @subscriptions_loop,$subscription;
}
}
$template->param (
title => $title,
issn => $issn,
numsubscription => scalar @subscriptions_loop,
date => format_date($date),
subscriptions_loop => \@subscriptions_loop,
"BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
);
}
$template->param (
DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
(uc(C4::Context->preference("marcflavour"))) => 1
);
output_html_with_http_headers $query, $cookie, $template->output;