Skip to content

Commit

Permalink
Evarisk#4026 [Mod] add: setValueFrom + transnotentities + PSR12
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-francois committed Jul 26, 2024
1 parent 00eb6b5 commit 9619290
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
24 changes: 11 additions & 13 deletions core/modules/modDigiriskDolibarr.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2205,34 +2205,32 @@ public function init($options = '')

dolibarr_set_const($this->db, 'DIGIRISKDOLIBARR_THIRDPARTY_UPDATED', 2, 'integer', 0, '', $conf->entity);
}
if ( $conf->global->DIGIRISKDOLIBARR_THIRDPARTY_UPDATED == 2 ) {
if (getDolGlobalInt('DIGIRISKDOLIBARR_THIRDPARTY_UPDATED') == 2) {
require_once __DIR__ . '/../../../saturne/class/saturneschedules.class.php';

$labourDoctorID = $resources->fetchDigiriskResource('LabourDoctorSociety');
$societe->fetch($labourDoctorID);
$societe->name = $langs->trans('LabourDoctorNameFull') . ' - ' . $conf->global->MAIN_INFO_SOCIETE_NOM;
$result = $societe->update(0, $user);
$result = $societe->setValueFrom('nom', $langs->transnoentities('LabourDoctorNameFull') . ' - ' . getDolGlobalString('MAIN_INFO_SOCIETE_NOM'));

if ($result >= 0) {
$schedule = new SaturneSchedules($this->db);
$schedule = new SaturneSchedules($this->db);
$schedule->element_id = $labourDoctorID;

$schedule->monday = $langs->trans('weekDayDefault');
$schedule->tuesday = $langs->trans('weekDayDefault');
$schedule->wednesday = $langs->trans('weekDayDefault');
$schedule->thursday = $langs->trans('weekDayDefault');
$schedule->friday = $langs->trans('weekDayDefault');
$schedule->saturday = $langs->trans('weekEndDefault');
$schedule->sunday = $langs->trans('weekEndDefault');
$schedule->monday = $langs->transnoentities('weekDayDefault');
$schedule->tuesday = $langs->transnoentities('weekDayDefault');
$schedule->wednesday = $langs->transnoentities('weekDayDefault');
$schedule->thursday = $langs->transnoentities('weekDayDefault');
$schedule->friday = $langs->transnoentities('weekDayDefault');
$schedule->saturday = $langs->transnoentities('weekEndDefault');
$schedule->sunday = $langs->transnoentities('weekEndDefault');

$schedule->element_type = 'societe';
$schedule->tms = dol_now('tzuser');
$schedule->status = 1;

$schedule->create($user);
}

dolibarr_set_const($this->db, 'DIGIRISKDOLIBARR_THIRDPARTY_SET', 3, 'integer', 0, '', $conf->entity);
dolibarr_set_const($this->db, 'DIGIRISKDOLIBARR_THIRDPARTY_UPDATED', 3, 'integer', 0, '', $conf->entity);
}

// Create extrafields during init
Expand Down
11 changes: 2 additions & 9 deletions langs/fr_FR/digiriskdolibarr.lang
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ LabourInspectorSociety = Tiers Inspecteur du travail
LabourInspectorAssigned = Inspecteur du travail

SocieteSchedules = Horaires de la société

weekDayDefault = Cf-Site Internet
weekEndDefault = Fermé Fermé

#
# DigriskDocuments - Documents Digirisk
Expand Down Expand Up @@ -1495,11 +1496,3 @@ ManuelInputNBWorkedHours = Saisir manuellement le nombre d'heures tra
ManuelInputNBWorkedHoursDescription = Si l'option est activée, vous pouvez saisir manuellement le nombre d'heures travaillées dans la configuration de la société.<br>Sinon le nombre d'heures travaillées est calculé.<br>Consulter la documentation pour plus d'informations.
HowToConfigureSetupConf = Pour configurer les donnés de la société lié à Digirisk,<br>veuillez vous rendre sur Digirisk - Configuration - Réglages
LabourDoctorNameFull = Association des Médecins

#
# Schedules - horaires
#

# Data - Donnée
weekDayDefault = Cf-Site Internet
weekEndDefault = Fermé Fermé

0 comments on commit 9619290

Please sign in to comment.