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

(-)a/Koha/ILL/Request.pm (-19 / +27 lines)
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 435-452 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
    my $backend_plugin = $self->get_backend_plugin($backend_name);
445
    my $backend_plugin = $self->get_backend_plugin($backend_name);
439
    if ($backend_plugin) {
446
447
    if ( $backend_name eq 'Standard' ) {
448
        
449
        # Load the Standard core backend
450
        $self->{_my_backend} = Koha::ILL::Backend::Standard->new($backend_params);
451
        return $self;
452
    } elsif ($backend_plugin) {
440
453
441
        # New way of loading backends: Through plugins
454
        # New way of loading backends: Through plugins
442
        my $backend_plugin_class = $backend_plugin->{class};
455
        my $backend_plugin_class = $backend_plugin->{class};
443
456
444
        $self->{_my_backend} = $backend_plugin_class->new_backend(
457
        $self->{_my_backend} = $backend_plugin_class->new_backend($backend_params);
445
            {
446
                config => $self->_config,
447
                logger => Koha::ILL::Request::Logger->new
448
            }
449
        );
450
    } elsif ($backend_name) {
458
    } elsif ($backend_name) {
451
459
452
        # Old way of loading backends: Through backend_dir config
460
        # Old way of loading backends: Through backend_dir config
Lines 454-465 sub load_backend { Link Here
454
        my $location      = join "/",  @raw, $backend_name, "Base.pm";    # File to load
462
        my $location      = join "/",  @raw, $backend_name, "Base.pm";    # File to load
455
        my $backend_class = join "::", @raw, $backend_name, "Base";       # Package name
463
        my $backend_class = join "::", @raw, $backend_name, "Base";       # Package name
456
        require $location;
464
        require $location;
457
        $self->{_my_backend} = $backend_class->new(
465
        $self->{_my_backend} = $backend_class->new($backend_params);
458
            {
459
                config => $self->_config,
460
                logger => Koha::ILL::Request::Logger->new
461
            }
462
        );
463
    }
466
    }
464
467
465
    return $self;
468
    return $self;
Lines 1089-1094 sub expand_template { Link Here
1089
        # New way of loading backends: Through plugins
1092
        # New way of loading backends: Through plugins
1090
        $backend_dir  = $backend_plugin->bundle_path;
1093
        $backend_dir  = $backend_plugin->bundle_path;
1091
        $backend_tmpl = $backend_dir;
1094
        $backend_tmpl = $backend_dir;
1095
1096
    } elsif ( $backend eq 'Standard' ) {
1097
1098
        # Check for core Standard backend
1099
        $backend_tmpl = dirname(__FILE__) . '/Backend';
1092
    } else {
1100
    } else {
1093
1101
1094
        # Old way of loading backends: Through backend_dir config
1102
        # Old way of loading backends: Through backend_dir config
(-)a/Koha/ILL/Request/Config.pm (-2 / +1 lines)
Lines 151-157 sub available_backends { Link Here
151
151
152
    # Return unique list of backend names in the event that the same backend is
152
    # Return unique list of backend names in the event that the same backend is
153
    # installed as a plugin AND as the old way through backend_dir
153
    # installed as a plugin AND as the old way through backend_dir
154
    my @all_backends = ( @backends, @backend_plugins_names );
154
    my @all_backends = ( @backends, @backend_plugins_names, 'Standard' );
155
    my @all_uniq_backends = uniq(@all_backends);
155
    my @all_uniq_backends = uniq(@all_backends);
156
156
157
    return \@all_uniq_backends;
157
    return \@all_uniq_backends;
158
- 

Return to bug 35570