Bug 18942: Simplify syntax
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 17 Jul 2017 16:48:17 +0000 (13:48 -0300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 17 Jul 2017 18:52:01 +0000 (15:52 -0300)
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
C4/Budgets.pm

index 05f7ca5..bcc84db 100644 (file)
@@ -917,11 +917,8 @@ sub CanUserUseBudget {
 
     if (not ref $borrower) {
         $borrower = Koha::Patrons->find( $borrower );
-        if ( $borrower ) {
-            $borrower = $borrower->unblessed;
-        } else {
-            return 0;
-        }
+        return 0 unless $borrower;
+        $borrower = $borrower->unblessed;
     }
     if (not ref $budget) {
         $budget = GetBudget($budget);
@@ -1005,11 +1002,8 @@ sub CanUserModifyBudget {
 
     if (not ref $borrower) {
         $borrower = Koha::Patrons->find( $borrower );
-        if ( $borrower ) {
-            $borrower = $borrower->unblessed;
-        } else {
-            return 0;
-        }
+        return 0 unless $borrower;
+        $borrower = $borrower->unblessed;
     }
     if (not ref $budget) {
         $budget = GetBudget($budget);