From 5bfd83c2108afe6da7fe4c6c02667029eb7e4e80 Mon Sep 17 00:00:00 2001 From: evarisk-francois Date: Wed, 31 Jul 2024 16:56:17 +0200 Subject: [PATCH 1/4] #598 [Module] add: remove certificate from training session --- core/modules/modDoliMeet.class.php | 1 - view/session/session_card.php | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/core/modules/modDoliMeet.class.php b/core/modules/modDoliMeet.class.php index 2527256..646313e 100644 --- a/core/modules/modDoliMeet.class.php +++ b/core/modules/modDoliMeet.class.php @@ -579,7 +579,6 @@ public function init($options = ''): int delDocumentModel('completioncertificatedocument_odt', 'completioncertificatedocument'); addDocumentModel('attendancesheetdocument_odt', 'trainingsessiondocument', 'ODT templates', 'DOLIMEET_ATTENDANCESHEETDOCUMENT_ADDON_ODT_PATH'); - addDocumentModel('completioncertificatedocument_odt', 'trainingsessiondocument', 'ODT templates', 'DOLIMEET_COMPLETIONCERTIFICATEDOCUMENT_ADDON_ODT_PATH'); addDocumentModel('completioncertificatedocument_odt', 'completioncertificatedocument', 'ODT templates', 'DOLIMEET_COMPLETIONCERTIFICATEDOCUMENT_ADDON_ODT_PATH'); if (getDolGlobalInt('DOLIMEET_EMAIL_TEMPLATE_SET') == 0 && isModEnabled('digiquali') && version_compare(getDolGlobalString('DIGIQUALI_VERSION'), '1.11.0', '>=')) { diff --git a/view/session/session_card.php b/view/session/session_card.php index f369789..08e2067 100644 --- a/view/session/session_card.php +++ b/view/session/session_card.php @@ -458,7 +458,7 @@ unset($object->fields['fk_project']); // Hide field already shown in banner. unset($object->fields['fk_soc']); // Hide field already shown in banner. unset($object->fields['fk_contrat']); // Hide field already shown in banner. - + // Common attributes. require_once DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; @@ -480,7 +480,7 @@ print dol_get_fiche_end(); - $documentTypeArray = ['trainingsession', 'attendancesheet', 'completioncertificate']; + $documentTypeArray = ['trainingsession', 'attendancesheet']; // Buttons for actions. if ($action != 'presend') { print '
'; From 72dbf4fd6c04b44f377c9960db94b7e5debb2b1b Mon Sep 17 00:00:00 2001 From: evarisk-francois Date: Wed, 31 Jul 2024 17:11:07 +0200 Subject: [PATCH 2/4] #598 [Module] add: remove tab --- view/session/session_card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/session/session_card.php b/view/session/session_card.php index 08e2067..c27d283 100644 --- a/view/session/session_card.php +++ b/view/session/session_card.php @@ -458,7 +458,7 @@ unset($object->fields['fk_project']); // Hide field already shown in banner. unset($object->fields['fk_soc']); // Hide field already shown in banner. unset($object->fields['fk_contrat']); // Hide field already shown in banner. - + // Common attributes. require_once DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; From 7b5b2876844976cfec6121038e55fbd4770d8d87 Mon Sep 17 00:00:00 2001 From: evarisk-francois Date: Thu, 1 Aug 2024 14:26:24 +0200 Subject: [PATCH 3/4] #598 [Session] add: remove dead code --- class/actions_dolimeet.class.php | 33 +------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/class/actions_dolimeet.class.php b/class/actions_dolimeet.class.php index c1ec9d8..f062bd1 100644 --- a/class/actions_dolimeet.class.php +++ b/class/actions_dolimeet.class.php @@ -884,38 +884,7 @@ public function saturneBuildDoc(array $parameters, CommonObject $object, string global $conf, $langs; // Do something only for the current context - if (strpos($parameters['context'], 'trainingsessioncard') !== false) { - if (preg_match('/completioncertificate/', (!empty($parameters['models']) ? $parameters['models'][1] : $parameters['model']))) { - $signatory = new SaturneSignature($this->db, 'dolimeet', $object->element); - $document = new SessionDocument($this->db, $object->element . 'document'); - - $signatoriesArray = $signatory->fetchSignatories($object->id, $object->type); - if (is_array($signatoriesArray) && !empty($signatoriesArray)) { - foreach ($signatoriesArray as $objectSignatory) { - if ($objectSignatory->role == 'Trainee' && $objectSignatory->attendance != $objectSignatory::ATTENDANCE_ABSENT) { - $parameters['moreparams']['attendant'] = $objectSignatory; - $result = $document->generateDocument((!empty($parameters['models']) ? $parameters['models'][1] : $parameters['model']), $parameters['outputlangs'], $parameters['hidedetails'], $parameters['hidedesc'], $parameters['hideref'], $parameters['moreparams']); - if ($result <= 0) { - setEventMessages($document->error, $document->errors, 'errors'); - $action = ''; - } - } - } - $documentType = explode('_odt', (!empty($parameters['models']) ? $parameters['models'][1] : $parameters['model'])); - if ($document->element != $documentType[0]) { - $document->element = $documentType[0]; - } - setEventMessages($langs->trans('FileGenerated') . ' - ' . 'element . '/' . $object->ref . '/' . $document->last_main_doc) . '&entity=' . $conf->entity . '"' . '>' . $document->last_main_doc, []); - $urlToRedirect = $_SERVER['REQUEST_URI']; - $urlToRedirect = preg_replace('/#builddoc$/', '', $urlToRedirect); - $urlToRedirect = preg_replace('/action=builddoc&?/', '', $urlToRedirect); // To avoid infinite loop - if (!GETPOST('forcebuilddoc')){ - header('Location: ' . $urlToRedirect . '#builddoc'); - exit; - } - } - } - } else if (strpos($parameters['context'], 'contractcard') !== false) { + if (strpos($parameters['context'], 'contractcard') !== false) { if (strpos((!empty($parameters['models']) ? $parameters['models'][1] : $parameters['model']), 'completioncertificate') !== false) { require_once __DIR__ . '/session.class.php'; From 94e407da4e7dd0498444b590a179c6876c56c984 Mon Sep 17 00:00:00 2001 From: evarisk-francois Date: Thu, 1 Aug 2024 17:46:33 +0200 Subject: [PATCH 4/4] #598 [Session] add: remove dead code for certificate --- class/actions_dolimeet.class.php | 4 ---- view/session/session_card.php | 11 +++-------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/class/actions_dolimeet.class.php b/class/actions_dolimeet.class.php index f062bd1..723ff2d 100644 --- a/class/actions_dolimeet.class.php +++ b/class/actions_dolimeet.class.php @@ -834,10 +834,6 @@ public function saturneAdminDocumentData(array $parameters): int 'AttendanceSheetDocument' => [ 'documentType' => 'attendancesheetdocument', 'picto' => 'fontawesome_fa-people-arrows_fas_#d35968' - ], - 'CompletionCertificateDocument' => [ - 'documentType' => 'completioncertificatedocument', - 'picto' => 'fontawesome_fa-people-arrows_fas_#d35968' ] ]; $this->results = $types; diff --git a/view/session/session_card.php b/view/session/session_card.php index c27d283..653c846 100644 --- a/view/session/session_card.php +++ b/view/session/session_card.php @@ -545,17 +545,15 @@ $fileList = array_merge($fileList, dol_dir_list($upload_dir . '/' . $documentTypeName . 'document' . '/' . $object->ref, 'files', 0, '', '', 'date', SORT_DESC)); } if (!empty($fileList)) { - $fileType = ['attendancesheetdocument' => 0, 'completioncertificatedocument' => 0]; + $fileType = ['attendancesheetdocument' => 0]; foreach ($fileList as $file) { if (!strstr($file['name'], 'specimen')) { if (strstr($file['name'], str_replace(' ', '_', $langs->transnoentities('attendancesheetdocument'))) && $fileType['attendancesheetdocument'] == 0) { $fileType['attendancesheetdocument'] = 1; - } elseif (strstr($file['name'], str_replace(' ', '_', $langs->transnoentities('completioncertificatedocument'))) && $fileType['completioncertificatedocument'] < $nbTrainee) { - $fileType['completioncertificatedocument']++; } } } - if ($fileType['attendancesheetdocument'] == 1 && $fileType['completioncertificatedocument'] == $nbTrainee) { + if ($fileType['attendancesheetdocument'] == 1) { $forceBuildDoc = 0; } else { $forceBuildDoc = 1; @@ -639,15 +637,12 @@ $fileList = array_merge($fileList, dol_dir_list($upload_dir . '/' . $documentTypeName . 'document' . '/' . $ref, 'files', 0, '(\.pdf)', '', 'date', SORT_DESC)); } if (!empty($fileList) && is_array($fileList)) { - $fileType = ['attendancesheetdocument' => 0, 'completioncertificatedocument' => 0]; + $fileType = ['attendancesheetdocument' => 0]; foreach ($fileList as $file) { if (!strstr($file['name'], 'specimen')) { if (strstr($file['name'], str_replace(' ', '_', $langs->transnoentities('attendancesheetdocument'))) && $fileType['attendancesheetdocument'] == 0) { $files[] = $file['fullname']; $fileType['attendancesheetdocument'] = 1; - } elseif (strstr($file['name'], str_replace(' ', '_', $langs->transnoentities('completioncertificatedocument'))) && $fileType['completioncertificatedocument'] < $nbTrainee) { - $files[] = $file['fullname']; - $fileType['completioncertificatedocument']++; } } }