View | Details | Raw Unified | Return to bug 8436
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt (+16 lines)
Lines 51-56 Link Here
51
51
52
        <li><label for="issn">ISSN:</label>
52
        <li><label for="issn">ISSN:</label>
53
        <input id="issn" type="text" name="issn" size="15" value="[% issn %]" /></li>
53
        <input id="issn" type="text" name="issn" size="15" value="[% issn %]" /></li>
54
        [% IF (branches_loop.size) %]
55
        <li><label for="branch">Branch:</label>
56
        <select id="branch" name="branch">
57
            <option value="">All</option>
58
            [% FOREACH branch IN branches_loop %]
59
                [% IF branch.selected %]
60
                    <option selected="selected" value="[% branch.branchcode %]">
61
                [% ELSE %]
62
                    <option value="[% branch.branchcode %]">
63
                [% END %]
64
                    [% branch.branchname %]
65
                </option>
66
            [% END %]
67
        </select>
68
        </li>
69
        [% END %]
54
70
55
        <li><label for="date" class="required" title="Required field">Expiring before:</label>
71
        <li><label for="date" class="required" title="Required field">Expiring before:</label>
56
        <input id="date" type="text" name="date" size="10" value="[% date %]" class="focus datepicker" />
72
        <input id="date" type="text" name="date" size="10" value="[% date %]" class="focus datepicker" />
(-)a/serials/checkexpiration.pl (-5 / +38 lines)
Lines 47-52 use warnings; Link Here
47
use CGI;
47
use CGI;
48
use C4::Auth;
48
use C4::Auth;
49
use C4::Serials; # GetExpirationDate
49
use C4::Serials; # GetExpirationDate
50
use C4::Branch;
50
use C4::Output;
51
use C4::Output;
51
use C4::Context;
52
use C4::Context;
52
use C4::Dates qw/format_date format_date_in_iso/;
53
use C4::Dates qw/format_date format_date_in_iso/;
Lines 54-60 use Date::Calc qw/Today Date_to_Days/; Link Here
54
55
55
my $query = new CGI;
56
my $query = new CGI;
56
57
57
my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
58
my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user (
58
    {
59
    {
59
        template_name   => "serials/checkexpiration.tmpl",
60
        template_name   => "serials/checkexpiration.tmpl",
60
        query           => $query,
61
        query           => $query,
Lines 67-72 my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( Link Here
67
68
68
my $title = $query->param('title');
69
my $title = $query->param('title');
69
my $issn  = $query->param('issn');
70
my $issn  = $query->param('issn');
71
my $branch = $query->param('branch');
70
my $date  = format_date_in_iso($query->param('date'));
72
my $date  = format_date_in_iso($query->param('date'));
71
73
72
if ($date) {
74
if ($date) {
Lines 76-86 if ($date) { Link Here
76
    foreach my $subscription ( @subscriptions ) {
78
    foreach my $subscription ( @subscriptions ) {
77
        my $subscriptionid = $subscription->{'subscriptionid'};
79
        my $subscriptionid = $subscription->{'subscriptionid'};
78
        my $expirationdate = GetExpirationDate($subscriptionid);
80
        my $expirationdate = GetExpirationDate($subscriptionid);
79
80
        $subscription->{expirationdate} = $expirationdate;
81
        $subscription->{expirationdate} = $expirationdate;
81
        next if $expirationdate !~ /\d{4}-\d{2}-\d{2}/; # next if not in ISO format.
82
        next if $expirationdate !~ /\d{4}-\d{2}-\d{2}/; # next if not in ISO format.
83
        if (   ( ref $flags->{serials} and $flags->{serials}->{superserials} )
84
            or ( !ref $flags->{serials} and $flags->{serials} == 1 ) )
85
        {
86
            $subscription->{cannotedit} = 0;
87
        }
88
        next if $subscription->{cannotedit};
82
        if ( Date_to_Days(split "-",$expirationdate) < Date_to_Days(split "-",$date) &&
89
        if ( Date_to_Days(split "-",$expirationdate) < Date_to_Days(split "-",$date) &&
83
			 Date_to_Days(split "-",$expirationdate) > Date_to_Days(&Today) ) {
90
             Date_to_Days(split "-",$expirationdate) > Date_to_Days(&Today) &&
91
             ( !$branch || ($subscription->{'branchcode'} eq $branch) ) ) {
84
            $subscription->{expirationdate}=format_date($subscription->{expirationdate});
92
            $subscription->{expirationdate}=format_date($subscription->{expirationdate});
85
            push @subscriptions_loop,$subscription;
93
            push @subscriptions_loop,$subscription;
86
        }
94
        }
Lines 95-102 if ($date) { Link Here
95
        "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
103
        "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
96
    );
104
    );
97
}
105
}
106
107
my $branchname;
108
my @branches_loop;
109
if (   $flags->{superlibrarian}
110
    or ( ref $flags->{serials}  and $flags->{serials}->{superserials} )
111
    or ( !ref $flags->{serials} and $flags->{serials} == 1 ) )
112
{
113
    my $branches = GetBranches();
114
    foreach my $b (sort keys %$branches) {
115
        my $selected = 0;
116
        if( $branch and $branch eq $b ){
117
            $selected = 1;
118
            $branchname = $branches->{$b}->{branchname};
119
        }
120
        push @branches_loop, {
121
            branchcode => $b,
122
            branchname => $branches->{$b}->{branchname},
123
            selected   => $selected,
124
        };
125
    }
126
}
127
98
$template->param (
128
$template->param (
99
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
129
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
100
    (uc(C4::Context->preference("marcflavour"))) => 1
130
    (uc(C4::Context->preference("marcflavour"))) => 1,
131
    branches_loop   => \@branches_loop,
132
    branchcode      => $branch,
133
    branchname      => $branchname,
101
);
134
);
135
102
output_html_with_http_headers $query, $cookie, $template->output;
136
output_html_with_http_headers $query, $cookie, $template->output;
103
- 

Return to bug 8436