--- /dev/null
+package Koha::Exceptions::Ill;
+
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 3 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use Modern::Perl;
+
+use Exception::Class (
+
+ 'Koha::Exceptions::Ill' => {
+ description => 'Something went wrong!',
+ },
+ 'Koha::Exceptions::Ill::InvalidBackendId' => {
+ isa => 'Koha::Exceptions::Ill',
+ description => "Invalid backend name required",
+ }
+);
+
+=head1 NAME
+
+Koha::Exceptions::Ill - Base class for ILL exceptions
+
+=head1 Exceptions
+
+=head2 Koha::Exceptions::Ill
+
+Generic Ill exception
+
+=head2 Koha::Exceptions::Ill::InvalidBackend
+
+Exception to be used when the required ILL backend is invalid.
+
+=cut
+
+1;
# Koha; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301 USA.
+use Modern::Perl;
+
use Clone 'clone';
use File::Basename qw/basename/;
use Koha::Database;
use Koha::Email;
+use Koha::Exceptions::Ill;
use Koha::Illrequest;
use Koha::Illrequestattributes;
use Koha::Patron;
use Mail::Sendmail;
use Try::Tiny;
-use Modern::Perl;
use base qw(Koha::Object);
my @raw = qw/Koha Illbackends/; # Base Path
my $backend_name = $backend_id || $self->backend;
- my $location = join "/", @raw, $backend_name, "Base.pm"; # File to load
+
+ unless ( defined $backend_name && $backend_name ne '' ) {
+ Koha::Exceptions::Ill::InvalidBackendId->throw(
+ "An invalid backend ID was requested ('')");
+ }
+
+ my $location = join "/", @raw, $backend_name, "Base.pm"; # File to load
my $backend_class = join "::", @raw, $backend_name, "Base"; # Package name
require $location;
$self->{_my_backend} = $backend_class->new({ config => $self->_config });
return $self;
}
+
=head3 _backend
my $backend = $abstract->_backend($new_backend);
sub available_backends {
my ( $self ) = @_;
- my $backend_dir = $self->_config->backend_dir;
- my @backends = ();
- @backends = glob "$backend_dir/*" if ( $backend_dir );
- @backends = map { basename($_) } @backends;
+ my @backends = $self->_config->available_backends;
return \@backends;
}
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
+
+use File::Basename;
+
use C4::Context;
=head1 NAME
return $self->{configuration}->{backend_directory};
}
+=head3 available_backends
+
+Return a list of available backends.
+
+=cut
+
+sub available_backends {
+ my ( $self ) = @_;
+ my $backend_dir = $self->backend_dir;
+ my @backends = ();
+ @backends = glob "$backend_dir/*" if ( $backend_dir );
+ @backends = map { basename($_) } @backends;
+ return \@backends;
+}
+
=head3 partner_code
$partner_code = $config->partner_code($new_code);
=head1 API
-=head2 Class Methods
+=head2 Internal methods
=cut
-=head3 type
+=head3 _type
=cut
use Koha::Patrons;
use Koha::Caches;
use Koha::Config::SysPrefs;
+use Koha::Illrequest::Config;
use C4::Members::Statistics;
#use Smart::Comments '####';
}
}
+if ( C4::Context->preference('ILLModule') ) {
+ my $warnILLConfiguration = 0;
+ my $available_ill_backends =
+ ( scalar @{ Koha::Illrequest::Config->new->available_backends } > 0 );
+
+ if ( !$available_ill_backends ) {
+ $template->param( no_ill_backends => 1 );
+ $warnILLConfiguration = 1;
+ }
+
+ $template->param( warnILLConfiguration => $warnILLConfiguration );
+}
+
# Sco Patron should not contain any other perms than circulate => self_checkout
if ( C4::Context->preference('WebBasedSelfCheck')
and C4::Context->preference('AutoSelfCheckAllowed')
flagsrequired => { ill => '*' },
} );
-if ( $op eq 'illview' ) {
- # View the details of an ILL
- my $request = Koha::Illrequests->find($params->{illrequest_id});
-
- $template->param(
- request => $request
- );
-
-} elsif ( $op eq 'create' ) {
- # We're in the process of creating a request
- my $request = Koha::Illrequest->new
- ->load_backend($params->{backend});
- my $backend_result = $request->backend_create($params);
- $template->param(
- whole => $backend_result,
- request => $request
- );
- handle_commit_maybe($backend_result, $request);
-
-} elsif ( $op eq 'confirm' ) {
- # Backend 'confirm' method
- # confirm requires a specific request, so first, find it.
- my $request = Koha::Illrequests->find($params->{illrequest_id});
- my $backend_result = $request->backend_confirm($params);
- $template->param(
- whole => $backend_result,
- request => $request,
- );
-
- # handle special commit rules & update type
- handle_commit_maybe($backend_result, $request);
-
-} elsif ( $op eq 'cancel' ) {
- # Backend 'cancel' method
- # cancel requires a specific request, so first, find it.
- my $request = Koha::Illrequests->find($params->{illrequest_id});
- my $backend_result = $request->backend_cancel($params);
- $template->param(
- whole => $backend_result,
- request => $request,
- );
-
- # handle special commit rules & update type
- handle_commit_maybe($backend_result, $request);
-
-} elsif ( $op eq 'edit_action' ) {
- # Handle edits to the Illrequest object.
- # (not the Illrequestattributes)
- # We simulate the API for backend requests for uniformity.
- # So, init:
- my $request = Koha::Illrequests->find($params->{illrequest_id});
- if ( !$params->{stage} ) {
- my $backend_result = {
- error => 0,
- status => '',
- message => '',
- method => 'edit_action',
- stage => 'init',
- next => '',
- value => {}
- };
+# Are we able to actually work?
+my $backends = Koha::Illrequest::Config->new->available_backends;
+my $backends_available = ( scalar @{$backends} > 0 );
+$template->param( backends_available => $backends_available );
+
+if ( $backends_available ) {
+ if ( $op eq 'illview' ) {
+ # View the details of an ILL
+ my $request = Koha::Illrequests->find($params->{illrequest_id});
+
+ $template->param(
+ request => $request
+ );
+
+ } elsif ( $op eq 'create' ) {
+ # We're in the process of creating a request
+ my $request = Koha::Illrequest->new->load_backend( $params->{backend} );
+ my $backend_result = $request->backend_create($params);
$template->param(
whole => $backend_result,
request => $request
);
- } else {
- # Commit:
- # Save the changes
- $request->borrowernumber($params->{borrowernumber});
- $request->biblio_id($params->{biblio_id});
- $request->branchcode($params->{branchcode});
- $request->notesopac($params->{notesopac});
- $request->notesstaff($params->{notesstaff});
- $request->store;
- my $backend_result = {
- error => 0,
- status => '',
- message => '',
- method => 'edit_action',
- stage => 'commit',
- next => 'illlist',
- value => {}
- };
handle_commit_maybe($backend_result, $request);
- }
-} elsif ( $op eq 'moderate_action' ) {
- # Moderate action is required for an ILL submodule / syspref.
- # Currently still needs to be implemented.
- redirect_to_list();
+ } elsif ( $op eq 'confirm' ) {
+ # Backend 'confirm' method
+ # confirm requires a specific request, so first, find it.
+ my $request = Koha::Illrequests->find($params->{illrequest_id});
+ my $backend_result = $request->backend_confirm($params);
+ $template->param(
+ whole => $backend_result,
+ request => $request,
+ );
-} elsif ( $op eq 'delete_confirm') {
- my $request = Koha::Illrequests->find($params->{illrequest_id});
+ # handle special commit rules & update type
+ handle_commit_maybe($backend_result, $request);
+
+ } elsif ( $op eq 'cancel' ) {
+ # Backend 'cancel' method
+ # cancel requires a specific request, so first, find it.
+ my $request = Koha::Illrequests->find($params->{illrequest_id});
+ my $backend_result = $request->backend_cancel($params);
+ $template->param(
+ whole => $backend_result,
+ request => $request,
+ );
- $template->param(
- request => $request
- );
+ # handle special commit rules & update type
+ handle_commit_maybe($backend_result, $request);
-} elsif ( $op eq 'delete' ) {
+ } elsif ( $op eq 'edit_action' ) {
+ # Handle edits to the Illrequest object.
+ # (not the Illrequestattributes)
+ # We simulate the API for backend requests for uniformity.
+ # So, init:
+ my $request = Koha::Illrequests->find($params->{illrequest_id});
+ if ( !$params->{stage} ) {
+ my $backend_result = {
+ error => 0,
+ status => '',
+ message => '',
+ method => 'edit_action',
+ stage => 'init',
+ next => '',
+ value => {}
+ };
+ $template->param(
+ whole => $backend_result,
+ request => $request
+ );
+ } else {
+ # Commit:
+ # Save the changes
+ $request->borrowernumber($params->{borrowernumber});
+ $request->biblio_id($params->{biblio_id});
+ $request->branchcode($params->{branchcode});
+ $request->notesopac($params->{notesopac});
+ $request->notesstaff($params->{notesstaff});
+ $request->store;
+ my $backend_result = {
+ error => 0,
+ status => '',
+ message => '',
+ method => 'edit_action',
+ stage => 'commit',
+ next => 'illlist',
+ value => {}
+ };
+ handle_commit_maybe($backend_result, $request);
+ }
- # Check if the request is confirmed, if not, redirect
- # to the confirmation view
- if ($params->{confirmed} == 1) {
- # We simply delete the request...
- my $request = Koha::Illrequests->find(
- $params->{illrequest_id}
- )->delete;
- # ... then return to list view.
+ } elsif ( $op eq 'moderate_action' ) {
+ # Moderate action is required for an ILL submodule / syspref.
+ # Currently still needs to be implemented.
redirect_to_list();
- } else {
- print $cgi->redirect(
- "/cgi-bin/koha/ill/ill-requests.pl?" .
- "method=delete_confirm&illrequest_id=" .
- $params->{illrequest_id});
- }
-} elsif ( $op eq 'mark_completed' ) {
- my $request = Koha::Illrequests->find($params->{illrequest_id});
- my $backend_result = $request->mark_completed($params);
- $template->param(
- whole => $backend_result,
- request => $request,
- );
-
- # handle special commit rules & update type
- handle_commit_maybe($backend_result, $request);
-
-} elsif ( $op eq 'generic_confirm' ) {
- my $request = Koha::Illrequests->find($params->{illrequest_id});
- $params->{current_branchcode} = C4::Context->mybranch;
- my $backend_result = $request->generic_confirm($params);
- $template->param(
- whole => $backend_result,
- request => $request,
- );
-
- # handle special commit rules & update type
- handle_commit_maybe($backend_result, $request);
-
-} elsif ( $op eq 'illlist') {
- # Display all current ILLs
- my $requests = $illRequests->search();
-
- $template->param(
- requests => $requests
- );
-
- # If we receive a pre-filter, make it available to the template
- my $possible_filters = ['borrowernumber'];
- my $active_filters = [];
- foreach my $filter(@{$possible_filters}) {
- if ($params->{$filter}) {
- push @{$active_filters},
- { name => $filter, value => $params->{$filter}};
+ } elsif ( $op eq 'delete_confirm') {
+ my $request = Koha::Illrequests->find($params->{illrequest_id});
+
+ $template->param(
+ request => $request
+ );
+
+ } elsif ( $op eq 'delete' ) {
+
+ # Check if the request is confirmed, if not, redirect
+ # to the confirmation view
+ if ($params->{confirmed}) {
+ # We simply delete the request...
+ Koha::Illrequests->find( $params->{illrequest_id} )->delete;
+ # ... then return to list view.
+ redirect_to_list();
+ } else {
+ print $cgi->redirect(
+ "/cgi-bin/koha/ill/ill-requests.pl?" .
+ "method=delete_confirm&illrequest_id=" .
+ $params->{illrequest_id});
+ exit;
}
- }
- if (scalar @{$active_filters} > 0) {
+
+ } elsif ( $op eq 'mark_completed' ) {
+ my $request = Koha::Illrequests->find($params->{illrequest_id});
+ my $backend_result = $request->mark_completed($params);
+ $template->param(
+ whole => $backend_result,
+ request => $request,
+ );
+
+ # handle special commit rules & update type
+ handle_commit_maybe($backend_result, $request);
+
+ } elsif ( $op eq 'generic_confirm' ) {
+ my $request = Koha::Illrequests->find($params->{illrequest_id});
+ $params->{current_branchcode} = C4::Context->mybranch;
+ my $backend_result = $request->generic_confirm($params);
$template->param(
- prefilters => $active_filters
+ whole => $backend_result,
+ request => $request,
);
+
+ # handle special commit rules & update type
+ handle_commit_maybe($backend_result, $request);
+
+ } elsif ( $op eq 'illlist') {
+ # Display all current ILLs
+ my $requests = $illRequests->search();
+
+ $template->param(
+ requests => $requests
+ );
+
+ # If we receive a pre-filter, make it available to the template
+ my $possible_filters = ['borrowernumber'];
+ my $active_filters = [];
+ foreach my $filter(@{$possible_filters}) {
+ if ($params->{$filter}) {
+ push @{$active_filters},
+ { name => $filter, value => $params->{$filter}};
+ }
+ }
+ if (scalar @{$active_filters} > 0) {
+ $template->param(
+ prefilters => $active_filters
+ );
+ }
+ } else {
+ my $request = Koha::Illrequests->find($params->{illrequest_id});
+ my $backend_result = $request->custom_capability($op, $params);
+ $template->param(
+ whole => $backend_result,
+ request => $request,
+ );
+
+ # handle special commit rules & update type
+ handle_commit_maybe($backend_result, $request);
}
-} else {
- my $request = Koha::Illrequests->find($params->{illrequest_id});
- my $backend_result = $request->custom_capability($op, $params);
- $template->param(
- whole => $backend_result,
- request => $request,
- );
-
- # handle special commit rules & update type
- handle_commit_maybe($backend_result, $request);
}
-# Get a list of backends
-my $ir = Koha::Illrequest->new;
-
$template->param(
- backends => $ir->available_backends,
- media => [ "Book", "Article", "Journal" ],
- query_type => $op,
- branches => Koha::Libraries->search->unblessed,
- here_link => "/cgi-bin/koha/ill/ill-requests.pl"
+ backends => $backends,
+ media => [ "Book", "Article", "Journal" ],
+ query_type => $op,
+ branches => Koha::Libraries->search,
+ here_link => "/cgi-bin/koha/ill/ill-requests.pl"
);
output_html_with_http_headers( $cgi, $cookie, $template->output );
sub redirect_to_list {
print $cgi->redirect('/cgi-bin/koha/ill/ill-requests.pl');
+ exit;
}
[% USE Koha %]
[% IF Koha.Preference('ILLModule ') %]
<div id="toolbar" class="btn-toolbar">
- [% IF backends.size > 1 %]
+ [% IF backends_available %]
+ [% IF backends.size > 1 %]
<div class="dropdown btn-group">
<button class="btn btn-sm btn-default dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-plus"></i> New ILL request <span class="caret"></span>
[% END %]
</ul>
</div>
- [% ELSE %]
+ [% ELSE %]
<a id="ill-new" class="btn btn-sm btn-default" href="/cgi-bin/koha/ill/ill-requests.pl?method=create&backend=[% backends.0 %]">
<i class="fa fa-plus"></i> New ILL request
</a>
+ [% END %]
+ [% ELSE %]
+ <a id="ill-new" class="btn btn-sm btn-default disabled" href="">
+ <i class="fa fa-plus"></i> New ILL request
+ </a>
[% END %]
<a id="ill-list" class="btn btn-sm btn-default btn-group" href="/cgi-bin/koha/ill/ill-requests.pl">
<i class="fa fa-list"></i> List requests
</div>
<div id="sysinfo">
- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || has_ai_issues %]
+ [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues %]
[% IF (warnIsRootUser) %]
<h2>Warning regarding current user</h2>
<p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p>
<br/>
[% END %]
- [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching %]
+ [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatron || warnPrefAnonymousPatron_PatronDoesNotExist || warnNoActiveCurrency || QueryParserError || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration %]
<h2>Warnings regarding the system configuration</h2>
<table>
<caption>Preferences and parameters</caption>
That will bring a performance boost to enable it.
</td></tr>
[% END %]
+ [% IF warnILLConfiguration %]
+ <tr><th scope="row"><b>Warning</b> </th><td>
+ [% IF no_ill_backends %]The ILL module is enabled, but there are no backends available.[%END %]
+ </td></tr>
+ [% END %]
</table>
[% END %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › ILL requests ›</title>
[% INCLUDE 'doc-head-close.inc' %]
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
+<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css">
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
<div id="breadcrumbs">
<a href="/cgi-bin/koha/mainpage.pl">Home</a> ›
+ <a href="/cgi-bin/koha/ill/ill-requests.pl">ILL requests</a>
[% IF query_type == 'create' %]
- <a href=[% parent %]>ILL requests</a> › New request
+ › New request
[% ELSIF query_type == 'status' %]
- <a href=[% parent %]>ILL requests</a> › Status
- [% ELSE %]
- ILL requests
+ › Status
[% END %]
</div>
<div id="bd">
<div id="yui-main">
<div id="interlibraryloans" class="yui-b">
+ [% IF !backends_available %]
+ <div class="dialog message">ILL module configuration problem. Take a look at the <a href="/cgi-bin/koha/about.pl#sysinfo">about page</a></div>
+ [% ELSE %]
[% INCLUDE 'ill-toolbar.inc' %]
[% IF whole.error %]
[% INCLUDE $whole.template %]
[% END %]
+ [% END %]
</div>
</div>
</div>
[% ELSE %]
<div class="span12">
[% END %]
+ [% IF !backends_available %]
+ <div class="alert">ILL module configuration problem. Contact your administrator.</div>
+ [% ELSE %]
<div id="illrequests" class="maincontent">
[% IF method == 'create' %]
<h2>New Interlibrary loan request</h2>
</form>
[% END %]
</div> <!-- / .maincontent -->
+ [% END %]
</div> <!-- / .span10/12 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
use C4::Koha;
use C4::Output;
+use Koha::Illrequest::Config;
use Koha::Illrequests;
use Koha::Libraries;
use Koha::Patrons;
authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
});
+# Are we able to actually work?
+my $backends = Koha::Illrequest::Config->new->available_backends;
+my $backends_available = ( scalar @{$backends} > 0 );
+$template->param( backends_available => $backends_available );
+
my $op = $params->{'method'} || 'list';
if ( $op eq 'list' ) {
print $query->redirect('/cgi-bin/koha/opac-illrequests.pl?message=2');
}
}
-
-
}
$template->param(
subtest 'Backend core methods' => sub {
- plan tests => 16;
+ plan tests => 18;
$schema->storage->txn_begin;
$config->set_always('getLimitRules',
{ default => { count => 0, method => 'active' } });
- my $illrq = $builder->build({source => 'Illrequest'});
- my $illrq_obj = Koha::Illrequests->find($illrq->{illrequest_id});
- $illrq_obj->_config($config);
- $illrq_obj->_backend($backend);
+ my $illrq = $builder->build_object({
+ class => 'Koha::Illrequests',
+ value => { backend => undef }
+ });
+ $illrq->_config($config);
+
+ # Test error conditions (no backend)
+ throws_ok { $illrq->load_backend; }
+ 'Koha::Exceptions::Ill::InvalidBackendId',
+ 'Exception raised correctly';
+
+ throws_ok { $illrq->load_backend(''); }
+ 'Koha::Exceptions::Ill::InvalidBackendId',
+ 'Exception raised correctly';
+
+ # Now load the mocked backend
+ $illrq->_backend($backend);
# expandTemplate:
- is_deeply($illrq_obj->expandTemplate({ test => 1, method => "bar" }),
+ is_deeply($illrq->expandTemplate({ test => 1, method => "bar" }),
{
test => 1,
method => "bar",
{ stage => 'commit', method => 'create' });
# Test Copyright Clearance
t::lib::Mocks::mock_preference("ILLModuleCopyrightClearance", "Test Copyright Clearance.");
- is_deeply($illrq_obj->backend_create({test => 1}),
+ is_deeply($illrq->backend_create({test => 1}),
{
error => 0,
status => '',
"Backend create: copyright clearance.");
t::lib::Mocks::mock_preference("ILLModuleCopyrightClearance", "");
# Test non-commit
- is_deeply($illrq_obj->backend_create({test => 1}),
+ is_deeply($illrq->backend_create({test => 1}),
{
stage => 'bar', method => 'create',
template => "/tmp/Mock/intra-includes/create.inc",
},
"Backend create: arbitrary stage.");
# Test commit
- is_deeply($illrq_obj->backend_create({test => 1}),
+ is_deeply($illrq->backend_create({test => 1}),
{
stage => 'commit', method => 'create', permitted => 0,
template => "/tmp/Mock/intra-includes/create.inc",
opac_template => "/tmp/Mock/opac-includes/create.inc",
},
"Backend create: arbitrary stage, not permitted.");
- is($illrq_obj->status, "QUEUED", "Backend create: queued if restricted.");
+ is($illrq->status, "QUEUED", "Backend create: queued if restricted.");
$config->set_always('getLimitRules', {});
- $illrq_obj->status('NEW');
- is_deeply($illrq_obj->backend_create({test => 1}),
+ $illrq->status('NEW');
+ is_deeply($illrq->backend_create({test => 1}),
{
stage => 'commit', method => 'create', permitted => 1,
template => "/tmp/Mock/intra-includes/create.inc",
opac_template => "/tmp/Mock/opac-includes/create.inc",
},
"Backend create: arbitrary stage, permitted.");
- is($illrq_obj->status, "NEW", "Backend create: not-queued.");
+ is($illrq->status, "NEW", "Backend create: not-queued.");
# backend_renew
$backend->set_series('renew', { stage => 'bar', method => 'renew' });
- is_deeply($illrq_obj->backend_renew({test => 1}),
+ is_deeply($illrq->backend_renew({test => 1}),
{
stage => 'bar', method => 'renew',
template => "/tmp/Mock/intra-includes/renew.inc",
# backend_cancel
$backend->set_series('cancel', { stage => 'bar', method => 'cancel' });
- is_deeply($illrq_obj->backend_cancel({test => 1}),
+ is_deeply($illrq->backend_cancel({test => 1}),
{
stage => 'bar', method => 'cancel',
template => "/tmp/Mock/intra-includes/cancel.inc",
# backend_update_status
$backend->set_series('update_status', { stage => 'bar', method => 'update_status' });
- is_deeply($illrq_obj->backend_update_status({test => 1}),
+ is_deeply($illrq->backend_update_status({test => 1}),
{
stage => 'bar', method => 'update_status',
template => "/tmp/Mock/intra-includes/update_status.inc",
# backend_confirm
$backend->set_series('confirm', { stage => 'bar', method => 'confirm' });
- is_deeply($illrq_obj->backend_confirm({test => 1}),
+ is_deeply($illrq->backend_confirm({test => 1}),
{
stage => 'bar', method => 'confirm',
template => "/tmp/Mock/intra-includes/confirm.inc",
source => 'Borrower',
value => { categorycode => "ILLTSTLIB" },
});
- my $gen_conf = $illrq_obj->generic_confirm({
+ my $gen_conf = $illrq->generic_confirm({
current_branchcode => $illbrn->{branchcode}
});
isnt(index($gen_conf->{value}->{draft}->{body}, $backend->metadata->{Test}), -1,
"Generic confirm: partner 2 is correct."
);
- dies_ok { $illrq_obj->generic_confirm({
+ dies_ok { $illrq->generic_confirm({
current_branchcode => $illbrn->{branchcode},
stage => 'draft'
}) }
"Generic confirm: missing to dies OK.";
- dies_ok { $illrq_obj->generic_confirm({
+ dies_ok { $illrq->generic_confirm({
current_branchcode => $illbrn->{branchcode},
partners => $partner1->{email},
stage => 'draft'