Bug 16330: (QA follow-up) Repect guidelines on plurals Patron > Patrons
[koha_ffzg] / Koha / Illrequest.pm
index 5f6ee12..99b97bd 100644 (file)
@@ -21,15 +21,16 @@ package Koha::Illrequest;
 use Modern::Perl;
 
 use Clone 'clone';
-use File::Basename qw/basename/;
+use File::Basename qw( basename );
+use Encode qw( encode );
+use Mail::Sendmail;
+use Try::Tiny;
+
 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 base qw(Koha::Object);
 
@@ -477,8 +478,8 @@ Return a list of available backends.
 
 sub available_backends {
     my ( $self ) = @_;
-    my @backends = $self->_config->available_backends;
-    return \@backends;
+    my $backends = $self->_config->available_backends;
+    return $backends;
 }
 
 =head3 available_actions
@@ -893,12 +894,16 @@ EOF
             $to =~ s/^\x00//;       # Strip leading NULLs
             $to =~ s/\x00/; /;      # Replace others with '; '
         }
-        die "No target email addresses found. Either select at least one partner or check your ILL partner library records." if ( !$to );
+        Koha::Exceptions::Ill::NoTargetEmail->throw(
+            "No target email addresses found. Either select at least one partner or check your ILL partner library records.")
+          if ( !$to );
         # Create the from, replyto and sender headers
         my $from = $branch->branchemail;
         my $replyto = $branch->branchreplyto || $from;
-        die "Your branch has no email address. Please set it."
-            if ( !$from );
+        Koha::Exceptions::Ill::NoLibraryEmail->throw(
+            "Your library has no usable email address. Please set it.")
+          if ( !$from );
+
         # Create the email
         my $message = Koha::Email->new;
         my %mail = $message->create_message_headers(
@@ -1013,8 +1018,8 @@ sub TO_JSON {
             $object->{capabilities} = $self->capabilities;
         }
         # Augment the request response with library details if appropriate
-        if ( $embed->{branch} ) {
-            $object->{branch} = Koha::Libraries->find(
+        if ( $embed->{library} ) {
+            $object->{library} = Koha::Libraries->find(
                 $self->branchcode
             )->TO_JSON;
         }