From d9ae579f60cacdf89a20976f9513a13ac5cd9d7d Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 13 Dec 2018 17:04:16 -0300 Subject: [PATCH] Bug 21460: Simplify the code to have only 1 assignment --- Koha/REST/V1/Illrequests.pm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Koha/REST/V1/Illrequests.pm b/Koha/REST/V1/Illrequests.pm index d07045ff1b..5cc4230044 100644 --- a/Koha/REST/V1/Illrequests.pm +++ b/Koha/REST/V1/Illrequests.pm @@ -53,14 +53,13 @@ sub list { # Get all requests # If necessary, only get those from a specified patron - my @requests; - if ($args->{borrowernumber}) { - @requests = Koha::Illrequests->search( - { borrowernumber => $args->{borrowernumber} } - ); - } else { - @requests = Koha::Illrequests->as_list; - } + my @requests = Koha::Illrequests->search( + { + $args->{borrowernumber} + ? ( borrowernumber => $args->{borrowernumber} ) + : () + } + )->as_list; # Identify patrons & branches that # we're going to need and get them -- 2.11.0