Lines 171-183
passing $args along with the invocation, and return its return value.
Link Here
|
171 |
sub _backend_capability { |
171 |
sub _backend_capability { |
172 |
my ( $self, $name, $args ) = @_; |
172 |
my ( $self, $name, $args ) = @_; |
173 |
my $capability = 0; |
173 |
my $capability = 0; |
|
|
174 |
# See if capability is defined in backend. |
174 |
try { |
175 |
try { |
175 |
$capability = $self->_backend->capabilities($name); |
176 |
$capability = $self->_backend->capabilities($name); |
176 |
} catch { |
177 |
} catch { |
177 |
return 0; |
178 |
return 0; |
178 |
}; |
179 |
}; |
179 |
if ( $capability ) { |
180 |
# Try to invoke it. |
180 |
return $capability($args); |
181 |
if ( $capability && ref($capability) eq 'CODE' ) { |
|
|
182 |
return &{$capability}($args); |
181 |
} else { |
183 |
} else { |
182 |
return 0; |
184 |
return 0; |
183 |
} |
185 |
} |
Lines 538-560
sub backend_create {
Link Here
|
538 |
# ...Updating status! |
540 |
# ...Updating status! |
539 |
$self->status('QUEUED')->store unless ( $permitted ); |
541 |
$self->status('QUEUED')->store unless ( $permitted ); |
540 |
|
542 |
|
541 |
# FIXME: Fix Unmediated ILLs! |
543 |
## Handle Unmediated ILLs |
542 |
# Handle Unmediated ILLs |
544 |
|
543 |
# if ( C4::Context->preference("UnmediatedILL") && $permitted |
545 |
# For the unmediated workflow we only need to delegate to our backend. If |
544 |
# # XXX: Why && result manual? |
546 |
# that backend supports unmediateld_ill, it will do its thing and return a |
545 |
# && $result->{manual} ) { |
547 |
# proper response. If it doesn't then _backend_capability returns 0, so |
546 |
# # FIXME: Also carry out privilege checks |
548 |
# we keep the current result. |
547 |
# my ( $response, $new_rq ) = $self->place_request; # WTF? |
549 |
if ( C4::Context->preference("ILLModuleUnmediated") && $permitted ) { |
548 |
# if ( $response ) { |
550 |
my $unmediated_result = $self->_backend_capability('unmediated_ill', $args); |
549 |
# $result->{value}->{request} = $new_rq; |
551 |
$result = $unmediated_result if $unmediated_result; |
550 |
# return $result; |
552 |
} |
551 |
# } else { |
|
|
552 |
# die "Placing the request failed."; |
553 |
# } |
554 |
# } else { |
555 |
# $result->{value}->{request} = $request; |
556 |
# return $result; |
557 |
# } |
558 |
|
553 |
|
559 |
return $self->expandTemplate($result); |
554 |
return $self->expandTemplate($result); |
560 |
} |
555 |
} |
561 |
- |
|
|