Fix bug while store consultation

This commit is contained in:
Djery-Tom 2022-02-22 16:24:54 +01:00
parent 9017ac9609
commit 1fbeafbeba
1 changed files with 5 additions and 5 deletions

View File

@ -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();