Bugzilla – Attachment 100169 Details for
Bug 23112
Add circulation process to inter-library loans
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23051: (follow-up) Conditionally prevent checkout
Bug-23051-follow-up-Conditionally-prevent-checkout.patch (text/plain), 4.01 KB, created by
Andrew Isherwood
on 2020-03-05 09:30:17 UTC
(
hide
)
Description:
Bug 23051: (follow-up) Conditionally prevent checkout
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2020-03-05 09:30:17 UTC
Size:
4.01 KB
patch
obsolete
>From 976cabfff52c0fe7aba67f8331c5c711bcc9ba9f Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Thu, 5 Mar 2020 09:27:32 +0000 >Subject: [PATCH] Bug 23051: (follow-up) Conditionally prevent checkout > >As mentioned by Nick in comment #69, the checkout button displays even >for requests without a biblio attached (such as chapters). This patch >fixes that. > >https://bugs.koha-community.org/show_bug.cgi?id=23112 >--- > Koha/Illrequest.pm | 26 +++++++++++++++++++--- > .../prog/en/modules/ill/ill-requests.tt | 9 +++++++- > 2 files changed, 31 insertions(+), 4 deletions(-) > >diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm >index c6280d2057..a11ff8601f 100644 >--- a/Koha/Illrequest.pm >+++ b/Koha/Illrequest.pm >@@ -495,6 +495,8 @@ sub _core_status_graph { > ui_method_name => 'Check out', > needs_prefs => [ 'CirculateILL' ], > needs_perms => [ 'user_circulate_circulate_remaining_permissions' ], >+ # An array of functions that all must return true >+ needs_all => [ sub { my $r = shift; return $r->biblio; } ], > method => 'check_out', > next_actions => [ ], > ui_method_icon => 'fa-upload', >@@ -1049,6 +1051,25 @@ sub requires_moderation { > return $require_moderation->{$self->status}; > } > >+=head3 biblio >+ >+ my $biblio = $request->biblio; >+ >+For a given request, return the biblio associated with it, >+or undef if none exists >+ >+=cut >+ >+sub biblio { >+ my ( $self ) = @_; >+ >+ return if !$self->biblio_id; >+ >+ return Koha::Biblios->find({ >+ biblionumber => $self->biblio_id >+ }); >+} >+ > =head3 check_out > > my $stage_summary = $request->check_out; >@@ -1072,9 +1093,8 @@ sub check_out { > {}, > { order_by => ['branchcode'] } > ); >- my $biblio = Koha::Biblios->find({ >- biblionumber => $self->biblio_id >- }); >+ my $biblio = $self->biblio; >+ > # Find all statistical patrons > my $statistical_patrons = Koha::Patrons->search( > { 'category_type' => 'x' }, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >index 413e4a190a..b5ccab44b8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt >@@ -441,8 +441,10 @@ > [% FOREACH action IN request.available_actions %] > [% needs_prefs = action.needs_prefs.size ? action.needs_prefs : [] %] > [% needs_perms = action.needs_perms.size ? action.needs_perms : [] %] >+ [% needs_all = action.needs_all.size ? action.needs_all : [] %] > [% has_prefs_count = 0 %] > [% has_perms_count = 0 %] >+ [% has_all_count = 0 %] > [% FOREACH pref IN needs_prefs %] > [% IF Koha.Preference(pref) %] > [% has_prefs_count = has_prefs_count + 1 %] >@@ -454,7 +456,12 @@ > [% has_perms_count = has_perms_count + 1 %] > [% END %] > [% END %] >- [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size %] >+ [% FOREACH func IN needs_all %] >+ [% IF func(request) %] >+ [% has_all_count = has_all_count + 1 %] >+ [% END %] >+ [% END %] >+ [% NEXT IF has_prefs_count < needs_prefs.size || has_perms_count < needs_perms.size || has_all_count < needs_all.size %] > [% IF action.method == 'migrate' %] > [% IF backends.size > 2 %] > <div class="dropdown btn-group"> >-- >2.11.0
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 23112
:
91987
|
91988
|
91989
|
91990
|
91991
|
92000
|
92001
|
92002
|
92003
|
92004
|
93530
|
93531
|
93532
|
93533
|
93534
|
93958
|
94264
|
94265
|
94266
|
94267
|
94268
|
94269
|
95565
|
95566
|
95567
|
95568
|
95569
|
95570
|
96834
|
96870
|
99910
|
99911
|
99912
|
99913
|
99914
|
99915
|
99916
|
99917
|
100100
|
100101
|
100102
|
100103
|
100104
|
100105
|
100106
|
100107
|
100108
|
100169
|
100224
|
100225
|
100252
|
100253
|
100254
|
100255
|
100256
|
100257
|
100258
|
100259
|
100260
|
100261
|
100262
|
100263