Skip to content

Commit

Permalink
Merge pull request #345 from evarisk-theo/add_digiquali_interaction
Browse files Browse the repository at this point in the history
#341 [TrainingSession] add: satisfaction survey
  • Loading branch information
evarisk-theo authored Jul 24, 2023
2 parents 2d136cf + e4ed2ad commit 3a1bded
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 5 deletions.
29 changes: 27 additions & 2 deletions admin/setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@
*/

if ($action == 'update') {
$responsibleId = GETPOST('session_trainer_responsible_id');
$documentLocation = GETPOST('document_location');
$responsibleId = GETPOST('session_trainer_responsible_id');
$documentLocation = GETPOST('document_location');
$satisfactionSurveyId = GETPOST('satisfaction_survey_model');

if ($responsibleId != $conf->global->DOLIMEET_SESSION_TRAINER_RESPONSIBLE) {
dolibarr_set_const($db, 'DOLIMEET_SESSION_TRAINER_RESPONSIBLE', $responsibleId, 'int');
Expand All @@ -69,6 +70,11 @@
setEventMessages($langs->trans('DocumentLocationSet', $user->getFullName($langs)), null);
}

if ($satisfactionSurveyId != $conf->global->DOLIMEET_SATISFACTION_SURVEY_SHEET) {
dolibarr_set_const($db, 'DOLIMEET_SATISFACTION_SURVEY_SHEET', $satisfactionSurveyId);
setEventMessages($langs->trans('SatisfactionSurveySet'), null);
}

}
/*
* View
Expand Down Expand Up @@ -258,7 +264,26 @@
print '<td><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '</td>';
print '</tr>';

if (isModEnabled('digiquali')) {
require_once __DIR__ . '/../../digiquali/class/sheet.class.php';
$sheet = new Sheet($db);

print '<tr class="oddeven"><td>';
print $langs->trans('SatisfactionSurvey');
print '</td><td>';
print $langs->transnoentities('SatisfactionSurveyDesc');
print '</td>';

print '<td class="center">';
print $sheet->selectSheetList($conf->global->DOLIMEET_SATISFACTION_SURVEY_SHEET, 'satisfaction_survey_model');
print '<td><input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
print '</td>';
print '</tr>';
}

print '</form>';


$db->close();
llxFooter();
29 changes: 28 additions & 1 deletion class/actions_dolimeet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,33 @@ public function doActions(array $parameters, $object, string $action): int
return 0; // or return 1 to replace standard code
}

/**
* Execute action extendSheetLinkableObjectsList
*
* @param array $linkableObjectTypes Array of linkable objects
* @return int 1
*/
public function extendSheetLinkableObjectsList(array $linkableObjectTypes): int {
require_once __DIR__ . '/../class/trainingsession.class.php';
require_once __DIR__ . '/../lib/dolimeet_trainingsession.lib.php';
$trainingSession = new Trainingsession($this->db);
$linkableObjectTypes['dolimeet_trainsess'] = [
'langs' => 'TrainingSession',
'langfile' => 'dolimeet@dolimeet',
'picto' => $trainingSession->picto,
'className' => 'TrainingSession',
'post_name' => 'fk_trainingsession',
'link_name' => 'dolimeet_trainsess',
'name_field' => 'ref',
'create_url' => 'custom/dolimeet/view/trainingsession/session_card.php?action=create&object_type=trainingsession',
'class_path' => 'custom/dolimeet/class/trainingsession.class.php',
'lib_path' => 'custom/dolimeet/lib/dolimeet_trainingsession.lib.php',
];

$this->results = $linkableObjectTypes;
return 1;
}

/**
* Overloading the saturneBannerTab function : replacing the parent's function with the one below
*
Expand Down Expand Up @@ -281,4 +308,4 @@ public function moreHtmlStatus(array $parameters, CommonObject $object): int

return 0; // or return 1 to replace standard code
}
}
}
3 changes: 2 additions & 1 deletion core/modules/modDoliMeet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ public function __construct($db)
'saturneglobal',
'sessioncard',
'saturnepublicsignature',
'contractcard'
'contractcard',
'get_sheet_linkable_objects'
],
// Set this to 1 if features of module are opened to external users
'moduleforexternal' => 1,
Expand Down
8 changes: 7 additions & 1 deletion langs/fr_FR/dolimeet.lang
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,13 @@ SessionTrainerResponsibleIdSet = Responsable du dispensateur de formation
DocumentLocation = Lieu affiché sur les documents
DocumentLocationDesc = Enregistre le lieu qui sera affiché sur les documents (Fait à : xxxx)
DocumentLocationSet = Lieu enregistré
DocumentLocation
DocumentLocation = Lieu de signature des documents
LinkDolimeet_trainsess = Activer le lien avec les sessions de formation
LinkDolimeet_trainsessDescription = Permet la liaison entre les sessions de formations et les modèles de contrôle
SatisfactionSurvey = Enquête de satisfaction
SatisfactionSurveyDesc = Définit le modèle de contrôle utilisé par défaut pour les enquêtes de satisfaction



# Attendant role - Rôle participant
SessionTrainer = Formateur
Expand Down
12 changes: 12 additions & 0 deletions view/session/session_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@
saturne_get_fiche_head($object, 'card', $title);
saturne_banner_tab($object, 'ref', $linkback);

if ($object->fk_contrat > 0) {
$contract->fetch($object->fk_contrat);
}

$formconfirm = '';

// setDraft confirmation
Expand Down Expand Up @@ -543,6 +547,14 @@
print '</td></tr>';
}

if ($objectType == 'trainingsession' && isModEnabled('digiquali') && $object->fk_contrat > 0) {
$contract->fetchObjectLinked('digiquali_control', '');

print '<tr><td class="valignmiddle">' . $langs->trans('SatisfactionSurvey') . '</td><td>';
print '<a onclick="preventDefault()" target="_blank" href="../../../digiquali/view/control/control_card?action=create&fromtype=contrat&fromid='. $object->fk_contrat .'&fk_sheet='. $conf->global->DOLIMEET_SATISFACTION_SURVEY_SHEET .'"><button class="butAction">' . $langs->trans('Create') . '</button></a>';
print '</td></tr>';
}

// Other attributes. Fields from hook formObjectOptions and Extrafields.
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';

Expand Down

0 comments on commit 3a1bded

Please sign in to comment.