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 / +37 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
        }
82
        if ( Date_to_Days(split "-",$expirationdate) < Date_to_Days(split "-",$date) &&
88
        if ( Date_to_Days(split "-",$expirationdate) < Date_to_Days(split "-",$date) &&
83
			 Date_to_Days(split "-",$expirationdate) > Date_to_Days(&Today) ) {
89
             Date_to_Days(split "-",$expirationdate) > Date_to_Days(&Today) &&
90
             ( !$branch || ($subscription->{'branchcode'} eq $branch) ) ) {
84
            $subscription->{expirationdate}=format_date($subscription->{expirationdate});
91
            $subscription->{expirationdate}=format_date($subscription->{expirationdate});
85
            push @subscriptions_loop,$subscription;
92
            push @subscriptions_loop,$subscription;
86
        }
93
        }
Lines 95-102 if ($date) { Link Here
95
        "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
102
        "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
96
    );
103
    );
97
}
104
}
105
106
my $branchname;
107
my @branches_loop;
108
if (   $flags->{superlibrarian}
109
    or ( ref $flags->{serials}  and $flags->{serials}->{superserials} )
110
    or ( !ref $flags->{serials} and $flags->{serials} == 1 ) )
111
{
112
    my $branches = GetBranches();
113
    foreach my $b (sort keys %$branches) {
114
        my $selected = 0;
115
        if( $branch and $branch eq $b ){
116
            $selected = 1;
117
            $branchname = $branches->{$b}->{branchname};
118
        }
119
        push @branches_loop, {
120
            branchcode => $b,
121
            branchname => $branches->{$b}->{branchname},
122
            selected   => $selected,
123
        };
124
    }
125
}
126
98
$template->param (
127
$template->param (
99
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
128
    DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
100
    (uc(C4::Context->preference("marcflavour"))) => 1
129
    (uc(C4::Context->preference("marcflavour"))) => 1,
130
    branches_loop   => \@branches_loop,
131
    branchcode      => $branch,
132
    branchname      => $branchname,
101
);
133
);
134
102
output_html_with_http_headers $query, $cookie, $template->output;
135
output_html_with_http_headers $query, $cookie, $template->output;
103
- 

Return to bug 8436