diff --git a/app/Http/Controllers/HealthCareSheetController.php b/app/Http/Controllers/HealthCareSheetController.php index a85d37e..1f05541 100755 --- a/app/Http/Controllers/HealthCareSheetController.php +++ b/app/Http/Controllers/HealthCareSheetController.php @@ -700,7 +700,7 @@ class HealthCareSheetController extends Controller // Verification de la limite de couverture $this->verifyInsuranceCoverageAmount($nhConfig, $insurance, $healthCareSheet, $beneficiary ?? null); // Mettre à jour la couverture d'assurance de l'assuré - $this->updateInsuranceCoverageAmount($healthCareSheet, $insurance, $beneficiary ?? null, $datetime); + $this->updateInsuranceCoverageAmount($healthCareSheet, $insurance, $datetime, $beneficiary ?? null); foreach ($request->input('prescriptions', []) as $p) { $prescription = NhMedicalPrescription::create($p); @@ -802,8 +802,8 @@ class HealthCareSheetController extends Controller ]); } - private function updateInsuranceCoverageAmount(NhHealthCareSheet $sheet, NhInsurance $insurance, NhHavingRight $beneficiary, - $datetime, $currentInsuranceAmount = 0): void + private function updateInsuranceCoverageAmount(NhHealthCareSheet $sheet, NhInsurance $insurance, $datetime, + NhHavingRight $beneficiary = null, $currentInsuranceAmount = 0): void { // Current Insurance Amount en cas de mise à jour de la feuille de soins pour ne pas prendre en compte la couverture deja affecté) $sheet->insurance_consumed_at = $datetime; if (!empty($beneficiary)) { @@ -1048,7 +1048,7 @@ class HealthCareSheetController extends Controller // Verification de la limite de couverture $this->verifyInsuranceCoverageAmount($nhConfig, $sheet->insurance, $healthCareSheet, $sheet->beneficiary); // Mettre à jour la couverture d'assurance de l'assuré - $this->updateInsuranceCoverageAmount($healthCareSheet, $sheet->insurance, $sheet->beneficiary, $datetime); + $this->updateInsuranceCoverageAmount($healthCareSheet, $sheet->insurance, $datetime, $sheet->beneficiary,); #Clone pivots @@ -1935,7 +1935,7 @@ class HealthCareSheetController extends Controller // Verification de la limite de couverture $this->verifyInsuranceCoverageAmount($nhConfig, $sheet->insurance, $sheet, $sheet->beneficiary, $currentInsuranceAmount); // Mettre à jour la couverture d'assurance de l'assuré - $this->updateInsuranceCoverageAmount($sheet, $sheet->insurance, $sheet->beneficiary, $datetime, $currentInsuranceAmount); + $this->updateInsuranceCoverageAmount($sheet, $sheet->insurance, $datetime, $sheet->beneficiary, $currentInsuranceAmount); $sheet->save();