New functionality for add cronjob (#28282)

This commit is contained in:
lamrani abdelwadoud
2024-02-20 00:44:09 +01:00
committed by GitHub
parent 009c93f75a
commit 2c8a2e5f61
3 changed files with 18 additions and 3 deletions

View File

@@ -133,7 +133,20 @@ class modProjet extends DolibarrModules
3=>array('file'=>'box_validated_projects.php', 'enabledbydefaulton'=>'Home'), // task without timespent
4=>array('file'=>'box_funnel_of_prospection.php', 'enabledbydefaulton'=>'Home'),
);
// Cronjobs
$this->cronjobs[] = array(
'label' => 'WeeklyWorkingHoursReport',
'jobtype' => 'method',
'class' => 'projet/class/project.class.php',
'objectname' => 'Project',
'method' => 'createWeeklyReport',
'parameters' => '',
'comment' => 'Generates and sends a weekly report on time worked',
'frequency' => 1,
'unitfrequency' => 86400 * 7,
'status' => 0,
'test' => '$conf->projet->enabled',
);
// Permissions
$this->rights = array();
$this->rights_class = 'projet';

View File

@@ -144,7 +144,9 @@ if ($action == 'add' && $permissiontoadd) {
$object->frequency = GETPOSTINT('nbfrequency');
$object->maxrun = GETPOSTINT('maxrun');
$object->email_alert = GETPOST('email_alert');
$object->status = 0;
$object->processing = 0;
$object->lastresult = '';
// Add cron task
$result = $object->create($user);

View File

@@ -1241,7 +1241,7 @@ class Task extends CommonObjectLine
$sql .= " WHERE pt.rowid = ec.element_id";
}
if ($userp && $filteronprojstatus > -1) {
$sql .= " AND p.fk_statut = ".((int) $filteronprojstatus);
$sql .= " AND pt.fk_statut = ".((int) $filteronprojstatus);
}
if ($usert && $filteronprojstatus > -1) {
$sql .= " AND pt.fk_projet = p.rowid AND p.fk_statut = ".((int) $filteronprojstatus);