diff --git a/app/Http/Controllers/CompanyController.php b/app/Http/Controllers/CompanyController.php index 798f780e2229..f34980d6f431 100644 --- a/app/Http/Controllers/CompanyController.php +++ b/app/Http/Controllers/CompanyController.php @@ -11,6 +11,7 @@ namespace App\Http\Controllers; +use App\DataMapper\CompanySettings; use App\DataMapper\DefaultSettings; use App\Http\Requests\Company\CreateCompanyRequest; use App\Http\Requests\Company\DestroyCompanyRequest; @@ -218,6 +219,7 @@ class CompanyController extends BaseController 'is_locked' => 0, 'permissions' => '', 'settings' => null, + 'notifications' => CompanySettings::notificationDefaults(), //'settings' => DefaultSettings::userSettings(), ]); diff --git a/app/Http/Requests/Payment/UpdatePaymentRequest.php b/app/Http/Requests/Payment/UpdatePaymentRequest.php index 7ea172cf2c94..85539984270d 100644 --- a/app/Http/Requests/Payment/UpdatePaymentRequest.php +++ b/app/Http/Requests/Payment/UpdatePaymentRequest.php @@ -38,6 +38,7 @@ class UpdatePaymentRequest extends Request { return [ 'invoices' => ['required','array','min:1',new PaymentAppliedValidAmount,new ValidCreditsPresentRule], + 'invoices.*.invoice_id' => 'distinct', 'documents' => 'mimes:png,ai,svg,jpeg,tiff,pdf,gif,psd,txt,doc,xls,ppt,xlsx,docx,pptx', ]; } @@ -77,4 +78,11 @@ class UpdatePaymentRequest extends Request } $this->replace($input); } + + public function messages() + { + return [ + 'distinct' => 'Attemping duplicate payment on the same invoice Invoice', + ]; + } } diff --git a/app/Utils/Traits/Notifications/UserNotifies.php b/app/Utils/Traits/Notifications/UserNotifies.php index a7d4addf2caa..d5326910b249 100644 --- a/app/Utils/Traits/Notifications/UserNotifies.php +++ b/app/Utils/Traits/Notifications/UserNotifies.php @@ -50,6 +50,9 @@ trait UserNotifies $notifiable_methods = []; $notifications = $company_user->notifications; + if(!$notifications) + return []; + if ($entity->user_id == $company_user->_user_id || $entity->assigned_user_id == $company_user->user_id) { array_push($required_permissions, "all_user_notifications"); }