Skip to content

Commit

Permalink
#2740 [LegalDisplay] fix: display double labour doctor if no inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Dec 22, 2022
1 parent a63f2d5 commit db32f01
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 3 additions & 3 deletions admin/securityconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
$events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'labourdoctor_contactid', 'params' => array('add-customer-contact' => 'disabled'));
$societe->fetch($labour_doctor_society->id[0]);

print $form->select_company($labour_doctor_society->id[0], 'labourdoctor_socid', '', 0, 1, 0, $events, 0, 'minwidth300');
print $form->select_company($labour_doctor_society->id[0], 'labourdoctor_socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300');
} else {
$events = array();
$events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'labourdoctor_contactid', 'params' => array('add-customer-contact' => 'disabled'));
Expand All @@ -204,7 +204,7 @@
if ( ! empty($user->socid)) {
print $form->select_company($user->socid, 'labourdoctor_socid', '', 0, 1, 0, $events, 0, 'minwidth300');
} else {
print $form->select_company('', 'labourdoctor_socid', '', 0, 1, 0, $events, 0, 'minwidth300');
print $form->select_company('', 'labourdoctor_socid', '', 'SelectThirdParty', 1, 0, $events, 0, 'minwidth300');
}
}
if ( ! GETPOSTISSET('backtopage')) print ' <a href="' . DOL_URL_ROOT . '/societe/card.php?action=create&backtopage=' . urlencode($_SERVER["PHP_SELF"] . '?action=create') . '"><span class="fa fa-plus-circle valignmiddle paddingleft" title="' . $langs->trans("AddThirdParty") . '"></span></a>';
Expand All @@ -218,7 +218,7 @@
$labourdoctorpreselectedids = $labour_doctor_contact->id;

if ($labour_doctor_contact->id) {
print $form->selectcontacts(empty($labour_doctor_society->id[0]) ? - 1 : $labour_doctor_society->id[0], $labour_doctor_contact->id, 'labourdoctor_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourdoctor_contactid');
print $form->selectcontacts(empty($labour_doctor_society->id[0]) ? -1 : $labour_doctor_society->id[0], $labour_doctor_contact->id, 'labourdoctor_contactid[]', 0, '', '', 0, 'quatrevingtpercent', false, 0, array(), false, 'multiple', 'labourdoctor_contactid');
} else {
$labourdoctorpreselectedids = GETPOST('labourdoctor_contactid', 'array');
if (GETPOST('labourdoctor_contactid', 'array')) $labourdoctorpreselectedids[GETPOST('labourdoctor_contactid', 'array')] = GETPOST('labourdoctor_contactid', 'array');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@
print '<tr>';
print '<td class="titlefield"><i class="fas fa-hospital-alt"></i> ' . $form->textwithpicto($langs->trans("LabourDoctor"), $langs->trans('HowToSetDataLegalDisplay')) . '</td>';
print '<td>';
$contact->fetch($legaldisplay->occupational_health_service->id);
print $contact->getNomUrl(1);
if ($legaldisplay->occupational_health_service->id > 0) {
$contact->fetch($legaldisplay->occupational_health_service->id);
print $contact->getNomUrl(1);
}
print '</td></tr>';

// Inspecteur du travail
print '<tr>';
print '<td class="titlefield"><i class="fas fa-search"></i> ' . $form->textwithpicto($langs->trans("LabourInspector"), $langs->trans('HowToSetDataLegalDisplay')) . '</td>';
print '<td>';
$contact->fetch($legaldisplay->detective_work->id);
print $contact->getNomUrl(1);
if ($legaldisplay->detective_work->id > 0) {
$contact->fetch($legaldisplay->detective_work->id);
print $contact->getNomUrl(1);
}
print '</td></tr>';

// SAMU
Expand Down

0 comments on commit db32f01

Please sign in to comment.