Skip to content

Commit

Permalink
Evarisk#3211 [Document] fix: better display and attendant
Browse files Browse the repository at this point in the history
  • Loading branch information
evarisk-micka committed Dec 21, 2023
1 parent 91d0f5b commit 517b5e9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public function RiskAssessmentDocumentFillJSON()
{
global $conf, $user;

$json = array();
$json = [];
$now = dol_now();

if (!isset($conf->global->DIGIRISKDOLIBARR_RISKASSESSMENTDOCUMENT_AUDIT_START_DATE) || dol_strlen($conf->global->DIGIRISKDOLIBARR_RISKASSESSMENTDOCUMENT_AUDIT_START_DATE) < 1) {
dolibarr_set_const($this->db, 'DIGIRISKDOLIBARR_RISKASSESSMENTDOCUMENT_AUDIT_START_DATE', dol_now(), 'chaine', 0, '', $conf->entity);
Expand All @@ -78,7 +79,7 @@ public function RiskAssessmentDocumentFillJSON()
$json['RiskAssessmentDocument']['nomEntreprise'] = $conf->global->MAIN_INFO_SOCIETE_NOM;
$json['RiskAssessmentDocument']['dateAudit'] = dol_print_date($conf->global->DIGIRISKDOLIBARR_RISKASSESSMENTDOCUMENT_AUDIT_START_DATE, '%d/%m/%Y', 'tzuser') . ' - ' . dol_print_date($conf->global->DIGIRISKDOLIBARR_RISKASSESSMENTDOCUMENT_AUDIT_END_DATE, '%d/%m/%Y', 'tzuser');
$json['RiskAssessmentDocument']['emetteurDUER'] = $user->lastname . ' ' . $user->firstname;
$json['RiskAssessmentDocument']['dateGeneration'] = dol_print_date(strtotime($this->date_creation), '%d/%m/%Y %H:%M:%S', 'tzuser');
$json['RiskAssessmentDocument']['dateGeneration'] = dol_print_date($now, '%d/%m/%Y %H:%M:%S', 'tzuser');

if ($conf->global->DIGIRISKDOLIBARR_RISKASSESSMENTDOCUMENT_RECIPIENT > 0) {
$user->fetch($conf->global->DIGIRISKDOLIBARR_RISKASSESSMENTDOCUMENT_RECIPIENT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,9 @@ public function info(Translate $langs): string
*/
public function setTaskSegment(Odf $odfHandler, Translate $outputLangs, array $moreParam)
{
global $langs;

// Get tasks.
$foundTagForLines = 1;
$tmpArray = [];
$now = dol_now();
$taskType = $moreParam['task_type'];
try {
$listLines = $odfHandler->setSegment($taskType);
Expand All @@ -119,21 +116,17 @@ public function setTaskSegment(Odf $odfHandler, Translate $outputLangs, array $m
$tmpArray[$taskType . '_ref'] = $actionTask->ref;
$tmpArray[$taskType . '_label'] = $actionTask->label;
$tmpArray[$taskType . '_description'] = $actionTask->description;

$delay = $actionTask->datee > 0 ? round(($actionTask->datee - $now) / 60 / 60 / 24) : 0;
$delay .= ' ' . ($delay > 1 ? $langs->trans('Days') : $langs->trans('Day'));

$tmpArray[$taskType . '_resp'] = dol_strtoupper($taskExecutive[0]['lastname']) . ' ' . ucfirst($taskExecutive[0]['firstname']);
$tmpArray[$taskType . '_delay'] = $delay;
$tmpArray[$taskType . '_budget'] = price($actionTask->budget_amount, 0, '', 1, -1, -1, 'auto');
$tmpArray[$taskType . '_resp'] = dol_strtoupper($taskExecutive[0]['lastname']) . ' ' . ucfirst($taskExecutive[0]['firstname']);
$tmpArray[$taskType . '_end_date'] = dol_print_date($actionTask->datee, 'dayhour', 'tzuser');
$tmpArray[$taskType . '_budget'] = price($actionTask->budget_amount, 0, '', 1, -1, -1, 'auto');
$this->setTmpArrayVars($tmpArray, $listLines, $outputLangs);
}
} else {
$tmpArray[$taskType . '_ref'] = '';
$tmpArray[$taskType . '_label'] = '';
$tmpArray[$taskType . '_description'] = '';
$tmpArray[$taskType . '_resp'] = '';
$tmpArray[$taskType . '_delay'] = '';
$tmpArray[$taskType . '_end_date'] = '';
$tmpArray[$taskType . '_budget'] = '';
$this->setTmpArrayVars($tmpArray, $listLines, $outputLangs);
}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 517b5e9

Please sign in to comment.