Skip to content

Commit

Permalink
Merge pull request #607 from Evarisk/develop
Browse files Browse the repository at this point in the history
1.5.1
  • Loading branch information
nicolas-eoxia authored Sep 18, 2024
2 parents 5b84f45 + 40dd0f5 commit 8fa91a7
Show file tree
Hide file tree
Showing 16 changed files with 3,067 additions and 2,153 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
## Informations

- Numéro du module : 436310
- Dernière mise à jour : 22/12/2023
- Dernière mise à jour : 18/09/2024
- Éditeur : [Evarisk](https://evarisk.com)
- Thème : Eldy Menu
- Licence : GPLv3
- Disponible sur : Windows - MacOS - Linux

### Version

- Version : 1.5.0
- Version : 1.5.1
- PHP : 7.4.33
- Compatibilité : Dolibarr 16.0.0 - 18.0.4
- Saturne Framework : 1.2.1
- Compatibilité : Dolibarr 18.0.0 - 20.0.0
- Saturne Framework : 1.6.1

## Liens

Expand Down
30 changes: 16 additions & 14 deletions class/actions_dolisirh.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ class ActionsDoliSIRH
*/
public $results = array();

/**
* @var string String displayed by executeHook() immediately after return
*/
public $resprints;
/**
* @var string|null String displayed by executeHook() immediately after return
*/
public ?string $resprints;

/**
* Constructor
Expand Down Expand Up @@ -474,7 +474,7 @@ function getDiffTimestampEvent() {
}

if ($parameters['currentcontext'] == 'projectcard') {
if (GETPOST('action') == 'view' || empty(GETPOST('action'))) {
if (GETPOST('action') != 'create') {
global $user;

print '<link rel="stylesheet" type="text/css" href="../custom/saturne/css/saturne.min.css">';
Expand Down Expand Up @@ -1035,26 +1035,28 @@ public function saturneAdminDocumentData(array $parameters): int
}

/**
* Overloading the saturneIndex function : replacing the parent's function with the one below.
* Overloading the saturneIndex function : replacing the parent's function with the one below
*
* @param array $parameters Hook metadata (context, etc...)
* @return void
* @return int 0 < on error, 0 on success, 1 to replace standard code
*/
public function saturneIndex(array $parameters)
public function saturneIndex(array $parameters): int
{
global $conf, $langs;
global $conf, $langs, $moduleName;

if ($parameters['currentcontext'] == 'dolisirhindex') {
if ($conf->global->DOLISIRH_HR_PROJECT_SET == 0) {
$out = '<div class="wpeo-notice notice-info">';
if (strpos($parameters['context'], 'dolisirhindex') !== false) {
if (getDolGlobalInt('DOLISIRH_HR_PROJECT_SET') == 0) {
$out = '<div class="wpeo-notice notice-info">';
$out .= '<div class="notice-content">';
$out .= '<div class="notice-title"><strong>' . $langs->trans('SetupDefaultDataNotCreated') . '</strong></div>';
$out .= '<div class="notice-subtitle"><strong>' . $langs->trans('HowToSetupDefaultData') . ' <a href="admin/setup.php">' . $langs->trans('ConfigDefaultData') . '</a></strong></div>';
$out .= '<div class="notice-title"><strong>' . $langs->trans('SetupDefaultDataNotCreated', $moduleName) . '</strong></div>';
$out .= '<div class="notice-subtitle"><strong>' . $langs->trans('HowToSetupDefaultData', $moduleName) . ' <a href="admin/setup.php">' . $langs->trans('ConfigDefaultData', $moduleName) . '</a></strong></div>';
$out .= '</div>';
$out .= '</div>';

$this->resprints = $out;
}
}

return 0; // or return 1 to replace standard code
}
}
8 changes: 4 additions & 4 deletions class/timesheet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class TimeSheet extends SaturneObject
/**
* @var int Does object support extrafields ? 0 = No, 1 = Yes.
*/
public int $isextrafieldmanaged = 1;
public $isextrafieldmanaged = 1;

/**
* @var string Name of icon for timesheet. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'timesheet@dolisirh' if picto is file 'img/object_timesheet.png'.
Expand Down Expand Up @@ -203,12 +203,12 @@ class TimeSheet extends SaturneObject
/**
* @var int User ID.
*/
public int $fk_user_creat;
public $fk_user_creat;

/**
* @var int|null User ID.
*/
public ?int $fk_user_modif;
public $fk_user_modif;

/**
* @var int|string|null Project ID.
Expand Down Expand Up @@ -393,7 +393,7 @@ class TimeSheetLine extends SaturneObject
/**
* @var int Does object support extrafields ? 0 = No, 1 = Yes.
*/
public int $isextrafieldmanaged = 1;
public $isextrafieldmanaged = 1;

/**
* 'type' field format:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@
*/
class doc_certificatedocument_odt extends SaturneDocumentModel
{
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.5 = array(5, 5)
*/
public $phpmin = [7, 4];

/**
* @var string Dolibarr version of the loaded document.
*/
public string $version = 'dolibarr';

/**
* @var string Module.
*/
Expand Down Expand Up @@ -104,9 +93,9 @@ public function write_file(SaturneDocuments $objectDocument, Translate $outputLa
$tmpArray['object_date_end'] = dol_print_date($object->date_end, 'day', 'tzuser');
$tmpArray['object_public_url'] = $object->public_url;

$signatory = $signatory->fetchSignatory('Signatory', $object->id, $object->element);
if (is_array($signatory) && !empty($signatory)) {
$signatory = array_shift($signatory);
$signatories = $signatory->fetchSignatory('Signatory', $object->id, $object->element);
if (is_array($signatories) && !empty($signatories)) {
$signatory = array_shift($signatories);
$tmpArray['attendant_fullname'] = strtoupper($signatory->lastname) . ' ' . ucfirst($signatory->firstname);
if (dol_strlen($signatory->signature) > 0 && $signatory->signature != $langs->transnoentities('FileGenerated')) {
if ($moreParam['specimen'] == 0 || ($moreParam['specimen'] == 1 && $conf->global->DOLISIRH_SHOW_SIGNATURE_SPECIMEN == 1)) {
Expand All @@ -126,9 +115,9 @@ public function write_file(SaturneDocuments $objectDocument, Translate $outputLa
$tmpArray['attendant_signature'] = '';
}

$signatory = $signatory->fetchSignatory('Responsible', $object->id, $object->element);
if (is_array($signatory) && !empty($signatory)) {
$signatory = array_shift($signatory);
$signatories = $signatory->fetchSignatory('Responsible', $object->id, $object->element);
if (is_array($signatories) && !empty($signatories)) {
$signatory = array_shift($signatories);
if (dol_strlen($signatory->signature) > 0 && $signatory->signature != $langs->transnoentities('FileGenerated')) {
if ($moreParam['specimen'] == 0 || ($moreParam['specimen'] == 1 && $conf->global->DOLISIRH_SHOW_SIGNATURE_SPECIMEN == 1)) {
$tempDir = $conf->dolisirh->multidir_output[$object->entity ?? 1] . '/temp/';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@
*/
class doc_projectdocument_odt extends SaturneDocumentModel
{
/**
* @var array Minimum version of PHP required by module.
* e.g.: PHP ≥ 5.5 = array(5, 5)
*/
public $phpmin = [7, 4];

/**
* @var string Dolibarr version of the loaded document.
*/
public string $version = 'dolibarr';

/**
* @var string Module.
*/
Expand Down Expand Up @@ -126,7 +115,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('projectUsers');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template.
$foundTagForLines = 0;
$listLines = '';
Expand All @@ -144,7 +133,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$allTimespentUser = 0;
foreach ($allTasks as $task) {
if ($versionEighteenOrMore) {
$filter = ' AND fk_element = ' . $task->id . ' AND ptt.elementtype = "task" AND fk_user = ' . $contact['id'];
$filter = ' AND fk_element = ' . $task->id . ' AND elementtype = "task" AND fk_user = ' . $contact['id'];
} else {
$filter = ' AND fk_element = ' . $task->id . ' AND fk_user = ' . $contact['id'];
}
Expand Down Expand Up @@ -172,7 +161,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('projectTasks');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template.
$foundTagForLines = 0;
$listLines = '';
Expand Down Expand Up @@ -204,7 +193,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('projectTaskTimespents');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template.
$foundTagForLines = 0;
$listLines = '';
Expand All @@ -218,7 +207,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
if (is_array($allTasks) && !empty($allTasks)) {
foreach ($allTasks as $task) {
if ($versionEighteenOrMore) {
$filter = ' AND fk_element = ' . $task->id . ' AND ptt.elementtype = "task" AND fk_user = ' . $contact['id'];
$filter = ' AND fk_element = ' . $task->id . ' AND elementtype = "task" AND fk_user = ' . $contact['id'];
} else {
$filter = ' AND fk_element = ' . $task->id . ' AND fk_user = ' . $contact['id'];
}
Expand Down Expand Up @@ -250,7 +239,7 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$foundTagForLines = 1;
try {
$listLines = $odfHandler->setSegment('projectExtrafields');
} catch (OdfException $e) {
} catch (OdfException|OdfExceptionSegmentNotFound $e) {
// We may arrive here if tags for lines not present into template.
$foundTagForLines = 0;
$listLines = '';
Expand Down Expand Up @@ -344,9 +333,10 @@ public function write_file(SaturneDocuments $objectDocument, Translate $outputLa
if (is_array($tasksArray) && !empty($tasksArray)) {
$nbTasks = count($tasksArray);
foreach ($tasksArray as $task) {
$task->getSummaryOfTimeSpent();
$totalProgress += $task->progress;
$totalPlannedWorkload += $task->planned_workload;
$totalConsumedTime += $task->duration;
$totalConsumedTime += $task->timespent_total_duration;
}
$tmpArray['project_progress'] = (($totalProgress) ? price2num($totalProgress / $nbTasks, 2) . ' %' : '0 %');
$tmpArray['project_status'] = $object->getLibStatut();
Expand Down

This file was deleted.

Loading

0 comments on commit 8fa91a7

Please sign in to comment.