Skip to content

Commit

Permalink
Merge pull request #560 from Evarisk/develop
Browse files Browse the repository at this point in the history
1.5.0
  • Loading branch information
nicolas-eoxia authored Jan 15, 2024
2 parents d566156 + 5e65391 commit 9653827
Show file tree
Hide file tree
Showing 16 changed files with 398 additions and 279 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
## Informations

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

### Version

- Version : 1.4.0
- Compatibilité : Dolibarr 16.0.0 - 17.0.3
- Saturne Framework : 1.1.2
- Version : 1.5.0
- PHP : 7.4.33
- Compatibilité : Dolibarr 16.0.0 - 18.0.4
- Saturne Framework : 1.2.1

## Liens

Expand Down
238 changes: 44 additions & 194 deletions class/actions_dolisirh.class.php

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions class/timesheet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class TimeSheetLine extends SaturneObject
/**
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public array $fields = [
public $fields = [
'rowid' => ['type' => 'integer', 'label' => 'TechnicalID', 'enabled' => 1, 'position' => 1, 'notnull' => 1, 'visible' => 0, 'noteditable' => 1, 'index' => 1, 'css' => 'left', 'comment' => 'Id'],
'entity' => ['type' => 'integer', 'label' => 'Entity', 'enabled' => 1, 'position' => 5, 'notnull' => 1, 'visible' => 0],
'date_creation' => ['type' => 'datetime', 'label' => 'DateCreation', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 0],
Expand Down Expand Up @@ -475,9 +475,9 @@ class TimeSheetLine extends SaturneObject
public ?int $rang;

/**
* @var string Description.
* @var string|null Description.
*/
public string $description = '';
public ?string $description = '';

