View | Details | Raw Unified | Return to bug 35570
Collapse All | Expand All

(-)a/Koha/ILL/Request.pm (-19 / +26 lines)
Lines 25-47 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;
44
use Koha::AdditionalContents;
45
use Koha::AdditionalContents;
46
use Koha::Patron;
45
47
46
use C4::Circulation qw( CanBookBeIssued AddIssue );
48
use C4::Circulation qw( CanBookBeIssued AddIssue );
47
49
Lines 435-450 sub load_backend { Link Here
435
            "An invalid backend ID was requested ('')");
437
            "An invalid backend ID was requested ('')");
436
    }
438
    }
437
439
440
    my $backend_params = {
441
        config => $self->_config,
442
        logger => Koha::ILL::Request::Logger->new
443
    };
444
438
    # Find plugin implementing the backend for the request
445
    # Find plugin implementing the backend for the request
439
    my $backend_plugin = $self->get_backend_plugin($backend_name);
446
    my $backend_plugin = $self->get_backend_plugin($backend_name);
440
    if ($backend_plugin) {
441
447
442
        $self->{_my_backend} = $backend_plugin->new_ill_backend(
448
    if ( $backend_name eq 'Standard' ) {
443
            {
449
444
                config => $self->_config,
450
        # Load the Standard core backend
445
                logger => Koha::ILL::Request::Logger->new
451
        $self->{_my_backend} = Koha::ILL::Backend::Standard->new($backend_params);
446
            }
452
    } elsif ($backend_plugin) {
447
        );
453
454
        $self->{_my_backend} = $backend_plugin->new_ill_backend($backend_params);
448
    } elsif ($backend_name) {
455
    } elsif ($backend_name) {
449
456
450
        # Fallback to loading through backend_dir config
457
        # Fallback to loading through backend_dir config
Lines 452-463 sub load_backend { Link Here
452
        my $location      = join "/",  @raw, $backend_name, "Base.pm";    # File to load
459
        my $location      = join "/",  @raw, $backend_name, "Base.pm";    # File to load
453
        my $backend_class = join "::", @raw, $backend_name, "Base";       # Package name
460
        my $backend_class = join "::", @raw, $backend_name, "Base";       # Package name
454
        require $location;
461
        require $location;
455
        $self->{_my_backend} = $backend_class->new(
462
        $self->{_my_backend} = $backend_class->new($backend_params);
456
            {
457
                config => $self->_config,
458
                logger => Koha::ILL::Request::Logger->new
459
            }
460
        );
461
    }
463
    }
462
464
463
    return $self;
465
    return $self;
Lines 1098-1103 sub expand_template { Link Here
1098
        # New way of loading backends: Through plugins
1100
        # New way of loading backends: Through plugins
1099
        $backend_dir  = $backend_plugin->bundle_path;
1101
        $backend_dir  = $backend_plugin->bundle_path;
1100
        $backend_tmpl = $backend_dir;
1102
        $backend_tmpl = $backend_dir;
1103
1104
    } elsif ( $backend eq 'Standard' ) {
1105
1106
        # Check for core Standard backend
1107
        $backend_tmpl = dirname(__FILE__) . '/Backend';
1101
    } else {
1108
    } else {
1102
1109
1103
        # Old way of loading backends: Through backend_dir config
1110
        # Old way of loading backends: Through backend_dir config
(-)a/Koha/ILL/Request/Config.pm (-2 / +1 lines)
Lines 147-153 sub available_backends { Link Here
147
    @backends = glob "$backend_dir/*" if ($backend_dir);
147
    @backends = glob "$backend_dir/*" if ($backend_dir);
148
    @backends = map  { basename($_) } @backends;
148
    @backends = map  { basename($_) } @backends;
149
149
150
    my @all_backends = ( @backends, @backend_plugins_names );
150
    my @all_backends = ( @backends, @backend_plugins_names, 'Standard' );
151
    @all_backends = grep { $_ =~ /$reduce/ } @all_backends if $reduce;
151
    @all_backends = grep { $_ =~ /$reduce/ } @all_backends if $reduce;
152
152
153
    # Return unique list of backend names in the event that the same backend is
153
    # Return unique list of backend names in the event that the same backend is
154
- 

Return to bug 35570