|
Lines 25-46
use DateTime;
Link Here
|
| 25 |
|
25 |
|
| 26 |
use C4::Letters; |
26 |
use C4::Letters; |
| 27 |
use Mojo::Util qw(deprecated); |
27 |
use Mojo::Util qw(deprecated); |
|
|
28 |
use File::Basename qw( dirname ); |
| 28 |
|
29 |
|
|
|
30 |
use Koha::AuthorisedValue; |
| 31 |
use Koha::AuthorisedValues; |
| 32 |
use Koha::Biblios; |
| 29 |
use Koha::Cache::Memory::Lite; |
33 |
use Koha::Cache::Memory::Lite; |
| 30 |
use Koha::Database; |
34 |
use Koha::Database; |
| 31 |
use Koha::DateUtils qw( dt_from_string ); |
35 |
use Koha::DateUtils qw( dt_from_string ); |
| 32 |
use Koha::Exceptions::Ill; |
36 |
use Koha::Exceptions::Ill; |
|
|
37 |
use Koha::ILL::Backend::Standard; |
| 38 |
use Koha::ILL::Batches; |
| 33 |
use Koha::ILL::Comments; |
39 |
use Koha::ILL::Comments; |
| 34 |
use Koha::ILL::Request::Attributes; |
40 |
use Koha::ILL::Request::Attributes; |
| 35 |
use Koha::AuthorisedValue; |
|
|
| 36 |
use Koha::ILL::Request::Logger; |
41 |
use Koha::ILL::Request::Logger; |
| 37 |
use Koha::Patron; |
|
|
| 38 |
use Koha::ILL::Batches; |
| 39 |
use Koha::AuthorisedValues; |
| 40 |
use Koha::Biblios; |
| 41 |
use Koha::Items; |
| 42 |
use Koha::ItemTypes; |
42 |
use Koha::ItemTypes; |
|
|
43 |
use Koha::Items; |
| 43 |
use Koha::Libraries; |
44 |
use Koha::Libraries; |
|
|
45 |
use Koha::Patron; |
| 44 |
|
46 |
|
| 45 |
use C4::Circulation qw( CanBookBeIssued AddIssue ); |
47 |
use C4::Circulation qw( CanBookBeIssued AddIssue ); |
| 46 |
|
48 |
|
|
Lines 434-449
sub load_backend {
Link Here
|
| 434 |
"An invalid backend ID was requested ('')"); |
436 |
"An invalid backend ID was requested ('')"); |
| 435 |
} |
437 |
} |
| 436 |
|
438 |
|
|
|
439 |
my $backend_params = { |
| 440 |
config => $self->_config, |
| 441 |
logger => Koha::ILL::Request::Logger->new |
| 442 |
}; |
| 443 |
|
| 437 |
# Find plugin implementing the backend for the request |
444 |
# Find plugin implementing the backend for the request |
| 438 |
my $backend_plugin = $self->get_backend_plugin($backend_name); |
445 |
my $backend_plugin = $self->get_backend_plugin($backend_name); |
| 439 |
if ($backend_plugin) { |
|
|
| 440 |
|
446 |
|
| 441 |
$self->{_my_backend} = $backend_plugin->new_ill_backend( |
447 |
if ( $backend_name eq 'Standard' ) { |
| 442 |
{ |
448 |
|
| 443 |
config => $self->_config, |
449 |
# Load the Standard core backend |
| 444 |
logger => Koha::ILL::Request::Logger->new |
450 |
$self->{_my_backend} = Koha::ILL::Backend::Standard->new($backend_params); |
| 445 |
} |
451 |
} elsif ($backend_plugin) { |
| 446 |
); |
452 |
|
|
|
453 |
$self->{_my_backend} = $backend_plugin->new_ill_backend($backend_params); |
| 447 |
} elsif ($backend_name) { |
454 |
} elsif ($backend_name) { |
| 448 |
|
455 |
|
| 449 |
# Fallback to loading through backend_dir config |
456 |
# Fallback to loading through backend_dir config |
|
Lines 451-462
sub load_backend {
Link Here
|
| 451 |
my $location = join "/", @raw, $backend_name, "Base.pm"; # File to load |
458 |
my $location = join "/", @raw, $backend_name, "Base.pm"; # File to load |
| 452 |
my $backend_class = join "::", @raw, $backend_name, "Base"; # Package name |
459 |
my $backend_class = join "::", @raw, $backend_name, "Base"; # Package name |
| 453 |
require $location; |
460 |
require $location; |
| 454 |
$self->{_my_backend} = $backend_class->new( |
461 |
$self->{_my_backend} = $backend_class->new($backend_params); |
| 455 |
{ |
|
|
| 456 |
config => $self->_config, |
| 457 |
logger => Koha::ILL::Request::Logger->new |
| 458 |
} |
| 459 |
); |
| 460 |
} |
462 |
} |
| 461 |
|
463 |
|
| 462 |
return $self; |
464 |
return $self; |
|
Lines 1086-1091
sub expand_template {
Link Here
|
| 1086 |
# New way of loading backends: Through plugins |
1088 |
# New way of loading backends: Through plugins |
| 1087 |
$backend_dir = $backend_plugin->bundle_path; |
1089 |
$backend_dir = $backend_plugin->bundle_path; |
| 1088 |
$backend_tmpl = $backend_dir; |
1090 |
$backend_tmpl = $backend_dir; |
|
|
1091 |
|
| 1092 |
} elsif ( $backend eq 'Standard' ) { |
| 1093 |
|
| 1094 |
# Check for core Standard backend |
| 1095 |
$backend_tmpl = dirname(__FILE__) . '/Backend'; |
| 1089 |
} else { |
1096 |
} else { |
| 1090 |
|
1097 |
|
| 1091 |
# Old way of loading backends: Through backend_dir config |
1098 |
# Old way of loading backends: Through backend_dir config |