/**
* @var int|null Product type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
$contacts = array_merge($contacts, $internalContacts);
}

$versionEighteenOrMore = 0;
if ((float) DOL_VERSION >= 18.0) {
$versionEighteenOrMore = 1;
}

// Replace tags of lines.
try {
// Get project users.
Expand All @@ -138,7 +143,11 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
if (is_array($allTasks) && !empty($allTasks)) {
$allTimespentUser = 0;
foreach ($allTasks as $task) {
$filter = ' AND ptt.fk_task = ' . $task->id . ' AND ptt.fk_user = ' . $contact['id'];
if ($versionEighteenOrMore) {
$filter = ' AND fk_element = ' . $task->id . ' AND ptt.elementtype = "task" AND fk_user = ' . $contact['id'];
} else {
$filter = ' AND fk_element = ' . $task->id . ' AND fk_user = ' . $contact['id'];
}
$timeSpentsUser = $saturneTask->fetchAllTimeSpentAllUsers($filter);
foreach ($timeSpentsUser as $timespent) {
$allTimespentUser += $timespent->timespent_duration;
Expand Down Expand Up @@ -208,7 +217,11 @@ public function fillTagsLines(Odf $odfHandler, Translate $outputLangs, array $mo
foreach ($contacts as $contact) {
if (is_array($allTasks) && !empty($allTasks)) {
foreach ($allTasks as $task) {
$filter = ' AND ptt.fk_task = ' . $task->id . ' AND ptt.fk_user = ' . $contact['id'];
if ($versionEighteenOrMore) {
$filter = ' AND fk_element = ' . $task->id . ' AND ptt.elementtype = "task" AND fk_user = ' . $contact['id'];
} else {
$filter = ' AND fk_element = ' . $task->id . ' AND fk_user = ' . $contact['id'];
}
$timeSpentsUser = $saturneTask->fetchAllTimeSpentAllUsers($filter);
foreach ($timeSpentsUser as $timespent) {
$tmpArray['project_task_timespent_date'] = dol_print_date($timespent->timespent_datehour, (($timespent->timespent_withhour > 0) ? 'dayhour' : 'day'));
Expand Down
60 changes: 30 additions & 30 deletions core/modules/modDoliSIRH.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function __construct($db)
$this->editor_url = 'https://evarisk.com';

// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'.
$this->version = '1.4.0';
$this->version = '1.5.0';

// Url to the file with your last numberversion of this module.
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
Expand Down Expand Up @@ -162,7 +162,7 @@ public function __construct($db)
$this->hidden = false;

// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...).
$this->depends = ['modProjet', 'modBookmark', 'modHoliday', 'modFckeditor', 'modSalaries', 'modProduct', 'modService', 'modSociete', 'modECM', 'modCategorie', 'modSaturne', 'modCron'];
$this->depends = ['modAgenda', 'modProjet', 'modBookmark', 'modHoliday', 'modFckeditor', 'modSalaries', 'modProduct', 'modService', 'modSociete', 'modECM', 'modCategorie', 'modSaturne', 'modCron'];
$this->requiredby = []; // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...).
$this->conflictwith = []; // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...).

Expand Down Expand Up @@ -513,20 +513,20 @@ public function __construct($db)
];

// PROJECT MENU.
$this->menu[$r++] = [
'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=timespent',
'type' => 'left',
'titre' => '<i class="fas fa-id-card pictofixedwidth" style="padding-right: 4px; color: #d35968;"></i>' . $langs->transnoentities('DoliSIRHTimeSpent'),
'mainmenu' => 'project',
'leftmenu' => 'dolisirh_timespent_list',
'url' => '/dolisirh/view/timespent_list.php',
'langs' => 'dolisirh@dolisirh',
'position' => 1000 + $r,
'enabled' => '$conf->dolisirh->enabled && $conf->projet->enabled',
'perms' => '$user->rights->dolisirh->lire && $user->rights->projet->lire',
'target' => '',
'user' => 0,
];
// $this->menu[$r++] = [
// 'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=timespent',
// 'type' => 'left',
// 'titre' => '<i class="fas fa-id-card pictofixedwidth" style="padding-right: 4px; color: #d35968;"></i>' . $langs->transnoentities('DoliSIRHTimeSpent'),
// 'mainmenu' => 'project',
// 'leftmenu' => 'dolisirh_timespent_list',
// 'url' => '/dolisirh/view/timespent_list.php',
// 'langs' => 'dolisirh@dolisirh',
// 'position' => 1000 + $r,
// 'enabled' => '$conf->dolisirh->enabled && $conf->projet->enabled',
// 'perms' => '$user->rights->dolisirh->lire && $user->rights->projet->lire',
// 'target' => '',
// 'user' => 0,
// ];

$this->menu[$r++] = [
'fk_menu' => 'fk_mainmenu=project,fk_leftmenu=timespent',
Expand All @@ -544,20 +544,20 @@ public function __construct($db)
];

// HRM MENU.
$this->menu[$r++] = [
'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=timespent',
'type' => 'left',
'titre' => '<i class="fas fa-id-card pictofixedwidth" style="padding-right: 4px; color: #d35968;"></i>' . $langs->transnoentities('DoliSIRHTimeSpent'),
'mainmenu' => 'hrm',
'leftmenu' => 'dolisirh_timespent_list',
'url' => '/dolisirh/view/timespent_list.php',
'langs' => 'dolisirh@dolisirh',
'position' => 1000 + $r,
'enabled' => '$conf->dolisirh->enabled && $conf->salaries->enabled',
'perms' => '$user->rights->dolisirh->lire && $user->rights->projet->lire',
'target' => '',
'user' => 0,
];
// $this->menu[$r++] = [
// 'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=timespent',
// 'type' => 'left',
// 'titre' => '<i class="fas fa-id-card pictofixedwidth" style="padding-right: 4px; color: #d35968;"></i>' . $langs->transnoentities('DoliSIRHTimeSpent'),
// 'mainmenu' => 'hrm',
// 'leftmenu' => 'dolisirh_timespent_list',
// 'url' => '/dolisirh/view/timespent_list.php',
// 'langs' => 'dolisirh@dolisirh',
// 'position' => 1000 + $r,
// 'enabled' => '$conf->dolisirh->enabled && $conf->salaries->enabled',
// 'perms' => '$user->rights->dolisirh->lire && $user->rights->projet->lire',
// 'target' => '',
// 'user' => 0,
// ];

$this->menu[$r++] = [
'fk_menu' => 'fk_mainmenu=hrm,fk_leftmenu=timespent',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function __construct(DoliDB $db)
$this->name = preg_replace('/^Interface/i', '', get_class($this));
$this->family = 'demo';
$this->description = 'DoliSIRH triggers.';
$this->version = '1.4.0';
$this->version = '1.5.0';
$this->picto = 'dolisirh@dolisirh';
}

Expand Down
Loading

0 comments on commit 9653827

Please sign in to comment.