Bug 18316: (QA follow-up) Add final missing filter
[koha.git] / Koha / Illrequest / Config.pm
index 776cb99..7db926e 100644 (file)
@@ -64,8 +64,7 @@ sub new {
     my $self  = {};
 
     $self->{configuration} = _load_configuration(
-        C4::Context->config("interlibrary_loans"),
-        C4::Context->preference("UnmediatedILL")
+        C4::Context->config("interlibrary_loans")
       );
 
     bless $self, $class;
@@ -118,6 +117,17 @@ sub available_backends {
     return \@backends;
 }
 
+=head3 has_branch
+
+Return whether a 'branch' block is defined
+
+=cut
+
+sub has_branch {
+    my ( $self ) = @_;
+    return $self->{configuration}->{raw_config}->{branch};
+}
+
 =head3 partner_code
 
     $partner_code = $config->partner_code($new_code);
@@ -151,18 +161,15 @@ sub limits {
 
 =head3 getPrefixes
 
-    my $prefixes = $config->getPrefixes('brw_cat' | 'branch');
+    my $prefixes = $config->getPrefixes();
 
-Return the prefix for ILLs defined by our config.
+Return the branch prefix for ILLs defined by our config.
 
 =cut
 
 sub getPrefixes {
-    my ( $self, $type ) = @_;
-    die "Unexpected type." unless ( $type eq 'brw_cat' || $type eq 'branch' );
-    my $values = $self->{configuration}->{prefixes}->{$type};
-    $values->{default} = $self->{configuration}->{prefixes}->{default};
-    return $values;
+    my ( $self ) = @_;
+    return $self->{configuration}->{prefixes}->{branch};
 }
 
 =head3 getLimitRules
@@ -230,7 +237,7 @@ file to ensure we have only valid input there.
 =cut
 
 sub _load_configuration {
-    my ( $xml_config, $unmediated ) = @_;
+    my ( $xml_config ) = @_;
     my $xml_backend_dir = $xml_config->{backend_directory};
 
     # Default data structure to be returned
@@ -309,9 +316,6 @@ sub _load_configuration {
     # ILL Partners
     $configuration->{partner_code} = $xml_config->{partner_code} || 'ILLLIBS';
 
-    die "No DEFAULT_FORMATS has been defined in koha-conf.xml, but UNMEDIATEDILL is active."
-        if ( $unmediated && !$configuration->{default_formats}->{default} );
-
     return $configuration;
 }