From 60766b734307f34717e46a817643567605f7d9ea Mon Sep 17 00:00:00 2001 From: atm-jonathan Date: Thu, 11 Dec 2025 17:00:54 +0100 Subject: [PATCH] change log and num version --- class/techatm.class.php | 333 ++++--- config.default.php | 39 +- config.php | 18 +- core/modules/modScrollTo.class.php | 80 +- ...e_99_modScrollTo_ScrollTotrigger.class.php | 829 +++++++----------- 5 files changed, 527 insertions(+), 772 deletions(-) diff --git a/class/techatm.class.php b/class/techatm.class.php index c23e78e..f892610 100644 --- a/class/techatm.class.php +++ b/class/techatm.class.php @@ -1,5 +1,4 @@ db = $db; } /** - * @param DolibarrModules $moduleDescriptor + * Get about page content + * + * @param object $moduleDescriptor Module descriptor + * @param boolean $useCache Use cache + * @return string Content */ - function getAboutPage($moduleDescriptor, $useCache = true){ + public function getAboutPage($moduleDescriptor, $useCache = true) + { global $langs; $url = self::ATM_TECH_URL.'/modules/modules-page-about.php'; - $url.= '?module='.$moduleDescriptor->name; - $url.= '&id='.$moduleDescriptor->numero; - $url.= '&version='.$moduleDescriptor->version; - $url.= '&langs='.$langs->defaultlang; - $url.= '&callv='.self::CALL_VERSION; + $url .= '?module='.$moduleDescriptor->name; + $url .= '&id='.$moduleDescriptor->numero; + $url .= '&version='.$moduleDescriptor->version; + $url .= '&langs='.$langs->defaultlang; + $url .= '&callv='.self::CALL_VERSION; $cachePath = DOL_DATA_ROOT . "/modules-atm/temp/about_page"; $cacheFileName = dol_sanitizeFileName($moduleDescriptor->name.'_'.$langs->defaultlang).'.html'; $cacheFilePath = $cachePath.'/'.$cacheFileName; - if($useCache && is_readable($cacheFilePath)){ + if ($useCache && is_readable($cacheFilePath)) { $lastChange = filemtime($cacheFilePath); - if($lastChange > time() - 86400){ + if ($lastChange > time() - 86400) { $content = @file_get_contents($cacheFilePath); - if($content !== false){ + if ($content !== false) { return $content; } } @@ -94,25 +103,25 @@ function getAboutPage($moduleDescriptor, $useCache = true){ $content = $this->getContents($url); - if(!$content){ + if (!$content) { $content = ''; // About page goes here - $content.= '
'; - $content.= '
'.$langs->trans('ATMAbout').'
'; - $content.= '
'; - $content.= ''; - $content.= '
'; + $content .= '
'; + $content .= '
'.$langs->trans('ATMAbout').'
'; + $content .= '
'; + $content .= ''; + $content .= '
'; } - if($useCache){ - if(!is_dir($cachePath)){ + if ($useCache) { + if (!is_dir($cachePath)) { $res = dol_mkdir($cachePath, DOL_DATA_ROOT); - }else{ + } else { $res = true; } - if($res){ - $comment = ''."\r\n"; + if ($res) { + $comment = ''."\r\n"; file_put_contents( $cacheFilePath, @@ -125,40 +134,55 @@ function getAboutPage($moduleDescriptor, $useCache = true){ } /** - * @param string $moduleTechMane + * Get module doc URL + * + * @param string $moduleTechMane Module technical name + * @return string URL */ - public static function getModuleDocUrl($moduleTechMane){ + public static function getModuleDocUrl($moduleTechMane) + { $url = self::ATM_TECH_URL.'/modules/doc-redirect.php'; - $url.= '?module='.$moduleTechMane; + $url .= '?module='.$moduleTechMane; return $url; } /** - * @param DolibarrModules $moduleDescriptor + * Get last module version URL + * + * @param object $moduleDescriptor Module descriptor + * @return string URL */ - public static function getLastModuleVersionUrl($moduleDescriptor){ + public static function getLastModuleVersionUrl($moduleDescriptor) + { $url = self::ATM_TECH_URL.'/modules/modules-last-version.php'; - $url.= '?module='.$moduleDescriptor->name; - $url.= '&number='.$moduleDescriptor->numero; - $url.= '&version='.$moduleDescriptor->version; - $url.= '&dolversion='.DOL_VERSION; - $url.= '&callv='.self::CALL_VERSION; + $url .= '?module='.$moduleDescriptor->name; + $url .= '&number='.$moduleDescriptor->numero; + $url .= '&version='.$moduleDescriptor->version; + $url .= '&dolversion='.DOL_VERSION; + $url .= '&callv='.self::CALL_VERSION; return $url; } /** - * @param $url - * @return false|object + * Get JSON data from URL + * + * @param string $url URL to reach + * @return mixed Data content */ - public function getJsonData($url){ + public function getJsonData($url) + { $this->data = false; $res = @file_get_contents($url); - $this->http_response_header = $http_response_header; - $this->TResponseHeader = self::parseHeaders($http_response_header); - if($res !== false){ + + if (isset($http_response_header)) { + $this->http_response_header = $http_response_header; + $this->TResponseHeader = self::parseHeaders($http_response_header); + } + + if ($res !== false) { $pos = strpos($res, '{'); - if($pos > 0){ + if ($pos > 0) { // cela signifie qu'il y a une erreur ou que la sortie n'est pas propre $res = substr($res, $pos); } @@ -170,168 +194,109 @@ public function getJsonData($url){ } /** - * @param $url - * @return false|string + * Get content from URL + * + * @param string $url URL to reach + * @return false|string Content or false */ - public function getContents($url){ + public function getContents($url) + { $this->data = false; $res = @file_get_contents($url); - $this->http_response_header = $http_response_header; - $this->TResponseHeader = self::parseHeaders($http_response_header); - if($res !== false){ + + if (isset($http_response_header)) { + $this->http_response_header = $http_response_header; + $this->TResponseHeader = self::parseHeaders($http_response_header); + } + + if ($res !== false) { $this->data = $res; } return $this->data; } - public static function http_response_code_msg($code = NULL) + /** + * Get HTTP response code message + * + * @param int $code HTTP Code + * @return string Message + */ + public static function httpResponseCodeMsg($code = null) { - if ($code !== NULL) { - + if ($code !== null) { switch ($code) { - case 100: - $text = 'Continue'; - break; - case 101: - $text = 'Switching Protocols'; - break; - case 200: - $text = 'OK'; - break; - case 201: - $text = 'Created'; - break; - case 202: - $text = 'Accepted'; - break; - case 203: - $text = 'Non-Authoritative Information'; - break; - case 204: - $text = 'No Content'; - break; - case 205: - $text = 'Reset Content'; - break; - case 206: - $text = 'Partial Content'; - break; - case 300: - $text = 'Multiple Choices'; - break; - case 301: - $text = 'Moved Permanently'; - break; - case 302: - $text = 'Moved Temporarily'; - break; - case 303: - $text = 'See Other'; - break; - case 304: - $text = 'Not Modified'; - break; - case 305: - $text = 'Use Proxy'; - break; - case 400: - $text = 'Bad Request'; - break; - case 401: - $text = 'Unauthorized'; - break; - case 402: - $text = 'Payment Required'; - break; - case 403: - $text = 'Forbidden'; - break; - case 404: - $text = 'Not Found'; - break; - case 405: - $text = 'Method Not Allowed'; - break; - case 406: - $text = 'Not Acceptable'; - break; - case 407: - $text = 'Proxy Authentication Required'; - break; - case 408: - $text = 'Request Time-out'; - break; - case 409: - $text = 'Conflict'; - break; - case 410: - $text = 'Gone'; - break; - case 411: - $text = 'Length Required'; - break; - case 412: - $text = 'Precondition Failed'; - break; - case 413: - $text = 'Request Entity Too Large'; - break; - case 414: - $text = 'Request-URI Too Large'; - break; - case 415: - $text = 'Unsupported Media Type'; - break; - case 500: - $text = 'Internal Server Error'; - break; - case 501: - $text = 'Not Implemented'; - break; - case 502: - $text = 'Bad Gateway'; - break; - case 503: - $text = 'Service Unavailable'; - break; - case 504: - $text = 'Gateway Time-out'; - break; - case 505: - $text = 'HTTP Version not supported'; - break; + case 100: $text = 'Continue'; break; + case 101: $text = 'Switching Protocols'; break; + case 200: $text = 'OK'; break; + case 201: $text = 'Created'; break; + case 202: $text = 'Accepted'; break; + case 203: $text = 'Non-Authoritative Information'; break; + case 204: $text = 'No Content'; break; + case 205: $text = 'Reset Content'; break; + case 206: $text = 'Partial Content'; break; + case 300: $text = 'Multiple Choices'; break; + case 301: $text = 'Moved Permanently'; break; + case 302: $text = 'Moved Temporarily'; break; + case 303: $text = 'See Other'; break; + case 304: $text = 'Not Modified'; break; + case 305: $text = 'Use Proxy'; break; + case 400: $text = 'Bad Request'; break; + case 401: $text = 'Unauthorized'; break; + case 402: $text = 'Payment Required'; break; + case 403: $text = 'Forbidden'; break; + case 404: $text = 'Not Found'; break; + case 405: $text = 'Method Not Allowed'; break; + case 406: $text = 'Not Acceptable'; break; + case 407: $text = 'Proxy Authentication Required'; break; + case 408: $text = 'Request Time-out'; break; + case 409: $text = 'Conflict'; break; + case 410: $text = 'Gone'; break; + case 411: $text = 'Length Required'; break; + case 412: $text = 'Precondition Failed'; break; + case 413: $text = 'Request Entity Too Large'; break; + case 414: $text = 'Request-URI Too Large'; break; + case 415: $text = 'Unsupported Media Type'; break; + case 500: $text = 'Internal Server Error'; break; + case 501: $text = 'Not Implemented'; break; + case 502: $text = 'Bad Gateway'; break; + case 503: $text = 'Service Unavailable'; break; + case 504: $text = 'Gateway Time-out'; break; + case 505: $text = 'HTTP Version not supported'; break; default: $text = 'Unknown http status code "' . htmlentities($code) . '"'; break; } return $text; - } else { - return $text = 'Unknown http status code NULL'; + return 'Unknown http status code NULL'; } } - public static function parseHeaders( $headers ) + /** + * Parse Headers + * + * @param array $headers Headers + * @return array Parsed headers + */ + public static function parseHeaders($headers) { $head = array(); - if(!is_array($headers)){ + if (!is_array($headers)) { return $head; } - foreach( $headers as $k=>$v ) - { - $t = explode( ':', $v, 2 ); - if( isset( $t[1] ) ) - $head[ trim($t[0]) ] = trim( $t[1] ); - else - { + foreach ($headers as $k => $v) { + $t = explode(':', $v, 2); + if (isset($t[1])) { + $head[trim($t[0])] = trim($t[1]); + } else { $head[] = $v; - if( preg_match( "#HTTP/[0-9\.]+\s+([0-9]+)#",$v, $out ) ) + if (preg_match("#HTTP/[0-9\.]+\s+([0-9]+)#", $v, $out)) { $head['reponse_code'] = intval($out[1]); + } } } return $head; } - } diff --git a/config.default.php b/config.default.php index 0a6f7e0..2768a32 100644 --- a/config.default.php +++ b/config.default.php @@ -1,18 +1,29 @@ . + */ + if (is_file('../main.inc.php'))$dir = '../'; +elseif (is_file('../../../main.inc.php'))$dir = '../../../'; +else $dir = '../../'; - if(!defined('INC_FROM_DOLIBARR') && defined('INC_FROM_CRON_SCRIPT')) { - include($dir."master.inc.php"); - } - elseif(!defined('INC_FROM_DOLIBARR')) { - include($dir."main.inc.php"); - } else { - global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass; - } - - +if (!defined('INC_FROM_DOLIBARR') && defined('INC_FROM_CRON_SCRIPT')) { + include $dir."master.inc.php"; +} elseif (!defined('INC_FROM_DOLIBARR')) { + include $dir."main.inc.php"; +} else { + global $dolibarr_main_db_host, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass; +} diff --git a/config.php b/config.php index a20fa5a..b4e0eb3 100644 --- a/config.php +++ b/config.php @@ -1,4 +1,18 @@ . + */ - require('config.default.php'); - + require 'config.default.php'; diff --git a/core/modules/modScrollTo.class.php b/core/modules/modScrollTo.class.php index 148d3c0..ce46215 100644 --- a/core/modules/modScrollTo.class.php +++ b/core/modules/modScrollTo.class.php @@ -38,11 +38,11 @@ class modScrollTo extends DolibarrModules * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { - global $langs,$conf; + global $langs,$conf; - $this->db = $db; + $this->db = $db; // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). @@ -54,11 +54,11 @@ function __construct($db) // It is used to group modules in module setup page $this->family = "ATM Consulting"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) - $this->name = preg_replace('/^mod/i','',get_class($this)); + $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) $this->description = "Description of module ScrollTo"; // Possible values for version are: 'development', 'experimental', 'dolibarr' or version - $this->version = '1.4.2'; + $this->version = '1.4.3'; // Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Where to store the module in setup page (0=common,1=interface,2=others,3=very specific) @@ -82,7 +82,7 @@ function __construct($db) // 'barcode' => 0, // Set this to 1 if module has its own barcode directory (core/modules/barcode) // 'models' => 0, // Set this to 1 if module has its own models directory (core/modules/xxx) // 'css' => array('/scrollto/css/scrollto.css.php'), // Set this to relative path of css file if module has its own css file - // 'js' => array('/scrollto/js/scrollto.js'), // Set this to relative path of js file if module must load a js on all pages + // 'js' => array('/scrollto/js/scrollto.js'), // Set this to relative path of js file if module must load a js on all pages // 'hooks' => array('hookcontext1','hookcontext2') // Set here all hooks context managed by module // 'dir' => array('output' => 'othermodulename'), // To force the default directories names // 'workflow' => array('WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2'=>array('enabled'=>'isModEnabled("module1") && isModEnabled("module2")', 'picto'=>'yourpicto@scrollto')) // Set here all workflow context managed by module @@ -119,9 +119,9 @@ function __construct($db) $this->const = array(); // Array to add new pages in new tabs - // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@scrollto:$user->rights->scrollto->read:/scrollto/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 - // 'objecttype:+tabname2:Title2:mylangfile@scrollto:$user->rights->othermodule->read:/scrollto/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 - // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // Example: $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@scrollto:$user->hasRight('scrollto', 'read'):/scrollto/mynewtab1.php?id=__ID__', // To add a new tab identified by code tabname1 + // 'objecttype:+tabname2:Title2:mylangfile@scrollto:$user->hasRight('othermodule', 'read'):/scrollto/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2 + // 'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname // where objecttype can be // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // 'contact' to add a tab in contact view @@ -142,34 +142,33 @@ function __construct($db) // 'stock' to add a tab in stock view // 'thirdparty' to add a tab in third party view // 'user' to add a tab in user view - $this->tabs = array(); + $this->tabs = array(); - // Dictionaries - if (!isModEnabled('scrollto')) - { - $conf->scrollto=new stdClass(); - $conf->scrollto->enabled=0; - } + // Dictionaries + if (!isModEnabled('scrollto')) { + $conf->scrollto=new stdClass(); + $conf->scrollto->enabled=0; + } $this->dictionaries=array(); - /* Example: - if (! isModEnabled("scrollto")) $conf->scrollto->enabled=0; // This is to avoid warnings - $this->dictionaries=array( - 'langs'=>'mylangfile@scrollto', - 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor - 'tablib'=>array("Table1","Table2","Table3"), // Label of tables - 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields - 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order - 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) - 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) - 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) - 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') - 'tabcond'=>array(isModEnabled("scrollto"),isModEnabled("scrollto"),isModEnabled("scrollto")) // Condition to show each dictionary - ); - */ + /* Example: + if (! isModEnabled("scrollto")) $conf->scrollto->enabled=0; // This is to avoid warnings + $this->dictionaries=array( + 'langs'=>'mylangfile@scrollto', + 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor + 'tablib'=>array("Table1","Table2","Table3"), // Label of tables + 'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f','SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'), // Request to select fields + 'tabsqlsort'=>array("label ASC","label ASC","label ASC"), // Sort order + 'tabfield'=>array("code,label","code,label","code,label"), // List of fields (result of select to show dictionary) + 'tabfieldvalue'=>array("code,label","code,label","code,label"), // List of fields (list of fields to edit a record) + 'tabfieldinsert'=>array("code,label","code,label","code,label"), // List of fields (list of fields for insert) + 'tabrowid'=>array("rowid","rowid","rowid"), // Name of columns with primary key (try to always name it 'rowid') + 'tabcond'=>array(isModEnabled("scrollto"),isModEnabled("scrollto"),isModEnabled("scrollto")) // Condition to show each dictionary + ); + */ - // Boxes + // Boxes // Add here list of php file(s) stored in core/boxes that contains class to show a box. - $this->boxes = array(); // List of boxes + $this->boxes = array(); // List of boxes // Example: //$this->boxes=array(array(0=>array('file'=>'myboxa.php','note'=>'','enabledbydefaulton'=>'Home'),1=>array('file'=>'myboxb.php','note'=>''),2=>array('file'=>'myboxc.php','note'=>''));); @@ -230,7 +229,7 @@ function __construct($db) // Example: // $this->export_code[$r]=$this->rights_class.'_'.$r; // $this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. + // $this->export_enabled[$r]='1'; // Condition to show export in list (ie: '$user->id==3'). Set to 1 to always show when module is enabled. // $this->export_permission[$r]=array(array("facture","facture","export")); // $this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef'); // $this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'); @@ -247,18 +246,18 @@ function __construct($db) * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * It also creates data directories * - * @param string $options Options when enabling module ('', 'noboxes') + * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ - function init($options='') + public function init($options = '') { $sql = array(); - /* define('INC_FROM_DOLIBARR',true); + /* define('INC_FROM_DOLIBARR',true); dol_include_once('/scrollto/config.php'); dol_include_once('/scrollto/script/create-maj-base.php'); -*/ + */ $result=$this->_load_tables('/scrollto/sql/'); return $this->_init($sql, $options); @@ -269,14 +268,13 @@ function init($options='') * Remove from database constants, boxes and permissions from Dolibarr database. * Data directories are not deleted * - * @param string $options Options when enabling module ('', 'noboxes') + * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ - function remove($options='') + public function remove($options = '') { $sql = array(); return $this->_remove($sql, $options); } - } diff --git a/core/triggers/interface_99_modScrollTo_ScrollTotrigger.class.php b/core/triggers/interface_99_modScrollTo_ScrollTotrigger.class.php index a482197..0e818aa 100644 --- a/core/triggers/interface_99_modScrollTo_ScrollTotrigger.class.php +++ b/core/triggers/interface_99_modScrollTo_ScrollTotrigger.class.php @@ -17,17 +17,9 @@ */ /** - * \file core/triggers/interface_99_modMyodule_ScrollTotrigger.class.php - * \ingroup scrollto - * \brief Sample trigger - * \remarks You can create other triggers by copying this one - * - File name should be either: - * interface_99_modMymodule_Mytrigger.class.php - * interface_99_all_Mytrigger.class.php - * - The file must stay in core/triggers - * - The class name must be InterfaceMytrigger - * - The constructor method must be named InterfaceMytrigger - * - The name property name must be Mytrigger + * \file core/triggers/interface_99_modScrollTo_ScrollTotrigger.class.php + * \ingroup scrollto + * \brief Sample trigger */ /** @@ -35,537 +27,312 @@ */ class InterfaceScrollTotrigger { + /** + * @var DoliDB Database handler + */ + protected $db; - private $db; + /** + * @var string Name + */ + public $name; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; + /** + * @var string Family + */ + public $family; - $this->name = preg_replace('/^Interface/i', '', get_class($this)); - $this->family = "demo"; - $this->description = "Triggers of this module are empty functions." - . "They have no effect." - . "They are provided for tutorial purpose only."; - // 'development', 'experimental', 'dolibarr' or version - $this->version = 'development'; - $this->picto = 'scrollto@scrollto'; - } + /** + * @var string Description + */ + public $description; - /** - * Trigger name - * - * @return string Name of trigger file - */ - public function getName() - { - return $this->name; - } + /** + * @var string Version + */ + public $version; - /** - * Trigger description - * - * @return string Description of trigger file - */ - public function getDesc() - { - return $this->description; - } + /** + * @var string Picto + */ + public $picto; - /** - * Trigger version - * - * @return string Version of trigger file - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - if ($this->version == 'development') { - return $langs->trans("Development"); - } elseif ($this->version == 'experimental') + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "demo"; + $this->description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only."; + // 'development', 'experimental', 'dolibarr' or version + $this->version = 'development'; + $this->picto = 'scrollto@scrollto.png'; + } - return $langs->trans("Experimental"); - elseif ($this->version == 'dolibarr') return DOL_VERSION; - elseif ($this->version) return $this->version; - else { - return $langs->trans("Unknown"); - } - } + /** + * Trigger name + * + * @return string Name of trigger file + */ + public function getName() + { + return $this->name; + } - /** - * Function called when a Dolibarrr business event is done. - * All functions "run_trigger" are triggered if file - * is inside directory core/triggers - * - * @param string $action Event action code - * @param Object $object Object - * @param User $user Object user - * @param Translate $langs Object langs - * @param conf $conf Object conf - * @return int <0 if KO, 0 if no triggered ran, >0 if OK - */ - public function run_trigger($action, $object, $user, $langs, $conf) - { - // Put here code you want to execute when a Dolibarr business events occurs. - // Data and type of action are stored into $object and $action - // Users - if ($action == 'USER_LOGIN') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_UPDATE_SESSION') { - // Warning: To increase performances, this action is triggered only if - // constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1. - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_CREATE_FROM_CONTACT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_NEW_PASSWORD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_ENABLEDISABLE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_LOGOUT') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_SETINGROUP') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'USER_REMOVEFROMGROUP') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } + /** + * Trigger description + * + * @return string Description of trigger file + */ + public function getDesc() + { + return $this->description; + } - // Groups - elseif ($action == 'GROUP_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'GROUP_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'GROUP_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } + /** + * Trigger version + * + * @return string Version of trigger file + */ + public function getVersion() + { + global $langs; + $langs->load("admin"); - // Companies - elseif ($action == 'COMPANY_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'COMPANY_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'COMPANY_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } + if ($this->version == 'development') { + return $langs->trans("Development"); + } elseif ($this->version == 'experimental') { + return $langs->trans("Experimental"); + } elseif ($this->version == 'dolibarr') { + return DOL_VERSION; + } elseif ($this->version) { + return $this->version; + } else { + return $langs->trans("Unknown"); + } + } - // Contacts - elseif ($action == 'CONTACT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTACT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTACT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } + /** + * Function called when a Dolibarrr business event is done. + * All functions "run_trigger" are triggered if file + * is inside directory core/triggers + * + * @param string $action Event action code + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, $user, $langs, $conf) + { + // Put here code you want to execute when a Dolibarr business events occurs. + // Data and type of action are stored into $object and $action - // Products - elseif ($action == 'PRODUCT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PRODUCT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PRODUCT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } + // Users + if ($action == 'USER_LOGIN') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_UPDATE_SESSION') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_CREATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_CREATE_FROM_CONTACT') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_NEW_PASSWORD') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_ENABLEDISABLE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_LOGOUT') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_SETINGROUP') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'USER_REMOVEFROMGROUP') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'GROUP_CREATE') { // Groups + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'GROUP_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'GROUP_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'COMPANY_CREATE') { // Companies + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'COMPANY_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'COMPANY_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTACT_CREATE') { // Contacts + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTACT_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTACT_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PRODUCT_CREATE') { // Products + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PRODUCT_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PRODUCT_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_CREATE') { // Customer orders + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_CLONE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_VALIDATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_BUILDDOC') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_SENTBYMAIL') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'LINEORDER_INSERT' || $action == 'LINEORDER_CREATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'LINEORDER_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_SUPPLIER_CREATE') { // Supplier orders + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_CREATE') { // Proposals + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_CLONE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_VALIDATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_BUILDDOC') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_SENTBYMAIL') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_CLOSE_SIGNED') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_CLOSE_REFUSED') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROPAL_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'LINEPROPAL_INSERT' || $action == 'LINEPROPAL_CREATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'LINEPROPAL_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'LINEPROPAL_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTRACT_CREATE') { // Contracts + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTRACT_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTRACT_ACTIVATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTRACT_CANCEL') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTRACT_CLOSE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CONTRACT_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'BILL_CREATE') { // Bills + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'BILL_CLONE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'BILL_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'BILL_VALIDATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'BILL_BUILDDOC') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'BILL_SENTBYMAIL') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'BILL_CANCEL') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'BILL_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'LINEBILL_INSERT' || $action == 'LINEBILL_CREATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'LINEBILL_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { // Payments + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PAYMENT_ADD_TO_BANK') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PAYMENT_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'FICHEINTER_CREATE') { // Interventions + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'FICHEINTER_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'FICHEINTER_VALIDATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'FICHEINTER_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'MEMBER_CREATE') { // Members + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'MEMBER_VALIDATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'MEMBER_SUBSCRIPTION') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'MEMBER_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'MEMBER_NEW_PASSWORD') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'MEMBER_RESILIATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'MEMBER_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CATEGORY_CREATE') { // Categories + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CATEGORY_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'CATEGORY_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROJECT_CREATE') { // Projects + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROJECT_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'PROJECT_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'TASK_CREATE') { // Project tasks + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'TASK_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'TASK_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'TASK_TIMESPENT_CREATE') { // Task time spent + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'TASK_TIMESPENT_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'TASK_TIMESPENT_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'SHIPPING_CREATE') { // Shipping + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'SHIPPING_MODIFY') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'SHIPPING_VALIDATE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'SHIPPING_SENTBYMAIL') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'SHIPPING_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'SHIPPING_BUILDDOC') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'FILE_UPLOAD') { // File + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } elseif ($action == 'FILE_DELETE') { + dol_syslog("Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id); + } - // Customer orders - elseif ($action == 'ORDER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEORDER_INSERT' || $action == 'LINEORDER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEORDER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Supplier orders - elseif ($action == 'ORDER_SUPPLIER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SUPPLIER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Proposals - elseif ($action == 'PROPAL_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLOSE_SIGNED') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_CLOSE_REFUSED') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROPAL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_INSERT' || $action == 'LINEPROPAL_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEPROPAL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Contracts - elseif ($action == 'CONTRACT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_ACTIVATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_CANCEL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_CLOSE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CONTRACT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Bills - elseif ($action == 'BILL_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_CLONE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_CANCEL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'BILL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEBILL_INSERT' || $action == 'LINEBILL_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'LINEBILL_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Payments - elseif ($action == 'PAYMENT_CUSTOMER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_SUPPLIER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_ADD_TO_BANK') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PAYMENT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Interventions - elseif ($action == 'FICHEINTER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FICHEINTER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Members - elseif ($action == 'MEMBER_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_SUBSCRIPTION') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_NEW_PASSWORD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_RESILIATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'MEMBER_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Categories - elseif ($action == 'CATEGORY_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CATEGORY_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'CATEGORY_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Projects - elseif ($action == 'PROJECT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROJECT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'PROJECT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Project tasks - elseif ($action == 'TASK_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Task time spent - elseif ($action == 'TASK_TIMESPENT_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_TIMESPENT_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'TASK_TIMESPENT_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // Shipping - elseif ($action == 'SHIPPING_CREATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_MODIFY') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_VALIDATE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_SENTBYMAIL') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'SHIPPING_BUILDDOC') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - // File - elseif ($action == 'FILE_UPLOAD') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } elseif ($action == 'FILE_DELETE') { - dol_syslog( - "Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id - ); - } - - return 0; - } -} \ No newline at end of file + return 0; + } +}