Bugzilla – Attachment 35166 Details for
Bug 8436
Add branch limit on checkexpiration.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED OFF] Bug 8436: Add limit on branch in checkexpiration.pl
0001-Bug-8436-Add-limit-on-branch-in-checkexpiration.pl.patch (text/plain), 5.14 KB, created by
Paola Rossi
on 2015-01-13 16:33:05 UTC
(
hide
)
Description:
[SIGNED OFF] Bug 8436: Add limit on branch in checkexpiration.pl
Filename:
MIME Type:
Creator:
Paola Rossi
Created:
2015-01-13 16:33:05 UTC
Size:
5.14 KB
patch
obsolete
>From 16ea43d3f8ced9fbfd872a1f2c478a0c995a12c0 Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Wed, 22 Aug 2012 14:35:37 +0200 >Subject: [PATCH] Bug 8436: Add limit on branch in checkexpiration.pl > >This limit is only available for superlibrarians and patrons that have >superserials permission. Other patrons will only see subscriptions of >their branch. > >Signed-off-by: Paola Rossi <paola.rossi@cineca.it> >--- > .../prog/en/modules/serials/checkexpiration.tt | 16 ++++++++ > serials/checkexpiration.pl | 42 ++++++++++++++++++-- > 2 files changed, 54 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >index 95bfcb8..1859faf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >@@ -51,6 +51,22 @@ > > <li><label for="issn">ISSN:</label> > <input id="issn" type="text" name="issn" size="15" value="[% issn %]" /></li> >+ [% IF (branches_loop.size) %] >+ <li><label for="branch">Branch:</label> >+ <select id="branch" name="branch"> >+ <option value="">All</option> >+ [% FOREACH branch IN branches_loop %] >+ [% IF branch.selected %] >+ <option selected="selected" value="[% branch.branchcode %]"> >+ [% ELSE %] >+ <option value="[% branch.branchcode %]"> >+ [% END %] >+ [% branch.branchname %] >+ </option> >+ [% END %] >+ </select> >+ </li> >+ [% END %] > > <li><label for="date" class="required" title="Required field">Expiring before:</label> > <input id="date" type="text" name="date" size="10" value="[% date %]" class="focus datepicker" /> >diff --git a/serials/checkexpiration.pl b/serials/checkexpiration.pl >index e24210f..6969a68 100755 >--- a/serials/checkexpiration.pl >+++ b/serials/checkexpiration.pl >@@ -47,6 +47,7 @@ use warnings; > use CGI; > use C4::Auth; > use C4::Serials; # GetExpirationDate >+use C4::Branch; > use C4::Output; > use C4::Context; > use C4::Dates qw/format_date format_date_in_iso/; >@@ -54,7 +55,7 @@ use Date::Calc qw/Today Date_to_Days/; > > my $query = new CGI; > >-my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( >+my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user ( > { > template_name => "serials/checkexpiration.tt", > query => $query, >@@ -67,6 +68,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( > > my $title = $query->param('title'); > my $issn = $query->param('issn'); >+my $branch = $query->param('branch'); > my $date = format_date_in_iso($query->param('date')); > > if ($date) { >@@ -76,12 +78,18 @@ if ($date) { > 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 ( ( ref $flags->{serials} and $flags->{serials}->{superserials} ) >+ or ( !ref $flags->{serials} and $flags->{serials} == 1 ) ) >+ { >+ $subscription->{cannotedit} = 0; >+ } >+ next if $subscription->{cannotedit}; > if ( Date_to_Days(split "-",$expirationdate) < Date_to_Days(split "-",$date) && >- Date_to_Days(split "-",$expirationdate) > Date_to_Days(&Today) ) { >+ Date_to_Days(split "-",$expirationdate) > Date_to_Days(&Today) && >+ ( !$branch || ($subscription->{'branchcode'} eq $branch) ) ) { > $subscription->{expirationdate}=format_date($subscription->{expirationdate}); > push @subscriptions_loop,$subscription; > } >@@ -96,7 +104,33 @@ if ($date) { > "BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1, > ); > } >+ >+my $branchname; >+my @branches_loop; >+if ( $flags->{superlibrarian} >+ or ( ref $flags->{serials} and $flags->{serials}->{superserials} ) >+ or ( !ref $flags->{serials} and $flags->{serials} == 1 ) ) >+{ >+ my $branches = GetBranches(); >+ foreach my $b (sort keys %$branches) { >+ my $selected = 0; >+ if( $branch and $branch eq $b ){ >+ $selected = 1; >+ $branchname = $branches->{$b}->{branchname}; >+ } >+ push @branches_loop, { >+ branchcode => $b, >+ branchname => $branches->{$b}->{branchname}, >+ selected => $selected, >+ }; >+ } >+} >+ > $template->param ( >- (uc(C4::Context->preference("marcflavour"))) => 1 >+ (uc(C4::Context->preference("marcflavour"))) => 1, >+ branches_loop => \@branches_loop, >+ branchcode => $branch, >+ branchname => $branchname, > ); >+ > output_html_with_http_headers $query, $cookie, $template->output; >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 8436
:
11742
|
11746
|
19262
|
35166
|
36062
|
41891
|
43646
|
43647
|
43648
|
43649
|
43650
|
43750
|
43751