diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 60855c42d58..d1b8975eaf4 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -42,7 +42,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; */ class Categorie extends CommonObject { - // Categories types + // Categories types (we use string because we want to accept any modules/types in a future) const TYPE_PRODUCT = 'product'; const TYPE_SUPPLIER = 'supplier'; const TYPE_CUSTOMER = 'customer'; @@ -189,15 +189,16 @@ class Categorie extends CommonObject * * @param int $id Id of category * @param string $label Label of category - * @param string $type Type of category + * @param string $type Type of category ('product', '...') or (0, 1, ...) * @return int <0 if KO, >0 if OK */ - function fetch($id,$label='',$type='') + function fetch($id, $label='', $type=null) { global $conf; // Check parameters if (empty($id) && empty($label)) return -1; + if (! is_numeric($type)) $type=$this->MAP_ID[$type]; $sql = "SELECT rowid, fk_parent, entity, label, description, color, fk_soc, visible, type"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; @@ -208,7 +209,7 @@ class Categorie extends CommonObject else { $sql.= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")"; - if ($type) $sql.= " AND type = '".$this->db->escape($type)."'"; + if (! is_null($type)) $sql.= " AND type = ".$this->db->escape($type); } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -265,6 +266,10 @@ class Categorie extends CommonObject global $conf,$langs,$hookmanager; $langs->load('categories'); + $type=$this->type; + + if (! is_numeric($type)) $type=$this->MAP_ID[$type]; + $error=0; dol_syslog(get_class($this).'::create', LOG_DEBUG); @@ -310,7 +315,7 @@ class Categorie extends CommonObject $sql.= ($this->socid != -1 ? $this->socid : 'null').","; } $sql.= "'".$this->visible."',"; - $sql.= $this->type.","; + $sql.= $type.","; $sql.= (! empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":'null').","; $sql.= $conf->entity; $sql.= ")"; @@ -629,12 +634,11 @@ class Categorie extends CommonObject /** * Link an object to the category * - * @param CommonObject $obj Object to link to category - * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') - * - * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked + * @param CommonObject $obj Object to link to category + * @param string $type Type of category ('product', ...) + * @return int 1 : OK, -1 : erreur SQL, -2 : id not defined, -3 : Already linked */ - function add_type($obj,$type) + function add_type($obj, $type) { global $user,$langs,$conf; @@ -851,13 +855,12 @@ class Categorie extends CommonObject /** * Check for the presence of an object in a category * - * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') - * @param int $object_id id of the object to search - * - * @return int number of occurrences + * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') + * @param int $object_id Id of the object to search + * @return int Number of occurrences * @see getObjectsInCateg */ - function containsObject($type, $object_id ) + function containsObject($type, $object_id) { $sql = "SELECT COUNT(*) as nb FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type]; $sql .= " WHERE fk_categorie = " . $this->id . " AND fk_" . $this->MAP_CAT_FK[$type] . " = " . $object_id; @@ -944,24 +947,16 @@ class Categorie extends CommonObject * fulllabel = nom avec chemin complet de la categorie * fullpath = chemin complet compose des id * - * @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member'). - * Old mode (0, 1, 2, ...) is deprecated. - * @param int $markafterid Removed all categories including the leaf $markafterid in category tree. + * @param string $type Type of categories ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...). + * @param int $markafterid Removed all categories including the leaf $markafterid in category tree. * - * @return array Array of categories. this->cats and this->motherof are set. + * @return array Array of categories. this->cats and this->motherof are set. */ function get_full_arbo($type, $markafterid=0) { global $conf, $langs; - // For backward compatibility - if (is_numeric($type)) - { - // We want to reverse lookup - $map_type = array_flip($this->MAP_ID); - $type = $map_type[$type]; - dol_syslog( get_class( $this ) . "::get_full_arbo(): numeric types are deprecated, please use string instead", LOG_WARNING); - } + if (! is_numeric($type)) $type = $this->MAP_ID[$type]; $this->cats = array(); @@ -975,7 +970,7 @@ class Categorie extends CommonObject $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c"; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; $sql .= " WHERE c.entity IN (" . getEntity( 'category', 1 ) . ")"; - $sql .= " AND c.type = " . $this->MAP_ID[$type]; + $sql .= " AND c.type = " . $type; dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1099,7 +1094,7 @@ class Categorie extends CommonObject /** * Returns all categories * - * @param int $type Type of category + * @param int $type Type of category (0, 1, ...) * @param boolean $parent Just parent categories if true * @return array Table of Object Category */ @@ -1162,13 +1157,17 @@ class Categorie extends CommonObject */ function already_exists() { + $type=$this->type; + + if (! is_numeric($type)) $type=$this->MAP_ID[$type]; + /* We have to select any rowid from llx_categorie which category's mother and label * are equals to those of the calling category */ $sql = "SELECT c.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c "; $sql.= " WHERE c.entity IN (".getEntity('category').")"; - $sql.= " AND c.type = ".$this->type; + $sql.= " AND c.type = ".$type; $sql.= " AND c.fk_parent = ".$this->fk_parent; $sql.= " AND c.label = '".$this->db->escape($this->label)."'"; @@ -1203,7 +1202,7 @@ class Categorie extends CommonObject /** * Returns the top level categories (which are not girls) * - * @param int $type Type of category + * @param int $type Type of category (0, 1, ...) * @return array */ function get_main_categories($type=null) @@ -1341,24 +1340,17 @@ class Categorie extends CommonObject * Return list of categories (object instances or labels) linked to element of id $id and type $type * Should be named getListOfCategForObject * - * @param int $id Id of element - * @param string $type Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated. - * @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category - * labels, 'id'= Get array of category IDs - * @return mixed Array of category objects or < 0 if KO + * @param int $id Id of element + * @param int $type Type of category ('customer', 'supplier', 'contact', 'product', 'member') or (0, 1, 2, ...) + * @param string $mode 'id'=Get array of category ids, 'object'=Get array of fetched category instances, 'label'=Get array of category + * labels, 'id'= Get array of category IDs + * @return mixed Array of category objects or < 0 if KO */ function containing($id, $type, $mode='object') { $cats = array(); - // For backward compatibility - if (is_numeric($type)) - { - dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING); - // We want to reverse lookup - $map_type = array_flip($this->MAP_ID); - $type = $map_type[$type]; - } + if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; if ($type == Categorie::TYPE_BANK_LINE) // TODO Remove this with standard category code { diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index d38ea012c3c..3a072f946be 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1311,7 +1311,7 @@ else print ''; print '
'; print $langs->trans('RIB'); print ''; - if (($action != 'editbankaccount') && $user->rights->commande->creer && ! empty($object->brouillon)) + if (($action != 'editbankaccount') && $user->rights->facture->creer && ! empty($object->brouillon)) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; print ''; diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index a371069d7cf..dce56ff5468 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -380,7 +380,7 @@ if (($action=="create") || ($action=="edit")) print ''; print $langs->trans('CronArgs').""; - print "params."\" /> "; + print "params."\" /> "; print ""; print ""; print $form->textwithpicto('',$langs->trans("CronArgsHelp"),1,'help'); @@ -408,10 +408,10 @@ if (($action=="create") || ($action=="edit")) print ''; print $langs->trans('CronEvery').""; print ""; - print "'; + for ($i=1; $i<=60; $i++) { - if (! empty($object->unitfrequency) && ($object->frequency/$object->unitfrequency) == $i) + if ($object->frequency == $i) { print ""; } diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index f9b4ac67f03..b7de98b0c1c 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013 Florian Henry + * Copyright (C) 2013 Florian Henry * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,7 +61,7 @@ class Cronjob extends CommonObject public $fk_user_mod; public $nbrun; public $libname; - + public $test; // A test condition to know if job is visible/qualified /** * Constructor @@ -194,12 +194,12 @@ class Cronjob extends CommonObject $sql.= " ".(! isset($this->md5params)?'NULL':"'".$this->db->escape($this->md5params)."'").","; $sql.= " ".(! isset($this->module_name)?'NULL':"'".$this->db->escape($this->module_name)."'").","; $sql.= " ".(! isset($this->priority)?'0':$this->priority).","; - $sql.= " ".(! isset($this->datelastrun) || dol_strlen($this->datelastrun)==0?'NULL':$this->db->idate($this->datelastrun)).","; - $sql.= " ".(! isset($this->datenextrun) || dol_strlen($this->datenextrun)==0?'NULL':$this->db->idate($this->datenextrun)).","; - $sql.= " ".(! isset($this->dateend) || dol_strlen($this->dateend)==0?'NULL':$this->db->idate($this->dateend)).","; - $sql.= " ".(! isset($this->datestart) || dol_strlen($this->datestart)==0?'NULL':$this->db->idate($this->datestart)).","; + $sql.= " ".(! isset($this->datelastrun) || dol_strlen($this->datelastrun)==0?'NULL':"'".$this->db->idate($this->datelastrun)."'").","; + $sql.= " ".(! isset($this->datenextrun) || dol_strlen($this->datenextrun)==0?'NULL':"'".$this->db->idate($this->datenextrun)."'").","; + $sql.= " ".(! isset($this->dateend) || dol_strlen($this->dateend)==0?'NULL':"'".$this->db->idate($this->dateend)."'").","; + $sql.= " ".(! isset($this->datestart) || dol_strlen($this->datestart)==0?'NULL':"'".$this->db->idate($this->datestart)."'").","; $sql.= " ".(! isset($this->lastresult)?'NULL':"'".$this->db->escape($this->lastresult)."'").","; - $sql.= " ".(! isset($this->datelastresult) || dol_strlen($this->datelastresult)==0?'NULL':$this->db->idate($this->datelastresult)).","; + $sql.= " ".(! isset($this->datelastresult) || dol_strlen($this->datelastresult)==0?'NULL':"'".$this->db->idate($this->datelastresult)."'").","; $sql.= " ".(! isset($this->lastoutput)?'NULL':"'".$this->db->escape($this->lastoutput)."'").","; $sql.= " ".(! isset($this->unitfrequency)?'NULL':"'".$this->unitfrequency."'").","; $sql.= " ".(! isset($this->frequency)?'0':$this->frequency).","; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index 913da57ac39..e00ac9dcc71 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/cron/cron/list.php + * \file htdocs/cron/list.php * \ingroup cron * \brief Lists Jobs */ @@ -356,11 +356,7 @@ if ($num > 0) if (! verifCond($obj->test)) continue; // Discard line with test = false - // title profil - if ($style=='pair') {$style='impair';} - else {$style='pair';} - - print ''; + print ''; print ''; print ''; diff --git a/htdocs/langs/en_US/cron.lang b/htdocs/langs/en_US/cron.lang index 8eb03114c64..78a4ea789f8 100644 --- a/htdocs/langs/en_US/cron.lang +++ b/htdocs/langs/en_US/cron.lang @@ -14,6 +14,8 @@ FileToLaunchCronJobs=Command line to launch cron jobs CronExplainHowToRunUnix=On Unix environment you should use the following crontab entry to run the command line each 5 minutes CronExplainHowToRunWin=On Microsoft(tm) Windows environement you can use Scheduled task tools to run the command line each 5 minutes CronMethodDoesNotExists=Class %s does not contains any method %s +CronJobDefDesc=Cron job profiles are defined into the module descriptor file. When module is activated, they are loaded and available so you can administer the jobs from the admin tools menu %s. +CronJobProfiles=List of predefined cron job profiles # Menu EnabledAndDisabled=Enabled and disabled # Page list @@ -53,16 +55,17 @@ CronSaveSucess=Save successfully CronNote=Comment CronFieldMandatory=Fields %s is mandatory CronErrEndDateStartDt=End date cannot be before start date +StatusAtInstall=Status at installation CronStatusActiveBtn=Enable CronStatusInactiveBtn=Disable CronTaskInactive=This job is disabled CronId=Id CronClassFile=Filename with class -CronModuleHelp=Name of Dolibarr module directory (also work with external Dolibarr module).
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for module is product -CronClassFileHelp=The relative path and file name to load (path is relative to web server root directory).
For exemple to call the fetch method of Dolibarr Product object htdocs/product/class/product.class.php, the value for class file name is product/class/product.class.php -CronObjectHelp=The object name to load.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for class file name is Product -CronMethodHelp=The object method to launch.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for method is fecth -CronArgsHelp=The method arguments.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for paramters can be 0, ProductRef +CronModuleHelp=Name of Dolibarr module directory (also work with external Dolibarr module).
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for module is
product +CronClassFileHelp=The relative path and file name to load (path is relative to web server root directory).
For exemple to call the fetch method of Dolibarr Product object htdocs/product/class/product.class.php, the value for class file name is
product/class/product.class.php +CronObjectHelp=The object name to load.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for class file name is
Product +CronMethodHelp=The object method to launch.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for method is
fetch +CronArgsHelp=The method arguments.
For exemple to call the fetch method of Dolibarr Product object /htdocs/product/class/product.class.php, the value for paramters can be
0, ProductRef CronCommandHelp=The system command line to execute. CronCreateJob=Create new Scheduled Job CronFrom=From diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 4298505a18b..06a9b4037d7 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -28,9 +28,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/modulebuilder.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -$langs->load("admin"); -$langs->load("modulebuilder"); -$langs->load("other"); +$langs->loadLangs(array("admin", "modulebuilder", "other", "cron")); $action=GETPOST('action','aZ09'); $confirm=GETPOST('confirm','alpha'); @@ -690,43 +688,24 @@ print load_fiche_titre($text, '', 'title_setup'); $listofmodules=array(); -/* -if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // Entry for Module builder -{ - global $dolibarr_main_document_root_alt; - if (! empty($dolibarr_main_document_root_alt) && is_array($dolibarr_main_document_root_alt)) - { - foreach ($dolibarr_main_document_root_alt as $diralt) - {*/ - $dirsincustom=dol_dir_list($dirins, 'directories'); - - if (is_array($dirsincustom) && count($dirsincustom) > 0) - { - foreach ($dirsincustom as $dircustomcursor) - { - $fullname = $dircustomcursor['fullname']; - if (dol_is_file($fullname.'/'.$FILEFLAG)) - { - // Get real name of module (MyModule instead of mymodule) - $descriptorfiles = dol_dir_list($fullname.'/core/modules/', 'files', 0, 'mod.*\.class\.php$'); - $modulenamewithcase=''; - foreach($descriptorfiles as $descriptorcursor) - { - $modulenamewithcase=preg_replace('/^mod/', '', $descriptorcursor['name']); - $modulenamewithcase=preg_replace('/\.class\.php$/', '', $modulenamewithcase); - } - if ($modulenamewithcase) $listofmodules[$dircustomcursor['name']]=$modulenamewithcase; - //var_dump($listofmodules); - } - } - } -/* } - } - else - { - $newmenu->add('', 'NoGeneratedModuleFound', 0, 0); - }*/ - +$dirsincustom=dol_dir_list($dirins, 'directories'); +if (is_array($dirsincustom) && count($dirsincustom) > 0) { + foreach ($dirsincustom as $dircustomcursor) { + $fullname = $dircustomcursor['fullname']; + if (dol_is_file($fullname . '/' . $FILEFLAG)) { + // Get real name of module (MyModule instead of mymodule) + $descriptorfiles = dol_dir_list($fullname . '/core/modules/', 'files', 0, 'mod.*\.class\.php$'); + $modulenamewithcase = ''; + foreach ($descriptorfiles as $descriptorcursor) { + $modulenamewithcase = preg_replace('/^mod/', '', $descriptorcursor['name']); + $modulenamewithcase = preg_replace('/\.class\.php$/', '', $modulenamewithcase); + } + if ($modulenamewithcase) + $listofmodules[$dircustomcursor['name']] = $modulenamewithcase; + // var_dump($listofmodules); + } + } +} // Show description of content $newdircustom=$dirins; @@ -764,7 +743,6 @@ if ($message) } print $langs->trans("ModuleBuilderDesc3", count($listofmodules), $FILEFLAG).'
'; -//print '
'; // Load module descriptor @@ -930,6 +908,11 @@ elseif (! empty($module)) $head2[$h][2] = 'widgets'; $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=cron&module='.$module; + $head2[$h][1] = $langs->trans("CronList"); + $head2[$h][2] = 'cron'; + $h++; + $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=buildpackage&module='.$module; $head2[$h][1] = $langs->trans("BuildPackage"); $head2[$h][2] = 'buildpackage'; @@ -1560,6 +1543,119 @@ elseif (! empty($module)) } } + if ($tab == 'cron') + { + $pathtofile = $modulelowercase.'/core/modules/mod'.$module.'.class.php'; + + $cronjobs = $moduleobj->cronjobs; + + if ($action != 'editfile' || empty($file)) + { + print $langs->trans("CronJobDefDesc", '
'.$langs->trans('CronList').'').'
'; + print '
'; + + print ' '.$langs->trans("DescriptorFile").' : '.$pathtofile.''; + print ' '.img_picto($langs->trans("Edit"), 'edit').''; + print '
'; + + print '
'; + print load_fiche_titre($langs->trans("CronJobProfiles"), '', ''); + + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + + print '
'; + print ''; + + print ''; + print_liste_field_titre($langs->trans("CronLabel"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("CronTask"),'','',"",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("CronFrequency"),'',"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("StatusAtInstall"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Comment"),$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); + print "\n"; + + foreach ($cronjobs as $cron) + { + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + } + + print '
'; + print $cron['label']; + print ''; + if ($cron['jobtype']=='method') + { + $text=$langs->trans("CronClass"); + $texttoshow=$langs->trans('CronModule').': '.$module.'
'; + $texttoshow.=$langs->trans('CronClass').': '. $cron['class'].'
'; + $texttoshow.=$langs->trans('CronObject').': '. $cron['objectname'].'
'; + $texttoshow.=$langs->trans('CronMethod').': '. $cron['method']; + $texttoshow.='
'.$langs->trans('CronArgs').': '. $cron['parameters']; + $texttoshow.='
'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); + } + elseif ($cron['jobtype']=='command') + { + $text=$langs->trans('CronCommand'); + $texttoshow=$langs->trans('CronCommand').': '.dol_trunc($cron['command']); + $texttoshow.='
'.$langs->trans('CronArgs').': '. $cron['parameters']; + $texttoshow.='
'.$langs->trans('Comment').': '. $langs->trans($cron['comment']); + } + print $form->textwithpicto($text, $texttoshow, 1); + print '
'; + if($cron['unitfrequency'] == "60") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Minutes'); + if($cron['unitfrequency'] == "3600") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Hours'); + if($cron['unitfrequency'] == "86400") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Days'); + if($cron['unitfrequency'] == "604800") print $langs->trans('CronEach')." ".($cron['frequency'])." ".$langs->trans('Weeks'); + print ''; + print $cron['status']; + print ''; + if (!empty($cron['comment'])) {print $cron['comment'];} + print '
'; + print '
'; + } + else + { + $fullpathoffile=dol_buildpath($file, 0); + + $content = file_get_contents($fullpathoffile); + + // New module + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $doleditor=new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format','aZ09')?GETPOST('format','aZ09'):'html')); + print '
'; + print '
'; + print ''; + print '   '; + print ''; + print '
'; + + print '
'; + } + } + if ($tab == 'buildpackage') { if (! class_exists('ZipArchive') && ! defined('ODTPHP_PATHTOPCLZIP')) diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 6d9054af60b..5ee59c10f90 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -186,12 +186,13 @@ class modMyModule extends DolibarrModules ); - // Cronjobs + // Cronjobs (List of cron jobs entries to add when module is enabled) + // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week $this->cronjobs = array( - 0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/mymodule/class/mymodulemyjob.class.php', 'objectname'=>'MyModuleMyJob', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true) - ); // List of cron jobs entries to add - // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'test'=>true), - // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'test'=>true) + 0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/mymodule/class/mymodulemyjob.class.php', 'objectname'=>'MyModuleMyJob', 'method'=>'myMethod', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true) + ); + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true) // );