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',
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;
{},
{ 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' },
[% 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 %]
[% 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">