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