diff --git a/app/Models/Banking/Transaction.php b/app/Models/Banking/Transaction.php index 188a45366..194d75198 100644 --- a/app/Models/Banking/Transaction.php +++ b/app/Models/Banking/Transaction.php @@ -372,7 +372,7 @@ class Transaction extends Model */ public function getRouteIdAttribute($value) { - return $value ?? $this->document_id ?? $this->id; + return !empty($value) ? $value : (!empty($this->document_id) ? $this->document_id : $this->id); } /** diff --git a/app/Traits/Import.php b/app/Traits/Import.php index 84440d9cd..d4a59d0f7 100644 --- a/app/Traits/Import.php +++ b/app/Traits/Import.php @@ -27,7 +27,7 @@ trait Import $id = $this->getAccountIdFromCurrency($row); } - return (int) $id; + return is_null($id) ? $id : (int) $id; } public function getCategoryId($row, $type = null) @@ -40,7 +40,7 @@ trait Import $id = $this->getCategoryIdFromName($row, $type); } - return (int) $id; + return is_null($id) ? $id : (int) $id; } public function getContactId($row, $type = null) @@ -57,7 +57,7 @@ trait Import $id = $this->getContactIdFromName($row, $type); } - return (int) $id; + return is_null($id) ? $id : (int) $id; } public function getDocumentId($row) @@ -84,7 +84,7 @@ trait Import } } - return $id == null ? null : (int) $id; + return is_null($id) ? $id : (int) $id; } public function getItemId($row) @@ -95,7 +95,7 @@ trait Import $id = $this->getItemIdFromName($row); } - return (int) $id; + return is_null($id) ? $id : (int) $id; } public function getTaxId($row) @@ -110,7 +110,7 @@ trait Import $id = $this->getTaxIdFromRate($row); } - return (int) $id; + return is_null($id) ? $id : (int) $id; } public function getAccountIdFromCurrency($row)