diff --git a/app/Export/CSV/PurchaseOrderItemExport.php b/app/Export/CSV/PurchaseOrderItemExport.php index 1ba5db7a12a6..3738ec5b6dd0 100644 --- a/app/Export/CSV/PurchaseOrderItemExport.php +++ b/app/Export/CSV/PurchaseOrderItemExport.php @@ -127,18 +127,18 @@ class PurchaseOrderItemExport extends BaseExport if (str_contains($key, "item.")) { - $key = str_replace("item.", "", $key); + $tmp_key = str_replace("item.", "", $key); - if($key == 'type_id') { - $keyval = 'type'; + if($tmp_key == 'type_id') { + $tmp_key = 'type'; } - if($key == 'tax_id') { - $keyval = 'tax_category'; + if($tmp_key == 'tax_id') { + $tmp_key = 'tax_category'; } - if (property_exists($item, $key)) { - $item_array[$key] = $item->{$key}; + if (property_exists($item, $tmp_key)) { + $item_array[$key] = $item->{$tmp_key}; } else { $item_array[$key] = ''; } diff --git a/app/Export/CSV/QuoteItemExport.php b/app/Export/CSV/QuoteItemExport.php index 5e327af612d8..0db08629c664 100644 --- a/app/Export/CSV/QuoteItemExport.php +++ b/app/Export/CSV/QuoteItemExport.php @@ -133,16 +133,16 @@ class QuoteItemExport extends BaseExport if (str_contains($key, "item.")) { - $key = str_replace("item.", "", $key); + $tmp_key = str_replace("item.", "", $key); - if($key == 'type_id') - $key = 'type'; + if($tmp_key == 'type_id') + $tmp_key = 'type'; - if($key == 'tax_id') - $key = 'tax_category'; + if($tmp_key == 'tax_id') + $tmp_key = 'tax_category'; - if (property_exists($item, $key)) { - $item_array[$key] = $item->{$key}; + if (property_exists($item, $tmp_key)) { + $item_array[$key] = $item->{$tmp_key}; } else { $item_array[$key] = ''; diff --git a/app/Http/Requests/Client/StoreClientRequest.php b/app/Http/Requests/Client/StoreClientRequest.php index a8ae0fb5fbae..7262b6ef5d0b 100644 --- a/app/Http/Requests/Client/StoreClientRequest.php +++ b/app/Http/Requests/Client/StoreClientRequest.php @@ -180,8 +180,6 @@ class StoreClientRequest extends Request public function messages() { return [ - // 'unique' => ctrans('validation.unique', ['attribute' => ['email','number']), - //'required' => trans('validation.required', ['attribute' => 'email']), 'contacts.*.email.required' => ctrans('validation.email', ['attribute' => 'email']), 'currency_code' => 'Currency code does not exist', ]; diff --git a/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php b/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php index ec629276068a..7099cc6317ae 100644 --- a/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php +++ b/app/Http/Requests/GroupSetting/StoreGroupSettingRequest.php @@ -26,12 +26,18 @@ class StoreGroupSettingRequest extends Request */ public function authorize() : bool { - return auth()->user()->can('create', GroupSetting::class) && auth()->user()->account->hasFeature(Account::FEATURE_API); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + return $user->can('create', GroupSetting::class) && $user->account->hasFeature(Account::FEATURE_API); } public function rules() { - $rules['name'] = 'required|unique:group_settings,name,null,null,company_id,'.auth()->user()->companyId(); + /** @var \App\Models\User $user */ + $user = auth()->user(); + + $rules['name'] = 'required|unique:group_settings,name,null,null,company_id,'.$user->companyId(); $rules['settings'] = new ValidClientGroupSettingsRule(); diff --git a/tests/Feature/Export/ReportCsvGenerationTest.php b/tests/Feature/Export/ReportCsvGenerationTest.php index 87c967c883bf..90b12ab96adc 100644 --- a/tests/Feature/Export/ReportCsvGenerationTest.php +++ b/tests/Feature/Export/ReportCsvGenerationTest.php @@ -1171,7 +1171,7 @@ class ReportCsvGenerationTest extends TestCase public function testQuoteItemsCustomColumnsCsvGeneration() { - \App\Models\Quote::factory()->create([ + $q = \App\Models\Quote::factory()->create([ 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'client_id' => $this->client->id, @@ -1217,7 +1217,6 @@ class ReportCsvGenerationTest extends TestCase $csv = $response->streamedContent(); - $this->assertEquals('bob', $this->getFirstValueByColumn($csv, 'Client Name')); $this->assertEquals('1234', $this->getFirstValueByColumn($csv, 'Quote Number')); $this->assertEquals('10', $this->getFirstValueByColumn($csv, 'Item Quantity'));