Skip to content

Commit

Permalink
#288 [Hook] add: moreHtmlStatus hook for add warning contract
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-eoxia committed Mar 28, 2023
1 parent 208ba93 commit d94d674
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 39 deletions.
37 changes: 37 additions & 0 deletions class/actions_dolimeet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,41 @@ public function saturneBannerTab(array $parameters, CommonObject $object): int

return 0; // or return 1 to replace standard code
}

/**
* Overloading the saturneBannerTab function : replacing the parent's function with the one below
*
* @param array $parameters Hook metadatas (context, etc...)
* @param CommonObject $object Current object
* @return int 0 < on error, 0 on success, 1 to replace standard code
*/
public function moreHtmlStatus(array $parameters, CommonObject $object): int
{
global $langs;

// Do something only for the current context
if ($parameters['currentcontext'] == 'contractcard') {
if (isModEnabled('contrat')) {
$error = 0;
$contactInternalSessionTrainerArray = $object->liste_contact(-1, 'internal', 0, 'SESSIONTRAINER');
$contactInternalTraineeArray = $object->liste_contact(-1, 'internal', 0, 'TRAINEE');
$contactExternalSessionTrainerArray = $object->liste_contact(-1, 'external', 0, 'SESSIONTRAINER');
$contactExternalTraineeArray = $object->liste_contact(-1, 'external', 0, 'TRAINEE');

if ((is_array($contactInternalSessionTrainerArray) && empty($contactInternalSessionTrainerArray)) && (is_array($contactExternalSessionTrainerArray) && empty($contactExternalSessionTrainerArray))) {
$error++;
}
if ((is_array($contactInternalTraineeArray) && empty($contactInternalTraineeArray)) && (is_array($contactExternalTraineeArray) && empty($contactExternalTraineeArray))) {
$error++;
}

if ($object->array_options['options_trainingsession_type'] <= 0 || $error > 0) {
$moreHtmlStatus = '<br><br><div><i class="fas fa-2x fa-exclamation-triangle pictowarning"></i> ' . $langs->trans('DontForgotAddSessionTrainerAndTrainee') . '</div>';
$this->resprints = $moreHtmlStatus;
}
}
}

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 @@ -126,7 +126,8 @@ public function __construct($db)
'admincompany',
'saturneglobal',
'sessioncard',
'saturnepublicsignature'
'saturnepublicsignature',
'contractcard'
],
// Set this to 1 if features of module are opened to external users
'moduleforexternal' => 1,
Expand Down
39 changes: 20 additions & 19 deletions langs/en_US/dolimeet.lang
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,26 @@ Responsible = Responsable
#

# Data
TrainingSession = Training session
Trainingsession = Training session
Trainingsessions = training sessions
TheTrainingsession = the training session
TrainingsessionList = List of training sessions
TrainingSessionList = List of training sessions
TrainingSessionCreate = Create a training session
Contract = Contract
NewTrainingsession = New training session
ModifyTrainingsession = Modify a training session
TrainingSessionStart = Start date of the training
TrainingSessionEnd = End date of the training
ActionFormation = Training action
ActionFormationApprentissage = Apprenticeship training action
ActionVAE = VAE action
BilanCompetences = Skills assessment
TrainingSessionType = Type of training
TrainingSessionLocation = Location of the training
TrainingsessionsCategoriesArea = Trainingsession tags/categories area
TrainingSession = Training session
Trainingsession = Training session
Trainingsessions = training sessions
TheTrainingsession = the training session
TrainingsessionList = List of training sessions
TrainingSessionList = List of training sessions
TrainingSessionCreate = Create a training session
Contract = Contract
NewTrainingsession = New training session
ModifyTrainingsession = Modify a training session
TrainingSessionStart = Start date of the training
TrainingSessionEnd = End date of the training
ActionFormation = Training action
ActionFormationApprentissage = Apprenticeship training action
ActionVAE = VAE action
BilanCompetences = Skills assessment
TrainingSessionType = Type of training
TrainingSessionLocation = Location of the training
TrainingsessionsCategoriesArea = Trainingsession tags/categories area
DontForgotAddSessionTrainerAndTrainee = Remember to add at least one trainer and one trainee to the training contract.

# Attendant role
SessionTrainer = Trainer
Expand Down
39 changes: 20 additions & 19 deletions langs/fr_FR/dolimeet.lang
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,26 @@ Responsible = Responsable
#

# Data - Donnée
TrainingSession = Session de formation
Trainingsession = Session de formation
Trainingsessions = sessions de formation
TheTrainingsession = la session de formation
TrainingsessionList = Liste des sessions de formation
TrainingSessionList = Liste des sessions de formation
TrainingSessionCreate = Créer une session de formation
Contract = Contrat
NewTrainingsession = Nouvelle session de formation
ModifyTrainingsession = Modifier une session de formation
TrainingSessionStart = Date de début de la formation
TrainingSessionEnd = Date de fin de la formation
ActionFormation = Action de formation
ActionFormationApprentissage = Action de formation par apprentissage
ActionVAE = Action de VAE
BilanCompetences = Bilan de compétences
TrainingSessionType = Type de formation
TrainingSessionLocation = Lieu de la formation
TrainingsessionsCategoriesArea = Espace des tags/catégories des sessions de formations
TrainingSession = Session de formation
Trainingsession = Session de formation
Trainingsessions = sessions de formation
TheTrainingsession = la session de formation
TrainingsessionList = Liste des sessions de formation
TrainingSessionList = Liste des sessions de formation
TrainingSessionCreate = Créer une session de formation
Contract = Contrat
NewTrainingsession = Nouvelle session de formation
ModifyTrainingsession = Modifier une session de formation
TrainingSessionStart = Date de début de la formation
TrainingSessionEnd = Date de fin de la formation
ActionFormation = Action de formation
ActionFormationApprentissage = Action de formation par apprentissage
ActionVAE = Action de VAE
BilanCompetences = Bilan de compétences
TrainingSessionType = Type de formation
TrainingSessionLocation = Lieu de la formation
TrainingsessionsCategoriesArea = Espace des tags/catégories des sessions de formations
DontForgotAddSessionTrainerAndTrainee = N'oubliez pas d'ajouter au moins un formateur et un stagiaire au contrat de formation.

# Attendant role - Rôle participant
SessionTrainer = Formateur
Expand Down

0 comments on commit d94d674

Please sign in to comment.