diff --git a/dev/dolibarr_changes.txt b/dev/dolibarr_changes.txt index 81a273d102a..9cfec54bd5e 100644 --- a/dev/dolibarr_changes.txt +++ b/dev/dolibarr_changes.txt @@ -104,6 +104,27 @@ with //return false; } +* Replace in tcpdf.php + + if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + +with + + // @CHANGE LDR Add support for src="file://..." links + if (strpos($imgsrc, 'file://') === 0) { + $imgsrc = str_replace('file://', '/', $imgsrc); + $imgsrc = urldecode($imgsrc); + $testscrtype = @parse_url($imgsrc); + if (empty($testscrtype['query'])) { + // convert URL to server path + $imgsrc = str_replace(K_PATH_URL, K_PATH_MAIN, $imgsrc); + } elseif (preg_match('|^https?://|', $imgsrc) !== 1) { + // convert URL to server path + $imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc); + } + } + elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + * In tecnickcom/tcpdf/include/tcpdf_static, in function fopenLocal, replace diff --git a/dev/initdemo/mysqldump_dolibarr_11.0.0.sql b/dev/initdemo/mysqldump_dolibarr_11.0.0.sql index f9f2b5185d8..848e6720ef1 100644 --- a/dev/initdemo/mysqldump_dolibarr_11.0.0.sql +++ b/dev/initdemo/mysqldump_dolibarr_11.0.0.sql @@ -7729,7 +7729,7 @@ CREATE TABLE `llx_menu` ( LOCK TABLES `llx_menu` WRITE; /*!40000 ALTER TABLE `llx_menu` DISABLE KEYS */; -INSERT INTO `llx_menu` VALUES (103094,'all',2,'agenda','top','agenda',0,NULL,NULL,100,'/comm/action/index.php','','Agenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103095,'all',2,'agenda','left','agenda',103094,NULL,NULL,100,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Actions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103096,'all',2,'agenda','left','agenda',103095,NULL,NULL,101,'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create','','NewAction','commercial',NULL,NULL,'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103097,'all',2,'agenda','left','agenda',103095,NULL,NULL,102,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Calendar','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103098,'all',2,'agenda','left','agenda',103097,NULL,NULL,103,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103099,'all',2,'agenda','left','agenda',103097,NULL,NULL,104,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103100,'all',2,'agenda','left','agenda',103097,NULL,NULL,105,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2015-03-13 15:29:19'),(103101,'all',2,'agenda','left','agenda',103097,NULL,NULL,106,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2015-03-13 15:29:19'),(103102,'all',2,'agenda','left','agenda',103095,NULL,NULL,112,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda','','List','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103103,'all',2,'agenda','left','agenda',103102,NULL,NULL,113,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103104,'all',2,'agenda','left','agenda',103102,NULL,NULL,114,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103105,'all',2,'agenda','left','agenda',103102,NULL,NULL,115,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2015-03-13 15:29:19'),(103106,'all',2,'agenda','left','agenda',103102,NULL,NULL,116,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2015-03-13 15:29:19'),(103107,'all',2,'agenda','left','agenda',103095,NULL,NULL,120,'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda','','Reportings','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103134,'all',2,'opensurvey','top','opensurvey',0,NULL,NULL,200,'/opensurvey/index.php','','Surveys','opensurvey',NULL,NULL,'$user->rights->opensurvey->survey->read','$conf->opensurvey->enabled',0,'2015-03-13 20:33:42'),(103135,'all',2,'opensurvey','left','opensurvey',-1,NULL,'opensurvey',200,'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey','','Survey','opensurvey@opensurvey',NULL,'opensurvey','','$conf->opensurvey->enabled',0,'2015-03-13 20:33:42'),(103136,'all',2,'opensurvey','left','opensurvey',-1,'opensurvey','opensurvey',210,'/opensurvey/public/index.php','_blank','NewSurvey','opensurvey@opensurvey',NULL,'opensurvey_new','','$conf->opensurvey->enabled',0,'2015-03-13 20:33:42'),(103137,'all',2,'opensurvey','left','opensurvey',-1,'opensurvey','opensurvey',220,'/opensurvey/list.php','','List','opensurvey@opensurvey',NULL,'opensurvey_list','','$conf->opensurvey->enabled',0,'2015-03-13 20:33:42'),(145127,'all',1,'printing','left','home',-1,'admintools','home',300,'/printing/index.php?mainmenu=home&leftmenu=admintools','','MenuDirectPrinting','printing',NULL,NULL,'$user->rights->printing->read','$conf->printing->enabled && $leftmenu==\'admintools\'',0,'2017-01-29 15:12:44'),(161088,'auguria',1,'','top','home',0,NULL,NULL,10,'/index.php?mainmenu=home&leftmenu=','','Home','',-1,'','','1',2,'2017-08-30 15:14:30'),(161089,'auguria',1,'societe|fournisseur','top','companies',0,NULL,NULL,20,'/societe/index.php?mainmenu=companies&leftmenu=','','ThirdParties','companies',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)',2,'2017-08-30 15:14:30'),(161090,'auguria',1,'product|service','top','products',0,NULL,NULL,30,'/product/index.php?mainmenu=products&leftmenu=','','Products/Services','products',-1,'','$user->rights->produit->lire||$user->rights->service->lire','$conf->product->enabled || $conf->service->enabled',0,'2017-08-30 15:14:30'),(161092,'auguria',1,'propal|commande|fournisseur|contrat|ficheinter','top','commercial',0,NULL,NULL,40,'/comm/index.php?mainmenu=commercial&leftmenu=','','Commercial','commercial',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(161093,'auguria',1,'comptabilite|accounting|facture|don|tax|salaries|loan','top','accountancy',0,NULL,NULL,50,'/compta/index.php?mainmenu=accountancy&leftmenu=','','MenuFinancial','compta',-1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read','$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled',2,'2017-08-30 15:14:30'),(161094,'auguria',1,'projet','top','project',0,NULL,NULL,70,'/projet/index.php?mainmenu=project&leftmenu=','','Projects','projects',-1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(161095,'auguria',1,'mailing|export|import|opensurvey|resource','top','tools',0,NULL,NULL,90,'/core/tools.php?mainmenu=tools&leftmenu=','','Tools','other',-1,'','$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read || $user->rights->resource->read','$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled || $conf->resource->enabled',2,'2017-08-30 15:14:30'),(161101,'auguria',1,'banque|prelevement','top','bank',0,NULL,NULL,60,'/compta/bank/index.php?mainmenu=bank&leftmenu=bank','','MenuBankCash','banks',-1,'','$user->rights->banque->lire || $user->rights->prelevement->bons->lire','$conf->banque->enabled || $conf->prelevement->enabled',0,'2017-08-30 15:14:30'),(161102,'auguria',1,'hrm|holiday|deplacement|expensereport','top','hrm',0,NULL,NULL,80,'/hrm/index.php?mainmenu=hrm&leftmenu=','','HRM','holiday',-1,'','$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire','$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(161177,'auguria',1,'','left','home',161088,NULL,NULL,0,'/index.php','','MyDashboard','',0,'','','1',2,'2017-08-30 15:14:30'),(161187,'auguria',1,'','left','home',161088,NULL,NULL,1,'/admin/index.php?leftmenu=setup','','Setup','admin',0,'setup','','$user->admin',2,'2017-08-30 15:14:30'),(161188,'auguria',1,'','left','home',161187,NULL,NULL,1,'/admin/company.php?leftmenu=setup','','MenuCompanySetup','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161189,'auguria',1,'','left','home',161187,NULL,NULL,4,'/admin/ihm.php?leftmenu=setup','','GUISetup','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161190,'auguria',1,'','left','home',161187,NULL,NULL,2,'/admin/modules.php?leftmenu=setup','','Modules','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161191,'auguria',1,'','left','home',161187,NULL,NULL,6,'/admin/boxes.php?leftmenu=setup','','Boxes','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161192,'auguria',1,'','left','home',161187,NULL,NULL,3,'/admin/menus.php?leftmenu=setup','','Menus','admin',1,'','','$leftmenu==\'setup\'',2,'2017-09-06 08:29:47'),(161193,'auguria',1,'','left','home',161187,NULL,NULL,7,'/admin/delais.php?leftmenu=setup','','Alerts','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161194,'auguria',1,'','left','home',161187,NULL,NULL,10,'/admin/pdf.php?leftmenu=setup','','PDF','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161195,'auguria',1,'','left','home',161187,NULL,NULL,8,'/admin/security_other.php?leftmenu=setup','','Security','admin',1,'','','$leftmenu==\'setup\'',2,'2017-09-06 08:29:36'),(161196,'auguria',1,'','left','home',161187,NULL,NULL,11,'/admin/mails.php?leftmenu=setup','','Emails','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161197,'auguria',1,'','left','home',161187,NULL,NULL,9,'/admin/limits.php?leftmenu=setup','','MenuLimits','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161198,'auguria',1,'','left','home',161187,NULL,NULL,13,'/admin/dict.php?leftmenu=setup','','Dictionary','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161199,'auguria',1,'','left','home',161187,NULL,NULL,14,'/admin/const.php?leftmenu=setup','','OtherSetup','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161200,'auguria',1,'','left','home',161187,NULL,NULL,12,'/admin/sms.php?leftmenu=setup','','SMS','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161201,'auguria',1,'','left','home',161187,NULL,NULL,4,'/admin/translation.php?leftmenu=setup','','Translation','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161288,'auguria',1,'','left','home',161387,NULL,NULL,0,'/admin/system/dolibarr.php?leftmenu=admintools','','InfoDolibarr','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161289,'auguria',1,'','left','home',161288,NULL,NULL,2,'/admin/system/modules.php?leftmenu=admintools','','Modules','admin',2,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161290,'auguria',1,'','left','home',161288,NULL,NULL,3,'/admin/triggers.php?leftmenu=admintools','','Triggers','admin',2,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161291,'auguria',1,'','left','home',161288,NULL,NULL,4,'/admin/system/filecheck.php?leftmenu=admintools','','FileCheck','admin',2,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161292,'auguria',1,'','left','home',161387,NULL,NULL,1,'/admin/system/browser.php?leftmenu=admintools','','InfoBrowser','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161293,'auguria',1,'','left','home',161387,NULL,NULL,2,'/admin/system/os.php?leftmenu=admintools','','InfoOS','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161294,'auguria',1,'','left','home',161387,NULL,NULL,3,'/admin/system/web.php?leftmenu=admintools','','InfoWebServer','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161295,'auguria',1,'','left','home',161387,NULL,NULL,4,'/admin/system/phpinfo.php?leftmenu=admintools','','InfoPHP','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161297,'auguria',1,'','left','home',161387,NULL,NULL,5,'/admin/system/database.php?leftmenu=admintools','','InfoDatabase','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161387,'auguria',1,'','left','home',161088,NULL,NULL,2,'/admin/tools/index.php?leftmenu=admintools','','AdminTools','admin',0,'admintools','','$user->admin',2,'2017-08-30 15:14:30'),(161388,'auguria',1,'','left','home',161387,NULL,NULL,6,'/admin/tools/dolibarr_export.php?leftmenu=admintools','','Backup','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161389,'auguria',1,'','left','home',161387,NULL,NULL,7,'/admin/tools/dolibarr_import.php?leftmenu=admintools','','Restore','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161392,'auguria',1,'','left','home',161387,NULL,NULL,8,'/admin/tools/update.php?leftmenu=admintools','','MenuUpgrade','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161393,'auguria',1,'','left','home',161387,NULL,NULL,9,'/admin/tools/eaccelerator.php?leftmenu=admintools','','EAccelerator','admin',1,'','','$leftmenu==\"admintools\" && function_exists(\"eaccelerator_info\")',2,'2017-08-30 15:14:30'),(161394,'auguria',1,'','left','home',161387,NULL,NULL,10,'/admin/tools/listevents.php?leftmenu=admintools','','Audit','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161395,'auguria',1,'','left','home',161387,NULL,NULL,11,'/admin/tools/listsessions.php?leftmenu=admintools','','Sessions','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161396,'auguria',1,'','left','home',161387,NULL,NULL,12,'/admin/tools/purge.php?leftmenu=admintools','','Purge','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161398,'auguria',1,'','left','home',161387,NULL,NULL,14,'/admin/system/about.php?leftmenu=admintools','','ExternalResources','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161407,'auguria',1,'','left','home',161387,NULL,NULL,15,'/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools','','ProductVatMassChange','products',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161487,'auguria',1,'','left','home',161088,NULL,NULL,4,'/user/home.php?leftmenu=users','','MenuUsersAndGroups','users',0,'users','','1',2,'2017-08-30 15:14:30'),(161488,'auguria',1,'','left','home',161487,NULL,NULL,0,'/user/index.php?leftmenu=users','','Users','users',1,'','$user->rights->user->user->lire || $user->admin','$leftmenu==\"users\"',2,'2017-08-30 15:14:30'),(161489,'auguria',1,'','left','home',161488,NULL,NULL,0,'/user/card.php?leftmenu=users&action=create','','NewUser','users',2,'','($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)','$leftmenu==\"users\"',2,'2017-08-30 15:14:30'),(161490,'auguria',1,'','left','home',161487,NULL,NULL,1,'/user/group/index.php?leftmenu=users','','Groups','users',1,'','(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)','$leftmenu==\"users\"',2,'2017-08-30 15:14:30'),(161491,'auguria',1,'','left','home',161490,NULL,NULL,0,'/user/group/card.php?leftmenu=users&action=create','','NewGroup','users',2,'','(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)','$leftmenu==\"users\"',2,'2017-08-30 15:14:30'),(161587,'auguria',1,'','left','companies',161089,NULL,NULL,0,'/societe/index.php?leftmenu=thirdparties','','ThirdParty','companies',0,'thirdparties','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161588,'auguria',1,'','left','companies',161587,NULL,NULL,0,'/societe/card.php?action=create','','MenuNewThirdParty','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161589,'auguria',1,'','left','companies',161587,NULL,NULL,0,'/societe/list.php?action=create','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161590,'auguria',1,'','left','companies',161587,NULL,NULL,5,'/societe/list.php?type=f&leftmenu=suppliers','','ListSuppliersShort','suppliers',1,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2017-08-30 15:14:30'),(161591,'auguria',1,'','left','companies',161590,NULL,NULL,0,'/societe/card.php?leftmenu=supplier&action=create&type=f','','NewSupplier','suppliers',2,'','$user->rights->societe->creer','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2017-08-30 15:14:30'),(161593,'auguria',1,'','left','companies',161587,NULL,NULL,3,'/societe/list.php?type=p&leftmenu=prospects','','ListProspectsShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161594,'auguria',1,'','left','companies',161593,NULL,NULL,0,'/societe/card.php?leftmenu=prospects&action=create&type=p','','MenuNewProspect','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161596,'auguria',1,'','left','companies',161587,NULL,NULL,4,'/societe/list.php?type=c&leftmenu=customers','','ListCustomersShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161597,'auguria',1,'','left','companies',161596,NULL,NULL,0,'/societe/card.php?leftmenu=customers&action=create&type=c','','MenuNewCustomer','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161687,'auguria',1,'','left','companies',161089,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','ContactsAddresses','companies',0,'contacts','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161688,'auguria',1,'','left','companies',161687,NULL,NULL,0,'/contact/card.php?leftmenu=contacts&action=create','','NewContactAddress','companies',1,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161689,'auguria',1,'','left','companies',161687,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161691,'auguria',1,'','left','companies',161689,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=p','','ThirdPartyProspects','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161692,'auguria',1,'','left','companies',161689,NULL,NULL,2,'/contact/list.php?leftmenu=contacts&type=c','','ThirdPartyCustomers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161693,'auguria',1,'','left','companies',161689,NULL,NULL,3,'/contact/list.php?leftmenu=contacts&type=f','','ThirdPartySuppliers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2017-08-30 15:14:30'),(161694,'auguria',1,'','left','companies',161689,NULL,NULL,4,'/contact/list.php?leftmenu=contacts&type=o','','Others','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161737,'auguria',1,'','left','companies',161089,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=1','','SuppliersCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->societe->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161738,'auguria',1,'','left','companies',161737,NULL,NULL,0,'/categories/card.php?action=create&type=1','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->societe->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161747,'auguria',1,'','left','companies',161089,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=2','','CustomersProspectsCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161748,'auguria',1,'','left','companies',161747,NULL,NULL,0,'/categories/card.php?action=create&type=2','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161757,'auguria',1,'','left','companies',161089,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=4','','ContactCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->societe->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161758,'auguria',1,'','left','companies',161757,NULL,NULL,0,'/categories/card.php?action=create&type=4','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->societe->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(162187,'auguria',1,'','left','commercial',161092,NULL,NULL,4,'/comm/propal/index.php?leftmenu=propals','','Prop','propal',0,'propals','$user->rights->propale->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(162188,'auguria',1,'','left','commercial',162187,NULL,NULL,0,'/comm/propal/card.php?action=create&leftmenu=propals','','NewPropal','propal',1,'','$user->rights->propale->creer','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(162189,'auguria',1,'','left','commercial',162187,NULL,NULL,1,'/comm/propal/list.php?leftmenu=propals','','List','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(162190,'auguria',1,'','left','commercial',162189,NULL,NULL,2,'/comm/propal/list.php?leftmenu=propals&viewstatut=0','','PropalsDraft','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162191,'auguria',1,'','left','commercial',162189,NULL,NULL,3,'/comm/propal/list.php?leftmenu=propals&viewstatut=1','','PropalsOpened','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162192,'auguria',1,'','left','commercial',162189,NULL,NULL,4,'/comm/propal/list.php?leftmenu=propals&viewstatut=2','','PropalStatusSigned','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162193,'auguria',1,'','left','commercial',162189,NULL,NULL,5,'/comm/propal/list.php?leftmenu=propals&viewstatut=3','','PropalStatusNotSigned','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162194,'auguria',1,'','left','commercial',162189,NULL,NULL,6,'/comm/propal/list.php?leftmenu=propals&viewstatut=4','','PropalStatusBilled','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162197,'auguria',1,'','left','commercial',162187,NULL,NULL,4,'/comm/propal/stats/index.php?leftmenu=propals','','Statistics','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(162287,'auguria',1,'','left','commercial',161092,NULL,NULL,5,'/commande/index.php?leftmenu=orders','','CustomersOrders','orders',0,'orders','$user->rights->commande->lire','$conf->commande->enabled',2,'2017-08-30 15:14:30'),(162288,'auguria',1,'','left','commercial',162287,NULL,NULL,0,'/commande/card.php?action=create&leftmenu=orders','','NewOrder','orders',1,'','$user->rights->commande->creer','$conf->commande->enabled',2,'2017-08-30 15:14:30'),(162289,'auguria',1,'','left','commercial',162287,NULL,NULL,1,'/commande/list.php?leftmenu=orders','','List','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2017-08-30 15:14:30'),(162290,'auguria',1,'','left','commercial',162289,NULL,NULL,2,'/commande/list.php?leftmenu=orders&viewstatut=0','','StatusOrderDraftShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162291,'auguria',1,'','left','commercial',162289,NULL,NULL,3,'/commande/list.php?leftmenu=orders&viewstatut=1','','StatusOrderValidated','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162292,'auguria',1,'','left','commercial',162289,NULL,NULL,4,'/commande/list.php?leftmenu=orders&viewstatut=2','','StatusOrderOnProcessShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162293,'auguria',1,'','left','commercial',162289,NULL,NULL,5,'/commande/list.php?leftmenu=orders&viewstatut=3','','StatusOrderToBill','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162294,'auguria',1,'','left','commercial',162289,NULL,NULL,6,'/commande/list.php?leftmenu=orders&viewstatut=4','','StatusOrderProcessed','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162295,'auguria',1,'','left','commercial',162289,NULL,NULL,7,'/commande/list.php?leftmenu=orders&viewstatut=-1','','StatusOrderCanceledShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162296,'auguria',1,'','left','commercial',162287,NULL,NULL,4,'/commande/stats/index.php?leftmenu=orders','','Statistics','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2017-08-30 15:14:30'),(162387,'auguria',1,'','left','commercial',161090,NULL,NULL,6,'/expedition/index.php?leftmenu=sendings','','Shipments','sendings',0,'sendings','$user->rights->expedition->lire','$conf->expedition->enabled',2,'2017-08-30 15:14:30'),(162388,'auguria',1,'','left','commercial',162387,NULL,NULL,0,'/expedition/card.php?action=create2&leftmenu=sendings','','NewSending','sendings',1,'','$user->rights->expedition->creer','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2017-08-30 15:14:30'),(162389,'auguria',1,'','left','commercial',162387,NULL,NULL,1,'/expedition/list.php?leftmenu=sendings','','List','sendings',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2017-08-30 15:14:30'),(162390,'auguria',1,'','left','commercial',162387,NULL,NULL,2,'/expedition/stats/index.php?leftmenu=sendings','','Statistics','sendings',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2017-08-30 15:14:30'),(162487,'auguria',1,'','left','commercial',161092,NULL,NULL,7,'/contrat/index.php?leftmenu=contracts','','Contracts','contracts',0,'contracts','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2017-08-30 15:14:30'),(162488,'auguria',1,'','left','commercial',162487,NULL,NULL,0,'/contrat/card.php?&action=create&leftmenu=contracts','','NewContract','contracts',1,'','$user->rights->contrat->creer','$conf->contrat->enabled',2,'2017-08-30 15:14:30'),(162489,'auguria',1,'','left','commercial',162487,NULL,NULL,1,'/contrat/list.php?leftmenu=contracts','','List','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2017-08-30 15:14:30'),(162490,'auguria',1,'','left','commercial',162487,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts','','MenuServices','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2017-08-30 15:14:30'),(162491,'auguria',1,'','left','commercial',162490,NULL,NULL,0,'/contrat/services.php?leftmenu=contracts&mode=0','','MenuInactiveServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled && $leftmenu==\"contracts\"',2,'2017-08-30 15:14:30'),(162492,'auguria',1,'','left','commercial',162490,NULL,NULL,1,'/contrat/services.php?leftmenu=contracts&mode=4','','MenuRunningServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled && $leftmenu==\"contracts\"',2,'2017-08-30 15:14:30'),(162493,'auguria',1,'','left','commercial',162490,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts&mode=4&filter=expired','','MenuExpiredServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled && $leftmenu==\"contracts\"',2,'2017-08-30 15:14:30'),(162494,'auguria',1,'','left','commercial',162490,NULL,NULL,3,'/contrat/services.php?leftmenu=contracts&mode=5','','MenuClosedServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled && $leftmenu==\"contracts\"',2,'2017-08-30 15:14:30'),(162587,'auguria',1,'','left','commercial',161092,NULL,NULL,8,'/fichinter/list.php?leftmenu=ficheinter','','Interventions','interventions',0,'ficheinter','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(162588,'auguria',1,'','left','commercial',162587,NULL,NULL,0,'/fichinter/card.php?action=create&leftmenu=ficheinter','','NewIntervention','interventions',1,'','$user->rights->ficheinter->creer','$conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(162589,'auguria',1,'','left','commercial',162587,NULL,NULL,1,'/fichinter/list.php?leftmenu=ficheinter','','List','interventions',1,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(162590,'auguria',1,'','left','commercial',162587,NULL,NULL,2,'/fichinter/stats/index.php?leftmenu=ficheinter','','Statistics','interventions',1,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(162687,'auguria',1,'','left','accountancy',161093,NULL,NULL,3,'/fourn/facture/list.php?leftmenu=suppliers_bills','','BillsSuppliers','bills',0,'supplier_bills','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162688,'auguria',1,'','left','accountancy',162687,NULL,NULL,0,'/fourn/facture/card.php?action=create&leftmenu=suppliers_bills','','NewBill','bills',1,'','$user->rights->fournisseur->facture->creer','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162689,'auguria',1,'','left','accountancy',162687,NULL,NULL,1,'/fourn/facture/list.php?leftmenu=suppliers_bills','','List','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162690,'auguria',1,'','left','accountancy',162687,NULL,NULL,2,'/fourn/facture/paiement.php?leftmenu=suppliers_bills','','Payments','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162691,'auguria',1,'','left','accountancy',162687,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier','','Statistics','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162692,'auguria',1,'','left','accountancy',162690,NULL,NULL,1,'/fourn/facture/rapport.php?leftmenu=suppliers_bills','','Reporting','bills',2,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162787,'auguria',1,'','left','accountancy',161093,NULL,NULL,3,'/compta/facture/list.php?leftmenu=customers_bills','','BillsCustomers','bills',0,'customer_bills','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162788,'auguria',1,'','left','accountancy',162787,NULL,NULL,3,'/compta/facture/card.php?action=create&leftmenu=customers_bills','','NewBill','bills',1,'','$user->rights->facture->creer','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162789,'auguria',1,'','left','accountancy',162787,NULL,NULL,5,'/compta/facture/fiche-rec.php?leftmenu=customers_bills','','ListOfTemplates','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162791,'auguria',1,'','left','accountancy',162787,NULL,NULL,6,'/compta/paiement/list.php?leftmenu=customers_bills','','Payments','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162792,'auguria',1,'','left','accountancy',162787,NULL,NULL,4,'/compta/facture/list.php?leftmenu=customers_bills','','List','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162797,'auguria',1,'','left','accountancy',162791,NULL,NULL,1,'/compta/paiement/rapport.php?leftmenu=customers_bills','','Reportings','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162798,'auguria',1,'','left','accountancy',161101,NULL,NULL,9,'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank','','MenuChequeDeposits','bills',0,'checks','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2017-08-30 15:14:30'),(162799,'auguria',1,'','left','accountancy',162798,NULL,NULL,0,'/compta/paiement/cheque/card.php?leftmenu=checks&action=new','','NewCheckDeposit','compta',1,'','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2017-08-30 15:14:30'),(162800,'auguria',1,'','left','accountancy',162798,NULL,NULL,1,'/compta/paiement/cheque/list.php?leftmenu=checks','','List','bills',1,'','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2017-08-30 15:14:30'),(162801,'auguria',1,'','left','accountancy',162787,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills','','Statistics','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162807,'auguria',1,'','left','accountancy',162792,NULL,NULL,1,'/compta/facture/list.php?leftmenu=customers_bills&search_status=0','','BillShortStatusDraft','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162808,'auguria',1,'','left','accountancy',162792,NULL,NULL,2,'/compta/facture/list.php?leftmenu=customers_bills&search_status=1','','BillShortStatusNotPaid','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162809,'auguria',1,'','left','accountancy',162792,NULL,NULL,3,'/compta/facture/list.php?leftmenu=customers_bills&search_status=2','','BillShortStatusPaid','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162810,'auguria',1,'','left','accountancy',162792,NULL,NULL,4,'/compta/facture/list.php?leftmenu=customers_bills&search_status=3','','BillShortStatusCanceled','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162987,'auguria',1,'','left','accountancy',161093,NULL,NULL,3,'/commande/list.php?leftmenu=orders&viewstatut=3','','MenuOrdersToBill','orders',0,'orders','$user->rights->commande->lire','$conf->commande->enabled',0,'2017-08-30 15:14:30'),(163087,'auguria',1,'','left','accountancy',161093,NULL,NULL,4,'/don/index.php?leftmenu=donations&mainmenu=accountancy','','Donations','donations',0,'donations','$user->rights->don->lire','$conf->don->enabled',2,'2017-08-30 15:14:30'),(163088,'auguria',1,'','left','accountancy',163087,NULL,NULL,0,'/don/card.php?leftmenu=donations&mainmenu=accountancy&action=create','','NewDonation','donations',1,'','$user->rights->don->creer','$conf->don->enabled && $leftmenu==\"donations\"',2,'2017-08-30 15:14:30'),(163089,'auguria',1,'','left','accountancy',163087,NULL,NULL,1,'/don/list.php?leftmenu=donations&mainmenu=accountancy','','List','donations',1,'','$user->rights->don->lire','$conf->don->enabled && $leftmenu==\"donations\"',2,'2017-08-30 15:14:30'),(163187,'auguria',1,'','left','accountancy',161102,NULL,NULL,5,'/compta/deplacement/index.php?leftmenu=tripsandexpenses','','TripsAndExpenses','trips',0,'tripsandexpenses','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2017-08-30 15:14:30'),(163188,'auguria',1,'','left','accountancy',163187,NULL,NULL,1,'/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses','','New','trips',1,'','$user->rights->deplacement->creer','$conf->deplacement->enabled',0,'2017-08-30 15:14:30'),(163189,'auguria',1,'','left','accountancy',163187,NULL,NULL,2,'/compta/deplacement/list.php?leftmenu=tripsandexpenses','','List','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2017-08-30 15:14:30'),(163190,'auguria',1,'','left','accountancy',163187,NULL,NULL,2,'/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses','','Statistics','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2017-08-30 15:14:30'),(163287,'auguria',1,'','left','accountancy',161093,NULL,NULL,6,'/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy','','MenuSpecialExpenses','compta',0,'tax','(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)','$conf->tax->enabled || $conf->salaries->enabled',0,'2017-08-30 15:14:30'),(163297,'auguria',1,'','left','accountancy',163287,NULL,NULL,1,'/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy','','Salaries','salaries',1,'tax_sal','$user->rights->salaries->payment->read','$conf->salaries->enabled',0,'2017-08-30 15:14:30'),(163298,'auguria',1,'','left','accountancy',163297,NULL,NULL,2,'/compta/salaries/card.php?leftmenu=tax_salary&action=create','','NewPayment','companies',2,'','$user->rights->salaries->payment->write','$conf->salaries->enabled && $leftmenu==\"tax_salary\"',0,'2017-08-30 15:14:30'),(163299,'auguria',1,'','left','accountancy',163297,NULL,NULL,3,'/compta/salaries/index.php?leftmenu=tax_salary','','Payments','companies',2,'','$user->rights->salaries->payment->read','$conf->salaries->enabled && $leftmenu==\"tax_salary\"',0,'2017-08-30 15:14:30'),(163307,'auguria',1,'','left','accountancy',163287,NULL,NULL,1,'/loan/index.php?leftmenu=tax_loan&mainmenu=accountancy','','Loans','loan',1,'tax_loan','$user->rights->loan->read','$conf->loan->enabled',0,'2017-08-30 15:14:30'),(163308,'auguria',1,'','left','accountancy',163307,NULL,NULL,2,'/loan/card.php?leftmenu=tax_loan&action=create','','NewLoan','loan',2,'','$user->rights->loan->write','$conf->loan->enabled && $leftmenu==\"tax_loan\"',0,'2017-08-30 15:14:30'),(163310,'auguria',1,'','left','accountancy',163307,NULL,NULL,4,'/loan/calc.php?leftmenu=tax_loan','','Calculator','companies',2,'','$user->rights->loan->calc','$conf->loan->enabled && $leftmenu==\"tax_loan\" && ! empty($conf->global->LOAN_SHOW_CALCULATOR)',0,'2017-08-30 15:14:30'),(163337,'auguria',1,'','left','accountancy',163287,NULL,NULL,1,'/compta/sociales/index.php?leftmenu=tax_social','','SocialContributions','',1,'tax_social','$user->rights->tax->charges->lire','$conf->tax->enabled',0,'2017-08-30 15:14:30'),(163338,'auguria',1,'','left','accountancy',163337,NULL,NULL,2,'/compta/sociales/card.php?leftmenu=tax_social&action=create','','MenuNewSocialContribution','',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2017-08-30 15:14:30'),(163339,'auguria',1,'','left','accountancy',163337,NULL,NULL,3,'/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly','','Payments','',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2017-08-30 15:14:30'),(163387,'auguria',1,'','left','accountancy',163287,NULL,NULL,7,'/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy','','VAT','companies',1,'tax_vat','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)',0,'2017-08-30 15:14:30'),(163388,'auguria',1,'','left','accountancy',163387,NULL,NULL,0,'/compta/tva/card.php?leftmenu=tax_vat&action=create','','New','companies',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2017-08-30 15:14:30'),(163389,'auguria',1,'','left','accountancy',163387,NULL,NULL,1,'/compta/tva/reglement.php?leftmenu=tax_vat','','List','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2017-08-30 15:14:30'),(163390,'auguria',1,'','left','accountancy',163387,NULL,NULL,2,'/compta/tva/clients.php?leftmenu=tax_vat','','ReportByCustomers','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2017-08-30 15:14:30'),(163391,'auguria',1,'','left','accountancy',163387,NULL,NULL,3,'/compta/tva/quadri_detail.php?leftmenu=tax_vat','','ReportByQuarter','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2017-08-30 15:14:30'),(163487,'auguria',1,'','left','accountancy',161093,NULL,NULL,7,'/accountancy/index.php?leftmenu=accountancy','','MenuAccountancy','accountancy',0,'accounting','! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163488,'auguria',1,'','left','accountancy',163487,NULL,NULL,2,'/accountancy/customer/index.php?leftmenu=dispatch_customer','','CustomersVentilation','accountancy',1,'dispatch_customer','$user->rights->accounting->bind->write','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163489,'auguria',1,'','left','accountancy',163488,NULL,NULL,3,'/accountancy/customer/list.php','','ToDispatch','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $leftmenu==\"dispatch_customer\"',0,'2017-08-30 15:14:30'),(163490,'auguria',1,'','left','accountancy',163488,NULL,NULL,4,'/accountancy/customer/lines.php','','Dispatched','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $leftmenu==\"dispatch_customer\"',0,'2017-08-30 15:14:30'),(163497,'auguria',1,'','left','accountancy',163487,NULL,NULL,5,'/accountancy/supplier/index.php?leftmenu=dispatch_supplier','','SuppliersVentilation','accountancy',1,'ventil_supplier','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->fournisseur->enabled',0,'2017-08-30 15:14:30'),(163498,'auguria',1,'','left','accountancy',163497,NULL,NULL,6,'/accountancy/supplier/list.php','','ToDispatch','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu==\"dispatch_supplier\"',0,'2017-08-30 15:14:30'),(163499,'auguria',1,'','left','accountancy',163497,NULL,NULL,7,'/accountancy/supplier/lines.php','','Dispatched','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu==\"dispatch_supplier\"',0,'2017-08-30 15:14:30'),(163507,'auguria',1,'','left','accountancy',163487,NULL,NULL,5,'/accountancy/expensereport/index.php?leftmenu=dispatch_expensereport','','ExpenseReportsVentilation','accountancy',1,'ventil_expensereport','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(163508,'auguria',1,'','left','accountancy',163507,NULL,NULL,6,'/accountancy/expensereport/list.php','','ToDispatch','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu==\"dispatch_expensereport\"',0,'2017-08-30 15:14:30'),(163509,'auguria',1,'','left','accountancy',163507,NULL,NULL,7,'/accountancy/expensereport/lines.php','','Dispatched','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu==\"dispatch_expensereport\"',0,'2017-08-30 15:14:30'),(163517,'auguria',1,'','left','accountancy',163487,NULL,NULL,15,'/accountancy/bookkeeping/list.php','','Bookkeeping','accountancy',1,'bookkeeping','$user->rights->accounting->mouvements->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163522,'auguria',1,'','left','accountancy',163487,NULL,NULL,16,'/accountancy/bookkeeping/balance.php','','AccountBalance','accountancy',1,'balance','$user->rights->accounting->mouvements->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163527,'auguria',1,'','left','accountancy',163487,NULL,NULL,17,'/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy','','Reportings','main',1,'report','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163528,'auguria',1,'','left','accountancy',163527,NULL,NULL,19,'/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy','','ReportInOut','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163529,'auguria',1,'','left','accountancy',163528,NULL,NULL,18,'/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy','','ByAccounts','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163530,'auguria',1,'','left','accountancy',163528,NULL,NULL,20,'/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy','','ByCompanies','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163531,'auguria',1,'','left','accountancy',163527,NULL,NULL,21,'/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy','','ReportTurnover','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163532,'auguria',1,'','left','accountancy',163531,NULL,NULL,22,'/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy','','ByCompanies','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163533,'auguria',1,'','left','accountancy',163531,NULL,NULL,23,'/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy','','ByUsers','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163534,'auguria',1,'','left','accountancy',163531,NULL,NULL,24,'/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=accountancy','','ByProductsAndServices','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163537,'auguria',1,'','left','accountancy',163538,NULL,NULL,80,'/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin','','FiscalPeriod','admin',1,'accountancy_admin_period','','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\" && $conf->global->MAIN_FEATURES_LEVEL > 0',2,'2017-08-30 15:14:30'),(163538,'auguria',1,'','left','accountancy',163487,NULL,NULL,1,'/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin','','Setup','accountancy',1,'accountancy_admin','$user->rights->accounting->chartofaccount','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163541,'auguria',1,'','left','accountancy',163538,NULL,NULL,10,'/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin','','AccountingJournals','accountancy',2,'accountancy_admin_journal','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163542,'auguria',1,'','left','accountancy',163538,NULL,NULL,20,'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin','','Pcg_version','accountancy',2,'accountancy_admin_chartmodel','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163543,'auguria',1,'','left','accountancy',163538,NULL,NULL,30,'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin','','Chartofaccounts','accountancy',2,'accountancy_admin_chart','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163544,'auguria',1,'','left','accountancy',163538,NULL,NULL,40,'/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin','','AccountingCategory','accountancy',2,'accountancy_admin_chart_group','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163545,'auguria',1,'','left','accountancy',163538,NULL,NULL,50,'/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin','','MenuDefaultAccounts','accountancy',2,'accountancy_admin_default','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163546,'auguria',1,'','left','accountancy',163538,NULL,NULL,60,'/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin','','MenuVatAccounts','accountancy',2,'accountancy_admin_vat','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163547,'auguria',1,'','left','accountancy',163538,NULL,NULL,70,'/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin','','MenuTaxAccounts','accountancy',2,'accountancy_admin_tax','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163548,'auguria',1,'','left','accountancy',163538,NULL,NULL,80,'/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin','','MenuExpenseReportAccounts','accountancy',2,'accountancy_admin_expensereport','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163549,'auguria',1,'','left','accountancy',163538,NULL,NULL,90,'/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin','','MenuProductsAccounts','accountancy',2,'accountancy_admin_product','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163587,'auguria',1,'','left','accountancy',161101,NULL,NULL,9,'/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank','','StandingOrders','withdrawals',0,'withdraw','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled',2,'2017-08-30 15:14:30'),(163589,'auguria',1,'','left','accountancy',163587,NULL,NULL,0,'/compta/prelevement/create.php?leftmenu=withdraw','','NewStandingOrder','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163590,'auguria',1,'','left','accountancy',163587,NULL,NULL,2,'/compta/prelevement/bons.php?leftmenu=withdraw','','WithdrawalsReceipts','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163591,'auguria',1,'','left','accountancy',163587,NULL,NULL,3,'/compta/prelevement/list.php?leftmenu=withdraw','','WithdrawalsLines','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163593,'auguria',1,'','left','accountancy',163587,NULL,NULL,5,'/compta/prelevement/rejets.php?leftmenu=withdraw','','Rejects','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163594,'auguria',1,'','left','accountancy',163587,NULL,NULL,6,'/compta/prelevement/stats.php?leftmenu=withdraw','','Statistics','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163687,'auguria',1,'','left','accountancy',161101,NULL,NULL,1,'/compta/bank/index.php?leftmenu=bank&mainmenu=bank','','MenuBankCash','banks',0,'bank','$user->rights->banque->lire','$conf->banque->enabled',0,'2017-08-30 15:14:30'),(163688,'auguria',1,'','left','accountancy',163687,NULL,NULL,0,'/compta/bank/card.php?action=create&leftmenu=bank','','MenuNewFinancialAccount','banks',1,'','$user->rights->banque->configurer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2017-08-30 15:14:30'),(163690,'auguria',1,'','left','accountancy',163687,NULL,NULL,2,'/compta/bank/bankentries.php?leftmenu=bank','','ListTransactions','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2017-08-30 15:14:30'),(163691,'auguria',1,'','left','accountancy',163687,NULL,NULL,3,'/compta/bank/budget.php?leftmenu=bank','','ListTransactionsByCategory','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2017-08-30 15:14:30'),(163693,'auguria',1,'','left','accountancy',163687,NULL,NULL,5,'/compta/bank/transfer.php?leftmenu=bank','','BankTransfers','banks',1,'','$user->rights->banque->transfer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2017-08-30 15:14:30'),(163737,'auguria',1,'','left','accountancy',161101,NULL,NULL,4,'/categories/index.php?leftmenu=bank&type=5','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(163738,'auguria',1,'','left','accountancy',163737,NULL,NULL,0,'/categories/card.php?leftmenu=bank&action=create&type=5','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(163787,'auguria',1,'','left','accountancy',161093,NULL,NULL,11,'/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy','','Reportings','main',0,'ca','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled',0,'2017-08-30 15:14:30'),(163792,'auguria',1,'','left','accountancy',163487,NULL,NULL,1,'','','Journalization','main',1,'','$user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163793,'auguria',1,'','left','accountancy',163792,NULL,NULL,4,'/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1','','SellsJournal','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163794,'auguria',1,'','left','accountancy',163792,NULL,NULL,1,'/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3','','BankJournal','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163795,'auguria',1,'','left','accountancy',163792,NULL,NULL,2,'/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6','','ExpenseReportJournal','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163796,'auguria',1,'','left','accountancy',163792,NULL,NULL,3,'/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2','','PurchasesJournal','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163798,'auguria',1,'','left','accountancy',163787,NULL,NULL,0,'/compta/resultat/index.php?leftmenu=ca','','ReportInOut','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163799,'auguria',1,'','left','accountancy',163788,NULL,NULL,0,'/compta/resultat/clientfourn.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163800,'auguria',1,'','left','accountancy',163787,NULL,NULL,1,'/compta/stats/index.php?leftmenu=ca','','ReportTurnover','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163801,'auguria',1,'','left','accountancy',163790,NULL,NULL,0,'/compta/stats/casoc.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163802,'auguria',1,'','left','accountancy',163790,NULL,NULL,1,'/compta/stats/cabyuser.php?leftmenu=ca','','ByUsers','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163803,'auguria',1,'','left','accountancy',163790,NULL,NULL,1,'/compta/stats/cabyprodserv.php?leftmenu=ca','','ByProductsAndServices','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163887,'auguria',1,'','left','products',161090,NULL,NULL,0,'/product/index.php?leftmenu=product&type=0','','Products','products',0,'product','$user->rights->produit->lire','$conf->product->enabled',2,'2017-08-30 15:14:30'),(163888,'auguria',1,'','left','products',163887,NULL,NULL,0,'/product/card.php?leftmenu=product&action=create&type=0','','NewProduct','products',1,'','$user->rights->produit->creer','$conf->product->enabled',2,'2017-08-30 15:14:30'),(163889,'auguria',1,'','left','products',163887,NULL,NULL,1,'/product/list.php?leftmenu=product&type=0','','List','products',1,'','$user->rights->produit->lire','$conf->product->enabled',2,'2017-08-30 15:14:30'),(163890,'auguria',1,'','left','products',163887,NULL,NULL,4,'/product/reassort.php?type=0','','Stocks','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->product->enabled',2,'2017-08-30 15:14:30'),(163891,'auguria',1,'','left','products',163887,NULL,NULL,7,'/product/stats/card.php?id=all&leftmenu=stats&type=0','','Statistics','main',1,'','$user->rights->produit->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(163892,'auguria',1,'','left','products',163887,NULL,NULL,5,'/product/reassortlot.php?type=0','','StocksByLotSerial','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->productbatch->enabled',2,'2017-08-30 15:14:30'),(163893,'auguria',1,'','left','products',163887,NULL,NULL,6,'/product/stock/productlot_list.php','','LotSerial','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->productbatch->enabled',2,'2017-08-30 15:14:30'),(163987,'auguria',1,'','left','products',161090,NULL,NULL,1,'/product/index.php?leftmenu=service&type=1','','Services','products',0,'service','$user->rights->service->lire','$conf->service->enabled',2,'2017-08-30 15:14:30'),(163988,'auguria',1,'','left','products',163987,NULL,NULL,0,'/product/card.php?leftmenu=service&action=create&type=1','','NewService','products',1,'','$user->rights->service->creer','$conf->service->enabled',2,'2017-08-30 15:14:30'),(163989,'auguria',1,'','left','products',163987,NULL,NULL,1,'/product/list.php?leftmenu=service&type=1','','List','products',1,'','$user->rights->service->lire','$conf->service->enabled',2,'2017-08-30 15:14:30'),(163990,'auguria',1,'','left','products',163987,NULL,NULL,5,'/product/stats/card.php?id=all&leftmenu=stats&type=1','','Statistics','main',1,'','$user->rights->service->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(164187,'auguria',1,'','left','products',161090,NULL,NULL,3,'/product/stock/index.php?leftmenu=stock','','Stock','stocks',0,'stock','$user->rights->stock->lire','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164188,'auguria',1,'','left','products',164187,NULL,NULL,0,'/product/stock/card.php?action=create','','MenuNewWarehouse','stocks',1,'','$user->rights->stock->creer','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164189,'auguria',1,'','left','products',164187,NULL,NULL,1,'/product/stock/list.php','','List','stocks',1,'','$user->rights->stock->lire','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164191,'auguria',1,'','left','products',164187,NULL,NULL,3,'/product/stock/mouvement.php','','Movements','stocks',1,'','$user->rights->stock->mouvement->lire','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164192,'auguria',1,'','left','products',164187,NULL,NULL,4,'/product/stock/replenish.php','','Replenishments','stocks',1,'','$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire','$conf->stock->enabled && $conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(164193,'auguria',1,'','left','products',164187,NULL,NULL,5,'/product/stock/massstockmove.php','','MassStockTransferShort','stocks',1,'','$user->rights->stock->mouvement->creer','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164287,'auguria',1,'','left','products',161090,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=0','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(164288,'auguria',1,'','left','products',164287,NULL,NULL,0,'/categories/card.php?action=create&type=0','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(164487,'auguria',1,'','left','project',161094,NULL,NULL,3,'/projet/activity/perweek.php?leftmenu=projects','','NewTimeSpent','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164687,'auguria',1,'','left','project',161094,NULL,NULL,0,'/projet/index.php?leftmenu=projects','','Projects','projects',0,'projects','$user->rights->projet->lire','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(164688,'auguria',1,'','left','project',164687,NULL,NULL,1,'/projet/card.php?leftmenu=projects&action=create','','NewProject','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(164689,'auguria',1,'','left','project',164687,NULL,NULL,2,'/projet/list.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(164690,'auguria',1,'','left','project',164687,NULL,NULL,3,'/projet/stats/index.php?leftmenu=projects','','Statistics','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(164787,'auguria',1,'','left','project',161094,NULL,NULL,0,'/projet/activity/index.php?leftmenu=projects','','Activities','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164788,'auguria',1,'','left','project',164787,NULL,NULL,1,'/projet/tasks.php?leftmenu=projects&action=create','','NewTask','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164789,'auguria',1,'','left','project',164787,NULL,NULL,2,'/projet/tasks/list.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164791,'auguria',1,'','left','project',164787,NULL,NULL,4,'/projet/tasks/stats/index.php?leftmenu=projects','','Statistics','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164891,'auguria',1,'','left','project',161094,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=6','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(164892,'auguria',1,'','left','project',164891,NULL,NULL,0,'/categories/card.php?action=create&type=6','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(164987,'auguria',1,'','left','tools',161095,NULL,NULL,0,'/comm/mailing/index.php?leftmenu=mailing','','EMailings','mails',0,'mailing','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2017-08-30 15:14:30'),(164988,'auguria',1,'','left','tools',164987,NULL,NULL,0,'/comm/mailing/card.php?leftmenu=mailing&action=create','','NewMailing','mails',1,'','$user->rights->mailing->creer','$conf->mailing->enabled',0,'2017-08-30 15:14:30'),(164989,'auguria',1,'','left','tools',164987,NULL,NULL,1,'/comm/mailing/list.php?leftmenu=mailing','','List','mails',1,'','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2017-08-30 15:14:30'),(165187,'auguria',1,'','left','tools',161095,NULL,NULL,2,'/exports/index.php?leftmenu=export','','FormatedExport','exports',0,'export','$user->rights->export->lire','$conf->export->enabled',2,'2017-08-30 15:14:30'),(165188,'auguria',1,'','left','tools',165187,NULL,NULL,0,'/exports/export.php?leftmenu=export','','NewExport','exports',1,'','$user->rights->export->creer','$conf->export->enabled',2,'2017-08-30 15:14:30'),(165217,'auguria',1,'','left','tools',161095,NULL,NULL,2,'/imports/index.php?leftmenu=import','','FormatedImport','exports',0,'import','$user->rights->import->run','$conf->import->enabled',2,'2017-08-30 15:14:30'),(165218,'auguria',1,'','left','tools',165217,NULL,NULL,0,'/imports/import.php?leftmenu=import','','NewImport','exports',1,'','$user->rights->import->run','$conf->import->enabled',2,'2017-08-30 15:14:30'),(165287,'auguria',1,'','left','members',161100,NULL,NULL,0,'/adherents/index.php?leftmenu=members&mainmenu=members','','Members','members',0,'members','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165288,'auguria',1,'','left','members',165287,NULL,NULL,0,'/adherents/card.php?leftmenu=members&action=create','','NewMember','members',1,'','$user->rights->adherent->creer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165289,'auguria',1,'','left','members',165287,NULL,NULL,1,'/adherents/list.php','','List','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165290,'auguria',1,'','left','members',165289,NULL,NULL,2,'/adherents/list.php?leftmenu=members&statut=-1','','MenuMembersToValidate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165291,'auguria',1,'','left','members',165289,NULL,NULL,3,'/adherents/list.php?leftmenu=members&statut=1','','MenuMembersValidated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165292,'auguria',1,'','left','members',165289,NULL,NULL,4,'/adherents/list.php?leftmenu=members&statut=1&filter=outofdate','','MenuMembersNotUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165293,'auguria',1,'','left','members',165289,NULL,NULL,5,'/adherents/list.php?leftmenu=members&statut=1&filter=uptodate','','MenuMembersUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165294,'auguria',1,'','left','members',165289,NULL,NULL,6,'/adherents/list.php?leftmenu=members&statut=0','','MenuMembersResiliated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165295,'auguria',1,'','left','members',165287,NULL,NULL,7,'/adherents/stats/geo.php?leftmenu=members&mode=memberbycountry','','MenuMembersStats','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165387,'auguria',1,'','left','members',161100,NULL,NULL,1,'/adherents/index.php?leftmenu=members&mainmenu=members','','Subscriptions','compta',0,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165388,'auguria',1,'','left','members',165387,NULL,NULL,0,'/adherents/list.php?statut=-1&leftmenu=accountancy&mainmenu=members','','NewSubscription','compta',1,'','$user->rights->adherent->cotisation->creer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165389,'auguria',1,'','left','members',165387,NULL,NULL,1,'/adherents/subscription/list.php?leftmenu=members','','List','compta',1,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165390,'auguria',1,'','left','members',165387,NULL,NULL,7,'/adherents/stats/index.php?leftmenu=members','','MenuMembersStats','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165589,'auguria',1,'','left','members',165287,NULL,NULL,9,'/adherents/htpasswd.php?leftmenu=export','','Filehtpasswd','members',1,'','$user->rights->adherent->export','! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && $conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165590,'auguria',1,'','left','members',165287,NULL,NULL,10,'/adherents/cartes/carte.php?leftmenu=export','','MembersCards','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165687,'auguria',1,'','left','hrm',161102,NULL,NULL,1,'/user/index.php?leftmenu=hrm&mode=employee','','Employees','hrm',0,'hrm','$user->rights->hrm->employee->read','$conf->hrm->enabled',0,'2017-08-30 15:14:30'),(165688,'auguria',1,'','left','hrm',165687,NULL,NULL,1,'/user/card.php?action=create&employee=1','','NewEmployee','hrm',1,'','$user->rights->hrm->employee->write','$conf->hrm->enabled',0,'2017-08-30 15:14:30'),(165689,'auguria',1,'','left','hrm',165687,NULL,NULL,2,'/user/index.php?$leftmenu=hrm&mode=employee&contextpage=employeelist','','List','hrm',1,'','$user->rights->hrm->employee->read','$conf->hrm->enabled',0,'2017-08-30 15:14:30'),(165787,'auguria',1,'','left','members',161100,NULL,NULL,5,'/adherents/type.php?leftmenu=setup&mainmenu=members','','MembersTypes','members',0,'setup','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165788,'auguria',1,'','left','members',165787,NULL,NULL,0,'/adherents/type.php?leftmenu=setup&mainmenu=members&action=create','','New','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165789,'auguria',1,'','left','members',165787,NULL,NULL,1,'/adherents/type.php?leftmenu=setup&mainmenu=members','','List','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(166087,'auguria',1,'','left','hrm',161102,NULL,NULL,1,'/holiday/list.php?&leftmenu=hrm','','CPTitreMenu','holiday',0,'hrm','$user->rights->holiday->read','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166088,'auguria',1,'','left','hrm',166087,NULL,NULL,1,'/holiday/card.php?&action=request','','MenuAddCP','holiday',1,'','$user->rights->holiday->write','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166089,'auguria',1,'','left','hrm',166087,NULL,NULL,1,'/holiday/list.php?&leftmenu=hrm','','List','holiday',1,'','$user->rights->holiday->read','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166090,'auguria',1,'','left','hrm',166089,NULL,NULL,1,'/holiday/list.php?select_statut=2&leftmenu=hrm','','ListToApprove','trips',2,'','$user->rights->holiday->read','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166091,'auguria',1,'','left','hrm',166087,NULL,NULL,2,'/holiday/define_holiday.php?&action=request','','MenuConfCP','holiday',1,'','$user->rights->holiday->define_holiday','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166092,'auguria',1,'','left','hrm',166087,NULL,NULL,3,'/holiday/view_log.php?&action=request','','MenuLogCP','holiday',1,'','$user->rights->holiday->define_holiday','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166187,'auguria',1,'','left','commercial',161092,NULL,NULL,6,'/fourn/commande/index.php?leftmenu=orders_suppliers','','SuppliersOrders','orders',0,'orders_suppliers','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(166188,'auguria',1,'','left','commercial',166187,NULL,NULL,0,'/fourn/commande/card.php?action=create&leftmenu=orders_suppliers','','NewOrder','orders',1,'','$user->rights->fournisseur->commande->creer','$conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(166189,'auguria',1,'','left','commercial',166187,NULL,NULL,1,'/fourn/commande/list.php?leftmenu=orders_suppliers&viewstatut=0','','List','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(166195,'auguria',1,'','left','commercial',166187,NULL,NULL,7,'/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier','','Statistics','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(166287,'auguria',1,'','left','members',161100,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=3','','MembersCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->adherent->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(166288,'auguria',1,'','left','members',166287,NULL,NULL,0,'/categories/card.php?action=create&type=3','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->adherent->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(166387,'auguria',1,'','left','hrm',161102,NULL,NULL,5,'/expensereport/index.php?leftmenu=expensereport','','TripsAndExpenses','trips',0,'expensereport','$user->rights->expensereport->lire','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166388,'auguria',1,'','left','hrm',166387,NULL,NULL,1,'/expensereport/card.php?action=create&leftmenu=expensereport','','New','trips',1,'','$user->rights->expensereport->creer','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166389,'auguria',1,'','left','hrm',166387,NULL,NULL,2,'/expensereport/list.php?leftmenu=expensereport','','List','trips',1,'','$user->rights->expensereport->lire','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166390,'auguria',1,'','left','hrm',166389,NULL,NULL,2,'/expensereport/list.php?search_status=2&leftmenu=expensereport','','ListToApprove','trips',2,'','$user->rights->expensereport->approve','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166391,'auguria',1,'','left','hrm',166387,NULL,NULL,2,'/expensereport/stats/index.php?leftmenu=expensereport','','Statistics','trips',1,'','$user->rights->expensereport->lire','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166467,'all',1,'variants','left','products',-1,'product','products',100,'/variants/list.php','','VariantAttributes','products',NULL,'product','1','$conf->product->enabled',0,'2018-01-19 11:28:04'),(166541,'all',1,'ticket','top','ticket',0,NULL,NULL,88,'/ticket/index.php','','Ticket','ticket',NULL,'1','$user->rights->ticket->read','$conf->ticket->enabled',2,'2019-06-05 09:15:29'),(166542,'all',1,'ticket','left','ticket',-1,NULL,'ticket',101,'/ticket/index.php','','Ticket','ticket',NULL,'ticket','$user->rights->ticket->read','$conf->ticket->enabled',2,'2019-06-05 09:15:29'),(166543,'all',1,'ticket','left','ticket',-1,'ticket','ticket',102,'/ticket/card.php?action=create','','NewTicket','ticket',NULL,NULL,'$user->rights->ticket->write','$conf->ticket->enabled',2,'2019-06-05 09:15:29'),(166544,'all',1,'ticket','left','ticket',-1,'ticket','ticket',103,'/ticket/list.php?search_fk_status=non_closed','','List','ticket',NULL,'ticketlist','$user->rights->ticket->read','$conf->ticket->enabled',2,'2019-06-05 09:15:29'),(166545,'all',1,'ticket','left','ticket',-1,'ticket','ticket',105,'/ticket/list.php?mode=mine&search_fk_status=non_closed','','MenuTicketMyAssign','ticket',NULL,'ticketmy','$user->rights->ticket->read','$conf->ticket->enabled',0,'2019-06-05 09:15:29'),(166546,'all',1,'ticket','left','ticket',-1,'ticket','ticket',107,'/ticket/stats/index.php','','Statistics','ticket',NULL,NULL,'$user->rights->ticket->read','$conf->ticket->enabled',0,'2019-06-05 09:15:29'),(166547,'all',1,'takepos','top','takepos',0,NULL,NULL,1001,'/takepos/takepos.php','takepos','PointOfSaleShort','cashdesk',NULL,NULL,'1','$conf->takepos->enabled',2,'2019-06-05 09:15:58'),(166919,'all',1,'supplier_proposal','left','commercial',-1,NULL,'commercial',300,'/supplier_proposal/index.php','','SupplierProposalsShort','supplier_proposal',NULL,'supplier_proposalsubmenu','$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2020-01-13 14:37:09'),(166920,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',301,'/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals','','SupplierProposalNew','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->creer','$conf->supplier_proposal->enabled',2,'2020-01-13 14:37:09'),(166921,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',302,'/supplier_proposal/list.php?leftmenu=supplier_proposals','','List','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2020-01-13 14:37:09'),(166922,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',303,'/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier','','Statistics','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2020-01-13 14:37:09'),(166923,'all',1,'resource','left','tools',-1,NULL,'tools',100,'/resource/list.php','','MenuResourceIndex','resource',NULL,'resource','$user->rights->resource->read','1',0,'2020-01-20 11:46:00'),(166924,'all',1,'resource','left','tools',-1,'resource','tools',101,'/resource/card.php?action=create','','MenuResourceAdd','resource',NULL,'resource_add','$user->rights->resource->write','1',0,'2020-01-20 11:46:00'),(166925,'all',1,'resource','left','tools',-1,'resource','tools',102,'/resource/list.php','','List','resource',NULL,'resource_list','$user->rights->resource->read','1',0,'2020-01-20 11:46:00'),(166951,'all',1,'agenda','top','agenda',0,NULL,NULL,86,'/comm/action/index.php','','TMenuAgenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166952,'all',1,'agenda','left','agenda',166951,NULL,NULL,100,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Actions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166953,'all',1,'agenda','left','agenda',166952,NULL,NULL,101,'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create','','NewAction','commercial',NULL,NULL,'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166954,'all',1,'agenda','left','agenda',166952,NULL,NULL,140,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda','','Calendar','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166955,'all',1,'agenda','left','agenda',166954,NULL,NULL,141,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166956,'all',1,'agenda','left','agenda',166954,NULL,NULL,142,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166957,'all',1,'agenda','left','agenda',166954,NULL,NULL,143,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2020-01-20 11:47:19'),(166958,'all',1,'agenda','left','agenda',166954,NULL,NULL,144,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2020-01-20 11:47:19'),(166959,'all',1,'agenda','left','agenda',166952,NULL,NULL,110,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda','','List','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166960,'all',1,'agenda','left','agenda',166959,NULL,NULL,111,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166961,'all',1,'agenda','left','agenda',166959,NULL,NULL,112,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166962,'all',1,'agenda','left','agenda',166959,NULL,NULL,113,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2020-01-20 11:47:19'),(166963,'all',1,'agenda','left','agenda',166959,NULL,NULL,114,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2020-01-20 11:47:19'),(166964,'all',1,'agenda','left','agenda',166952,NULL,NULL,160,'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda','','Reportings','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166965,'all',1,'barcode','left','tools',-1,NULL,'tools',200,'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint','','BarCodePrintsheet','products',NULL,'barcodeprint','($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->lire_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)','$conf->barcode->enabled',2,'2020-01-20 11:47:19'),(166966,'all',1,'barcode','left','home',-1,'admintools','home',300,'/barcode/codeinit.php?mainmenu=home&leftmenu=admintools','','MassBarcodeInit','products',NULL,NULL,'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->creer_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)','$conf->barcode->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)',0,'2020-01-20 11:47:19'),(166967,'all',1,'cron','left','home',-1,'admintools','home',200,'/cron/list.php?leftmenu=admintools','','CronList','cron',NULL,NULL,'$user->rights->cron->read','$conf->cron->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)',2,'2020-01-20 11:47:19'),(166968,'all',1,'ecm','top','ecm',0,NULL,NULL,82,'/ecm/index.php','','MenuECM','ecm',NULL,NULL,'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup','$conf->ecm->enabled',2,'2020-01-20 11:47:20'),(166969,'all',1,'ecm','left','ecm',-1,NULL,'ecm',101,'/ecm/index.php?mainmenu=ecm&leftmenu=ecm','','ECMArea','ecm',NULL,'ecm','$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2020-01-20 11:47:20'),(166970,'all',1,'ecm','left','ecm',-1,'ecm','ecm',102,'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm','','ECMSectionsManual','ecm',NULL,'ecm_manual','$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2020-01-20 11:47:20'),(166971,'all',1,'ecm','left','ecm',-1,'ecm','ecm',103,'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm','','ECMSectionsAuto','ecm',NULL,NULL,'$user->rights->ecm->read || $user->rights->ecm->upload','($user->rights->ecm->read || $user->rights->ecm->upload) && ! empty($conf->global->ECM_AUTO_TREE_ENABLED)',2,'2020-01-20 11:47:20'),(166972,'all',1,'opensurvey','left','tools',-1,NULL,'tools',200,'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey','','Survey','opensurvey',NULL,'opensurvey','$user->rights->opensurvey->read','$conf->opensurvey->enabled',0,'2020-01-20 11:47:20'),(166973,'all',1,'opensurvey','left','tools',-1,'opensurvey','tools',210,'/opensurvey/wizard/index.php','','NewSurvey','opensurvey',NULL,'opensurvey_new','$user->rights->opensurvey->write','$conf->opensurvey->enabled',0,'2020-01-20 11:47:20'),(166974,'all',1,'opensurvey','left','tools',-1,'opensurvey','tools',220,'/opensurvey/list.php','','List','opensurvey',NULL,'opensurvey_list','$user->rights->opensurvey->read','$conf->opensurvey->enabled',0,'2020-01-20 11:47:20'),(166975,'all',1,'website','top','website',0,NULL,NULL,100,'/website/index.php','','WebSites','website',NULL,NULL,'$user->rights->website->read','$conf->website->enabled',2,'2020-01-20 11:47:21'); +INSERT INTO `llx_menu` VALUES (103094,'all',2,'agenda','top','agenda',0,NULL,NULL,100,'/comm/action/index.php','','Agenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103095,'all',2,'agenda','left','agenda',103094,NULL,NULL,100,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Actions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103096,'all',2,'agenda','left','agenda',103095,NULL,NULL,101,'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create','','NewAction','commercial',NULL,NULL,'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103097,'all',2,'agenda','left','agenda',103095,NULL,NULL,102,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Calendar','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103098,'all',2,'agenda','left','agenda',103097,NULL,NULL,103,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103099,'all',2,'agenda','left','agenda',103097,NULL,NULL,104,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103100,'all',2,'agenda','left','agenda',103097,NULL,NULL,105,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2015-03-13 15:29:19'),(103101,'all',2,'agenda','left','agenda',103097,NULL,NULL,106,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2015-03-13 15:29:19'),(103102,'all',2,'agenda','left','agenda',103095,NULL,NULL,112,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda','','List','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103103,'all',2,'agenda','left','agenda',103102,NULL,NULL,113,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103104,'all',2,'agenda','left','agenda',103102,NULL,NULL,114,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103105,'all',2,'agenda','left','agenda',103102,NULL,NULL,115,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=todo','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2015-03-13 15:29:19'),(103106,'all',2,'agenda','left','agenda',103102,NULL,NULL,116,'/comm/action/listactions.php?mainmenu=agenda&leftmenu=agenda&status=done','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2015-03-13 15:29:19'),(103107,'all',2,'agenda','left','agenda',103095,NULL,NULL,120,'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda','','Reportings','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$conf->agenda->enabled',2,'2015-03-13 15:29:19'),(103134,'all',2,'opensurvey','top','opensurvey',0,NULL,NULL,200,'/opensurvey/index.php','','Surveys','opensurvey',NULL,NULL,'$user->rights->opensurvey->survey->read','$conf->opensurvey->enabled',0,'2015-03-13 20:33:42'),(103135,'all',2,'opensurvey','left','opensurvey',-1,NULL,'opensurvey',200,'/opensurvey/index.php?mainmenu=opensurvey&leftmenu=opensurvey','','Survey','opensurvey@opensurvey',NULL,'opensurvey','','$conf->opensurvey->enabled',0,'2015-03-13 20:33:42'),(103136,'all',2,'opensurvey','left','opensurvey',-1,'opensurvey','opensurvey',210,'/opensurvey/public/index.php','_blank','NewSurvey','opensurvey@opensurvey',NULL,'opensurvey_new','','$conf->opensurvey->enabled',0,'2015-03-13 20:33:42'),(103137,'all',2,'opensurvey','left','opensurvey',-1,'opensurvey','opensurvey',220,'/opensurvey/list.php','','List','opensurvey@opensurvey',NULL,'opensurvey_list','','$conf->opensurvey->enabled',0,'2015-03-13 20:33:42'),(145127,'all',1,'printing','left','home',-1,'admintools','home',300,'/printing/index.php?mainmenu=home&leftmenu=admintools','','MenuDirectPrinting','printing',NULL,NULL,'$user->rights->printing->read','$conf->printing->enabled && $leftmenu==\'admintools\'',0,'2017-01-29 15:12:44'),(161088,'auguria',1,'','top','home',0,NULL,NULL,10,'/index.php?mainmenu=home&leftmenu=','','Home','',-1,'','','1',2,'2017-08-30 15:14:30'),(161089,'auguria',1,'societe|fournisseur','top','companies',0,NULL,NULL,20,'/societe/index.php?mainmenu=companies&leftmenu=','','ThirdParties','companies',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)',2,'2017-08-30 15:14:30'),(161090,'auguria',1,'product|service','top','products',0,NULL,NULL,30,'/product/index.php?mainmenu=products&leftmenu=','','Products/Services','products',-1,'','$user->rights->produit->lire||$user->rights->service->lire','$conf->product->enabled || $conf->service->enabled',0,'2017-08-30 15:14:30'),(161092,'auguria',1,'propal|commande|fournisseur|contrat|ficheinter','top','commercial',0,NULL,NULL,40,'/comm/index.php?mainmenu=commercial&leftmenu=','','Commercial','commercial',-1,'','$user->rights->societe->lire || $user->rights->societe->contact->lire','$conf->propal->enabled || $conf->commande->enabled || $conf->supplier_order->enabled || $conf->contrat->enabled || $conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(161093,'auguria',1,'comptabilite|accounting|facture|don|tax|salaries|loan','top','accountancy',0,NULL,NULL,50,'/compta/index.php?mainmenu=accountancy&leftmenu=','','MenuFinancial','compta',-1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->plancompte->lire || $user->rights->facture->lire|| $user->rights->don->lire || $user->rights->tax->charges->lire || $user->rights->salaries->read || $user->rights->loan->read','$conf->comptabilite->enabled || $conf->accounting->enabled || $conf->facture->enabled || $conf->don->enabled || $conf->tax->enabled || $conf->salaries->enabled || $conf->supplier_invoice->enabled || $conf->loan->enabled',2,'2017-08-30 15:14:30'),(161094,'auguria',1,'projet','top','project',0,NULL,NULL,70,'/projet/index.php?mainmenu=project&leftmenu=','','Projects','projects',-1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(161095,'auguria',1,'mailing|export|import|opensurvey|resource','top','tools',0,NULL,NULL,90,'/core/tools.php?mainmenu=tools&leftmenu=','','Tools','other',-1,'','$user->rights->mailing->lire || $user->rights->export->lire || $user->rights->import->run || $user->rights->opensurvey->read || $user->rights->resource->read','$conf->mailing->enabled || $conf->export->enabled || $conf->import->enabled || $conf->opensurvey->enabled || $conf->resource->enabled',2,'2017-08-30 15:14:30'),(161101,'auguria',1,'banque|prelevement','top','bank',0,NULL,NULL,60,'/compta/bank/index.php?mainmenu=bank&leftmenu=bank','','MenuBankCash','banks',-1,'','$user->rights->banque->lire || $user->rights->prelevement->bons->lire','$conf->banque->enabled || $conf->prelevement->enabled',0,'2017-08-30 15:14:30'),(161102,'auguria',1,'hrm|holiday|deplacement|expensereport','top','hrm',0,NULL,NULL,80,'/hrm/index.php?mainmenu=hrm&leftmenu=','','HRM','holiday',-1,'','$user->rights->hrm->employee->read || $user->rights->holiday->write || $user->rights->deplacement->lire || $user->rights->expensereport->lire','$conf->hrm->enabled || $conf->holiday->enabled || $conf->deplacement->enabled || $conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(161177,'auguria',1,'','left','home',161088,NULL,NULL,0,'/index.php','','MyDashboard','',0,'','','1',2,'2017-08-30 15:14:30'),(161187,'auguria',1,'','left','home',161088,NULL,NULL,1,'/admin/index.php?leftmenu=setup','','Setup','admin',0,'setup','','$user->admin',2,'2017-08-30 15:14:30'),(161188,'auguria',1,'','left','home',161187,NULL,NULL,1,'/admin/company.php?leftmenu=setup','','MenuCompanySetup','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161189,'auguria',1,'','left','home',161187,NULL,NULL,4,'/admin/ihm.php?leftmenu=setup','','GUISetup','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161190,'auguria',1,'','left','home',161187,NULL,NULL,2,'/admin/modules.php?leftmenu=setup','','Modules','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161191,'auguria',1,'','left','home',161187,NULL,NULL,6,'/admin/boxes.php?leftmenu=setup','','Boxes','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161192,'auguria',1,'','left','home',161187,NULL,NULL,3,'/admin/menus.php?leftmenu=setup','','Menus','admin',1,'','','$leftmenu==\'setup\'',2,'2017-09-06 08:29:47'),(161193,'auguria',1,'','left','home',161187,NULL,NULL,7,'/admin/delais.php?leftmenu=setup','','Alerts','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161194,'auguria',1,'','left','home',161187,NULL,NULL,10,'/admin/pdf.php?leftmenu=setup','','PDF','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161195,'auguria',1,'','left','home',161187,NULL,NULL,8,'/admin/security_other.php?leftmenu=setup','','Security','admin',1,'','','$leftmenu==\'setup\'',2,'2017-09-06 08:29:36'),(161196,'auguria',1,'','left','home',161187,NULL,NULL,11,'/admin/mails.php?leftmenu=setup','','Emails','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161197,'auguria',1,'','left','home',161187,NULL,NULL,9,'/admin/limits.php?leftmenu=setup','','MenuLimits','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161198,'auguria',1,'','left','home',161187,NULL,NULL,13,'/admin/dict.php?leftmenu=setup','','Dictionary','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161199,'auguria',1,'','left','home',161187,NULL,NULL,14,'/admin/const.php?leftmenu=setup','','OtherSetup','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161200,'auguria',1,'','left','home',161187,NULL,NULL,12,'/admin/sms.php?leftmenu=setup','','SMS','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161201,'auguria',1,'','left','home',161187,NULL,NULL,4,'/admin/translation.php?leftmenu=setup','','Translation','admin',1,'','','$leftmenu==\"setup\"',2,'2017-08-30 15:14:30'),(161288,'auguria',1,'','left','home',161387,NULL,NULL,0,'/admin/system/dolibarr.php?leftmenu=admintools','','InfoDolibarr','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161289,'auguria',1,'','left','home',161288,NULL,NULL,2,'/admin/system/modules.php?leftmenu=admintools','','Modules','admin',2,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161290,'auguria',1,'','left','home',161288,NULL,NULL,3,'/admin/triggers.php?leftmenu=admintools','','Triggers','admin',2,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161291,'auguria',1,'','left','home',161288,NULL,NULL,4,'/admin/system/filecheck.php?leftmenu=admintools','','FileCheck','admin',2,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161292,'auguria',1,'','left','home',161387,NULL,NULL,1,'/admin/system/browser.php?leftmenu=admintools','','InfoBrowser','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161293,'auguria',1,'','left','home',161387,NULL,NULL,2,'/admin/system/os.php?leftmenu=admintools','','InfoOS','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161294,'auguria',1,'','left','home',161387,NULL,NULL,3,'/admin/system/web.php?leftmenu=admintools','','InfoWebServer','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161295,'auguria',1,'','left','home',161387,NULL,NULL,4,'/admin/system/phpinfo.php?leftmenu=admintools','','InfoPHP','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161297,'auguria',1,'','left','home',161387,NULL,NULL,5,'/admin/system/database.php?leftmenu=admintools','','InfoDatabase','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161387,'auguria',1,'','left','home',161088,NULL,NULL,2,'/admin/tools/index.php?leftmenu=admintools','','AdminTools','admin',0,'admintools','','$user->admin',2,'2017-08-30 15:14:30'),(161388,'auguria',1,'','left','home',161387,NULL,NULL,6,'/admin/tools/dolibarr_export.php?leftmenu=admintools','','Backup','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161389,'auguria',1,'','left','home',161387,NULL,NULL,7,'/admin/tools/dolibarr_import.php?leftmenu=admintools','','Restore','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161392,'auguria',1,'','left','home',161387,NULL,NULL,8,'/admin/tools/update.php?leftmenu=admintools','','MenuUpgrade','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161393,'auguria',1,'','left','home',161387,NULL,NULL,9,'/admin/tools/eaccelerator.php?leftmenu=admintools','','EAccelerator','admin',1,'','','$leftmenu==\"admintools\" && function_exists(\"eaccelerator_info\")',2,'2017-08-30 15:14:30'),(161394,'auguria',1,'','left','home',161387,NULL,NULL,10,'/admin/tools/listevents.php?leftmenu=admintools','','Audit','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161395,'auguria',1,'','left','home',161387,NULL,NULL,11,'/admin/tools/listsessions.php?leftmenu=admintools','','Sessions','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161396,'auguria',1,'','left','home',161387,NULL,NULL,12,'/admin/tools/purge.php?leftmenu=admintools','','Purge','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161398,'auguria',1,'','left','home',161387,NULL,NULL,14,'/admin/system/about.php?leftmenu=admintools','','ExternalResources','admin',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161407,'auguria',1,'','left','home',161387,NULL,NULL,15,'/product/admin/product_tools.php?mainmenu=home&leftmenu=admintools','','ProductVatMassChange','products',1,'','','$leftmenu==\"admintools\"',2,'2017-08-30 15:14:30'),(161487,'auguria',1,'','left','home',161088,NULL,NULL,4,'/user/home.php?leftmenu=users','','MenuUsersAndGroups','users',0,'users','','1',2,'2017-08-30 15:14:30'),(161488,'auguria',1,'','left','home',161487,NULL,NULL,0,'/user/index.php?leftmenu=users','','Users','users',1,'','$user->rights->user->user->lire || $user->admin','$leftmenu==\"users\"',2,'2017-08-30 15:14:30'),(161489,'auguria',1,'','left','home',161488,NULL,NULL,0,'/user/card.php?leftmenu=users&action=create','','NewUser','users',2,'','($user->rights->user->user->creer || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)','$leftmenu==\"users\"',2,'2017-08-30 15:14:30'),(161490,'auguria',1,'','left','home',161487,NULL,NULL,1,'/user/group/index.php?leftmenu=users','','Groups','users',1,'','(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)','$leftmenu==\"users\"',2,'2017-08-30 15:14:30'),(161491,'auguria',1,'','left','home',161490,NULL,NULL,0,'/user/group/card.php?leftmenu=users&action=create','','NewGroup','users',2,'','(($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->write:$user->rights->user->user->creer) || $user->admin) && !(! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE)','$leftmenu==\"users\"',2,'2017-08-30 15:14:30'),(161587,'auguria',1,'','left','companies',161089,NULL,NULL,0,'/societe/index.php?leftmenu=thirdparties','','ThirdParty','companies',0,'thirdparties','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161588,'auguria',1,'','left','companies',161587,NULL,NULL,0,'/societe/card.php?action=create','','MenuNewThirdParty','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161589,'auguria',1,'','left','companies',161587,NULL,NULL,0,'/societe/list.php?action=create','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161590,'auguria',1,'','left','companies',161587,NULL,NULL,5,'/societe/list.php?type=f&leftmenu=suppliers','','ListSuppliersShort','suppliers',1,'','$user->rights->societe->lire && $user->rights->fournisseur->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2017-08-30 15:14:30'),(161591,'auguria',1,'','left','companies',161590,NULL,NULL,0,'/societe/card.php?leftmenu=supplier&action=create&type=f','','NewSupplier','suppliers',2,'','$user->rights->societe->creer','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2017-08-30 15:14:30'),(161593,'auguria',1,'','left','companies',161587,NULL,NULL,3,'/societe/list.php?type=p&leftmenu=prospects','','ListProspectsShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161594,'auguria',1,'','left','companies',161593,NULL,NULL,0,'/societe/card.php?leftmenu=prospects&action=create&type=p','','MenuNewProspect','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161596,'auguria',1,'','left','companies',161587,NULL,NULL,4,'/societe/list.php?type=c&leftmenu=customers','','ListCustomersShort','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161597,'auguria',1,'','left','companies',161596,NULL,NULL,0,'/societe/card.php?leftmenu=customers&action=create&type=c','','MenuNewCustomer','companies',2,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161687,'auguria',1,'','left','companies',161089,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','ContactsAddresses','companies',0,'contacts','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161688,'auguria',1,'','left','companies',161687,NULL,NULL,0,'/contact/card.php?leftmenu=contacts&action=create','','NewContactAddress','companies',1,'','$user->rights->societe->creer','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161689,'auguria',1,'','left','companies',161687,NULL,NULL,1,'/contact/list.php?leftmenu=contacts','','List','companies',1,'','$user->rights->societe->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161691,'auguria',1,'','left','companies',161689,NULL,NULL,1,'/contact/list.php?leftmenu=contacts&type=p','','ThirdPartyProspects','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161692,'auguria',1,'','left','companies',161689,NULL,NULL,2,'/contact/list.php?leftmenu=contacts&type=c','','ThirdPartyCustomers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161693,'auguria',1,'','left','companies',161689,NULL,NULL,3,'/contact/list.php?leftmenu=contacts&type=f','','ThirdPartySuppliers','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled && $conf->fournisseur->enabled',2,'2017-08-30 15:14:30'),(161694,'auguria',1,'','left','companies',161689,NULL,NULL,4,'/contact/list.php?leftmenu=contacts&type=o','','Others','companies',2,'','$user->rights->societe->contact->lire','$conf->societe->enabled',2,'2017-08-30 15:14:30'),(161737,'auguria',1,'','left','companies',161089,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=1','','SuppliersCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->societe->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161738,'auguria',1,'','left','companies',161737,NULL,NULL,0,'/categories/card.php?action=create&type=1','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->societe->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161747,'auguria',1,'','left','companies',161089,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=2','','CustomersProspectsCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161748,'auguria',1,'','left','companies',161747,NULL,NULL,0,'/categories/card.php?action=create&type=2','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->fournisseur->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161757,'auguria',1,'','left','companies',161089,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=4','','ContactCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->societe->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(161758,'auguria',1,'','left','companies',161757,NULL,NULL,0,'/categories/card.php?action=create&type=4','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->societe->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(162187,'auguria',1,'','left','commercial',161092,NULL,NULL,4,'/comm/propal/index.php?leftmenu=propals','','Prop','propal',0,'propals','$user->rights->propale->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(162188,'auguria',1,'','left','commercial',162187,NULL,NULL,0,'/comm/propal/card.php?action=create&leftmenu=propals','','NewPropal','propal',1,'','$user->rights->propale->creer','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(162189,'auguria',1,'','left','commercial',162187,NULL,NULL,1,'/comm/propal/list.php?leftmenu=propals','','List','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(162190,'auguria',1,'','left','commercial',162189,NULL,NULL,2,'/comm/propal/list.php?leftmenu=propals&search_status=0','','PropalsDraft','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162191,'auguria',1,'','left','commercial',162189,NULL,NULL,3,'/comm/propal/list.php?leftmenu=propals&search_status=1','','PropalsOpened','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162192,'auguria',1,'','left','commercial',162189,NULL,NULL,4,'/comm/propal/list.php?leftmenu=propals&search_status=2','','PropalStatusSigned','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162193,'auguria',1,'','left','commercial',162189,NULL,NULL,5,'/comm/propal/list.php?leftmenu=propals&search_status=3','','PropalStatusNotSigned','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162194,'auguria',1,'','left','commercial',162189,NULL,NULL,6,'/comm/propal/list.php?leftmenu=propals&search_status=4','','PropalStatusBilled','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled && $leftmenu==\"propals\"',2,'2017-08-30 15:14:30'),(162197,'auguria',1,'','left','commercial',162187,NULL,NULL,4,'/comm/propal/stats/index.php?leftmenu=propals','','Statistics','propal',1,'','$user->rights->propale->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(162287,'auguria',1,'','left','commercial',161092,NULL,NULL,5,'/commande/index.php?leftmenu=orders','','CustomersOrders','orders',0,'orders','$user->rights->commande->lire','$conf->commande->enabled',2,'2017-08-30 15:14:30'),(162288,'auguria',1,'','left','commercial',162287,NULL,NULL,0,'/commande/card.php?action=create&leftmenu=orders','','NewOrder','orders',1,'','$user->rights->commande->creer','$conf->commande->enabled',2,'2017-08-30 15:14:30'),(162289,'auguria',1,'','left','commercial',162287,NULL,NULL,1,'/commande/list.php?leftmenu=orders','','List','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2017-08-30 15:14:30'),(162290,'auguria',1,'','left','commercial',162289,NULL,NULL,2,'/commande/list.php?leftmenu=orders&search_status=0','','StatusOrderDraftShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162291,'auguria',1,'','left','commercial',162289,NULL,NULL,3,'/commande/list.php?leftmenu=orders&search_status=1','','StatusOrderValidated','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162292,'auguria',1,'','left','commercial',162289,NULL,NULL,4,'/commande/list.php?leftmenu=orders&search_status=2','','StatusOrderOnProcessShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162293,'auguria',1,'','left','commercial',162289,NULL,NULL,5,'/commande/list.php?leftmenu=orders&search_status=3','','StatusOrderToBill','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162294,'auguria',1,'','left','commercial',162289,NULL,NULL,6,'/commande/list.php?leftmenu=orders&search_status=4','','StatusOrderProcessed','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162295,'auguria',1,'','left','commercial',162289,NULL,NULL,7,'/commande/list.php?leftmenu=orders&search_status=-1','','StatusOrderCanceledShort','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled && $leftmenu==\"orders\"',2,'2017-08-30 15:14:30'),(162296,'auguria',1,'','left','commercial',162287,NULL,NULL,4,'/commande/stats/index.php?leftmenu=orders','','Statistics','orders',1,'','$user->rights->commande->lire','$conf->commande->enabled',2,'2017-08-30 15:14:30'),(162387,'auguria',1,'','left','commercial',161090,NULL,NULL,6,'/expedition/index.php?leftmenu=sendings','','Shipments','sendings',0,'sendings','$user->rights->expedition->lire','$conf->expedition->enabled',2,'2017-08-30 15:14:30'),(162388,'auguria',1,'','left','commercial',162387,NULL,NULL,0,'/expedition/card.php?action=create2&leftmenu=sendings','','NewSending','sendings',1,'','$user->rights->expedition->creer','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2017-08-30 15:14:30'),(162389,'auguria',1,'','left','commercial',162387,NULL,NULL,1,'/expedition/list.php?leftmenu=sendings','','List','sendings',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2017-08-30 15:14:30'),(162390,'auguria',1,'','left','commercial',162387,NULL,NULL,2,'/expedition/stats/index.php?leftmenu=sendings','','Statistics','sendings',1,'','$user->rights->expedition->lire','$conf->expedition->enabled && $leftmenu==\"sendings\"',2,'2017-08-30 15:14:30'),(162487,'auguria',1,'','left','commercial',161092,NULL,NULL,7,'/contrat/index.php?leftmenu=contracts','','Contracts','contracts',0,'contracts','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2017-08-30 15:14:30'),(162488,'auguria',1,'','left','commercial',162487,NULL,NULL,0,'/contrat/card.php?&action=create&leftmenu=contracts','','NewContract','contracts',1,'','$user->rights->contrat->creer','$conf->contrat->enabled',2,'2017-08-30 15:14:30'),(162489,'auguria',1,'','left','commercial',162487,NULL,NULL,1,'/contrat/list.php?leftmenu=contracts','','List','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2017-08-30 15:14:30'),(162490,'auguria',1,'','left','commercial',162487,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts','','MenuServices','contracts',1,'','$user->rights->contrat->lire','$conf->contrat->enabled',2,'2017-08-30 15:14:30'),(162491,'auguria',1,'','left','commercial',162490,NULL,NULL,0,'/contrat/services.php?leftmenu=contracts&mode=0','','MenuInactiveServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled && $leftmenu==\"contracts\"',2,'2017-08-30 15:14:30'),(162492,'auguria',1,'','left','commercial',162490,NULL,NULL,1,'/contrat/services.php?leftmenu=contracts&mode=4','','MenuRunningServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled && $leftmenu==\"contracts\"',2,'2017-08-30 15:14:30'),(162493,'auguria',1,'','left','commercial',162490,NULL,NULL,2,'/contrat/services.php?leftmenu=contracts&mode=4&filter=expired','','MenuExpiredServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled && $leftmenu==\"contracts\"',2,'2017-08-30 15:14:30'),(162494,'auguria',1,'','left','commercial',162490,NULL,NULL,3,'/contrat/services.php?leftmenu=contracts&mode=5','','MenuClosedServices','contracts',2,'','$user->rights->contrat->lire','$conf->contrat->enabled && $leftmenu==\"contracts\"',2,'2017-08-30 15:14:30'),(162587,'auguria',1,'','left','commercial',161092,NULL,NULL,8,'/fichinter/list.php?leftmenu=ficheinter','','Interventions','interventions',0,'ficheinter','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(162588,'auguria',1,'','left','commercial',162587,NULL,NULL,0,'/fichinter/card.php?action=create&leftmenu=ficheinter','','NewIntervention','interventions',1,'','$user->rights->ficheinter->creer','$conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(162589,'auguria',1,'','left','commercial',162587,NULL,NULL,1,'/fichinter/list.php?leftmenu=ficheinter','','List','interventions',1,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(162590,'auguria',1,'','left','commercial',162587,NULL,NULL,2,'/fichinter/stats/index.php?leftmenu=ficheinter','','Statistics','interventions',1,'','$user->rights->ficheinter->lire','$conf->ficheinter->enabled',2,'2017-08-30 15:14:30'),(162687,'auguria',1,'','left','accountancy',161093,NULL,NULL,3,'/fourn/facture/list.php?leftmenu=suppliers_bills','','BillsSuppliers','bills',0,'supplier_bills','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162688,'auguria',1,'','left','accountancy',162687,NULL,NULL,0,'/fourn/facture/card.php?action=create&leftmenu=suppliers_bills','','NewBill','bills',1,'','$user->rights->fournisseur->facture->creer','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162689,'auguria',1,'','left','accountancy',162687,NULL,NULL,1,'/fourn/facture/list.php?leftmenu=suppliers_bills','','List','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162690,'auguria',1,'','left','accountancy',162687,NULL,NULL,2,'/fourn/facture/paiement.php?leftmenu=suppliers_bills','','Payments','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162691,'auguria',1,'','left','accountancy',162687,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills&mode=supplier','','Statistics','bills',1,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162692,'auguria',1,'','left','accountancy',162690,NULL,NULL,1,'/fourn/facture/rapport.php?leftmenu=suppliers_bills','','Reporting','bills',2,'','$user->rights->fournisseur->facture->lire','$conf->supplier_invoice->enabled',2,'2017-08-30 15:14:30'),(162787,'auguria',1,'','left','accountancy',161093,NULL,NULL,3,'/compta/facture/list.php?leftmenu=customers_bills','','BillsCustomers','bills',0,'customer_bills','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162788,'auguria',1,'','left','accountancy',162787,NULL,NULL,3,'/compta/facture/card.php?action=create&leftmenu=customers_bills','','NewBill','bills',1,'','$user->rights->facture->creer','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162789,'auguria',1,'','left','accountancy',162787,NULL,NULL,5,'/compta/facture/fiche-rec.php?leftmenu=customers_bills','','ListOfTemplates','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162791,'auguria',1,'','left','accountancy',162787,NULL,NULL,6,'/compta/paiement/list.php?leftmenu=customers_bills','','Payments','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162792,'auguria',1,'','left','accountancy',162787,NULL,NULL,4,'/compta/facture/list.php?leftmenu=customers_bills','','List','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162797,'auguria',1,'','left','accountancy',162791,NULL,NULL,1,'/compta/paiement/rapport.php?leftmenu=customers_bills','','Reportings','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162798,'auguria',1,'','left','accountancy',161101,NULL,NULL,9,'/compta/paiement/cheque/index.php?leftmenu=checks&mainmenu=bank','','MenuChequeDeposits','bills',0,'checks','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2017-08-30 15:14:30'),(162799,'auguria',1,'','left','accountancy',162798,NULL,NULL,0,'/compta/paiement/cheque/card.php?leftmenu=checks&action=new','','NewCheckDeposit','compta',1,'','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2017-08-30 15:14:30'),(162800,'auguria',1,'','left','accountancy',162798,NULL,NULL,1,'/compta/paiement/cheque/list.php?leftmenu=checks','','List','bills',1,'','$user->rights->banque->lire','empty($conf->global->BANK_DISABLE_CHECK_DEPOSIT) && ! empty($conf->banque->enabled) && (! empty($conf->facture->enabled) || ! empty($conf->global->MAIN_MENU_CHEQUE_DEPOSIT_ON))',2,'2017-08-30 15:14:30'),(162801,'auguria',1,'','left','accountancy',162787,NULL,NULL,8,'/compta/facture/stats/index.php?leftmenu=customers_bills','','Statistics','bills',1,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162807,'auguria',1,'','left','accountancy',162792,NULL,NULL,1,'/compta/facture/list.php?leftmenu=customers_bills&search_status=0','','BillShortStatusDraft','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162808,'auguria',1,'','left','accountancy',162792,NULL,NULL,2,'/compta/facture/list.php?leftmenu=customers_bills&search_status=1','','BillShortStatusNotPaid','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162809,'auguria',1,'','left','accountancy',162792,NULL,NULL,3,'/compta/facture/list.php?leftmenu=customers_bills&search_status=2','','BillShortStatusPaid','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162810,'auguria',1,'','left','accountancy',162792,NULL,NULL,4,'/compta/facture/list.php?leftmenu=customers_bills&search_status=3','','BillShortStatusCanceled','bills',2,'','$user->rights->facture->lire','$conf->facture->enabled',2,'2017-08-30 15:14:30'),(162987,'auguria',1,'','left','accountancy',161093,NULL,NULL,3,'/commande/list.php?leftmenu=orders&search_status=3','','MenuOrdersToBill','orders',0,'orders','$user->rights->commande->lire','$conf->commande->enabled',0,'2017-08-30 15:14:30'),(163087,'auguria',1,'','left','accountancy',161093,NULL,NULL,4,'/don/index.php?leftmenu=donations&mainmenu=accountancy','','Donations','donations',0,'donations','$user->rights->don->lire','$conf->don->enabled',2,'2017-08-30 15:14:30'),(163088,'auguria',1,'','left','accountancy',163087,NULL,NULL,0,'/don/card.php?leftmenu=donations&mainmenu=accountancy&action=create','','NewDonation','donations',1,'','$user->rights->don->creer','$conf->don->enabled && $leftmenu==\"donations\"',2,'2017-08-30 15:14:30'),(163089,'auguria',1,'','left','accountancy',163087,NULL,NULL,1,'/don/list.php?leftmenu=donations&mainmenu=accountancy','','List','donations',1,'','$user->rights->don->lire','$conf->don->enabled && $leftmenu==\"donations\"',2,'2017-08-30 15:14:30'),(163187,'auguria',1,'','left','accountancy',161102,NULL,NULL,5,'/compta/deplacement/index.php?leftmenu=tripsandexpenses','','TripsAndExpenses','trips',0,'tripsandexpenses','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2017-08-30 15:14:30'),(163188,'auguria',1,'','left','accountancy',163187,NULL,NULL,1,'/compta/deplacement/card.php?action=create&leftmenu=tripsandexpenses','','New','trips',1,'','$user->rights->deplacement->creer','$conf->deplacement->enabled',0,'2017-08-30 15:14:30'),(163189,'auguria',1,'','left','accountancy',163187,NULL,NULL,2,'/compta/deplacement/list.php?leftmenu=tripsandexpenses','','List','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2017-08-30 15:14:30'),(163190,'auguria',1,'','left','accountancy',163187,NULL,NULL,2,'/compta/deplacement/stats/index.php?leftmenu=tripsandexpenses','','Statistics','trips',1,'','$user->rights->deplacement->lire','$conf->deplacement->enabled',0,'2017-08-30 15:14:30'),(163287,'auguria',1,'','left','accountancy',161093,NULL,NULL,6,'/compta/charges/index.php?leftmenu=tax&mainmenu=accountancy','','MenuSpecialExpenses','compta',0,'tax','(! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) || (! empty($conf->salaries->enabled) && $user->rights->salaries->read)','$conf->tax->enabled || $conf->salaries->enabled',0,'2017-08-30 15:14:30'),(163297,'auguria',1,'','left','accountancy',163287,NULL,NULL,1,'/compta/salaries/index.php?leftmenu=tax_salary&mainmenu=accountancy','','Salaries','salaries',1,'tax_sal','$user->rights->salaries->payment->read','$conf->salaries->enabled',0,'2017-08-30 15:14:30'),(163298,'auguria',1,'','left','accountancy',163297,NULL,NULL,2,'/compta/salaries/card.php?leftmenu=tax_salary&action=create','','NewPayment','companies',2,'','$user->rights->salaries->payment->write','$conf->salaries->enabled && $leftmenu==\"tax_salary\"',0,'2017-08-30 15:14:30'),(163299,'auguria',1,'','left','accountancy',163297,NULL,NULL,3,'/compta/salaries/index.php?leftmenu=tax_salary','','Payments','companies',2,'','$user->rights->salaries->payment->read','$conf->salaries->enabled && $leftmenu==\"tax_salary\"',0,'2017-08-30 15:14:30'),(163307,'auguria',1,'','left','accountancy',163287,NULL,NULL,1,'/loan/index.php?leftmenu=tax_loan&mainmenu=accountancy','','Loans','loan',1,'tax_loan','$user->rights->loan->read','$conf->loan->enabled',0,'2017-08-30 15:14:30'),(163308,'auguria',1,'','left','accountancy',163307,NULL,NULL,2,'/loan/card.php?leftmenu=tax_loan&action=create','','NewLoan','loan',2,'','$user->rights->loan->write','$conf->loan->enabled && $leftmenu==\"tax_loan\"',0,'2017-08-30 15:14:30'),(163310,'auguria',1,'','left','accountancy',163307,NULL,NULL,4,'/loan/calc.php?leftmenu=tax_loan','','Calculator','companies',2,'','$user->rights->loan->calc','$conf->loan->enabled && $leftmenu==\"tax_loan\" && ! empty($conf->global->LOAN_SHOW_CALCULATOR)',0,'2017-08-30 15:14:30'),(163337,'auguria',1,'','left','accountancy',163287,NULL,NULL,1,'/compta/sociales/index.php?leftmenu=tax_social','','SocialContributions','',1,'tax_social','$user->rights->tax->charges->lire','$conf->tax->enabled',0,'2017-08-30 15:14:30'),(163338,'auguria',1,'','left','accountancy',163337,NULL,NULL,2,'/compta/sociales/card.php?leftmenu=tax_social&action=create','','MenuNewSocialContribution','',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2017-08-30 15:14:30'),(163339,'auguria',1,'','left','accountancy',163337,NULL,NULL,3,'/compta/sociales/payments.php?leftmenu=tax_social&mainmenu=accountancy&mode=sconly','','Payments','',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && $leftmenu==\"tax_social\"',0,'2017-08-30 15:14:30'),(163387,'auguria',1,'','left','accountancy',163287,NULL,NULL,7,'/compta/tva/index.php?leftmenu=tax_vat&mainmenu=accountancy','','VAT','companies',1,'tax_vat','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS)',0,'2017-08-30 15:14:30'),(163388,'auguria',1,'','left','accountancy',163387,NULL,NULL,0,'/compta/tva/card.php?leftmenu=tax_vat&action=create','','New','companies',2,'','$user->rights->tax->charges->creer','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2017-08-30 15:14:30'),(163389,'auguria',1,'','left','accountancy',163387,NULL,NULL,1,'/compta/tva/reglement.php?leftmenu=tax_vat','','List','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2017-08-30 15:14:30'),(163390,'auguria',1,'','left','accountancy',163387,NULL,NULL,2,'/compta/tva/clients.php?leftmenu=tax_vat','','ReportByCustomers','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2017-08-30 15:14:30'),(163391,'auguria',1,'','left','accountancy',163387,NULL,NULL,3,'/compta/tva/quadri_detail.php?leftmenu=tax_vat','','ReportByQuarter','companies',2,'','$user->rights->tax->charges->lire','$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu==\"tax_vat\"',0,'2017-08-30 15:14:30'),(163487,'auguria',1,'','left','accountancy',161093,NULL,NULL,7,'/accountancy/index.php?leftmenu=accountancy','','MenuAccountancy','accountancy',0,'accounting','! empty($conf->accounting->enabled) || $user->rights->accounting->bind->write || $user->rights->accounting->bind->write || $user->rights->compta->resultat->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163488,'auguria',1,'','left','accountancy',163487,NULL,NULL,2,'/accountancy/customer/index.php?leftmenu=dispatch_customer','','CustomersVentilation','accountancy',1,'dispatch_customer','$user->rights->accounting->bind->write','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163489,'auguria',1,'','left','accountancy',163488,NULL,NULL,3,'/accountancy/customer/list.php','','ToDispatch','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $leftmenu==\"dispatch_customer\"',0,'2017-08-30 15:14:30'),(163490,'auguria',1,'','left','accountancy',163488,NULL,NULL,4,'/accountancy/customer/lines.php','','Dispatched','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $leftmenu==\"dispatch_customer\"',0,'2017-08-30 15:14:30'),(163497,'auguria',1,'','left','accountancy',163487,NULL,NULL,5,'/accountancy/supplier/index.php?leftmenu=dispatch_supplier','','SuppliersVentilation','accountancy',1,'ventil_supplier','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->fournisseur->enabled',0,'2017-08-30 15:14:30'),(163498,'auguria',1,'','left','accountancy',163497,NULL,NULL,6,'/accountancy/supplier/list.php','','ToDispatch','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu==\"dispatch_supplier\"',0,'2017-08-30 15:14:30'),(163499,'auguria',1,'','left','accountancy',163497,NULL,NULL,7,'/accountancy/supplier/lines.php','','Dispatched','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu==\"dispatch_supplier\"',0,'2017-08-30 15:14:30'),(163507,'auguria',1,'','left','accountancy',163487,NULL,NULL,5,'/accountancy/expensereport/index.php?leftmenu=dispatch_expensereport','','ExpenseReportsVentilation','accountancy',1,'ventil_expensereport','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(163508,'auguria',1,'','left','accountancy',163507,NULL,NULL,6,'/accountancy/expensereport/list.php','','ToDispatch','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu==\"dispatch_expensereport\"',0,'2017-08-30 15:14:30'),(163509,'auguria',1,'','left','accountancy',163507,NULL,NULL,7,'/accountancy/expensereport/lines.php','','Dispatched','accountancy',2,'','$user->rights->accounting->bind->write','$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu==\"dispatch_expensereport\"',0,'2017-08-30 15:14:30'),(163517,'auguria',1,'','left','accountancy',163487,NULL,NULL,15,'/accountancy/bookkeeping/list.php','','Bookkeeping','accountancy',1,'bookkeeping','$user->rights->accounting->mouvements->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163522,'auguria',1,'','left','accountancy',163487,NULL,NULL,16,'/accountancy/bookkeeping/balance.php','','AccountBalance','accountancy',1,'balance','$user->rights->accounting->mouvements->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163527,'auguria',1,'','left','accountancy',163487,NULL,NULL,17,'/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy','','Reportings','main',1,'report','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163528,'auguria',1,'','left','accountancy',163527,NULL,NULL,19,'/compta/resultat/index.php?mainmenu=accountancy&leftmenu=accountancy','','ReportInOut','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163529,'auguria',1,'','left','accountancy',163528,NULL,NULL,18,'/accountancy/report/result.php?mainmenu=accountancy&leftmenu=accountancy','','ByAccounts','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163530,'auguria',1,'','left','accountancy',163528,NULL,NULL,20,'/compta/resultat/clientfourn.php?mainmenu=accountancy&leftmenu=accountancy','','ByCompanies','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163531,'auguria',1,'','left','accountancy',163527,NULL,NULL,21,'/compta/stats/index.php?mainmenu=accountancy&leftmenu=accountancy','','ReportTurnover','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163532,'auguria',1,'','left','accountancy',163531,NULL,NULL,22,'/compta/stats/casoc.php?mainmenu=accountancy&leftmenu=accountancy','','ByCompanies','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163533,'auguria',1,'','left','accountancy',163531,NULL,NULL,23,'/compta/stats/cabyuser.php?mainmenu=accountancy&leftmenu=accountancy','','ByUsers','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163534,'auguria',1,'','left','accountancy',163531,NULL,NULL,24,'/compta/stats/cabyprodserv.php?mainmenu=accountancy&leftmenu=accountancy','','ByProductsAndServices','main',3,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled && $leftmenu==\"accountancy\"',0,'2017-08-30 15:14:30'),(163537,'auguria',1,'','left','accountancy',163538,NULL,NULL,80,'/accountancy/admin/fiscalyear.php?mainmenu=accountancy&leftmenu=accountancy_admin','','FiscalPeriod','admin',1,'accountancy_admin_period','','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\" && $conf->global->MAIN_FEATURES_LEVEL > 0',2,'2017-08-30 15:14:30'),(163538,'auguria',1,'','left','accountancy',163487,NULL,NULL,1,'/accountancy/index.php?mainmenu=accountancy&leftmenu=accountancy_admin','','Setup','accountancy',1,'accountancy_admin','$user->rights->accounting->chartofaccount','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163541,'auguria',1,'','left','accountancy',163538,NULL,NULL,10,'/accountancy/admin/journals_list.php?id=35&mainmenu=accountancy&leftmenu=accountancy_admin','','AccountingJournals','accountancy',2,'accountancy_admin_journal','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163542,'auguria',1,'','left','accountancy',163538,NULL,NULL,20,'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin','','Pcg_version','accountancy',2,'accountancy_admin_chartmodel','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163543,'auguria',1,'','left','accountancy',163538,NULL,NULL,30,'/accountancy/admin/account.php?mainmenu=accountancy&leftmenu=accountancy_admin','','Chartofaccounts','accountancy',2,'accountancy_admin_chart','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163544,'auguria',1,'','left','accountancy',163538,NULL,NULL,40,'/accountancy/admin/categories_list.php?id=32&mainmenu=accountancy&leftmenu=accountancy_admin','','AccountingCategory','accountancy',2,'accountancy_admin_chart_group','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163545,'auguria',1,'','left','accountancy',163538,NULL,NULL,50,'/accountancy/admin/defaultaccounts.php?mainmenu=accountancy&leftmenu=accountancy_admin','','MenuDefaultAccounts','accountancy',2,'accountancy_admin_default','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163546,'auguria',1,'','left','accountancy',163538,NULL,NULL,60,'/admin/dict.php?id=10&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin','','MenuVatAccounts','accountancy',2,'accountancy_admin_vat','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163547,'auguria',1,'','left','accountancy',163538,NULL,NULL,70,'/admin/dict.php?id=7&from=accountancy&search_country_id=__MYCOUNTRYID__&mainmenu=accountancy&leftmenu=accountancy_admin','','MenuTaxAccounts','accountancy',2,'accountancy_admin_tax','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163548,'auguria',1,'','left','accountancy',163538,NULL,NULL,80,'/admin/dict.php?id=17&from=accountancy&mainmenu=accountancy&leftmenu=accountancy_admin','','MenuExpenseReportAccounts','accountancy',2,'accountancy_admin_expensereport','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $conf->expensereport->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163549,'auguria',1,'','left','accountancy',163538,NULL,NULL,90,'/accountancy/admin/productaccount.php?mainmenu=accountancy&leftmenu=accountancy_admin','','MenuProductsAccounts','accountancy',2,'accountancy_admin_product','$user->rights->accounting->chartofaccount','$conf->accounting->enabled && $leftmenu==\"accountancy_admin\"',0,'2017-08-30 15:14:30'),(163587,'auguria',1,'','left','accountancy',161101,NULL,NULL,9,'/compta/prelevement/index.php?leftmenu=withdraw&mainmenu=bank','','StandingOrders','withdrawals',0,'withdraw','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled',2,'2017-08-30 15:14:30'),(163589,'auguria',1,'','left','accountancy',163587,NULL,NULL,0,'/compta/prelevement/create.php?leftmenu=withdraw','','NewStandingOrder','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163590,'auguria',1,'','left','accountancy',163587,NULL,NULL,2,'/compta/prelevement/bons.php?leftmenu=withdraw','','WithdrawalsReceipts','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163591,'auguria',1,'','left','accountancy',163587,NULL,NULL,3,'/compta/prelevement/list.php?leftmenu=withdraw','','WithdrawalsLines','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163593,'auguria',1,'','left','accountancy',163587,NULL,NULL,5,'/compta/prelevement/rejets.php?leftmenu=withdraw','','Rejects','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163594,'auguria',1,'','left','accountancy',163587,NULL,NULL,6,'/compta/prelevement/stats.php?leftmenu=withdraw','','Statistics','withdrawals',1,'','$user->rights->prelevement->bons->lire','$conf->prelevement->enabled && $leftmenu==\"withdraw\"',2,'2017-08-30 15:14:30'),(163687,'auguria',1,'','left','accountancy',161101,NULL,NULL,1,'/compta/bank/index.php?leftmenu=bank&mainmenu=bank','','MenuBankCash','banks',0,'bank','$user->rights->banque->lire','$conf->banque->enabled',0,'2017-08-30 15:14:30'),(163688,'auguria',1,'','left','accountancy',163687,NULL,NULL,0,'/compta/bank/card.php?action=create&leftmenu=bank','','MenuNewFinancialAccount','banks',1,'','$user->rights->banque->configurer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2017-08-30 15:14:30'),(163690,'auguria',1,'','left','accountancy',163687,NULL,NULL,2,'/compta/bank/bankentries.php?leftmenu=bank','','ListTransactions','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2017-08-30 15:14:30'),(163691,'auguria',1,'','left','accountancy',163687,NULL,NULL,3,'/compta/bank/budget.php?leftmenu=bank','','ListTransactionsByCategory','banks',1,'','$user->rights->banque->lire','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2017-08-30 15:14:30'),(163693,'auguria',1,'','left','accountancy',163687,NULL,NULL,5,'/compta/bank/transfer.php?leftmenu=bank','','BankTransfers','banks',1,'','$user->rights->banque->transfer','$conf->banque->enabled && ($leftmenu==\"bank\" || $leftmenu==\"checks\" || $leftmenu==\"withdraw\")',0,'2017-08-30 15:14:30'),(163737,'auguria',1,'','left','accountancy',161101,NULL,NULL,4,'/categories/index.php?leftmenu=bank&type=5','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(163738,'auguria',1,'','left','accountancy',163737,NULL,NULL,0,'/categories/card.php?leftmenu=bank&action=create&type=5','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(163787,'auguria',1,'','left','accountancy',161093,NULL,NULL,11,'/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy','','Reportings','main',0,'ca','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled',0,'2017-08-30 15:14:30'),(163792,'auguria',1,'','left','accountancy',163487,NULL,NULL,1,'','','Journalization','main',1,'','$user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163793,'auguria',1,'','left','accountancy',163792,NULL,NULL,4,'/accountancy/journal/sellsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=1','','SellsJournal','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163794,'auguria',1,'','left','accountancy',163792,NULL,NULL,1,'/accountancy/journal/bankjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=3','','BankJournal','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163795,'auguria',1,'','left','accountancy',163792,NULL,NULL,2,'/accountancy/journal/expensereportsjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=6','','ExpenseReportJournal','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163796,'auguria',1,'','left','accountancy',163792,NULL,NULL,3,'/accountancy/journal/purchasesjournal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal=2','','PurchasesJournal','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->accounting->enabled',0,'2017-08-30 15:14:30'),(163798,'auguria',1,'','left','accountancy',163787,NULL,NULL,0,'/compta/resultat/index.php?leftmenu=ca','','ReportInOut','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163799,'auguria',1,'','left','accountancy',163788,NULL,NULL,0,'/compta/resultat/clientfourn.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163800,'auguria',1,'','left','accountancy',163787,NULL,NULL,1,'/compta/stats/index.php?leftmenu=ca','','ReportTurnover','main',1,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163801,'auguria',1,'','left','accountancy',163790,NULL,NULL,0,'/compta/stats/casoc.php?leftmenu=ca','','ByCompanies','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163802,'auguria',1,'','left','accountancy',163790,NULL,NULL,1,'/compta/stats/cabyuser.php?leftmenu=ca','','ByUsers','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163803,'auguria',1,'','left','accountancy',163790,NULL,NULL,1,'/compta/stats/cabyprodserv.php?leftmenu=ca','','ByProductsAndServices','main',2,'','$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire','$conf->comptabilite->enabled && $leftmenu==\"ca\"',0,'2017-08-30 15:14:30'),(163887,'auguria',1,'','left','products',161090,NULL,NULL,0,'/product/index.php?leftmenu=product&type=0','','Products','products',0,'product','$user->rights->produit->lire','$conf->product->enabled',2,'2017-08-30 15:14:30'),(163888,'auguria',1,'','left','products',163887,NULL,NULL,0,'/product/card.php?leftmenu=product&action=create&type=0','','NewProduct','products',1,'','$user->rights->produit->creer','$conf->product->enabled',2,'2017-08-30 15:14:30'),(163889,'auguria',1,'','left','products',163887,NULL,NULL,1,'/product/list.php?leftmenu=product&type=0','','List','products',1,'','$user->rights->produit->lire','$conf->product->enabled',2,'2017-08-30 15:14:30'),(163890,'auguria',1,'','left','products',163887,NULL,NULL,4,'/product/reassort.php?type=0','','Stocks','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->product->enabled',2,'2017-08-30 15:14:30'),(163891,'auguria',1,'','left','products',163887,NULL,NULL,7,'/product/stats/card.php?id=all&leftmenu=stats&type=0','','Statistics','main',1,'','$user->rights->produit->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(163892,'auguria',1,'','left','products',163887,NULL,NULL,5,'/product/reassortlot.php?type=0','','StocksByLotSerial','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->productbatch->enabled',2,'2017-08-30 15:14:30'),(163893,'auguria',1,'','left','products',163887,NULL,NULL,6,'/product/stock/productlot_list.php','','LotSerial','products',1,'','$user->rights->produit->lire && $user->rights->stock->lire','$conf->productbatch->enabled',2,'2017-08-30 15:14:30'),(163987,'auguria',1,'','left','products',161090,NULL,NULL,1,'/product/index.php?leftmenu=service&type=1','','Services','products',0,'service','$user->rights->service->lire','$conf->service->enabled',2,'2017-08-30 15:14:30'),(163988,'auguria',1,'','left','products',163987,NULL,NULL,0,'/product/card.php?leftmenu=service&action=create&type=1','','NewService','products',1,'','$user->rights->service->creer','$conf->service->enabled',2,'2017-08-30 15:14:30'),(163989,'auguria',1,'','left','products',163987,NULL,NULL,1,'/product/list.php?leftmenu=service&type=1','','List','products',1,'','$user->rights->service->lire','$conf->service->enabled',2,'2017-08-30 15:14:30'),(163990,'auguria',1,'','left','products',163987,NULL,NULL,5,'/product/stats/card.php?id=all&leftmenu=stats&type=1','','Statistics','main',1,'','$user->rights->service->lire','$conf->propal->enabled',2,'2017-08-30 15:14:30'),(164187,'auguria',1,'','left','products',161090,NULL,NULL,3,'/product/stock/index.php?leftmenu=stock','','Stock','stocks',0,'stock','$user->rights->stock->lire','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164188,'auguria',1,'','left','products',164187,NULL,NULL,0,'/product/stock/card.php?action=create','','MenuNewWarehouse','stocks',1,'','$user->rights->stock->creer','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164189,'auguria',1,'','left','products',164187,NULL,NULL,1,'/product/stock/list.php','','List','stocks',1,'','$user->rights->stock->lire','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164191,'auguria',1,'','left','products',164187,NULL,NULL,3,'/product/stock/mouvement.php','','Movements','stocks',1,'','$user->rights->stock->mouvement->lire','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164192,'auguria',1,'','left','products',164187,NULL,NULL,4,'/product/stock/replenish.php','','Replenishments','stocks',1,'','$user->rights->stock->mouvement->creer && $user->rights->fournisseur->lire','$conf->stock->enabled && $conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(164193,'auguria',1,'','left','products',164187,NULL,NULL,5,'/product/stock/massstockmove.php','','MassStockTransferShort','stocks',1,'','$user->rights->stock->mouvement->creer','$conf->stock->enabled',2,'2017-08-30 15:14:30'),(164287,'auguria',1,'','left','products',161090,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=0','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(164288,'auguria',1,'','left','products',164287,NULL,NULL,0,'/categories/card.php?action=create&type=0','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(164487,'auguria',1,'','left','project',161094,NULL,NULL,3,'/projet/activity/perweek.php?leftmenu=projects','','NewTimeSpent','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164687,'auguria',1,'','left','project',161094,NULL,NULL,0,'/projet/index.php?leftmenu=projects','','Projects','projects',0,'projects','$user->rights->projet->lire','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(164688,'auguria',1,'','left','project',164687,NULL,NULL,1,'/projet/card.php?leftmenu=projects&action=create','','NewProject','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(164689,'auguria',1,'','left','project',164687,NULL,NULL,2,'/projet/list.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(164690,'auguria',1,'','left','project',164687,NULL,NULL,3,'/projet/stats/index.php?leftmenu=projects','','Statistics','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled',2,'2017-08-30 15:14:30'),(164787,'auguria',1,'','left','project',161094,NULL,NULL,0,'/projet/activity/index.php?leftmenu=projects','','Activities','projects',0,'','$user->rights->projet->lire','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164788,'auguria',1,'','left','project',164787,NULL,NULL,1,'/projet/tasks.php?leftmenu=projects&action=create','','NewTask','projects',1,'','$user->rights->projet->creer','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164789,'auguria',1,'','left','project',164787,NULL,NULL,2,'/projet/tasks/list.php?leftmenu=projects','','List','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164791,'auguria',1,'','left','project',164787,NULL,NULL,4,'/projet/tasks/stats/index.php?leftmenu=projects','','Statistics','projects',1,'','$user->rights->projet->lire','$conf->projet->enabled && $conf->global->PROJECT_USE_TASKS',2,'2017-08-30 15:14:30'),(164891,'auguria',1,'','left','project',161094,NULL,NULL,4,'/categories/index.php?leftmenu=cat&type=6','','Categories','categories',0,'cat','$user->rights->categorie->lire','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(164892,'auguria',1,'','left','project',164891,NULL,NULL,0,'/categories/card.php?action=create&type=6','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->categorie->enabled',2,'2017-08-30 15:14:30'),(164987,'auguria',1,'','left','tools',161095,NULL,NULL,0,'/comm/mailing/index.php?leftmenu=mailing','','EMailings','mails',0,'mailing','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2017-08-30 15:14:30'),(164988,'auguria',1,'','left','tools',164987,NULL,NULL,0,'/comm/mailing/card.php?leftmenu=mailing&action=create','','NewMailing','mails',1,'','$user->rights->mailing->creer','$conf->mailing->enabled',0,'2017-08-30 15:14:30'),(164989,'auguria',1,'','left','tools',164987,NULL,NULL,1,'/comm/mailing/list.php?leftmenu=mailing','','List','mails',1,'','$user->rights->mailing->lire','$conf->mailing->enabled',0,'2017-08-30 15:14:30'),(165187,'auguria',1,'','left','tools',161095,NULL,NULL,2,'/exports/index.php?leftmenu=export','','FormatedExport','exports',0,'export','$user->rights->export->lire','$conf->export->enabled',2,'2017-08-30 15:14:30'),(165188,'auguria',1,'','left','tools',165187,NULL,NULL,0,'/exports/export.php?leftmenu=export','','NewExport','exports',1,'','$user->rights->export->creer','$conf->export->enabled',2,'2017-08-30 15:14:30'),(165217,'auguria',1,'','left','tools',161095,NULL,NULL,2,'/imports/index.php?leftmenu=import','','FormatedImport','exports',0,'import','$user->rights->import->run','$conf->import->enabled',2,'2017-08-30 15:14:30'),(165218,'auguria',1,'','left','tools',165217,NULL,NULL,0,'/imports/import.php?leftmenu=import','','NewImport','exports',1,'','$user->rights->import->run','$conf->import->enabled',2,'2017-08-30 15:14:30'),(165287,'auguria',1,'','left','members',161100,NULL,NULL,0,'/adherents/index.php?leftmenu=members&mainmenu=members','','Members','members',0,'members','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165288,'auguria',1,'','left','members',165287,NULL,NULL,0,'/adherents/card.php?leftmenu=members&action=create','','NewMember','members',1,'','$user->rights->adherent->creer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165289,'auguria',1,'','left','members',165287,NULL,NULL,1,'/adherents/list.php','','List','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165290,'auguria',1,'','left','members',165289,NULL,NULL,2,'/adherents/list.php?leftmenu=members&statut=-1','','MenuMembersToValidate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165291,'auguria',1,'','left','members',165289,NULL,NULL,3,'/adherents/list.php?leftmenu=members&statut=1','','MenuMembersValidated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165292,'auguria',1,'','left','members',165289,NULL,NULL,4,'/adherents/list.php?leftmenu=members&statut=1&filter=outofdate','','MenuMembersNotUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165293,'auguria',1,'','left','members',165289,NULL,NULL,5,'/adherents/list.php?leftmenu=members&statut=1&filter=uptodate','','MenuMembersUpToDate','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165294,'auguria',1,'','left','members',165289,NULL,NULL,6,'/adherents/list.php?leftmenu=members&statut=0','','MenuMembersResiliated','members',2,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165295,'auguria',1,'','left','members',165287,NULL,NULL,7,'/adherents/stats/geo.php?leftmenu=members&mode=memberbycountry','','MenuMembersStats','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165387,'auguria',1,'','left','members',161100,NULL,NULL,1,'/adherents/index.php?leftmenu=members&mainmenu=members','','Subscriptions','compta',0,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165388,'auguria',1,'','left','members',165387,NULL,NULL,0,'/adherents/list.php?statut=-1&leftmenu=accountancy&mainmenu=members','','NewSubscription','compta',1,'','$user->rights->adherent->cotisation->creer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165389,'auguria',1,'','left','members',165387,NULL,NULL,1,'/adherents/subscription/list.php?leftmenu=members','','List','compta',1,'','$user->rights->adherent->cotisation->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165390,'auguria',1,'','left','members',165387,NULL,NULL,7,'/adherents/stats/index.php?leftmenu=members','','MenuMembersStats','members',1,'','$user->rights->adherent->lire','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165589,'auguria',1,'','left','members',165287,NULL,NULL,9,'/adherents/htpasswd.php?leftmenu=export','','Filehtpasswd','members',1,'','$user->rights->adherent->export','! empty($conf->global->MEMBER_LINK_TO_HTPASSWDFILE) && $conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165590,'auguria',1,'','left','members',165287,NULL,NULL,10,'/adherents/cartes/carte.php?leftmenu=export','','MembersCards','members',1,'','$user->rights->adherent->export','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165687,'auguria',1,'','left','hrm',161102,NULL,NULL,1,'/user/index.php?leftmenu=hrm&mode=employee','','Employees','hrm',0,'hrm','$user->rights->hrm->employee->read','$conf->hrm->enabled',0,'2017-08-30 15:14:30'),(165688,'auguria',1,'','left','hrm',165687,NULL,NULL,1,'/user/card.php?action=create&employee=1','','NewEmployee','hrm',1,'','$user->rights->hrm->employee->write','$conf->hrm->enabled',0,'2017-08-30 15:14:30'),(165689,'auguria',1,'','left','hrm',165687,NULL,NULL,2,'/user/index.php?$leftmenu=hrm&mode=employee&contextpage=employeelist','','List','hrm',1,'','$user->rights->hrm->employee->read','$conf->hrm->enabled',0,'2017-08-30 15:14:30'),(165787,'auguria',1,'','left','members',161100,NULL,NULL,5,'/adherents/type.php?leftmenu=setup&mainmenu=members','','MembersTypes','members',0,'setup','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165788,'auguria',1,'','left','members',165787,NULL,NULL,0,'/adherents/type.php?leftmenu=setup&mainmenu=members&action=create','','New','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(165789,'auguria',1,'','left','members',165787,NULL,NULL,1,'/adherents/type.php?leftmenu=setup&mainmenu=members','','List','members',1,'','$user->rights->adherent->configurer','$conf->adherent->enabled',2,'2017-08-30 15:14:30'),(166087,'auguria',1,'','left','hrm',161102,NULL,NULL,1,'/holiday/list.php?&leftmenu=hrm','','CPTitreMenu','holiday',0,'hrm','$user->rights->holiday->read','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166088,'auguria',1,'','left','hrm',166087,NULL,NULL,1,'/holiday/card.php?&action=request','','MenuAddCP','holiday',1,'','$user->rights->holiday->write','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166089,'auguria',1,'','left','hrm',166087,NULL,NULL,1,'/holiday/list.php?&leftmenu=hrm','','List','holiday',1,'','$user->rights->holiday->read','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166090,'auguria',1,'','left','hrm',166089,NULL,NULL,1,'/holiday/list.php?select_statut=2&leftmenu=hrm','','ListToApprove','trips',2,'','$user->rights->holiday->read','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166091,'auguria',1,'','left','hrm',166087,NULL,NULL,2,'/holiday/define_holiday.php?&action=request','','MenuConfCP','holiday',1,'','$user->rights->holiday->define_holiday','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166092,'auguria',1,'','left','hrm',166087,NULL,NULL,3,'/holiday/view_log.php?&action=request','','MenuLogCP','holiday',1,'','$user->rights->holiday->define_holiday','$conf->holiday->enabled',0,'2017-08-30 15:14:30'),(166187,'auguria',1,'','left','commercial',161092,NULL,NULL,6,'/fourn/commande/index.php?leftmenu=orders_suppliers','','SuppliersOrders','orders',0,'orders_suppliers','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(166188,'auguria',1,'','left','commercial',166187,NULL,NULL,0,'/fourn/commande/card.php?action=create&leftmenu=orders_suppliers','','NewOrder','orders',1,'','$user->rights->fournisseur->commande->creer','$conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(166189,'auguria',1,'','left','commercial',166187,NULL,NULL,1,'/fourn/commande/list.php?leftmenu=orders_suppliers&search_status=0','','List','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(166195,'auguria',1,'','left','commercial',166187,NULL,NULL,7,'/commande/stats/index.php?leftmenu=orders_suppliers&mode=supplier','','Statistics','orders',1,'','$user->rights->fournisseur->commande->lire','$conf->supplier_order->enabled',2,'2017-08-30 15:14:30'),(166287,'auguria',1,'','left','members',161100,NULL,NULL,3,'/categories/index.php?leftmenu=cat&type=3','','MembersCategoriesShort','categories',0,'cat','$user->rights->categorie->lire','$conf->adherent->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(166288,'auguria',1,'','left','members',166287,NULL,NULL,0,'/categories/card.php?action=create&type=3','','NewCategory','categories',1,'','$user->rights->categorie->creer','$conf->adherent->enabled && $conf->categorie->enabled',2,'2017-08-30 15:14:30'),(166387,'auguria',1,'','left','hrm',161102,NULL,NULL,5,'/expensereport/index.php?leftmenu=expensereport','','TripsAndExpenses','trips',0,'expensereport','$user->rights->expensereport->lire','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166388,'auguria',1,'','left','hrm',166387,NULL,NULL,1,'/expensereport/card.php?action=create&leftmenu=expensereport','','New','trips',1,'','$user->rights->expensereport->creer','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166389,'auguria',1,'','left','hrm',166387,NULL,NULL,2,'/expensereport/list.php?leftmenu=expensereport','','List','trips',1,'','$user->rights->expensereport->lire','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166390,'auguria',1,'','left','hrm',166389,NULL,NULL,2,'/expensereport/list.php?search_status=2&leftmenu=expensereport','','ListToApprove','trips',2,'','$user->rights->expensereport->approve','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166391,'auguria',1,'','left','hrm',166387,NULL,NULL,2,'/expensereport/stats/index.php?leftmenu=expensereport','','Statistics','trips',1,'','$user->rights->expensereport->lire','$conf->expensereport->enabled',0,'2017-08-30 15:14:30'),(166467,'all',1,'variants','left','products',-1,'product','products',100,'/variants/list.php','','VariantAttributes','products',NULL,'product','1','$conf->product->enabled',0,'2018-01-19 11:28:04'),(166541,'all',1,'ticket','top','ticket',0,NULL,NULL,88,'/ticket/index.php','','Ticket','ticket',NULL,'1','$user->rights->ticket->read','$conf->ticket->enabled',2,'2019-06-05 09:15:29'),(166542,'all',1,'ticket','left','ticket',-1,NULL,'ticket',101,'/ticket/index.php','','Ticket','ticket',NULL,'ticket','$user->rights->ticket->read','$conf->ticket->enabled',2,'2019-06-05 09:15:29'),(166543,'all',1,'ticket','left','ticket',-1,'ticket','ticket',102,'/ticket/card.php?action=create','','NewTicket','ticket',NULL,NULL,'$user->rights->ticket->write','$conf->ticket->enabled',2,'2019-06-05 09:15:29'),(166544,'all',1,'ticket','left','ticket',-1,'ticket','ticket',103,'/ticket/list.php?search_fk_status=non_closed','','List','ticket',NULL,'ticketlist','$user->rights->ticket->read','$conf->ticket->enabled',2,'2019-06-05 09:15:29'),(166545,'all',1,'ticket','left','ticket',-1,'ticket','ticket',105,'/ticket/list.php?mode=mine&search_fk_status=non_closed','','MenuTicketMyAssign','ticket',NULL,'ticketmy','$user->rights->ticket->read','$conf->ticket->enabled',0,'2019-06-05 09:15:29'),(166546,'all',1,'ticket','left','ticket',-1,'ticket','ticket',107,'/ticket/stats/index.php','','Statistics','ticket',NULL,NULL,'$user->rights->ticket->read','$conf->ticket->enabled',0,'2019-06-05 09:15:29'),(166547,'all',1,'takepos','top','takepos',0,NULL,NULL,1001,'/takepos/takepos.php','takepos','PointOfSaleShort','cashdesk',NULL,NULL,'1','$conf->takepos->enabled',2,'2019-06-05 09:15:58'),(166919,'all',1,'supplier_proposal','left','commercial',-1,NULL,'commercial',300,'/supplier_proposal/index.php','','SupplierProposalsShort','supplier_proposal',NULL,'supplier_proposalsubmenu','$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2020-01-13 14:37:09'),(166920,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',301,'/supplier_proposal/card.php?action=create&leftmenu=supplier_proposals','','SupplierProposalNew','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->creer','$conf->supplier_proposal->enabled',2,'2020-01-13 14:37:09'),(166921,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',302,'/supplier_proposal/list.php?leftmenu=supplier_proposals','','List','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2020-01-13 14:37:09'),(166922,'all',1,'supplier_proposal','left','commercial',-1,'supplier_proposalsubmenu','commercial',303,'/comm/propal/stats/index.php?leftmenu=supplier_proposals&mode=supplier','','Statistics','supplier_proposal',NULL,NULL,'$user->rights->supplier_proposal->lire','$conf->supplier_proposal->enabled',2,'2020-01-13 14:37:09'),(166923,'all',1,'resource','left','tools',-1,NULL,'tools',100,'/resource/list.php','','MenuResourceIndex','resource',NULL,'resource','$user->rights->resource->read','1',0,'2020-01-20 11:46:00'),(166924,'all',1,'resource','left','tools',-1,'resource','tools',101,'/resource/card.php?action=create','','MenuResourceAdd','resource',NULL,'resource_add','$user->rights->resource->write','1',0,'2020-01-20 11:46:00'),(166925,'all',1,'resource','left','tools',-1,'resource','tools',102,'/resource/list.php','','List','resource',NULL,'resource_list','$user->rights->resource->read','1',0,'2020-01-20 11:46:00'),(166951,'all',1,'agenda','top','agenda',0,NULL,NULL,86,'/comm/action/index.php','','TMenuAgenda','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166952,'all',1,'agenda','left','agenda',166951,NULL,NULL,100,'/comm/action/index.php?mainmenu=agenda&leftmenu=agenda','','Actions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166953,'all',1,'agenda','left','agenda',166952,NULL,NULL,101,'/comm/action/card.php?mainmenu=agenda&leftmenu=agenda&action=create','','NewAction','commercial',NULL,NULL,'($user->rights->agenda->myactions->create||$user->rights->agenda->allactions->create)','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166954,'all',1,'agenda','left','agenda',166952,NULL,NULL,140,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda','','Calendar','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166955,'all',1,'agenda','left','agenda',166954,NULL,NULL,141,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166956,'all',1,'agenda','left','agenda',166954,NULL,NULL,142,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166957,'all',1,'agenda','left','agenda',166954,NULL,NULL,143,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2020-01-20 11:47:19'),(166958,'all',1,'agenda','left','agenda',166954,NULL,NULL,144,'/comm/action/index.php?action=default&mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2020-01-20 11:47:19'),(166959,'all',1,'agenda','left','agenda',166952,NULL,NULL,110,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda','','List','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166960,'all',1,'agenda','left','agenda',166959,NULL,NULL,111,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filter=mine','','MenuToDoMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166961,'all',1,'agenda','left','agenda',166959,NULL,NULL,112,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filter=mine','','MenuDoneMyActions','agenda',NULL,NULL,'$user->rights->agenda->myactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166962,'all',1,'agenda','left','agenda',166959,NULL,NULL,113,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=todo&filtert=-1','','MenuToDoActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2020-01-20 11:47:19'),(166963,'all',1,'agenda','left','agenda',166959,NULL,NULL,114,'/comm/action/list.php?mainmenu=agenda&leftmenu=agenda&status=done&filtert=-1','','MenuDoneActions','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$user->rights->agenda->allactions->read',2,'2020-01-20 11:47:19'),(166964,'all',1,'agenda','left','agenda',166952,NULL,NULL,160,'/comm/action/rapport/index.php?mainmenu=agenda&leftmenu=agenda','','Reportings','agenda',NULL,NULL,'$user->rights->agenda->allactions->read','$conf->agenda->enabled',2,'2020-01-20 11:47:19'),(166965,'all',1,'barcode','left','tools',-1,NULL,'tools',200,'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint','','BarCodePrintsheet','products',NULL,'barcodeprint','($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->lire_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)','$conf->barcode->enabled',2,'2020-01-20 11:47:19'),(166966,'all',1,'barcode','left','home',-1,'admintools','home',300,'/barcode/codeinit.php?mainmenu=home&leftmenu=admintools','','MassBarcodeInit','products',NULL,NULL,'($conf->global->MAIN_USE_ADVANCED_PERMS && $user->rights->barcode->creer_advance) || (! $conf->global->MAIN_USE_ADVANCED_PERMS)','$conf->barcode->enabled && preg_match(\'/^(admintools|all)/\',$leftmenu)',0,'2020-01-20 11:47:19'),(166967,'all',1,'cron','left','home',-1,'admintools','home',200,'/cron/list.php?leftmenu=admintools','','CronList','cron',NULL,NULL,'$user->rights->cron->read','$conf->cron->enabled && preg_match(\'/^(admintools|all)/\', $leftmenu)',2,'2020-01-20 11:47:19'),(166968,'all',1,'ecm','top','ecm',0,NULL,NULL,82,'/ecm/index.php','','MenuECM','ecm',NULL,NULL,'$user->rights->ecm->read || $user->rights->ecm->upload || $user->rights->ecm->setup','$conf->ecm->enabled',2,'2020-01-20 11:47:20'),(166969,'all',1,'ecm','left','ecm',-1,NULL,'ecm',101,'/ecm/index.php?mainmenu=ecm&leftmenu=ecm','','ECMArea','ecm',NULL,'ecm','$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2020-01-20 11:47:20'),(166970,'all',1,'ecm','left','ecm',-1,'ecm','ecm',102,'/ecm/index.php?action=file_manager&mainmenu=ecm&leftmenu=ecm','','ECMSectionsManual','ecm',NULL,'ecm_manual','$user->rights->ecm->read || $user->rights->ecm->upload','$user->rights->ecm->read || $user->rights->ecm->upload',2,'2020-01-20 11:47:20'),(166971,'all',1,'ecm','left','ecm',-1,'ecm','ecm',103,'/ecm/index_auto.php?action=file_manager&mainmenu=ecm&leftmenu=ecm','','ECMSectionsAuto','ecm',NULL,NULL,'$user->rights->ecm->read || $user->rights->ecm->upload','($user->rights->ecm->read || $user->rights->ecm->upload) && ! empty($conf->global->ECM_AUTO_TREE_ENABLED)',2,'2020-01-20 11:47:20'),(166972,'all',1,'opensurvey','left','tools',-1,NULL,'tools',200,'/opensurvey/index.php?mainmenu=tools&leftmenu=opensurvey','','Survey','opensurvey',NULL,'opensurvey','$user->rights->opensurvey->read','$conf->opensurvey->enabled',0,'2020-01-20 11:47:20'),(166973,'all',1,'opensurvey','left','tools',-1,'opensurvey','tools',210,'/opensurvey/wizard/index.php','','NewSurvey','opensurvey',NULL,'opensurvey_new','$user->rights->opensurvey->write','$conf->opensurvey->enabled',0,'2020-01-20 11:47:20'),(166974,'all',1,'opensurvey','left','tools',-1,'opensurvey','tools',220,'/opensurvey/list.php','','List','opensurvey',NULL,'opensurvey_list','$user->rights->opensurvey->read','$conf->opensurvey->enabled',0,'2020-01-20 11:47:20'),(166975,'all',1,'website','top','website',0,NULL,NULL,100,'/website/index.php','','WebSites','website',NULL,NULL,'$user->rights->website->read','$conf->website->enabled',2,'2020-01-20 11:47:21'); /*!40000 ALTER TABLE `llx_menu` ENABLE KEYS */; UNLOCK TABLES; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 8d3f3937823..6d1a0ccd610 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -373,7 +373,7 @@ if ($result) { print ''.dol_print_date($db->jdate($objp->datef), 'day').''; // Ref product - print ''; + print ''; if ($product_static->id > 0) print $product_static->getNomUrl(1); if ($product_static->id > 0 && $objp->product_label) print '
'; if ($objp->product_label) print $objp->product_label; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 302c4410111..ce354c789f3 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -462,7 +462,7 @@ if ($result) { } } elseif ($objp->type_l == 0) { if ($objp->country_code == $mysoc->country_code || empty($objp->country_code)) { // If buyer in same country than seller (if not defined, we assume it is same country) - $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : ''); + $objp->code_buy_l = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : ''); $suggestedaccountingaccountbydefaultfor = ''; } else { if ($isSellerInEEC && $isBuyerInEEC) { // European intravat sale diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index bbc03c3387f..8e2e0d278f0 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -86,13 +86,14 @@ class Members extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $typeid ID of the type of member + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. * Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))" * @return array Array of member objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $typeid = '', $category = 0, $sqlfilters = '') { global $db, $conf; @@ -104,11 +105,19 @@ class Members extends DolibarrApi $sql = "SELECT t.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."adherent as t"; + if ($category > 0) { + $sql .= ", ".MAIN_DB_PREFIX."categorie_member as c"; + } $sql .= ' WHERE t.entity IN ('.getEntity('adherent').')'; if (!empty($typeid)) { $sql .= ' AND t.fk_adherent_type='.$typeid; } + // Select members of given category + if ($category > 0) { + $sql .= " AND c.fk_categorie = ".$db->escape($category); + $sql .= " AND c.fk_member = t.rowid "; + } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index e8163c72f56..76f04d94c15 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -192,7 +192,8 @@ elseif ($action == 'set_ORDER_FREE_TEXT') { setEventMessages($langs->trans("Error"), null, 'errors'); } -} elseif ($action == "setshippableiconinlist") { +} +elseif ($action == "setshippableiconinlist") { // Activate Set Shippable Icon In List $setshippableiconinlist = GETPOST('value', 'int'); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist, 'yesno', 0, '', $conf->entity); @@ -203,6 +204,25 @@ elseif ($action == 'set_ORDER_FREE_TEXT') setEventMessages($langs->trans("Error"), null, 'errors'); } } +elseif ($action == 'setribchq') +{ + $rib = GETPOST('rib', 'alpha'); + $chq = GETPOST('chq', 'alpha'); + + $res = dolibarr_set_const($db, "FACTURE_RIB_NUMBER", $rib, 'chaine', 0, '', $conf->entity); + $res = dolibarr_set_const($db, "FACTURE_CHQ_NUMBER", $chq, 'chaine', 0, '', $conf->entity); + + if (!$res > 0) $error++; + + if (!$error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} // Activate ask for payment bank elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') @@ -517,7 +537,122 @@ foreach ($dirmodels as $reldir) } print ''; -print "
"; + + +/* + * Payment mode + */ + +print '
'; +print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInOrder"), '', ''); + +print '
'; +print ''; + +print ''; + +print ''; +print ''; +print ''; +print "\n"; + +print ''; +print ""; +print ""; + +print ''; +print ""; +print ""; +print "
'; +print ''; +print $langs->trans("PaymentMode").''; +if (empty($conf->facture->enabled)) { + print ''; +} +print '
".$langs->trans("SuggestPaymentByRIBOnAccount").""; +if (empty($conf->facture->enabled)) +{ + if (!empty($conf->banque->enabled)) + { + $sql = "SELECT rowid, label"; + $sql .= " FROM ".MAIN_DB_PREFIX."bank_account"; + $sql .= " WHERE clos = 0"; + $sql .= " AND courant = 1"; + $sql .= " AND entity IN (".getEntity('bank_account').")"; + $resql = $db->query($sql); + if ($resql) + { + $num = $db->num_rows($resql); + $i = 0; + if ($num > 0) + { + print '"; + } + else + { + print "".$langs->trans("NoActiveBankAccountDefined").""; + } + } + } + else + { + print ''.$langs->trans("BankModuleNotActive").''; + } +} +else { + print ''.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).''; +} +print "
".$langs->trans("SuggestPaymentByChequeToAddress").""; +if (empty($conf->facture->enabled)) +{ + print '"; +} +else { + print ''.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).''; +} +print "
"; +print "
"; + + +print '
'; /* * Other options diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 8d917088d51..1a484ec8c7e 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -643,7 +643,7 @@ if (!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf } /* - * Modes de reglement + * Payment modes */ print '
'; print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInInvoice"), '', ''); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 83505747fcd..bd24e793374 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -3,7 +3,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2006-2011 Laurent Destailleur + * Copyright (C) 2006-2020 Laurent Destailleur * Copyright (C) 2011-2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -23,7 +23,7 @@ /** * \file htdocs/admin/ldap.php * \ingroup ldap - * \brief Page d'administration/configuration du module Ldap + * \brief Page to setup module LDAP */ require '../main.inc.php'; @@ -57,19 +57,20 @@ if (empty($reshook)) $error = 0; $db->begin(); - if (!dolibarr_set_const($db, 'LDAP_SERVER_TYPE', GETPOST("type"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_SERVER_PROTOCOLVERSION', GETPOST("LDAP_SERVER_PROTOCOLVERSION"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_SERVER_HOST', GETPOST("host"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_SERVER_HOST_SLAVE', GETPOST("slave"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_SERVER_PORT', GETPOST("port"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_SERVER_DN', GETPOST("dn"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_ADMIN_DN', GETPOST("admin"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_ADMIN_PASS', GETPOST("pass"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_SERVER_USE_TLS', GETPOST("usetls"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_SYNCHRO_ACTIVE', GETPOST("activesynchro"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_CONTACT_ACTIVE', GETPOST("activecontact"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_MEMBER_ACTIVE', GETPOST("activemembers"), 'chaine', 0, '', $conf->entity)) $error++; - if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_ACTIVE', GETPOST("activememberstypes"), 'chaine', 0, '', $conf->entity)) $error++; + + if (!dolibarr_set_const($db, 'LDAP_SERVER_TYPE', GETPOST("type", 'aZ09'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_SERVER_PROTOCOLVERSION', GETPOST("LDAP_SERVER_PROTOCOLVERSION", 'aZ09'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_SERVER_HOST', GETPOST("host", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_SERVER_HOST_SLAVE', GETPOST("slave", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_SERVER_PORT', GETPOST("port", 'int'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_SERVER_DN', GETPOST("dn", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_ADMIN_DN', GETPOST("admin", 'alphanohtml'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_ADMIN_PASS', GETPOST("pass", 'none'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_SERVER_USE_TLS', GETPOST("usetls", 'aZ09'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_SYNCHRO_ACTIVE', GETPOST("activesynchro", 'aZ09'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_CONTACT_ACTIVE', GETPOST("activecontact", 'aZ09'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_MEMBER_ACTIVE', GETPOST("activemembers", 'aZ09'), 'chaine', 0, '', $conf->entity)) $error++; + if (!dolibarr_set_const($db, 'LDAP_MEMBER_TYPE_ACTIVE', GETPOST("activememberstypes", 'aZ09'), 'chaine', 0, '', $conf->entity)) $error++; if (!$error) { diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 781d7da5f6f..73703829b8c 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -515,29 +515,35 @@ foreach ($dirmodels as $reldir) print ''; + /* * Payment mode */ + +print '
'; +print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInProposal"), '', ''); + +print '
'; +print ''; + +print ''; + +print ''; +print ''; +print ''; +print "\n"; + +print ''; +print ""; +print ""; +print "
'; +print ''; +print $langs->trans("PaymentMode").''; +if (empty($conf->facture->enabled)) { + print ''; +} +print '
".$langs->trans("SuggestPaymentByRIBOnAccount").""; if (empty($conf->facture->enabled)) { - print '
'; - print load_fiche_titre($langs->trans("SuggestedPaymentModesIfNotDefinedInProposal"), '', ''); - - print ''; - print ''; - - print ''; - - print ''; - print ''; - print ''; - print "\n"; - - print ''; - print ""; - print ""; +} +else { + print ''.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).''; +} +print ""; - print ''; - print ""; - print "'; +print ""; +print ""; - print "
'; - print ''; - print $langs->trans("PaymentMode").'
".$langs->trans("SuggestPaymentByRIBOnAccount").""; if (!empty($conf->banque->enabled)) { $sql = "SELECT rowid, label"; @@ -574,13 +580,19 @@ if (empty($conf->facture->enabled)) } else { - print $langs->trans("BankModuleNotActive"); + print ''.$langs->trans("BankModuleNotActive").''; } - print "
".$langs->trans("SuggestPaymentByChequeToAddress").""; +print '
".$langs->trans("SuggestPaymentByChequeToAddress").""; +if (empty($conf->facture->enabled)) +{ print '"; - print "
"; - print ""; } +else { + print ''.$langs->trans("SeeSetupOfModule", $langs->transnoentitiesnoconv("Module30Name")).''; +} +print "
"; +print ""; + print '
'; diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index 51d1e06ba87..981ce2a0ccf 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -32,7 +32,7 @@ $langs->loadLangs(array("admin", "ticket")); // Access control if (!$user->admin) { - accessforbidden(); + accessforbidden(); } // Parameters @@ -49,117 +49,117 @@ $error = 0; */ if ($action == 'updateMask') { - $maskconstticket = GETPOST('maskconstticket', 'alpha'); - $maskticket = GETPOST('maskticket', 'alpha'); + $maskconstticket = GETPOST('maskconstticket', 'alpha'); + $maskticket = GETPOST('maskticket', 'alpha'); - if ($maskconstticket) { - $res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity); - } + if ($maskconstticket) { + $res = dolibarr_set_const($db, $maskconstticket, $maskticket, 'chaine', 0, '', $conf->entity); + } - if (!$res > 0) { - $error++; - } + if (!$res > 0) { + $error++; + } - if (!$error) - { - setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans("Error"), null, 'errors'); - } + if (!$error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } } elseif ($action == 'setmod') { - // TODO Verifier si module numerotation choisi peut etre active - // par appel methode canBeActivated + // TODO Verifier si module numerotation choisi peut etre active + // par appel methode canBeActivated - dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "TICKET_ADDON", $value, 'chaine', 0, '', $conf->entity); } elseif ($action == 'setvar') { - include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; + include_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; - $notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha'); - if (!empty($notification_email)) { - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity); - } else { - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity); - } - if (!$res > 0) { - $error++; - } + $notification_email = GETPOST('TICKET_NOTIFICATION_EMAIL_FROM', 'alpha'); + if (!empty($notification_email)) { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', $notification_email, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_FROM', '', 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } - // altairis : differentiate notification email FROM and TO - $notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha'); - if (!empty($notification_email_to)) { - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity); - } else { - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity); - } - if (!$res > 0) { - $error++; - } + // altairis : differentiate notification email FROM and TO + $notification_email_to = GETPOST('TICKET_NOTIFICATION_EMAIL_TO', 'alpha'); + if (!empty($notification_email_to)) { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', $notification_email_to, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_EMAIL_TO', '', 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } - $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'restricthtml'); - if (!empty($mail_intro)) { - $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity); - } else { - $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity); - } - if (!$res > 0) { - $error++; - } + $mail_intro = GETPOST('TICKET_MESSAGE_MAIL_INTRO', 'restricthtml'); + if (!empty($mail_intro)) { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $mail_intro, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_INTRO', $langs->trans('TicketMessageMailIntroText'), 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } - $mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'restricthtml'); - if (!empty($mail_signature)) { - $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity); - } else { - $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity); - } - if (!$res > 0) { - $error++; - } + $mail_signature = GETPOST('TICKET_MESSAGE_MAIL_SIGNATURE', 'restricthtml'); + if (!empty($mail_signature)) { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $mail_signature, 'chaine', 0, '', $conf->entity); + } else { + $res = dolibarr_set_const($db, 'TICKET_MESSAGE_MAIL_SIGNATURE', $langs->trans('TicketMessageMailSignatureText'), 'chaine', 0, '', $conf->entity); + } + if (!$res > 0) { + $error++; + } } if ($action == 'setvarother') { - $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } + $param_must_exists = GETPOST('TICKET_EMAIL_MUST_EXISTS', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_EMAIL_MUST_EXISTS', $param_must_exists, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } - $param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } + $param_disable_email = GETPOST('TICKET_DISABLE_NOTIFICATION_MAILS', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_DISABLE_NOTIFICATION_MAILS', $param_disable_email, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) - { - $param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } - } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + { + $param_show_module_logo = GETPOST('TICKET_SHOW_MODULE_LOGO', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_SHOW_MODULE_LOGO', $param_show_module_logo, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } + } - if ($conf->global->MAIN_FEATURES_LEVEL >= 2) - { - $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } - } + if ($conf->global->MAIN_FEATURES_LEVEL >= 2) + { + $param_notification_also_main_addressemail = GETPOST('TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS', $param_notification_also_main_addressemail, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } + } - $param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } + $param_limit_view = GETPOST('TICKET_LIMIT_VIEW_ASSIGNED_ONLY', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_LIMIT_VIEW_ASSIGNED_ONLY', $param_limit_view, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } - $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); - $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); - if (!$res > 0) { - $error++; - } + $param_auto_assign = GETPOST('TICKET_AUTO_ASSIGN_USER_CREATE', 'alpha'); + $res = dolibarr_set_const($db, 'TICKET_AUTO_ASSIGN_USER_CREATE', $param_auto_assign, 'chaine', 0, '', $conf->entity); + if (!$res > 0) { + $error++; + } } @@ -210,82 +210,82 @@ print "\n"; clearstatcache(); foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir."core/modules/ticket"); + $dir = dol_buildpath($reldir."core/modules/ticket"); - if (is_dir($dir)) { - $handle = opendir($dir); - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) { - $file = $reg[1]; - $classname = substr($file, 4); + if (is_dir($dir)) { + $handle = opendir($dir); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + if (preg_match('/^(mod_.*)\.php$/i', $file, $reg)) { + $file = $reg[1]; + $classname = substr($file, 4); - include_once $dir.'/'.$file.'.php'; + include_once $dir.'/'.$file.'.php'; - $module = new $file; + $module = new $file; - // Show modules according to features level - if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { - continue; - } + // Show modules according to features level + if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) { + continue; + } - if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { - continue; - } + if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) { + continue; + } - if ($module->isEnabled()) { - print ''.$module->name."\n"; - print $module->info(); - print ''; + if ($module->isEnabled()) { + print ''.$module->name."\n"; + print $module->info(); + print ''; - // Show example of numbering model - print ''; - $tmp = $module->getExample(); - if (preg_match('/^Error/', $tmp)) { - print '
'.$langs->trans($tmp).'
'; - } elseif ($tmp == 'NotConfigured') { - print $langs->trans($tmp); - } else { - print $tmp; - } + // Show example of numbering model + print ''; + $tmp = $module->getExample(); + if (preg_match('/^Error/', $tmp)) { + print '
'.$langs->trans($tmp).'
'; + } elseif ($tmp == 'NotConfigured') { + print $langs->trans($tmp); + } else { + print $tmp; + } - print ''."\n"; + print ''."\n"; - print ''; - if ($conf->global->TICKET_ADDON == 'mod_'.$classname) { - print img_picto($langs->trans("Activated"), 'switch_on'); - } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; - } - print ''; + print ''; + if ($conf->global->TICKET_ADDON == 'mod_'.$classname) { + print img_picto($langs->trans("Activated"), 'switch_on'); + } else { + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + } + print ''; - $ticket = new Ticket($db); - $ticket->initAsSpecimen(); + $ticket = new Ticket($db); + $ticket->initAsSpecimen(); - // Info - $htmltooltip = ''; - $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; - $nextval = $module->getNextValue($mysoc, $ticket); - if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval - $htmltooltip .= ''.$langs->trans("NextValue").': '; - if ($nextval) { - $htmltooltip .= $nextval.'
'; - } else { - $htmltooltip .= $langs->trans($module->error).'
'; - } - } + // Info + $htmltooltip = ''; + $htmltooltip .= ''.$langs->trans("Version").': '.$module->getVersion().'
'; + $nextval = $module->getNextValue($mysoc, $ticket); + if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval + $htmltooltip .= ''.$langs->trans("NextValue").': '; + if ($nextval) { + $htmltooltip .= $nextval.'
'; + } else { + $htmltooltip .= $langs->trans($module->error).'
'; + } + } - print ''; - print $form->textwithpicto('', $htmltooltip, 1, 0); - print ''; + print ''; + print $form->textwithpicto('', $htmltooltip, 1, 0); + print ''; - print ''; - } - } - } - closedir($handle); - } - } + print ''; + } + } + } + closedir($handle); + } + } } print ''; @@ -293,9 +293,9 @@ print ''; print '
'; if (!$conf->use_javascript_ajax) { - print '
'; - print ''; - print ''; + print ''; + print ''; + print ''; } print load_fiche_titre($langs->trans("Other"), '', ''); @@ -311,10 +311,10 @@ print "\n"; print ''.$langs->trans("TicketsAutoAssignTicket").''; print ''; if ($conf->use_javascript_ajax) { - print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); + print ajax_constantonoff('TICKET_AUTO_ASSIGN_USER_CREATE'); } else { - $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); - print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE); + $arrval = array('0' => $langs->trans("No"), '1' => $langs->trans("Yes")); + print $form->selectarray("TICKET_AUTO_ASSIGN_USER_CREATE", $arrval, $conf->global->TICKET_AUTO_ASSIGN_USER_CREATE); } print ''; print ''; @@ -325,7 +325,7 @@ print ''; print '
'; if (!$conf->use_javascript_ajax) { - print '
'; + print ''; } // Admin var of module @@ -342,9 +342,9 @@ print ''.$langs->trans("Email").''; print "\n"; if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) { - print ''; - print '
'.$langs->trans("TicketCkEditorEmailNotActivated").'
'; - print "\n"; + print ''; + print '
'.$langs->trans("TicketCkEditorEmailNotActivated").'
'; + print "\n"; } // @todo Use module notification instead... diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 0bb38aeaa38..f11c53f3352 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -171,7 +171,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) print '
'; print ''; print ''; - print ''; + print ''; if ($num > 0) { @@ -755,7 +755,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) { print '
'; print '
'.$langs->trans("ProposalsDraft").' '.$num.'
'.$langs->trans("ProposalsDraft").' '.$num.'
'; - print ''; + print ''; $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) @@ -863,7 +863,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) { print '
'; print '
'.$langs->trans("ProposalsOpened").' '.$num.'
'.$langs->trans("ProposalsOpened").' '.$num.'
'; - print ''; + print ''; $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index e14e3ec8f71..938430ea542 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3403,8 +3403,8 @@ class Propal extends CommonObject $response->warning_delay = $delay_warning / 60 / 60 / 24; $response->label = $label; $response->labelShort = $labelShort; - $response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals'; - $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; + $response->url = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals'; + $response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?search_status='.$status.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc'; $response->img = img_object('', "propal"); // This assignment in condition is not a bug. It allows walking the results. diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index a931af375c5..a0aac3e0387 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -195,7 +195,7 @@ if (!empty($conf->propal->enabled)) print '
'.$langs->trans("OrdersOpened").' '.$num.'
'.$langs->trans("OrdersOpened").' '.$num.'
'; print ''; $langs->load("propal"); - print ''; + print ''; $i = 0; $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); @@ -345,7 +345,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) { print '
'; print '
'.$langs->trans("DraftPropals").' '.$num.'
'.$langs->trans("DraftPropals").' '.$num.'
'; - print ''; + print ''; $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) @@ -434,7 +434,7 @@ if (! empty($conf->propal->enabled)) print '
'; print '
'.$langs->trans("ProposalsOpened").' '.$num.'
'.$langs->trans("ProposalsOpened").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { @@ -507,7 +507,7 @@ if (! empty($conf->propal->enabled)) print '
'; print '
'.$langs->trans("ProposalsToProcess").' '.$num.'
'.$langs->trans("ProposalsToProcess").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 69bbb056283..b274689ef3e 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -92,7 +92,7 @@ $search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); -$viewstatut = GETPOST('viewstatut', 'alpha'); +$search_status = GETPOST('search_status', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); $object_statut = GETPOST('search_statut', 'alpha'); @@ -243,13 +243,13 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_datedelivery_start = ''; $search_datedelivery_end = ''; $search_availability = ''; - $viewstatut = ''; + $search_status = ''; $object_statut = ''; $toselect = ''; $search_array_options = array(); $search_categ_cus = 0; } -if ($object_statut != '') $viewstatut = $object_statut; +if ($object_statut != '') $search_status = $object_statut; if (empty($reshook)) { @@ -359,9 +359,9 @@ if ($search_categ_cus == -2) $sql .= " AND cc.fk_categorie IS NULL"; if ($search_product_category > 0) $sql .= " AND cp.fk_categorie = ".$db->escape($search_product_category); if ($socid > 0) $sql .= ' AND s.rowid = '.$socid; -if ($viewstatut != '' && $viewstatut != '-1') +if ($search_status != '' && $search_status != '-1') { - $sql .= ' AND p.fk_statut IN ('.$db->escape($viewstatut).')'; + $sql .= ' AND p.fk_statut IN ('.$db->escape($search_status).')'; } if ($search_date_start) $sql .= " AND p.datep >= '".$db->idate($search_date_start)."'"; if ($search_date_end) $sql .= " AND p.datep <= '".$db->idate($search_date_end)."'"; @@ -436,7 +436,7 @@ if ($resql) llxHeader('', $langs->trans('Proposal'), $help_url); - $param = '&viewstatut='.urlencode($viewstatut); + $param = '&search_status='.urlencode($search_status); if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); @@ -793,7 +793,7 @@ if ($resql) if (!empty($arrayfields['p.fk_statut']['checked'])) { print ''; } // Action column diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e1195427bc1..9ebc0b166dc 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3540,7 +3540,7 @@ class Commande extends CommonOrder $response->warning_delay = $conf->commande->client->warning_delay / 60 / 60 / 24; $response->label = $langs->trans("OrdersToProcess"); $response->labelShort = $langs->trans("Opened"); - $response->url = DOL_URL_ROOT.'/commande/list.php?viewstatut=-3&mainmenu=commercial&leftmenu=orders'; + $response->url = DOL_URL_ROOT.'/commande/list.php?search_status=-3&mainmenu=commercial&leftmenu=orders'; $response->img = img_object('', "order"); $generic_commande = new Commande($this->db); diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 763371a727d..52e5108ff5f 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -168,6 +168,7 @@ if ($resql) print ''; } + //if ($totalinprocess != $total) print ''; print "
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$langs->trans("OnProcessOrders").' '.$num.'
'; - $formpropal->selectProposalStatus($viewstatut, 1, 0, 1, 'customer', 'search_statut'); + $formpropal->selectProposalStatus($search_status, 1, 0, 1, 'customer', 'search_statut'); print '
'.$langs->trans("Total").''.$total.'

"; @@ -353,7 +354,7 @@ if (!empty($conf->commande->enabled)) print '
'; print ''; print ''; - print ''; + print ''; if ($num) { @@ -439,7 +440,7 @@ if (!empty($conf->commande->enabled)) print '
'; print '
'.$langs->trans("OrdersToProcess").' '.$num.'
'.$langs->trans("OrdersToProcess").' '.$num.'
'; print ''; - print ''; + print ''; if ($num) { diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 0fcce9ad14f..4c2ade29fcc 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -10,8 +10,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2018 Charlene Benke - + * Copyright (C) 2018 Charlene Benke * * 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 @@ -86,7 +85,7 @@ $search_login = GETPOST('search_login', 'alpha'); $search_categ_cus = trim(GETPOST("search_categ_cus", 'int')); $optioncss = GETPOST('optioncss', 'alpha'); $billed = GETPOST('billed', 'int'); -$viewstatut = GETPOST('viewstatut', 'int'); +$search_status = GETPOST('search_status', 'int'); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); $search_project_ref = GETPOST('search_project_ref', 'alpha'); @@ -223,7 +222,7 @@ if (empty($reshook)) $search_datedelivery_end = ''; $search_project_ref = ''; $search_project = ''; - $viewstatut = ''; + $search_status = ''; $billed = ''; $toselect = ''; $search_array_options = array(); @@ -310,23 +309,23 @@ if ($search_ref) $sql .= natural_search('c.ref', $search_ref); if ($search_ref_customer) $sql .= natural_search('c.ref_client', $search_ref_customer); if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); if ($billed != '' && $billed >= 0) $sql .= ' AND c.facture = '.$billed; -if ($viewstatut <> '') +if ($search_status <> '') { - if ($viewstatut < 4 && $viewstatut > -3) + if ($search_status < 4 && $search_status > -3) { - if ($viewstatut == 1 && empty($conf->expedition->enabled)) $sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated' - else $sql .= ' AND c.fk_statut = '.$viewstatut; // brouillon, validee, en cours, annulee + if ($search_status == 1 && empty($conf->expedition->enabled)) $sql .= ' AND c.fk_statut IN (1,2)'; // If module expedition disabled, we include order with status 'sending in process' into 'validated' + else $sql .= ' AND c.fk_statut = '.$search_status; // brouillon, validee, en cours, annulee } - if ($viewstatut == 4) + if ($search_status == 4) { $sql .= ' AND c.facture = 1'; // invoice created } - if ($viewstatut == -2) // To process + if ($search_status == -2) // To process { //$sql.= ' AND c.fk_statut IN (1,2,3) AND c.facture = 0'; $sql .= " AND ((c.fk_statut IN (1,2)) OR (c.fk_statut = 3 AND c.facture = 0))"; // If status is 2 and facture=1, it must be selected } - if ($viewstatut == -3) // To bill + if ($search_status == -3) // To bill { //$sql.= ' AND c.fk_statut in (1,2,3)'; //$sql.= ' AND c.facture = 0'; // invoice not created @@ -401,21 +400,21 @@ if ($resql) { $title = $langs->trans('ListOfOrders'); } - if (strval($viewstatut) == '0') + if (strval($search_status) == '0') $title .= ' - '.$langs->trans('StatusOrderDraftShort'); - if ($viewstatut == 1) + if ($search_status == 1) $title .= ' - '.$langs->trans('StatusOrderValidatedShort'); - if ($viewstatut == 2) + if ($search_status == 2) $title .= ' - '.$langs->trans('StatusOrderSentShort'); - if ($viewstatut == 3) + if ($search_status == 3) $title .= ' - '.$langs->trans('StatusOrderToBillShort'); - if ($viewstatut == 4) + if ($search_status == 4) $title .= ' - '.$langs->trans('StatusOrderProcessedShort'); - if ($viewstatut == -1) + if ($search_status == -1) $title .= ' - '.$langs->trans('StatusOrderCanceledShort'); - if ($viewstatut == -2) + if ($search_status == -2) $title .= ' - '.$langs->trans('StatusOrderToProcessShort'); - if ($viewstatut == -3) + if ($search_status == -3) $title .= ' - '.$langs->trans('StatusOrderValidated').', '.(empty($conf->expedition->enabled) ? '' : $langs->trans("StatusOrderSent").', ').$langs->trans('StatusOrderToBill'); $num = $db->num_rows($resql); @@ -438,7 +437,7 @@ if ($resql) if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); if ($socid > 0) $param .= '&socid='.urlencode($socid); - if ($viewstatut != '') $param .= '&viewstatut='.urlencode($viewstatut); + if ($search_status != '') $param .= '&search_status='.urlencode($search_status); if ($search_dateorder_start) $param .= '&search_dateorder_start='.urlencode($search_dateorder_start); if ($search_dateorder_end) $param .= '&search_dateorder_end='.urlencode($search_dateorder_end); if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); @@ -500,7 +499,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -814,7 +813,7 @@ if ($resql) -3=>$langs->trans("StatusOrderValidatedShort").'+'.$langs->trans("StatusOrderSentShort").'+'.$langs->trans("StatusOrderDelivered"), Commande::STATUS_CANCELED=>$langs->trans("StatusOrderCanceledShort") ); - print $form->selectarray('viewstatut', $liststatus, $viewstatut, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); + print $form->selectarray('search_status', $liststatus, $search_status, -4, 0, 0, '', 0, 0, 0, '', 'maxwidth100'); print ''; } // Status billed @@ -924,7 +923,7 @@ if ($resql) $generic_commande->getLinesArray(); // This set ->lines - print $generic_commande->getNomUrl(1, ($viewstatut != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1); + print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1); // Show shippable Icon (create subloop, so may be slow) if ($conf->stock->enabled) diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index d47e711bc77..bad5034eac5 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -57,7 +57,7 @@ $socid = GETPOST('socid', 'int'); $selected = GETPOST('orders_to_invoice'); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); -$viewstatut = GETPOST('viewstatut', 'alpha'); +$search_status = GETPOST('search_status', 'alpha'); $error = 0; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index fb97a2e9129..43cfdef0b62 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -751,8 +751,8 @@ if ($resql) print ''; }*/ print ''; print '
'.$langs->trans("OnProcessOrders").' '.$num.'
'.$langs->trans("OnProcessOrders").' '.$num.'
'; - print '
'; - print ''; + print '
'; + print ''; print '
'; @@ -815,7 +815,7 @@ if ($resql) $morehtml .= $buttonreconcile; } - $morehtml .= $newcardbutton; + $morehtml .= ''.$newcardbutton; $picto = 'bank_account'; if ($id > 0 || !empty($ref)) $picto = ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index cbda53affed..ab99173b614 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -1390,8 +1390,8 @@ class Account extends CommonObject global $conf, $langs, $user; $result = ''; - $label = ''.$langs->trans("ShowAccount").''; - $label .= '
'.$langs->trans('BankAccount').': '.$this->label; + $label = ''.$langs->trans("BankAccount").''; + $label .= '
'.$langs->trans('Label').': '.$this->label; $label .= '
'.$langs->trans('AccountNumber').': '.$this->number; $label .= '
'.$langs->trans("AccountCurrency").': '.$this->currency_code; diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 2fb97ff949c..bc5b9d46be1 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -57,12 +57,13 @@ class BankAccounts extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.import_key:<:'20160101')" * @return array List of account objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '') { $list = array(); @@ -71,7 +72,14 @@ class BankAccounts extends DolibarrApi } $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."bank_account as t"; + if ($category > 0) { + $sql .= ", ".MAIN_DB_PREFIX."categorie_account as c"; + } $sql .= ' WHERE t.entity IN ('.getEntity('bank_account').')'; + // Select accounts of given category + if ($category > 0) { + $sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_account = t.rowid "; + } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 2d724ec2690..2e616a6ef48 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -264,7 +264,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'bank_account', 0, $newcardbutton, '', $limit, 1); diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 14e1e124f1e..759e9cc3944 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -330,7 +330,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; $title = $langs->trans("RepeatableInvoices"); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9dc99b482ff..1b0c99c3bfb 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -688,7 +688,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print ''; print_barre_liste($langs->trans('BillsCustomers').' '.($socid ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'invoicing', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index d6babe42416..6aa05f1cd7e 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -745,7 +745,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user print '
'; print ''; print ""; - print ''; + print ''; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''; print ''; print ''; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index a300b888578..3cb06396c80 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -216,7 +216,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit); diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 3297042407f..ec004717946 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -193,7 +193,7 @@ if ($result) print ''; print ''; print ''; - print ''; + print ''; $massactionbutton = ''; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index ca58830a7bb..9cfec1868fa 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -192,7 +192,7 @@ if ($resql) print ''; print ''; print ''; - print ''; + print ''; if ($year) { diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index beb5b8bfc4f..658c9353a00 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -209,7 +209,7 @@ if ($id) } } -// Formulaire saisie tva +// Form to enter VAT if ($action == 'create') { print load_fiche_titre($langs->trans("VAT").' - '.$langs->trans("New")); @@ -262,7 +262,7 @@ if ($action == 'create') print ''; print ''; // Label diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 077c577ff26..66ed09413ef 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -75,6 +75,8 @@ if ($action == 'add' && !empty($permissiontoadd)) $value = 60 * 60 * GETPOST($key.'hour', 'int') + 60 * GETPOST($key.'min', 'int'); } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup + } elseif ($object->fields[$key]['type'] == 'boolean') { + $value = (GETPOST($key) == 'on' ? 1 : 0); } else { $value = GETPOST($key, 'alphanohtml'); } @@ -156,6 +158,8 @@ if ($action == 'update' && !empty($permissiontoadd)) } } elseif (preg_match('/^(integer|price|real|double)/', $object->fields[$key]['type'])) { $value = price2num(GETPOST($key, 'none')); // To fix decimal separator according to lang setup + } elseif ($object->fields[$key]['type'] == 'boolean') { + $value = (GETPOST($key) == 'on' ? 1 : 0); } else { $value = GETPOST($key, 'alpha'); } diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index 7090b71c773..2542cf23268 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -52,15 +52,16 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC)) { // Define if we have to generate thumbs or not $generatethumbs = 1; - if (GETPOST('section_dir')) $generatethumbs = 0; + if (GETPOST('section_dir', 'alpha')) $generatethumbs = 0; + $allowoverwrite = (GETPOST('overwritefile', 'int') ? 1 : 0); if (!empty($upload_dirold) && !empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - $result = dol_add_file_process($upload_dirold, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); + $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); } elseif (!empty($upload_dir)) { - $result = dol_add_file_process($upload_dir, 0, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); + $result = dol_add_file_process($upload_dir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); } } } @@ -145,12 +146,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') if (is_object($object) && $object->id > 0) { if ($backtopage) { - header('Location: '.$backtopage); + header('Location: '.$backtopage); exit; } else { - header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : '').(!empty($withproject) ? '&withproject=1' : '')); + $tmpurl = $_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : '').(!empty($withproject) ? '&withproject=1' : ''); + header('Location: '.$tmpurl); exit; } } diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index b8cbce5e335..e8cfa803573 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -859,7 +859,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($sall) $param .= '&sall='.urlencode($sall); if ($socid > 0) $param .= '&socid='.urlencode($socid); - if ($viewstatut != '') $param .= '&viewstatut='.urlencode($viewstatut); + if ($search_status != '') $param .= '&search_status='.urlencode($search_status); if ($search_orderday) $param .= '&search_orderday='.urlencode($search_orderday); if ($search_ordermonth) $param .= '&search_ordermonth='.urlencode($search_ordermonth); if ($search_orderyear) $param .= '&search_orderyear='.urlencode($search_orderyear); diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index a9a7df300c3..31d0b449d5b 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -356,10 +356,12 @@ if ($useajax || $action == 'delete') require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $useglobalvars = 1; $form = new Form($db); - $formquestion['urlfile'] = array('type'=>'hidden', 'value'=>$urlfile, 'name'=>'urlfile'); // We must always put field, even if empty because it is fille by javascript later - $formquestion['section'] = array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); // We must always put field, even if empty because it is fille by javascript later - $formquestion['section_id'] = array('type'=>'hidden', 'value'=>$section_id, 'name'=>'section_id'); // We must always put field, even if empty because it is fille by javascript later - $formquestion['section_dir'] = array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); // We must always put field, even if empty because it is fille by javascript later + $formquestion['urlfile'] = array('type'=>'hidden', 'value'=>$urlfile, 'name'=>'urlfile'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['section'] = array('type'=>'hidden', 'value'=>$section, 'name'=>'section'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['section_id'] = array('type'=>'hidden', 'value'=>$section_id, 'name'=>'section_id'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['section_dir'] = array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['sortfield'] = array('type'=>'hidden', 'value'=>$sortfield, 'name'=>'sortfield'); // We must always put field, even if empty because it is filled by javascript later + $formquestion['sortorder'] = array('type'=>'hidden', 'value'=>$sortorder, 'name'=>'sortorder'); // We must always put field, even if empty because it is filled by javascript later if (!empty($action) && $action == 'file_manager') $formquestion['file_manager'] = array('type'=>'hidden', 'value'=>1, 'name'=>'file_manager'); if (!empty($websitekey)) $formquestion['website'] = array('type'=>'hidden', 'value'=>$websitekey, 'name'=>'website'); if (!empty($pageid) && $pageid > 0) $formquestion['pageid'] = array('type'=>'hidden', 'value'=>$pageid, 'name'=>'pageid'); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 65051b3c05b..8fc7b8766e4 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -154,7 +154,7 @@ class box_activity extends ModeleBoxes { $this->info_box_contents[$line][0] = array( 'td' => 'class="left" width="16"', - 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut, + 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".$data[$j]->fk_statut, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0), 'logo' => 'object_propal' ); @@ -168,7 +168,7 @@ class box_activity extends ModeleBoxes 'td' => 'class="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut, 0), - 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut, + 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=".$data[$j]->fk_statut, ); $totalnb += $data[$j]->nb; @@ -236,7 +236,7 @@ class box_activity extends ModeleBoxes while ($j < count($data)) { $this->info_box_contents[$line][0] = array( 'td' => 'class="left" width="16"', - 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut, + 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=".$data[$j]->fk_statut, 'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0), 'logo' => 'object_order', ); @@ -250,7 +250,7 @@ class box_activity extends ModeleBoxes 'td' => 'class="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut, 0, 0), - 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut, + 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=".$data[$j]->fk_statut, ); $totalnb += $data[$j]->nb; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 1be4d4eec89..e868934e55a 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2015 Marcos García * Copyright (C) 2016 Charlie Benke * Copyright (C) 2018 Frédéric France + * Copyright (C) 2020 Josep Lluís Amador * * 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 @@ -386,6 +387,12 @@ abstract class CommonDocGenerator $sumcreditnote = $object->getSumCreditNotesUsed(); $already_payed_all = $sumpayed + $sumdeposit + $sumcreditnote; $remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote; + + if ($object->fk_account > 0) { + require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; + $bank_account = new Account($this->db); + $bank_account->fetch($object->fk_account); + } } $date = ($object->element == 'contrat' ? $object->date_contrat : $object->date); @@ -414,6 +421,9 @@ abstract class CommonDocGenerator $array_key.'_payment_term_code'=>$object->cond_reglement_code, $array_key.'_payment_term'=>($outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) != 'PaymentCondition'.$object->cond_reglement_code ? $outputlangs->transnoentitiesnoconv('PaymentCondition'.$object->cond_reglement_code) : ($object->cond_reglement_doc ? $object->cond_reglement_doc : $object->cond_reglement)), + $array_key.'_bank_iban'=>$bank_account->iban, + $array_key.'_bank_bic'=>$bank_account->bic, + $array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs), $array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)), $array_key.'_total_localtax1_locale'=>price($object->total_localtax1, 0, $outputlangs), diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index c543fd436a2..914106ac49a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4386,7 +4386,7 @@ class Form buttons: { "'.dol_escape_js($langs->transnoentities("Yes")).'": function() { var options = "&token='.urlencode(newToken()).'"; - var inputok = '.json_encode($inputok).'; + var inputok = '.json_encode($inputok).'; /* List of fields into form */ var pageyes = "'.dol_escape_js(!empty($pageyes) ? $pageyes : '').'"; if (inputok.length>0) { $.each(inputok, function(i, inputname) { @@ -4405,7 +4405,7 @@ class Form }, "'.dol_escape_js($langs->transnoentities("No")).'": function() { var options = "&token='.urlencode(newToken()).'"; - var inputko = '.json_encode($inputko).'; + var inputko = '.json_encode($inputko).'; /* List of fields into form */ var pageno="'.dol_escape_js(!empty($pageno) ? $pageno : '').'"; if (inputko.length>0) { $.each(inputko, function(i, inputname) { diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 43006150928..16e9a70ab56 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -58,11 +58,11 @@ class FormAdmin * @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end * @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @param int $multiselect Make the combo a multiselect - * @param array $onlykeys Show only the following keys (opposite of $filter) + * @param array $onlykeys Show only the following keys (opposite of $filter). Example array('fr', 'es', ...) * @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...) * @return string Return HTML select string with list of languages */ - public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array(), $mainlangonly = 0) + public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = null, $mainlangonly = 0) { // phpcs:enable global $conf, $langs; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 7b689814960..4a50525c88a 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -76,7 +76,7 @@ class FormFile * @param integer $linkfiles 1=Also add form to link files, 0=Do not show form to link files * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) * @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*') - * @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be) + * @param string $sectiondir If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be) * @param int $usewithoutform 0=Default, 1=Disable
and style to use in existing area * @return int <0 if KO, >0 if OK */ @@ -108,8 +108,6 @@ class FormFile return 1; } - $maxlength = $size; - $out = "\n\n".'
'."\n"; if (empty($title)) $title = $langs->trans("AttachANewFile"); @@ -174,6 +172,10 @@ class FormFile $out .= (!empty($accept) ? ' accept="'.$accept.'"' : ' accept=""'); $out .= '>'; $out .= ' '; + if ($sectionid) { // Show overwrite if exists for ECM module only + $langs->load('link'); + $out .= ''; + } $out .= 'global->MAIN_UPLOAD_DOC) || empty($perm) ? ' disabled' : ''); $out .= '>'; @@ -1297,7 +1299,7 @@ class FormFile { $fileinfo = pathinfo($file['name']); print '
'.$langs->trans("OrdersDeliveredToBill").' '.$num.''.$langs->trans("OrdersDeliveredToBill").' '.$num.''.$langs->trans("AmountHT").''.$langs->trans("AmountTTC").''.$langs->trans("ToBill").'
'.$form->textwithpicto($langs->trans("PeriodEndDate"), $langs->trans("LastDayTaxIsRelatedTo")).''; - print $form->selectDate($datev, "datev", '', '', '', 'add', 1, 1); + print $form->selectDate((GETPOST("datevmonth", 'int') ? $datev : -1), "datev", '', '', '', 'add', 1, 1); print '
'; - if (image_format_supported($file['name']) > 0) + if (image_format_supported($file['name']) >= 0) { if ($useinecm == 5 || $useinecm == 6) { diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index ab4703f19e0..b6c7017e408 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -30,9 +30,9 @@ class FormProjets { /** - * @var DoliDB Database handler. - */ - public $db; + * @var DoliDB Database handler. + */ + public $db; /** * @var string Error code (or message) @@ -50,7 +50,7 @@ class FormProjets $this->db = $db; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Output a combo list with projects qualified for a third party / user * @@ -71,9 +71,9 @@ class FormProjets * @param int $htmlid Html id to use instead of htmlname * @return string Return html content */ - public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '') - { - // phpcs:enable + public function select_projects($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 16, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $morecss = '', $htmlid = '') + { + // phpcs:enable global $langs, $conf, $form; $out = ''; @@ -90,13 +90,13 @@ class FormProjets $selected_input_value = $project->ref; } $urloption = 'socid='.$socid.'&htmlname='.$htmlname.'&discardclosed='.$discard_closed; - $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array( - // 'update' => array( - // 'projectid' => 'id' - // ) - )); + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/projet/ajax/projects.php', $urloption, $conf->global->PROJECT_USE_SEARCH_TO_SELECT, 0, array( + // 'update' => array( + // 'projectid' => 'id' + // ) + )); - $out .= ''; + $out .= ''; } else { @@ -113,13 +113,13 @@ class FormProjets if (empty($nooutput)) { - print $out; - return ''; + print $out; + return ''; } else return $out; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Returns an array with projects qualified for a third party * @@ -130,8 +130,8 @@ class FormProjets * @param int $option_only Return only html options lines without the select tag * @param int $show_empty Add an empty line * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) - * @param int $forcefocus Force focus on field (works with javascript only) - * @param int $disabled Disabled + * @param int $forcefocus Force focus on field (works with javascript only) + * @param int $disabled Disabled * @param int $mode 0 for HTML mode and 1 for array return (to be used by json_encode for example) * @param string $filterkey Key to filter * @param int $nooutput No print output. Return it only. @@ -140,9 +140,9 @@ class FormProjets * @param string $morecss More CSS * @return int Nb of project if OK, <0 if KO */ - public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500') - { - // phpcs:enable + public function select_projects_list($socid = -1, $selected = '', $htmlname = 'projectid', $maxlength = 24, $option_only = 0, $show_empty = 1, $discard_closed = 0, $forcefocus = 0, $disabled = 0, $mode = 0, $filterkey = '', $nooutput = 0, $forceaddid = 0, $htmlid = '', $morecss = 'maxwidth500') + { + // phpcs:enable global $user, $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -170,11 +170,11 @@ class FormProjets if ($socid == 0) $sql .= " AND (p.fk_soc=0 OR p.fk_soc IS NULL)"; if ($socid > 0) { - if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql .= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; - elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. - { - $sql .= " AND (p.fk_soc IN (".$socid.", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") OR p.fk_soc IS NULL)"; - } + if (empty($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql .= " AND (p.fk_soc=".$socid." OR p.fk_soc IS NULL)"; + elseif ($conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') // PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. + { + $sql .= " AND (p.fk_soc IN (".$socid.", ".$conf->global->PROJECT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") OR p.fk_soc IS NULL)"; + } } if (!empty($filterkey)) $sql .= natural_search(array('p.title', 'p.ref'), $filterkey); $sql .= " ORDER BY p.ref ASC"; @@ -186,9 +186,9 @@ class FormProjets if (!empty($conf->use_javascript_ajax)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus); - $out .= $comboenhancement; - $morecss .= ' minwidth100'; + $comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus); + $out .= $comboenhancement; + $morecss .= ' minwidth100'; } if (empty($option_only)) { @@ -223,8 +223,8 @@ class FormProjets $labeltoshow .= ', '.dol_trunc($obj->title, $maxlength); if ($obj->name) { - $labeltoshow .= ' - '.$obj->name; - if ($obj->name_alias) $labeltoshow .= ' ('.$obj->name_alias.')'; + $labeltoshow .= ' - '.$obj->name; + if ($obj->name_alias) $labeltoshow .= ' ('.$obj->name_alias.')'; } $disabled = 0; @@ -287,8 +287,8 @@ class FormProjets if (empty($option_only)) $out .= ''; if (empty($nooutput)) { - print $out; - return ''; + print $out; + return ''; } else return $out; } else { @@ -312,15 +312,15 @@ class FormProjets * @param int $option_only Return only html options lines without the select tag * @param string $show_empty Add an empty line ('1' or string to show for empty line) * @param int $discard_closed Discard closed projects (0=Keep,1=hide completely,2=Disable) - * @param int $forcefocus Force focus on field (works with javascript only) - * @param int $disabled Disabled + * @param int $forcefocus Force focus on field (works with javascript only) + * @param int $disabled Disabled * @param string $morecss More css added to the select component * @param string $projectsListId ''=Automatic filter on project allowed. List of id=Filter on project ids. * @param string $showproject 'all' = Show project info, ''=Hide project info * @param User $usertofilter User object to use for filtering * @return int Nbr of tasks if OK, <0 if KO */ - public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null) + public function selectTasks($socid = -1, $selected = '', $htmlname = 'taskid', $maxlength = 24, $option_only = 0, $show_empty = '1', $discard_closed = 0, $forcefocus = 0, $disabled = 0, $morecss = 'maxwidth500', $projectsListId = '', $showproject = 'all', $usertofilter = null) { global $user, $conf, $langs; @@ -365,9 +365,9 @@ class FormProjets if (!empty($conf->use_javascript_ajax)) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); - $out .= $comboenhancement; - $morecss = 'minwidth200imp maxwidth500'; + $comboenhancement = ajax_combobox($htmlname, '', 0, $forcefocus); + $out .= $comboenhancement; + $morecss = 'minwidth200imp maxwidth500'; } if (empty($option_only)) { @@ -481,7 +481,7 @@ class FormProjets } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Build a HTML select list of element of same thirdparty to suggest to link them to project * @@ -494,7 +494,7 @@ class FormProjets */ public function select_element($table_element, $socid = 0, $morecss = '', $limitonstatus = -2, $projectkey = "fk_projet") { - // phpcs:enable + // phpcs:enable global $conf, $langs; if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done) @@ -518,7 +518,7 @@ class FormProjets break; case "commande_fourn": case "commande_fournisseur": - $sql = "SELECT t.rowid, t.ref, t.ref_supplier"; + $sql = "SELECT t.rowid, t.ref, t.ref_supplier"; break; case "facture_rec": $sql = "SELECT t.rowid, t.titre as ref"; @@ -535,10 +535,10 @@ class FormProjets break;*/ return ''; case "commande": - case "contrat": + case "contrat": case "fichinter": - $sql = "SELECT t.rowid, t.ref"; - break; + $sql = "SELECT t.rowid, t.ref"; + break; case 'stock_mouvement': $sql = 'SELECT t.rowid, t.label as ref'; $projectkey = 'fk_origin'; @@ -560,8 +560,8 @@ class FormProjets $sql .= " WHERE ".$projectkey." is null"; if (!empty($socid) && $linkedtothirdparty) { - if (is_numeric($socid)) $sql .= " AND t.fk_soc=".$socid; - else $sql .= " AND t.fk_soc IN (".$socid.")"; + if (is_numeric($socid)) $sql .= " AND t.fk_soc=".$socid; + else $sql .= " AND t.fk_soc IN (".$socid.")"; } if (!in_array($table_element, array('expensereport_det', 'stock_mouvement'))) $sql .= ' AND t.entity IN ('.getEntity('project').')'; if ($linkedtothirdparty) $sql .= " AND s.rowid = t.fk_soc"; @@ -640,15 +640,15 @@ class FormProjets { $sellist = ''; - print ''; - foreach ($this->param as $key => $value) { - print ''; - } - print ''; + print ''; + print ''; + print ''; + foreach ($this->param as $key => $value) { + print ''; + } + print ''; - print ''; + print '
'; - if ($this->withref) { - // Ref - $defaultref = $ticketstat->getDefaultRef(); - print ''; - } + if ($this->withref) { + // Ref + $defaultref = $ticketstat->getDefaultRef(); + print ''; + } - // TITLE - if ($this->withemail) { - print ''; - } + // TITLE + if ($this->withemail) { + print ''; + } - // Si origin du ticket - if (isset($this->param['origin']) && $this->param['originid'] > 0) { - // Parse element/subelement (ex: project_task) - $element = $subelement = $this->param['origin']; - if (preg_match('/^([^_]+)_([^_]+)/i', $this->param['origin'], $regs)) { - $element = $regs[1]; - $subelement = $regs[2]; - } + // Si origin du ticket + if (isset($this->param['origin']) && $this->param['originid'] > 0) { + // Parse element/subelement (ex: project_task) + $element = $subelement = $this->param['origin']; + if (preg_match('/^([^_]+)_([^_]+)/i', $this->param['origin'], $regs)) { + $element = $regs[1]; + $subelement = $regs[2]; + } - dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); - $classname = ucfirst($subelement); - $objectsrc = new $classname($this->db); - $objectsrc->fetch(GETPOST('originid', 'int')); + dol_include_once('/'.$element.'/class/'.$subelement.'.class.php'); + $classname = ucfirst($subelement); + $objectsrc = new $classname($this->db); + $objectsrc->fetch(GETPOST('originid', 'int')); - if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) { - $objectsrc->fetch_lines(); - } + if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines')) { + $objectsrc->fetch_lines(); + } - $objectsrc->fetch_thirdparty(); - $newclassname = $classname; - print ''; - } + $objectsrc->fetch_thirdparty(); + $newclassname = $classname; + print ''; + } - // Type - print ''; + // Type + print ''; - // Severity - print ''; + // Severity + print ''; - // Group - print ''; + // Group + print ''; - // Subject - if ($this->withtitletopic) { - print ''; - } else { - if ($this->withthreadid > 0) { - $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withthreadid.' : '.$this->topic_title.''; - } - print ''; - print ''; - } - } + // Réponse à un ticket : affichage du titre du thread en readonly + if ($this->withtopicreadonly) { + print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; + print ''; + } else { + if ($this->withthreadid > 0) { + $subject = $langs->trans('SubjectAnswerToTicket').' '.$this->withthreadid.' : '.$this->topic_title.''; + } + print ''; + print ''; + } + } - // MESSAGE - $msg = GETPOSTISSET('message') ? GETPOST('message', 'none') : ''; - print ''; + // If public form, display more information + $toolbarname = 'dolibarr_notes'; + if ($this->ispublic) + { + $toolbarname = 'dolibarr_details'; + print '
'.($conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')).'
'; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $uselocalbrowser = true; + $doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_8, '90%'); + $doleditor->Create(); + print ''; - // FK_USER_CREATE - if ($this->withusercreate > 0 && $this->fk_user_create) { - print '\n"; - } + if ($this->withcreatereadonly) { + if ($res = $fuser->fetch($this->fk_user_create)) { + print $fuser->getNomUrl(1); + } + } + print '   '; + print "\n"; + } - // Customer or supplier - if ($this->withcompany) { - // altairis: force company and contact id for external user - if (empty($user->socid)) { - // Company - print ''; - if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { - $htmlname = 'socid'; - print ''; - } + } - // Contact and type - print ''; - } else { - print ''; - print ''; - print ''; - } + // Contact and type + print ''; + } else { + print ''; + print ''; + print ''; + } - // Notify thirdparty at creation - if (empty($this->ispublic)) - { - print ''; - } - } + // Notify thirdparty at creation + if (empty($this->ispublic)) + { + print ''; + } + } - if (!empty($conf->projet->enabled) && !$this->ispublic) - { - $formproject = new FormProjets($this->db); - print ''; - } + if (!empty($conf->projet->enabled) && !$this->ispublic) + { + $formproject = new FormProjets($this->db); + print ''; + } - // Attached files - if (!empty($this->withfile)) { - // Define list of attached files - $listofpaths = array(); - $listofnames = array(); - $listofmimes = array(); - if (!empty($_SESSION["listofpaths"])) { - $listofpaths = explode(';', $_SESSION["listofpaths"]); - } + // Attached files + if (!empty($this->withfile)) { + // Define list of attached files + $listofpaths = array(); + $listofnames = array(); + $listofmimes = array(); + if (!empty($_SESSION["listofpaths"])) { + $listofpaths = explode(';', $_SESSION["listofpaths"]); + } - if (!empty($_SESSION["listofnames"])) { - $listofnames = explode(';', $_SESSION["listofnames"]); - } + if (!empty($_SESSION["listofnames"])) { + $listofnames = explode(';', $_SESSION["listofnames"]); + } - if (!empty($_SESSION["listofmimes"])) { - $listofmimes = explode(';', $_SESSION["listofmimes"]); - } + if (!empty($_SESSION["listofmimes"])) { + $listofmimes = explode(';', $_SESSION["listofmimes"]); + } - $out = ''; - $out .= ''; - $out .= '\n"; + $out = ''; + $out .= ''; + $out .= '\n"; - print $out; - } + print $out; + } - // Other attributes - $parameters = array(); - $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) - { - print $ticketstat->showOptionals($extrafields, 'create'); - } + // Other attributes + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $ticketstat, $this->action); // Note that $action and $object may have been modified by hook + if (empty($reshook)) + { + print $ticketstat->showOptionals($extrafields, 'create'); + } - print '
'.$langs->trans("Ref").'
'.$langs->trans("Ref").'
'; - print ''; - print '
'; + print ''; + print '
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
'.$langs->trans($newclassname).''.$objectsrc->getNomUrl(1).'
'; - $this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', '2', 0, 0, 0, 'minwidth150'); - print '
'; + $this->selectTypesTickets((GETPOST('type_code', 'alpha') ? GETPOST('type_code', 'alpha') : $this->type_code), 'type_code', '', '2', 0, 0, 0, 'minwidth150'); + print '
'; - $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2'); - print '
'; + $this->selectSeveritiesTickets((GETPOST('severity_code') ? GETPOST('severity_code') : $this->severity_code), 'severity_code', '', '2'); + print '
'; - $this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); - print '
'; + $this->selectGroupTickets((GETPOST('category_code') ? GETPOST('category_code') : $this->category_code), 'category_code', '', '2'); + print '
'; + // Subject + if ($this->withtitletopic) { + print '
'; - // Réponse à un ticket : affichage du titre du thread en readonly - if ($this->withtopicreadonly) { - print $langs->trans('SubjectAnswerToTicket').' '.$this->topic_title; - print '
'; + // MESSAGE + $msg = GETPOSTISSET('message') ? GETPOST('message', 'none') : ''; + print '
'; - // If public form, display more information - $toolbarname = 'dolibarr_notes'; - if ($this->ispublic) - { - $toolbarname = 'dolibarr_details'; - print '
'.($conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE ? $conf->global->TICKET_PUBLIC_TEXT_HELP_MESSAGE : $langs->trans('TicketPublicPleaseBeAccuratelyDescribe')).'
'; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $uselocalbrowser = true; - $doleditor = new DolEditor('message', $msg, '100%', 230, $toolbarname, 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_8, '90%'); - $doleditor->Create(); - print '
'.$langs->trans("CreatedBy").''; - $langs->load("users"); - $fuser = new User($this->db); + // FK_USER_CREATE + if ($this->withusercreate > 0 && $this->fk_user_create) { + print '
'.$langs->trans("CreatedBy").''; + $langs->load("users"); + $fuser = new User($this->db); - if ($this->withcreatereadonly) { - if ($res = $fuser->fetch($this->fk_user_create)) { - print $fuser->getNomUrl(1); - } - } - print '   '; - print "
'.$langs->trans("ThirdParty").''; - $events = array(); - $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); - print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events, 0, 'minwidth200'); - print '
'.$langs->trans("Contact").''; - // If no socid, set to -1 to avoid full contacts list - $selectedCompany = ($this->withfromsocid > 0) ? $this->withfromsocid : -1; - $nbofcontacts = $form->select_contacts($selectedCompany, $this->withfromcontactid, 'contactid', 3, '', '', 0, 'minwidth200'); - print ' '; - $formcompany->selectTypeContact($ticketstatic, '', 'type', 'external', '', 0, 'maginleftonly'); - print '
'.$langs->trans("Contact").''; + // If no socid, set to -1 to avoid full contacts list + $selectedCompany = ($this->withfromsocid > 0) ? $this->withfromsocid : -1; + $nbofcontacts = $form->select_contacts($selectedCompany, $this->withfromcontactid, 'contactid', 3, '', '', 0, 'minwidth200'); + print ' '; + $formcompany->selectTypeContact($ticketstatic, '', 'type', 'external', '', 0, 'maginleftonly'); + print '
'; - print 'withnotifytiersatcreate ? ' checked="checked"' : '').'>'; - print '
'; + print 'withnotifytiersatcreate ? ' checked="checked"' : '').'>'; + print '
'; - print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); - print '
'; + print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); + print '
'.$langs->trans("MailFile").''; - // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript - $out .= ''."\n"; - $out .= ''."\n"; - if (count($listofpaths)) { - foreach ($listofpaths as $key => $val) { - $out .= '
'; - $out .= img_mime($listofnames[$key]).' '.$listofnames[$key]; - if (!$this->withfilereadonly) { - $out .= ' '; - } - $out .= '
'; - } - } else { - $out .= $langs->trans("NoAttachedFiles").'
'; - } - if ($this->withfile == 2) { // Can add other files - $out .= ''; - $out .= ' '; - $out .= ''; - } - $out .= "
'.$langs->trans("MailFile").''; + // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript + $out .= ''."\n"; + $out .= ''."\n"; + if (count($listofpaths)) { + foreach ($listofpaths as $key => $val) { + $out .= '
'; + $out .= img_mime($listofnames[$key]).' '.$listofnames[$key]; + if (!$this->withfilereadonly) { + $out .= ' '; + } + $out .= '
'; + } + } else { + $out .= $langs->trans("NoAttachedFiles").'
'; + } + if ($this->withfile == 2) { // Can add other files + $out .= ''; + $out .= ' '; + $out .= ''; + } + $out .= "
'; + print '
'; - if ($withdolfichehead) dol_fiche_end(); + if ($withdolfichehead) dol_fiche_end(); print '
'; - print ''; - if ($this->withcancel) { - print "      "; - print "trans("Cancel")."\">"; - } + print ''; + if ($this->withcancel) { + print "      "; + print "trans("Cancel")."\">"; + } print '
'; - print "\n"; - print "\n"; - } - - /** - * Return html list of tickets type - * - * @param string $selected Id du type pre-selectionne - * @param string $htmlname Nom de la zone select - * @param string $filtertype To filter on field type in llx_c_ticket_type (array('code'=>xx,'label'=>zz)) - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon - * @param int $noadmininfo 0=Add admin info, 1=Disable admin info - * @param int $maxlength Max length of label - * @param string $morecss More CSS - * @return void - */ - public function selectTypesTickets($selected = '', $htmlname = 'tickettype', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') - { - global $langs, $user; - - $ticketstat = new Ticket($this->db); - - dol_syslog(get_class($this)."::select_types_tickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); - - $filterarray = array(); - - if ($filtertype != '' && $filtertype != '-1') { - $filterarray = explode(',', $filtertype); - } - - $ticketstat->loadCacheTypesTickets(); - - print ''; - if ($user->admin && !$noadmininfo) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - - print ajax_combobox('select'.$htmlname); - } - - /** - * Return html list of ticket anaytic codes - * - * @param string $selected Id categorie pre-selectionnée - * @param string $htmlname Nom de la zone select - * @param string $filtertype To filter on field type in llx_c_ticket_category (array('code'=>xx,'label'=>zz)) - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon - * @param int $noadmininfo 0=Add admin info, 1=Disable admin info - * @param int $maxlength Max length of label - * @param string $morecss More CSS - * @return void - */ - public function selectGroupTickets($selected = '', $htmlname = 'ticketcategory', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') - { - global $langs, $user; - - $ticketstat = new Ticket($this->db); - - dol_syslog(get_class($this)."::selectCategoryTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); - - $filterarray = array(); - - if ($filtertype != '' && $filtertype != '-1') { - $filterarray = explode(',', $filtertype); - } - - $ticketstat->loadCacheCategoriesTickets(); - - print ''; - if ($user->admin && !$noadmininfo) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - - print ajax_combobox('select'.$htmlname); - } - - /** - * Return html list of ticket severitys - * - * @param string $selected Id severity pre-selectionnée - * @param string $htmlname Nom de la zone select - * @param string $filtertype To filter on field type in llx_c_ticket_severity (array('code'=>xx,'label'=>zz)) - * @param int $format 0=id+libelle, 1=code+code, 2=code+libelle, 3=id+code - * @param int $empty 1=peut etre vide, 0 sinon - * @param int $noadmininfo 0=Add admin info, 1=Disable admin info - * @param int $maxlength Max length of label - * @param string $morecss More CSS - * @return void - */ - public function selectSeveritiesTickets($selected = '', $htmlname = 'ticketseverity', $filtertype = '', $format = 0, $empty = 0, $noadmininfo = 0, $maxlength = 0, $morecss = '') - { - global $langs, $user; - - $ticketstat = new Ticket($this->db); - - dol_syslog(get_class($this)."::selectSeveritiesTickets ".$selected.", ".$htmlname.", ".$filtertype.", ".$format, LOG_DEBUG); - - $filterarray = array(); - - if ($filtertype != '' && $filtertype != '-1') { - $filterarray = explode(',', $filtertype); - } - - $ticketstat->loadCacheSeveritiesTickets(); - - print ''; - if ($user->admin && !$noadmininfo) { - print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); - } - - print ajax_combobox('select'.$htmlname); - } - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Clear list of attached files in send mail form (also stored in session) - * - * @return void - */ - public function clear_attached_files() - { - // phpcs:enable - global $conf, $user; - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - // Set tmp user directory - $vardir = $conf->user->dir_output."/".$user->id; - $upload_dir = $vardir.'/temp/'; // TODO Add $keytoavoidconflict in upload_dir path - if (is_dir($upload_dir)) dol_delete_dir_recursive($upload_dir); - - $keytoavoidconflict = empty($this->trackid) ? '' : '-'.$this->trackid; // this->trackid must be defined - unset($_SESSION["listofpaths".$keytoavoidconflict]); - unset($_SESSION["listofnames".$keytoavoidconflict]); - unset($_SESSION["listofmimes".$keytoavoidconflict]); - } - - /** - * Show the form to add message on ticket - * - * @param string $width Width of form - * @return void - */ - public function showMessageForm($width = '40%') - { - global $conf, $langs, $user, $hookmanager, $form, $mysoc; - - $formmail = new FormMail($this->db); - $addfileaction = 'addfile'; - - if (!is_object($form)) $form = new Form($this->db); - - // Load translation files required by the page - $langs->loadLangs(array('other', 'mails')); - - // Clear temp files. Must be done at beginning, before call of triggers - if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) - { - $this->clear_attached_files(); - } - - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $this->param['langsmodels']; - if (!empty($newlang)) - { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outputlangs->load('other'); - } - - // Get message template for $this->param["models"] into c_email_templates - $arraydefaultmessage = -1; - if ($this->param['models'] != 'none') - { - $model_id = 0; - if (array_key_exists('models_id', $this->param)) - { - $model_id = $this->param["models_id"]; - } - - $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); // If $model_id is empty, preselect the first one - } - - // Define list of attached files - $listofpaths = array(); - $listofnames = array(); - $listofmimes = array(); - $keytoavoidconflict = empty($this->trackid) ? '' : '-'.$this->trackid; // this->trackid must be defined - - if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) - { - if (!empty($arraydefaultmessage->joinfiles) && is_array($this->param['fileinit'])) - { - foreach ($this->param['fileinit'] as $file) - { - $this->add_attached_files($file, basename($file), dol_mimetype($file)); - } - } - } - - if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) $listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]); - if (!empty($_SESSION["listofnames".$keytoavoidconflict])) $listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]); - if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) $listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]); - - // Define output language - $outputlangs = $langs; - $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { - $newlang = $this->param['langsmodels']; - } - if (!empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - $outputlangs->load('other'); - } - - print "\n\n"; - - $send_email = GETPOST('send_email', 'int') ? GETPOST('send_email', 'int') : 0; - - // Example 1 : Adding jquery code - print ''; - print '
'; - print ''; - print ''; - print ''; - foreach ($this->param as $key => $value) { - print ''; - } + print ''; + print ''; + print ''; + print ''; + foreach ($this->param as $key => $value) { + print ''; + } - // Get message template - $model_id = 0; - if (array_key_exists('models_id', $this->param)) { - $model_id = $this->param["models_id"]; - $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); - } + // Get message template + $model_id = 0; + if (array_key_exists('models_id', $this->param)) { + $model_id = $this->param["models_id"]; + $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $this->param["models"], $user, $outputlangs, $model_id); + } - $result = $formmail->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs); - if ($result < 0) { - setEventMessages($this->error, $this->errors, 'errors'); - } - $modelmail_array = array(); - foreach ($formmail->lines_model as $line) { - $modelmail_array[$line->id] = $line->label; - } + $result = $formmail->fetchAllEMailTemplate($this->param["models"], $user, $outputlangs); + if ($result < 0) { + setEventMessages($this->error, $this->errors, 'errors'); + } + $modelmail_array = array(); + foreach ($formmail->lines_model as $line) { + $modelmail_array[$line->id] = $line->label; + } - print ''; + print '
'; - // External users can't send message email - if ($user->rights->ticket->write && !$user->socid) - { - print ''; + // External users can't send message email + if ($user->rights->ticket->write && !$user->socid) + { + print ''; - // Zone to select its email template - if (count($modelmail_array) > 0) { - print ''; - } + // Zone to select its email template + if (count($modelmail_array) > 0) { + print ''; + } - // Private message (not visible by customer/external user) - if (!$user->socid) { - print ''; - } + // Private message (not visible by customer/external user) + if (!$user->socid) { + print ''; + } - print ''; - $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; - print ''; + print ''; + $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; + print ''; - // Destinataires - print ''; - } + // Print recipient list + if (is_array($sendto) && count($sendto) > 0) { + print implode(', ', $sendto); + } else { + print '
'.$langs->trans('WarningNoEMailsAdded').' '.$langs->trans('TicketGoIntoContactTab').'
'; + } + } + print ''; + } - // Intro - // External users can't send message email - if ($user->rights->ticket->write && !$user->socid) { - $mail_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKET_MESSAGE_MAIL_INTRO; - print ''; - } + $doleditor->Create(); + print ''; + } - // MESSAGE - $defaultmessage = ""; - if (is_array($arraydefaultmessage) && count($arraydefaultmessage) > 0 && $arraydefaultmessage->content) { - $defaultmessage = $arraydefaultmessage->content; - } - $defaultmessage = str_replace('\n', "\n", $defaultmessage); + // MESSAGE + $defaultmessage = ""; + if (is_array($arraydefaultmessage) && count($arraydefaultmessage) > 0 && $arraydefaultmessage->content) { + $defaultmessage = $arraydefaultmessage->content; + } + $defaultmessage = str_replace('\n', "\n", $defaultmessage); - // Deal with format differences between message and signature (text / HTML) - if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) { - $this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']); - } elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) { - $defaultmessage = dol_nl2br($defaultmessage); - } - if (isset($_POST["message"]) && !$_POST['modelselected']) { - $defaultmessage = GETPOST('message'); - } else { - $defaultmessage = make_substitutions($defaultmessage, $this->substit); - // Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty) - $defaultmessage = preg_replace("/^(
)+/", "", $defaultmessage); - $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage); - } + // Deal with format differences between message and signature (text / HTML) + if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__SIGNATURE__'])) { + $this->substit['__SIGNATURE__'] = dol_nl2br($this->substit['__SIGNATURE__']); + } elseif (!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__SIGNATURE__'])) { + $defaultmessage = dol_nl2br($defaultmessage); + } + if (isset($_POST["message"]) && !$_POST['modelselected']) { + $defaultmessage = GETPOST('message'); + } else { + $defaultmessage = make_substitutions($defaultmessage, $this->substit); + // Clean first \n and br (to avoid empty line when CONTACTCIVNAME is empty) + $defaultmessage = preg_replace("/^(
)+/", "", $defaultmessage); + $defaultmessage = preg_replace("/^\n+/", "", $defaultmessage); + } - print ''; + print ''; - // Signature - // External users can't send message email - if ($user->rights->ticket->write && !$user->socid) { - $mail_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE; - print ''; - } + print ''; + } - // Attached files - if (!empty($this->withfile)) { - $out = ''; - $out .= ''; - $out .= '\n"; + // Attached files + if (!empty($this->withfile)) { + $out = ''; + $out .= ''; + $out .= '\n"; - print $out; - } + print $out; + } - print '
'; - $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ''); - print ' '; - print ''; - print '
'; + $checkbox_selected = (GETPOST('send_email') == "1" ? ' checked' : ''); + print ' '; + print ''; + print '
'; - $checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : ''); - print ' '; - print ''; - print ''; - print $form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help'); - print '
'; + $checkbox_selected = (GETPOST('private_message', 'alpha') == "1" ? ' checked' : ''); + print ' '; + print ''; + print ''; + print $form->textwithpicto('', $langs->trans("TicketMessagePrivateHelp"), 1, 'help'); + print '
'; + print $form->textwithpicto('', $langs->trans("TicketMessageMailIntroHelp"), 1, 'help'); + print '
'; - //$toolbarname = 'dolibarr_details'; - $toolbarname = 'dolibarr_notes'; - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('message', $defaultmessage, '100%', 200, $toolbarname, '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, 70); - $doleditor->Create(); - print ''; - if ($user->rights->ticket->write && !$user->socid) { - print $form->textwithpicto('', $langs->trans("TicketMessageHelp"), 1, 'help'); - } + print '
'; + //$toolbarname = 'dolibarr_details'; + $toolbarname = 'dolibarr_notes'; + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('message', $defaultmessage, '100%', 200, $toolbarname, '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, 70); + $doleditor->Create(); + print ''; + if ($user->rights->ticket->write && !$user->socid) { + print $form->textwithpicto('', $langs->trans("TicketMessageHelp"), 1, 'help'); + } - print '
'; + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $doleditor = new DolEditor('mail_signature', $mail_signature, '100%', 150, 'dolibarr_details', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_2, 70); + $doleditor->Create(); + print ''; + print $form->textwithpicto('', $langs->trans("TicketMessageMailSignatureHelp"), 1, 'help'); + print '
'.$langs->trans("MailFile").''; - // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript - $out .= ''."\n"; - $out .= ''."\n"; - if (count($listofpaths)) { - foreach ($listofpaths as $key => $val) { - $out .= '
'; - $out .= img_mime($listofnames[$key]).' '.$listofnames[$key]; - if (!$this->withfilereadonly) { - $out .= ' '; - } - $out .= '
'; - } - } else { - $out .= $langs->trans("NoAttachedFiles").'
'; - } - if ($this->withfile == 2) { // Can add other files - $out .= ''; - $out .= ' '; - $out .= ''; - } - $out .= "
'.$langs->trans("MailFile").''; + // TODO Trick to have param removedfile containing nb of image to delete. But this does not works without javascript + $out .= ''."\n"; + $out .= ''."\n"; + if (count($listofpaths)) { + foreach ($listofpaths as $key => $val) { + $out .= '
'; + $out .= img_mime($listofnames[$key]).' '.$listofnames[$key]; + if (!$this->withfilereadonly) { + $out .= ' '; + } + $out .= '
'; + } + } else { + $out .= $langs->trans("NoAttachedFiles").'
'; + } + if ($this->withfile == 2) { // Can add other files + $out .= ''; + $out .= ' '; + $out .= ''; + } + $out .= "
'; + print ''; - print '

'; - print ''; - if ($this->withcancel) { - print "     "; - print "trans("Cancel")."\">"; - } - print "
\n"; + print '

'; + print ''; + if ($this->withcancel) { + print "     "; + print "trans("Cancel")."\">"; + } + print "
\n"; - print "
\n"; - print "\n"; - } + print "\n"; + print "\n"; + } } diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index c492eff97e8..dd02bf365c1 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -26,714 +26,792 @@ */ class RssParser { - /** - * @var DoliDB Database handler. - */ - public $db; + /** + * @var DoliDB Database handler. + */ + public $db; - /** - * @var string Error code (or message) - */ - public $error = ''; + /** + * @var string Error code (or message) + */ + public $error = ''; - private $_format = ''; - private $_urlRSS; - private $_language; - private $_generator; - private $_copyright; - private $_lastbuilddate; - private $_imageurl; - private $_link; - private $_title; - private $_description; - private $_lastfetchdate; // Last successful fetch - private $_rssarray = array(); + private $_format = ''; + private $_urlRSS; + private $_language; + private $_generator; + private $_copyright; + private $_lastbuilddate; + private $_imageurl; + private $_link; + private $_title; + private $_description; + private $_lastfetchdate; // Last successful fetch + private $_rssarray = array(); - // For parsing with xmlparser - public $stack = array(); // parser stack - private $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); + // For parsing with xmlparser + public $stack = array(); // parser stack + private $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright'); - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } - /** - * getFormat - * - * @return string - */ - public function getFormat() - { - return $this->_format; - } + /** + * getFormat + * + * @return string + */ + public function getFormat() + { + return $this->_format; + } - /** - * getUrlRss - * - * @return string - */ - public function getUrlRss() - { - return $this->_urlRSS; - } - /** - * getLanguage - * - * @return string - */ - public function getLanguage() - { - return $this->_language; - } - /** - * getGenerator - * - * @return string - */ - public function getGenerator() - { - return $this->_generator; - } - /** - * getCopyright - * - * @return string - */ - public function getCopyright() - { - return $this->_copyright; - } - /** - * getLastBuildDate - * - * @return string - */ - public function getLastBuildDate() - { - return $this->_lastbuilddate; - } - /** - * getImageUrl - * - * @return string - */ - public function getImageUrl() - { - return $this->_imageurl; - } - /** - * getLink - * - * @return string - */ - public function getLink() - { - return $this->_link; - } - /** - * getTitle - * - * @return string - */ - public function getTitle() - { - return $this->_title; - } - /** - * getDescription - * - * @return string - */ - public function getDescription() - { - return $this->_description; - } - /** - * getLastFetchDate - * - * @return string - */ - public function getLastFetchDate() - { - return $this->_lastfetchdate; - } - /** - * getItems - * - * @return string - */ - public function getItems() - { - return $this->_rssarray; - } + /** + * getUrlRss + * + * @return string + */ + public function getUrlRss() + { + return $this->_urlRSS; + } + /** + * getLanguage + * + * @return string + */ + public function getLanguage() + { + return $this->_language; + } + /** + * getGenerator + * + * @return string + */ + public function getGenerator() + { + return $this->_generator; + } + /** + * getCopyright + * + * @return string + */ + public function getCopyright() + { + return $this->_copyright; + } + /** + * getLastBuildDate + * + * @return string + */ + public function getLastBuildDate() + { + return $this->_lastbuilddate; + } + /** + * getImageUrl + * + * @return string + */ + public function getImageUrl() + { + return $this->_imageurl; + } + /** + * getLink + * + * @return string + */ + public function getLink() + { + return $this->_link; + } + /** + * getTitle + * + * @return string + */ + public function getTitle() + { + return $this->_title; + } + /** + * getDescription + * + * @return string + */ + public function getDescription() + { + return $this->_description; + } + /** + * getLastFetchDate + * + * @return string + */ + public function getLastFetchDate() + { + return $this->_lastfetchdate; + } + /** + * getItems + * + * @return string + */ + public function getItems() + { + return $this->_rssarray; + } - /** - * Parse rss URL - * - * @param string $urlRSS Url to parse - * @param int $maxNb Max nb of records to get (0 for no limit) - * @param int $cachedelay 0=No cache, nb of seconds we accept cache files (cachedir must also be defined) - * @param string $cachedir Directory where to save cache file - * @return int <0 if KO, >0 if OK - */ - public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '') - { - global $conf; + /** + * Parse rss URL + * + * @param string $urlRSS Url to parse + * @param int $maxNb Max nb of records to get (0 for no limit) + * @param int $cachedelay 0=No cache, nb of seconds we accept cache files (cachedir must also be defined) + * @param string $cachedir Directory where to save cache file + * @return int <0 if KO, >0 if OK + */ + public function parser($urlRSS, $maxNb = 0, $cachedelay = 60, $cachedir = '') + { + global $conf; - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $rss = ''; - $str = ''; // This will contain content of feed + $rss = ''; + $str = ''; // This will contain content of feed - // Check parameters - if (!dol_is_url($urlRSS)) - { - $this->error = "ErrorBadUrl"; - return -1; - } + // Check parameters + if (!dol_is_url($urlRSS)) + { + $this->error = "ErrorBadUrl"; + return -1; + } - $this->_urlRSS = $urlRSS; - $newpathofdestfile = $cachedir.'/'.dol_hash($this->_urlRSS, 3); // Force md5 hash (does not contains special chars) - $newmask = '0644'; + $this->_urlRSS = $urlRSS; + $newpathofdestfile = $cachedir.'/'.dol_hash($this->_urlRSS, 3); // Force md5 hash (does not contains special chars) + $newmask = '0644'; - //dol_syslog("RssPArser::parser parse url=".$urlRSS." => cache file=".$newpathofdestfile); - $nowgmt = dol_now(); + //dol_syslog("RssPArser::parser parse url=".$urlRSS." => cache file=".$newpathofdestfile); + $nowgmt = dol_now(); - // Search into cache - $foundintocache = 0; - if ($cachedelay > 0 && $cachedir) - { - $filedate = dol_filemtime($newpathofdestfile); - if ($filedate >= ($nowgmt - $cachedelay)) - { - //dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we use it."); - $foundintocache = 1; + // Search into cache + $foundintocache = 0; + if ($cachedelay > 0 && $cachedir) + { + $filedate = dol_filemtime($newpathofdestfile); + if ($filedate >= ($nowgmt - $cachedelay)) + { + //dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we use it."); + $foundintocache = 1; - $this->_lastfetchdate = $filedate; - } - else - { - dol_syslog(get_class($this)."::parser cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); - } - } + $this->_lastfetchdate = $filedate; + } + else + { + dol_syslog(get_class($this)."::parser cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); + } + } - // Load file into $str - if ($foundintocache) // Cache file found and is not too old - { - $str = file_get_contents($newpathofdestfile); - } - else - { - try { - ini_set("user_agent", "Dolibarr ERP-CRM RSS reader"); - ini_set("max_execution_time", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); - ini_set("default_socket_timeout", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); + // Load file into $str + if ($foundintocache) // Cache file found and is not too old + { + $str = file_get_contents($newpathofdestfile); + } + else + { + try { + ini_set("user_agent", "Dolibarr ERP-CRM RSS reader"); + ini_set("max_execution_time", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); + ini_set("default_socket_timeout", $conf->global->MAIN_USE_RESPONSE_TIMEOUT); - $opts = array('http'=>array('method'=>"GET")); - if (!empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)) $opts['http']['timeout'] = $conf->global->MAIN_USE_CONNECT_TIMEOUT; - if (!empty($conf->global->MAIN_PROXY_USE)) $opts['http']['proxy'] = 'tcp://'.$conf->global->MAIN_PROXY_HOST.':'.$conf->global->MAIN_PROXY_PORT; - //var_dump($opts);exit; - $context = stream_context_create($opts); + $opts = array('http'=>array('method'=>"GET")); + if (!empty($conf->global->MAIN_USE_CONNECT_TIMEOUT)) $opts['http']['timeout'] = $conf->global->MAIN_USE_CONNECT_TIMEOUT; + if (!empty($conf->global->MAIN_PROXY_USE)) $opts['http']['proxy'] = 'tcp://'.$conf->global->MAIN_PROXY_HOST.':'.$conf->global->MAIN_PROXY_PORT; + //var_dump($opts);exit; + $context = stream_context_create($opts); - $str = file_get_contents($this->_urlRSS, false, $context); - } - catch (Exception $e) { - print 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage(); - } - } + $str = file_get_contents($this->_urlRSS, false, $context); + } + catch (Exception $e) { + print 'Error retrieving URL '.$this->_urlRSS.' - '.$e->getMessage(); + } + } - if ($str !== false) - { - // Convert $str into xml - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) - { - //print 'xx'.LIBXML_NOCDATA; - libxml_use_internal_errors(false); - $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA); - } - else - { - $xmlparser = xml_parser_create(''); - if (!is_resource($xmlparser)) { - $this->error = "ErrorFailedToCreateParser"; return -1; - } + if ($str !== false) + { + // Convert $str into xml + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) + { + //print 'xx'.LIBXML_NOCDATA; + libxml_use_internal_errors(false); + $rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA); + } + else + { + $xmlparser = xml_parser_create(''); + if (!is_resource($xmlparser)) { + $this->error = "ErrorFailedToCreateParser"; return -1; + } - xml_set_object($xmlparser, $this); - xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); - xml_set_character_data_handler($xmlparser, 'feed_cdata'); - $status = xml_parse($xmlparser, $str); - xml_parser_free($xmlparser); - $rss = $this; - //var_dump($rss->_format);exit; - } - } + xml_set_object($xmlparser, $this); + xml_set_element_handler($xmlparser, 'feed_start_element', 'feed_end_element'); + xml_set_character_data_handler($xmlparser, 'feed_cdata'); + $status = xml_parse($xmlparser, $str); + xml_parser_free($xmlparser); + $rss = $this; + //var_dump($rss->_format);exit; + } + } - // If $rss loaded - if ($rss) - { - // Save file into cache - if (empty($foundintocache) && $cachedir) - { - dol_syslog(get_class($this)."::parser cache file ".$newpathofdestfile." is saved onto disk."); - if (!dol_is_dir($cachedir)) dol_mkdir($cachedir); - $fp = fopen($newpathofdestfile, 'w'); - if ($fp) - { - fwrite($fp, $str); - fclose($fp); - if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK; - @chmod($newpathofdestfile, octdec($newmask)); + // If $rss loaded + if ($rss) + { + // Save file into cache + if (empty($foundintocache) && $cachedir) + { + dol_syslog(get_class($this)."::parser cache file ".$newpathofdestfile." is saved onto disk."); + if (!dol_is_dir($cachedir)) dol_mkdir($cachedir); + $fp = fopen($newpathofdestfile, 'w'); + if ($fp) + { + fwrite($fp, $str); + fclose($fp); + if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK; + @chmod($newpathofdestfile, octdec($newmask)); - $this->_lastfetchdate = $nowgmt; - } - else - { - print 'Error, failed to open file '.$newpathofdestfile.' for write'; - } - } + $this->_lastfetchdate = $nowgmt; + } + else + { + print 'Error, failed to open file '.$newpathofdestfile.' for write'; + } + } - unset($str); // Free memory + unset($str); // Free memory - if (empty($rss->_format)) // If format not detected automatically - { - $rss->_format = 'rss'; - if (empty($rss->channel)) $rss->_format = 'atom'; - } + if (empty($rss->_format)) // If format not detected automatically + { + $rss->_format = 'rss'; + if (empty($rss->channel)) $rss->_format = 'atom'; + } - $items = array(); + $items = array(); - // Save description entries - if ($rss->_format == 'rss') - { - //var_dump($rss); - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) - { - if (!empty($rss->channel->language)) $this->_language = (string) $rss->channel->language; - if (!empty($rss->channel->generator)) $this->_generator = (string) $rss->channel->generator; - if (!empty($rss->channel->copyright)) $this->_copyright = (string) $rss->channel->copyright; - if (!empty($rss->channel->lastbuilddate)) $this->_lastbuilddate = (string) $rss->channel->lastbuilddate; - if (!empty($rss->channel->image->url[0])) $this->_imageurl = (string) $rss->channel->image->url[0]; - if (!empty($rss->channel->link)) $this->_link = (string) $rss->channel->link; - if (!empty($rss->channel->title)) $this->_title = (string) $rss->channel->title; - if (!empty($rss->channel->description)) $this->_description = (string) $rss->channel->description; - } - else - { - //var_dump($rss->channel); - if (!empty($rss->channel['language'])) $this->_language = (string) $rss->channel['language']; - if (!empty($rss->channel['generator'])) $this->_generator = (string) $rss->channel['generator']; - if (!empty($rss->channel['copyright'])) $this->_copyright = (string) $rss->channel['copyright']; - if (!empty($rss->channel['lastbuilddate'])) $this->_lastbuilddate = (string) $rss->channel['lastbuilddate']; - if (!empty($rss->image['url'])) $this->_imageurl = (string) $rss->image['url']; - if (!empty($rss->channel['link'])) $this->_link = (string) $rss->channel['link']; - if (!empty($rss->channel['title'])) $this->_title = (string) $rss->channel['title']; - if (!empty($rss->channel['description'])) $this->_description = (string) $rss->channel['description']; - } + // Save description entries + if ($rss->_format == 'rss') + { + //var_dump($rss); + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) + { + if (!empty($rss->channel->language)) $this->_language = (string) $rss->channel->language; + if (!empty($rss->channel->generator)) $this->_generator = (string) $rss->channel->generator; + if (!empty($rss->channel->copyright)) $this->_copyright = (string) $rss->channel->copyright; + if (!empty($rss->channel->lastbuilddate)) $this->_lastbuilddate = (string) $rss->channel->lastbuilddate; + if (!empty($rss->channel->image->url[0])) $this->_imageurl = (string) $rss->channel->image->url[0]; + if (!empty($rss->channel->link)) $this->_link = (string) $rss->channel->link; + if (!empty($rss->channel->title)) $this->_title = (string) $rss->channel->title; + if (!empty($rss->channel->description)) $this->_description = (string) $rss->channel->description; + } + else + { + //var_dump($rss->channel); + if (!empty($rss->channel['language'])) $this->_language = (string) $rss->channel['language']; + if (!empty($rss->channel['generator'])) $this->_generator = (string) $rss->channel['generator']; + if (!empty($rss->channel['copyright'])) $this->_copyright = (string) $rss->channel['copyright']; + if (!empty($rss->channel['lastbuilddate'])) $this->_lastbuilddate = (string) $rss->channel['lastbuilddate']; + if (!empty($rss->image['url'])) $this->_imageurl = (string) $rss->image['url']; + if (!empty($rss->channel['link'])) $this->_link = (string) $rss->channel['link']; + if (!empty($rss->channel['title'])) $this->_title = (string) $rss->channel['title']; + if (!empty($rss->channel['description'])) $this->_description = (string) $rss->channel['description']; + } - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) $items = $rss->channel->item; // With simplexml - else $items = $rss->items; // With xmlparse - //var_dump($items);exit; - } - elseif ($rss->_format == 'atom') - { - //var_dump($rss); - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) - { - if (!empty($rss->generator)) $this->_generator = (string) $rss->generator; - if (!empty($rss->lastbuilddate)) $this->_lastbuilddate = (string) $rss->modified; - if (!empty($rss->link->href)) $this->_link = (string) $rss->link->href; - if (!empty($rss->title)) $this->_title = (string) $rss->title; - if (!empty($rss->description)) $this->_description = (string) $rss->description; - } - else - { - //if (!empty($rss->channel['rss_language'])) $this->_language = (string) $rss->channel['rss_language']; - if (!empty($rss->channel['generator'])) $this->_generator = (string) $rss->channel['generator']; - //if (!empty($rss->channel['rss_copyright'])) $this->_copyright = (string) $rss->channel['rss_copyright']; - if (!empty($rss->channel['modified'])) $this->_lastbuilddate = (string) $rss->channel['modified']; - //if (!empty($rss->image['rss_url'])) $this->_imageurl = (string) $rss->image['rss_url']; - if (!empty($rss->channel['link'])) $this->_link = (string) $rss->channel['link']; - if (!empty($rss->channel['title'])) $this->_title = (string) $rss->channel['title']; - //if (!empty($rss->channel['rss_description'])) $this->_description = (string) $rss->channel['rss_description']; - } - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { - $tmprss = xml2php($rss); $items = $tmprss['entry']; - } // With simplexml - else $items = $rss->items; // With xmlparse - //var_dump($items);exit; - } + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) $items = $rss->channel->item; // With simplexml + else $items = $rss->items; // With xmlparse + //var_dump($items);exit; + } + elseif ($rss->_format == 'atom') + { + //var_dump($rss); + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) + { + if (!empty($rss->generator)) $this->_generator = (string) $rss->generator; + if (!empty($rss->lastbuilddate)) $this->_lastbuilddate = (string) $rss->modified; + if (!empty($rss->link->href)) $this->_link = (string) $rss->link->href; + if (!empty($rss->title)) $this->_title = (string) $rss->title; + if (!empty($rss->description)) $this->_description = (string) $rss->description; + } + else + { + //if (!empty($rss->channel['rss_language'])) $this->_language = (string) $rss->channel['rss_language']; + if (!empty($rss->channel['generator'])) $this->_generator = (string) $rss->channel['generator']; + //if (!empty($rss->channel['rss_copyright'])) $this->_copyright = (string) $rss->channel['rss_copyright']; + if (!empty($rss->channel['modified'])) $this->_lastbuilddate = (string) $rss->channel['modified']; + //if (!empty($rss->image['rss_url'])) $this->_imageurl = (string) $rss->image['rss_url']; + if (!empty($rss->channel['link'])) $this->_link = (string) $rss->channel['link']; + if (!empty($rss->channel['title'])) $this->_title = (string) $rss->channel['title']; + //if (!empty($rss->channel['rss_description'])) $this->_description = (string) $rss->channel['rss_description']; - $i = 0; + $this->_imageurl = $this->getAtomImageUrl($rss->channel); + } + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { + $tmprss = xml2php($rss); $items = $tmprss['entry']; + } // With simplexml + else $items = $rss->items; // With xmlparse + //var_dump($items);exit; + } - // Loop on each record - if (is_array($items)) - { - foreach ($items as $item) - { - //var_dump($item);exit; - if ($rss->_format == 'rss') - { - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) - { - $itemLink = (string) $item->link; - $itemTitle = (string) $item->title; - $itemDescription = (string) $item->description; - $itemPubDate = (string) $item->pubDate; - $itemId = ''; - $itemAuthor = ''; - } - else - { - $itemLink = (string) $item['link']; - $itemTitle = (string) $item['title']; - $itemDescription = (string) $item['description']; - $itemPubDate = (string) $item['pubdate']; - $itemId = (string) $item['guid']; - $itemAuthor = (string) $item['author']; - } + $i = 0; - // Loop on each category - $itemCategory = array(); - if (is_array($item->category)) - { - foreach ($item->category as $cat) - { - $itemCategory[] = (string) $cat; - } - } - } - elseif ($rss->_format == 'atom') - { - if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) - { - $itemLink = (isset($item['link']['href']) ? (string) $item['link']['href'] : ''); - $itemTitle = (string) $item['title']; - $itemDescription = (string) $item['summary']; - $itemPubDate = (string) $item['created']; - $itemId = (string) $item['id']; - $itemAuthor = (string) ($item['author'] ? $item['author'] : $item['author_name']); - } - else - { - $itemLink = (isset($item['link']['href']) ? (string) $item['link']['href'] : ''); - $itemTitle = (string) $item['title']; - $itemDescription = (string) $item['summary']; - $itemPubDate = (string) $item['created']; - $itemId = (string) $item['id']; - $itemAuthor = (string) ($item['author'] ? $item['author'] : $item['author_name']); - } - } - else print 'ErrorBadFeedFormat'; + // Loop on each record + if (is_array($items)) + { + foreach ($items as $item) + { + //var_dump($item);exit; + if ($rss->_format == 'rss') + { + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) + { + $itemLink = (string) $item->link; + $itemTitle = (string) $item->title; + $itemDescription = (string) $item->description; + $itemPubDate = (string) $item->pubDate; + $itemId = ''; + $itemAuthor = ''; + } + else + { + $itemLink = (string) $item['link']; + $itemTitle = (string) $item['title']; + $itemDescription = (string) $item['description']; + $itemPubDate = (string) $item['pubdate']; + $itemId = (string) $item['guid']; + $itemAuthor = (string) $item['author']; + } - // Add record to result array - $this->_rssarray[$i] = array( - 'link'=>$itemLink, - 'title'=>$itemTitle, - 'description'=>$itemDescription, - 'pubDate'=>$itemPubDate, - 'category'=>$itemCategory, - 'id'=>$itemId, - 'author'=>$itemAuthor); - //var_dump($this->_rssarray); + // Loop on each category + $itemCategory = array(); + if (is_array($item->category)) + { + foreach ($item->category as $cat) + { + $itemCategory[] = (string) $cat; + } + } + } + elseif ($rss->_format == 'atom') + { + if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) + { + $itemLink = (isset($item['link']) ? (string) $item['link'] : ''); + $itemTitle = (string) $item['title']; + $itemDescription = $this->getAtomItemDescription($item); + $itemPubDate = (string) $item['created']; + $itemId = (string) $item['id']; + $itemAuthor = (string) ($item['author'] ? $item['author'] : $item['author_name']); + } + else + { + $itemLink = (isset($item['link']) ? (string) $item['link'] : ''); + $itemTitle = (string) $item['title']; + $itemDescription = $this->getAtomItemDescription($item); + $itemPubDate = (string) $item['created']; + $itemId = (string) $item['id']; + $itemAuthor = (string) ($item['author'] ? $item['author'] : $item['author_name']); + } + } + else print 'ErrorBadFeedFormat'; - $i++; + // Add record to result array + $this->_rssarray[$i] = array( + 'link'=>$itemLink, + 'title'=>$itemTitle, + 'description'=>$itemDescription, + 'pubDate'=>$itemPubDate, + 'category'=>$itemCategory, + 'id'=>$itemId, + 'author'=>$itemAuthor); + //var_dump($this->_rssarray); - if ($i > $maxNb) break; // We get all records we want - } - } + $i++; - return 1; - } - else - { - $this->error = 'ErrorFailedToLoadRSSFile'; - return -1; - } - } + if ($i > $maxNb) break; // We get all records we want + } + } + + return 1; + } + else + { + $this->error = 'ErrorFailedToLoadRSSFile'; + return -1; + } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Triggered when opened tag is found - * - * @param string $p Start - * @param string $element Tag - * @param array $attrs Attributes of tags - * @return void - */ - public function feed_start_element($p, $element, &$attrs) - { - // phpcs:enable - $el = $element = strtolower($element); - $attrs = array_change_key_case($attrs, CASE_LOWER); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Triggered when opened tag is found + * + * @param string $p Start + * @param string $element Tag + * @param array $attrs Attributes of tags + * @return void + */ + public function feed_start_element($p, $element, &$attrs) + { + // phpcs:enable + $el = $element = strtolower($element); + $attrs = array_change_key_case($attrs, CASE_LOWER); - // check for a namespace, and split if found - $ns = false; - if (strpos($element, ':')) - { - list($ns, $el) = explode(':', $element, 2); - } - if ($ns and $ns != 'rdf') - { - $this->current_namespace = $ns; - } + // check for a namespace, and split if found + $ns = false; + if (strpos($element, ':')) + { + list($ns, $el) = explode(':', $element, 2); + } + if ($ns and $ns != 'rdf') + { + $this->current_namespace = $ns; + } - // if feed type isn't set, then this is first element of feed identify feed from root element - if (empty($this->_format)) - { - if ($el == 'rdf') { - $this->_format = 'rss'; - $this->feed_version = '1.0'; - } - elseif ($el == 'rss') { - $this->_format = 'rss'; - $this->feed_version = $attrs['version']; - } - elseif ($el == 'feed') { - $this->_format = 'atom'; - $this->feed_version = $attrs['version']; - $this->inchannel = true; - } - return; - } + // if feed type isn't set, then this is first element of feed identify feed from root element + if (empty($this->_format)) + { + if ($el == 'rdf') { + $this->_format = 'rss'; + $this->feed_version = '1.0'; + } + elseif ($el == 'rss') { + $this->_format = 'rss'; + $this->feed_version = $attrs['version']; + } + elseif ($el == 'feed') { + $this->_format = 'atom'; + $this->feed_version = $attrs['version']; + $this->inchannel = true; + } + return; + } - if ($el == 'channel') - { - $this->inchannel = true; - } - elseif ($el == 'item' or $el == 'entry') - { - $this->initem = true; - if (isset($attrs['rdf:about'])) { - $this->current_item['about'] = $attrs['rdf:about']; - } - } + if ($el == 'channel') + { + $this->inchannel = true; + } + elseif ($el == 'item' or $el == 'entry') + { + $this->initem = true; + if (isset($attrs['rdf:about'])) { + $this->current_item['about'] = $attrs['rdf:about']; + } + } - // if we're in the default namespace of an RSS feed, - // record textinput or image fields - elseif ( - $this->_format == 'rss' and - $this->current_namespace == '' and - $el == 'textinput' ) - { - $this->intextinput = true; - } + // if we're in the default namespace of an RSS feed, + // record textinput or image fields + elseif ( + $this->_format == 'rss' and + $this->current_namespace == '' and + $el == 'textinput' ) + { + $this->intextinput = true; + } - elseif ( - $this->_format == 'rss' and - $this->current_namespace == '' and - $el == 'image' ) - { - $this->inimage = true; - } + elseif ( + $this->_format == 'rss' and + $this->current_namespace == '' and + $el == 'image' ) + { + $this->inimage = true; + } - // handle atom content constructs - elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) - { - // avoid clashing w/ RSS mod_content - if ($el == 'content') { - $el = 'atom_content'; - } + // handle atom content constructs + elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) + { + // avoid clashing w/ RSS mod_content + if ($el == 'content') { + $el = 'atom_content'; + } - $this->incontent = $el; - } + $this->incontent = $el; + } - // if inside an Atom content construct (e.g. content or summary) field treat tags as text - elseif ($this->_format == 'atom' and $this->incontent) - { - // if tags are inlined, then flatten - $attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs))); + // if inside an Atom content construct (e.g. content or summary) field treat tags as text + elseif ($this->_format == 'atom' and $this->incontent) + { + // if tags are inlined, then flatten + $attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs))); - $this->append_content("<$element $attrs_str>"); + $this->append_content("<$element $attrs_str>"); - array_unshift($this->stack, $el); - } + array_unshift($this->stack, $el); + } - // Atom support many links per containging element. - // Magpie treats link elements of type rel='alternate' - // as being equivalent to RSS's simple link element. - // - elseif ($this->_format == 'atom' and $el == 'link') - { - if (isset($attrs['rel']) && $attrs['rel'] == 'alternate') - { - $link_el = 'link'; - } - else { - $link_el = 'link_'.$attrs['rel']; - } + // Atom support many links per containging element. + // Magpie treats link elements of type rel='alternate' + // as being equivalent to RSS's simple link element. + // + elseif ($this->_format == 'atom' and $el == 'link') + { + if (isset($attrs['rel']) && $attrs['rel'] == 'alternate') + { + $link_el = 'link'; + } + elseif (!isset($attrs['rel'])) + { + $link_el = 'link'; + } + else + { + $link_el = 'link_'.$attrs['rel']; + } - $this->append($link_el, $attrs['href']); - } - // set stack[0] to current element - else { - array_unshift($this->stack, $el); - } - } + $this->append($link_el, $attrs['href']); + } + // set stack[0] to current element + else { + array_unshift($this->stack, $el); + } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Triggered when CDATA is found - * - * @param string $p P - * @param string $text Tag - * @return void - */ - public function feed_cdata($p, $text) - { - // phpcs:enable - if ($this->_format == 'atom' and $this->incontent) - { - $this->append_content($text); - } - else - { - $current_el = join('_', array_reverse($this->stack)); - $this->append($current_el, $text); - } - } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Triggered when CDATA is found + * + * @param string $p P + * @param string $text Tag + * @return void + */ + public function feed_cdata($p, $text) + { + // phpcs:enable + if ($this->_format == 'atom' and $this->incontent) + { + $this->append_content($text); + } + else + { + $current_el = join('_', array_reverse($this->stack)); + $this->append($current_el, $text); + } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Triggered when closed tag is found - * - * @param string $p P - * @param string $el Tag - * @return void - */ - public function feed_end_element($p, $el) - { - // phpcs:enable - $el = strtolower($el); + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Triggered when closed tag is found + * + * @param string $p P + * @param string $el Tag + * @return void + */ + public function feed_end_element($p, $el) + { + // phpcs:enable + $el = strtolower($el); - if ($el == 'item' or $el == 'entry') - { - $this->items[] = $this->current_item; - $this->current_item = array(); - $this->initem = false; - } - elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'textinput') - { - $this->intextinput = false; - } - elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'image') - { - $this->inimage = false; - } - elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) - { - $this->incontent = false; - } - elseif ($el == 'channel' or $el == 'feed') - { - $this->inchannel = false; - } - elseif ($this->_format == 'atom' and $this->incontent) { - // balance tags properly - // note: i don't think this is actually neccessary - if ($this->stack[0] == $el) - { - $this->append_content(""); - } - else { - $this->append_content("<$el />"); - } + if ($el == 'item' or $el == 'entry') + { + $this->items[] = $this->current_item; + $this->current_item = array(); + $this->initem = false; + } + elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'textinput') + { + $this->intextinput = false; + } + elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'image') + { + $this->inimage = false; + } + elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) + { + $this->incontent = false; + } + elseif ($el == 'channel' or $el == 'feed') + { + $this->inchannel = false; + } + elseif ($this->_format == 'atom' and $this->incontent) { + // balance tags properly + // note: i don't think this is actually neccessary + if ($this->stack[0] == $el) + { + $this->append_content(""); + } + else { + $this->append_content("<$el />"); + } - array_shift($this->stack); - } - else { - array_shift($this->stack); - } + array_shift($this->stack); + } + else { + array_shift($this->stack); + } - $this->current_namespace = false; - } + $this->current_namespace = false; + } - /** - * To concat 2 string with no warning if an operand is not defined - * - * @param string $str1 Str1 - * @param string $str2 Str2 - * @return string String cancatenated - */ - public function concat(&$str1, $str2 = "") - { - if (!isset($str1)) { - $str1 = ""; - } - $str1 .= $str2; - } + /** + * To concat 2 string with no warning if an operand is not defined + * + * @param string $str1 Str1 + * @param string $str2 Str2 + * @return string String cancatenated + */ + public function concat(&$str1, $str2 = "") + { + if (!isset($str1)) { + $str1 = ""; + } + $str1 .= $str2; + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Enter description here ... - * - * @param string $text Text - * @return void - */ - public function append_content($text) - { - // phpcs:enable - if ($this->initem) { - $this->concat($this->current_item[$this->incontent], $text); - } - elseif ($this->inchannel) { - $this->concat($this->channel[$this->incontent], $text); - } - } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Enter description here ... + * + * @param string $text Text + * @return void + */ + public function append_content($text) + { + // phpcs:enable + if ($this->initem) { + $this->concat($this->current_item[$this->incontent], $text); + } + elseif ($this->inchannel) { + $this->concat($this->channel[$this->incontent], $text); + } + } - /** - * smart append - field and namespace aware - * - * @param string $el El - * @param string $text Text - * @return void - */ - public function append($el, $text) - { - if (!$el) { - return; - } - if ($this->current_namespace) - { - if ($this->initem) { - $this->concat($this->current_item[$this->current_namespace][$el], $text); - } - elseif ($this->inchannel) { - $this->concat($this->channel[$this->current_namespace][$el], $text); - } - elseif ($this->intextinput) { - $this->concat($this->textinput[$this->current_namespace][$el], $text); - } - elseif ($this->inimage) { - $this->concat($this->image[$this->current_namespace][$el], $text); - } - } - else { - if ($this->initem) { - $this->concat($this->current_item[$el], $text); - } - elseif ($this->intextinput) { - $this->concat($this->textinput[$el], $text); - } - elseif ($this->inimage) { - $this->concat($this->image[$el], $text); - } - elseif ($this->inchannel) { - $this->concat($this->channel[$el], $text); - } - } - } + /** + * smart append - field and namespace aware + * + * @param string $el El + * @param string $text Text + * @return void + */ + public function append($el, $text) + { + if (!$el) { + return; + } + if ($this->current_namespace) + { + if ($this->initem) { + $this->concat($this->current_item[$this->current_namespace][$el], $text); + } + elseif ($this->inchannel) { + $this->concat($this->channel[$this->current_namespace][$el], $text); + } + elseif ($this->intextinput) { + $this->concat($this->textinput[$this->current_namespace][$el], $text); + } + elseif ($this->inimage) { + $this->concat($this->image[$this->current_namespace][$el], $text); + } + } + else { + if ($this->initem) { + $this->concat($this->current_item[$el], $text); + } + elseif ($this->intextinput) { + $this->concat($this->textinput[$el], $text); + } + elseif ($this->inimage) { + $this->concat($this->image[$el], $text); + } + elseif ($this->inchannel) { + $this->concat($this->channel[$el], $text); + } + } + } + + /** + * Return a description/summary for one item from a ATOM feed + * + * @param array $item A parsed item of a ATOM feed + * @param int $maxlength (optional) The maximum length for the description + * @return string A summary description + */ + private function getAtomItemDescription(array $item, $maxlength = 500) + { + $result = ""; + + if (isset($item['summary'])) + { + $result = $item['summary']; + } + elseif (isset($item['atom_content'])) + { + $result = $item['atom_content']; + } + + // remove all HTML elements that can possible break the maximum size of a tooltip, + // like headings, image, video etc. and allow only simple style elements + $result = strip_tags($result, "

    1. "); + + $result = str_replace("\n", "", $result); + + if (strlen($result) > $maxlength) + { + $result = substr($result, 0, $maxlength); + $result .= "..."; + } + + return $result; + } + + /** + * Return a URL to a image of the given ATOM feed + * + * @param array $feed The ATOM feed that possible contain a link to a logo or icon + * @return string A URL to a image from a ATOM feed when found, otherwise a empty string + */ + private function getAtomImageUrl(array $feed) + { + if (isset($feed['icon'])) + { + return $feed['logo']; + } + + if (isset($feed['icon'])) + { + return $feed['logo']; + } + + if (isset($feed['webfeeds:logo'])) + { + return $feed['webfeeds:logo']; + } + + if (isset($feed['webfeeds:icon'])) + { + return $feed['webfeeds:icon']; + } + + if (isset($feed['webfeeds:wordmark'])) + { + return $feed['webfeeds:wordmark']; + } + + return ""; + } } @@ -745,48 +823,48 @@ class RssParser */ function xml2php($xml) { - $fils = 0; - $tab = false; - $array = array(); - foreach ($xml->children() as $key => $value) - { - $child = xml2php($value); + $fils = 0; + $tab = false; + $array = array(); + foreach ($xml->children() as $key => $value) + { + $child = xml2php($value); - //To deal with the attributes - foreach ($value->attributes() as $ak=>$av) - { - $child[$ak] = (string) $av; - } + //To deal with the attributes + foreach ($value->attributes() as $ak=>$av) + { + $child[$ak] = (string) $av; + } - //Let see if the new child is not in the array - if ($tab === false && in_array($key, array_keys($array))) - { - //If this element is already in the array we will create an indexed array - $tmp = $array[$key]; - $array[$key] = null; - $array[$key][] = $tmp; - $array[$key][] = $child; - $tab = true; - } - elseif ($tab === true) - { - //Add an element in an existing array - $array[$key][] = $child; - } - else - { - //Add a simple element - $array[$key] = $child; - } + //Let see if the new child is not in the array + if ($tab === false && in_array($key, array_keys($array))) + { + //If this element is already in the array we will create an indexed array + $tmp = $array[$key]; + $array[$key] = null; + $array[$key][] = $tmp; + $array[$key][] = $child; + $tab = true; + } + elseif ($tab === true) + { + //Add an element in an existing array + $array[$key][] = $child; + } + else + { + //Add a simple element + $array[$key] = $child; + } - $fils++; - } + $fils++; + } - if ($fils == 0) - { - return (string) $xml; - } + if ($fils == 0) + { + return (string) $xml; + } - return $array; + return $array; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a39e48e3a60..9746c1047b8 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1598,13 +1598,18 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess $formmail->add_attached_files($destfull, $destfile, $TFile['type'][$i]); } - // Update table of files + // Update index table of files (llx_ecm_files) if ($donotupdatesession == 1) { $result = addFileIntoDatabaseIndex($upload_dir, basename($destfile), $TFile['name'][$i], 'uploaded', 0); if ($result < 0) { - setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings'); + if ($allowoverwrite) { + // Do not show error message. We can have an error due to DB_ERROR_RECORD_ALREADY_EXISTS + } + else { + setEventMessages('FailedToAddFileIntoDatabaseIndex', '', 'warnings'); + } } } @@ -1760,7 +1765,6 @@ function addFileIntoDatabaseIndex($dir, $file, $fullpathorig = '', $mode = 'uplo return $result; } - /** * Delete files into database index using search criterias. * diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index ce6c17bb5af..4f65ca3a2bf 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -23,8 +23,8 @@ */ // Define size of logo small and mini -$maxwidthsmall = 350; $maxheightsmall = 200; // Near 16/9eme -$maxwidthmini = 128; $maxheightmini = 72; // 16/9eme +$maxwidthsmall = 350; $maxheightsmall = 200; // Near 16/9eme +$maxwidthmini = 128; $maxheightmini = 72; // 16/9eme $quality = 80; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index e097c6d7120..d31baf70b69 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -914,7 +914,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // // become // - $newfreetext = preg_replace('/()/', '\1'.DOL_DATA_ROOT.'/medias/\2\3', $newfreetext); + $newfreetext = preg_replace('/()/', '\1'.'file:/'.DOL_DATA_ROOT.'/medias/\2\3', $newfreetext); $line .= $outputlangs->convToOutputCharset($newfreetext); } diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 770bc3fda88..2dcabbcafaa 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -220,6 +220,8 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') global $db, $langs, $conf, $user; global $dolibarr_main_url_root, $dolibarr_main_data_root; + $nbrep = 0; + dol_syslog("dolWebsiteOutput start (contenttype=".$contenttype." containerid=".$containerid." USEDOLIBARREDITOR=".(defined('USEDOLIBARREDITOR') ? '1' : '')." USEDOLIBARRSERVER=".(defined('USEDOLIBARRSERVER') ? '1' : '').')'); // Define $urlwithroot @@ -300,7 +302,6 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') // // become // - $nbrep = 0; if (!$symlinktomediaexists) { // global->WEBSITE_ADD_CSS_TO_BODY)) { + $content = str_replace('global->MAIN_AGENDA_EXPORT_CACHE) && $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60) - { - $hh = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "hour"); - $mm = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "min"); - $ss = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "sec"); + if (!empty($conf->global->MAIN_AGENDA_EXPORT_CACHE) && $conf->global->MAIN_AGENDA_EXPORT_CACHE > 60) + { + $hh = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "hour"); + $mm = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "min"); + $ss = convertSecondToTime($conf->global->MAIN_AGENDA_EXPORT_CACHE, "sec"); - fwrite($calfileh, "X-PUBLISHED-TTL: P".$hh."H".$mm."M".$ss."S\n"); - } + fwrite($calfileh, "X-PUBLISHED-TTL: P".$hh."H".$mm."M".$ss."S\n"); + } - foreach ($events_array as $key => $event) - { - // See http://fr.wikipedia.org/wiki/ICalendar for format - // See http://www.ietf.org/rfc/rfc2445.txt for RFC + foreach ($events_array as $key => $event) + { + // See http://fr.wikipedia.org/wiki/ICalendar for format + // See http://www.ietf.org/rfc/rfc2445.txt for RFC - // TODO: avoid use extra event array, use objects direct thahtwas created before + // TODO: avoid use extra event array, use objects direct thahtwas created before - $uid = $event["uid"]; - $type = $event["type"]; - $startdate = $event["startdate"]; - $duration = $event["duration"]; - $enddate = $event["enddate"]; - $summary = $event["summary"]; - $category = $event["category"]; - $priority = $event["priority"]; - $fulldayevent = $event["fulldayevent"]; - $location = $event["location"]; - $email = $event["email"]; - $url = $event["url"]; - $transparency = $event["transparency"]; - $description = dol_string_nohtmltag(preg_replace("//i", "\n", $event["desc"]), 0); - $created = $event["created"]; - $modified = $event["modified"]; - $assignedUsers = $event["assignedUsers"]; + $uid = $event["uid"]; + $type = $event["type"]; + $startdate = $event["startdate"]; + $duration = $event["duration"]; + $enddate = $event["enddate"]; + $summary = $event["summary"]; + $category = $event["category"]; + $priority = $event["priority"]; + $fulldayevent = $event["fulldayevent"]; + $location = $event["location"]; + $email = $event["email"]; + $url = $event["url"]; + $transparency = $event["transparency"]; + $description = dol_string_nohtmltag(preg_replace("//i", "\n", $event["desc"]), 0); + $created = $event["created"]; + $modified = $event["modified"]; + $assignedUsers = $event["assignedUsers"]; - // Format - $summary = format_cal($format, $summary); - $description = format_cal($format, $description); - $category = format_cal($format, $category); - $location = format_cal($format, $location); + // Format + $summary = format_cal($format, $summary); + $description = format_cal($format, $description); + $category = format_cal($format, $category); + $location = format_cal($format, $location); // Output the vCard/iCal VEVENT object /* @@ -147,180 +147,180 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) END:VEVENT */ - if ($type === "event") - { - fwrite($calfileh, "BEGIN:VEVENT\n"); - fwrite($calfileh, "UID:".$uid."\n"); + if ($type === "event") + { + fwrite($calfileh, "BEGIN:VEVENT\n"); + fwrite($calfileh, "UID:".$uid."\n"); - if (!empty($email)) - { - fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n"); - fwrite($calfileh, "CONTACT:MAILTO:".$email."\n"); - } + if (!empty($email)) + { + fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n"); + fwrite($calfileh, "CONTACT:MAILTO:".$email."\n"); + } - if (!empty($url)) - { - fwrite($calfileh, "URL:".$url."\n"); - } + if (!empty($url)) + { + fwrite($calfileh, "URL:".$url."\n"); + } - if (is_array($assignedUsers)) - { - foreach ($assignedUsers as $assignedUser) - { - if ($assignedUser->email === $email) - { - continue; - } + if (is_array($assignedUsers)) + { + foreach ($assignedUsers as $assignedUser) + { + if ($assignedUser->email === $email) + { + continue; + } - fwrite($calfileh, "ATTENDEE;RSVP=TRUE:mailto:".$assignedUser->email."\n"); - } - } + fwrite($calfileh, "ATTENDEE;RSVP=TRUE:mailto:".$assignedUser->email."\n"); + } + } - if ($created) - { - fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n"); - } + if ($created) + { + fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n"); + } - if ($modified) - { - fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n"); - } + if ($modified) + { + fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n"); + } - fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); - fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n"); + fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); + fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n"); - if (!empty($location)) - { - fwrite($calfileh, "LOCATION:".$encoding.$location."\n"); - } + if (!empty($location)) + { + fwrite($calfileh, "LOCATION:".$encoding.$location."\n"); + } - if ($fulldayevent) - { - fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n"); - } + if ($fulldayevent) + { + fwrite($calfileh, "X-FUNAMBOL-ALLDAY:1\n"); + } - // see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2 - if ($fulldayevent) - { - fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n"); - } + // see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2 + if ($fulldayevent) + { + fwrite($calfileh, "X-MICROSOFT-CDO-ALLDAYEVENT:TRUE\n"); + } - // Date must be GMT dates - // Current date - fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n"); + // Date must be GMT dates + // Current date + fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n"); - // Start date - $prefix = ""; - $startdatef = dol_print_date($startdate, "dayhourxcard", true); + // Start date + $prefix = ""; + $startdatef = dol_print_date($startdate, "dayhourxcard", true); - if ($fulldayevent) - { - // Local time - $prefix = ";VALUE=DATE"; - $startdatef = dol_print_date($startdate, "dayxcard", false); - } + if ($fulldayevent) + { + // Local time + $prefix = ";VALUE=DATE"; + $startdatef = dol_print_date($startdate, "dayxcard", false); + } - fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n"); + fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n"); - // End date - if ($fulldayevent) - { - if (empty($enddate)) - { - $enddate = dol_time_plus_duree($startdate, 1, "d"); - } - } - else - { - if (empty($enddate)) - { - $enddate = $startdate + $duration; - } - } + // End date + if ($fulldayevent) + { + if (empty($enddate)) + { + $enddate = dol_time_plus_duree($startdate, 1, "d"); + } + } + else + { + if (empty($enddate)) + { + $enddate = $startdate + $duration; + } + } - $prefix = ""; - $enddatef = dol_print_date($enddate, "dayhourxcard", true); + $prefix = ""; + $enddatef = dol_print_date($enddate, "dayhourxcard", true); - if ($fulldayevent) - { - $prefix = ";VALUE=DATE"; - $enddatef = dol_print_date($enddate + 1, "dayxcard", false); + if ($fulldayevent) + { + $prefix = ";VALUE=DATE"; + $enddatef = dol_print_date($enddate + 1, "dayxcard", false); - // Local time - //$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false); - } + // Local time + //$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false); + } - fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); - fwrite($calfileh, "STATUS:CONFIRMED"."\n"); + fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); + fwrite($calfileh, "STATUS:CONFIRMED"."\n"); - if (!empty($transparency)) - { - fwrite($calfileh, "TRANSP:".$transparency."\n"); - } + if (!empty($transparency)) + { + fwrite($calfileh, "TRANSP:".$transparency."\n"); + } - if (!empty($category)) - { - fwrite($calfileh, "CATEGORIES:".$encoding.$category."\n"); - } + if (!empty($category)) + { + fwrite($calfileh, "CATEGORIES:".$encoding.$category."\n"); + } - fwrite($calfileh, "END:VEVENT\n"); - } + fwrite($calfileh, "END:VEVENT\n"); + } - // Output the vCard/iCal VJOURNAL object - if ($type === "journal") - { - fwrite($calfileh, "BEGIN:VJOURNAL\n"); - fwrite($calfileh, "UID:".$uid."\n"); + // Output the vCard/iCal VJOURNAL object + if ($type === "journal") + { + fwrite($calfileh, "BEGIN:VJOURNAL\n"); + fwrite($calfileh, "UID:".$uid."\n"); - if (!empty($email)) - { - fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n"); - fwrite($calfileh, "CONTACT:MAILTO:".$email."\n"); - } + if (!empty($email)) + { + fwrite($calfileh, "ORGANIZER:MAILTO:".$email."\n"); + fwrite($calfileh, "CONTACT:MAILTO:".$email."\n"); + } - if (!empty($url)) - { - fwrite($calfileh, "URL:".$url."\n"); - } + if (!empty($url)) + { + fwrite($calfileh, "URL:".$url."\n"); + } - if ($created) - { - fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n"); - } + if ($created) + { + fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n"); + } - if ($modified) - { - fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n"); - } + if ($modified) + { + fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n"); + } - fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); - fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n"); - fwrite($calfileh, "STATUS:CONFIRMED"."\n"); - fwrite($calfileh, "CATEGORIES:".$category."\n"); - fwrite($calfileh, "LOCATION:".$location."\n"); - fwrite($calfileh, "TRANSP:OPAQUE\n"); - fwrite($calfileh, "CLASS:CONFIDENTIAL\n"); - fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n"); + fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); + fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n"); + fwrite($calfileh, "STATUS:CONFIRMED"."\n"); + fwrite($calfileh, "CATEGORIES:".$category."\n"); + fwrite($calfileh, "LOCATION:".$location."\n"); + fwrite($calfileh, "TRANSP:OPAQUE\n"); + fwrite($calfileh, "CLASS:CONFIDENTIAL\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n"); - fwrite($calfileh, "END:VJOURNAL\n"); - } - } + fwrite($calfileh, "END:VJOURNAL\n"); + } + } - // Footer - fwrite($calfileh, "END:VCALENDAR"); + // Footer + fwrite($calfileh, "END:VCALENDAR"); - fclose($calfileh); + fclose($calfileh); - if (!empty($conf->global->MAIN_UMASK)) - { - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); - } - } - else - { - dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing"); - return -2; - } + if (!empty($conf->global->MAIN_UMASK)) + { + @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); + } + } + else + { + dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing"); + return -2; + } } /** @@ -338,33 +338,33 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) */ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '') { - global $user, $conf, $langs; - global $dolibarr_main_url_root; + global $user, $conf, $langs; + global $dolibarr_main_url_root; - dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format); + dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format); - if (empty($outputfile)) - { - // -1 = error - return -1; - } + if (empty($outputfile)) + { + // -1 = error + return -1; + } - $fichier = fopen($outputfile, "w"); + $fichier = fopen($outputfile, "w"); - if ($fichier) - { - $date = date("r"); + if ($fichier) + { + $date = date("r"); - // Print header - fwrite($fichier, 'charset_output.'"?>'); - fwrite($fichier, "\n"); + // Print header + fwrite($fichier, 'charset_output.'"?>'); + fwrite($fichier, "\n"); - fwrite($fichier, ''); - fwrite($fichier, "\n"); + fwrite($fichier, ''); + fwrite($fichier, "\n"); - fwrite($fichier, "\n".$title."\n"); + fwrite($fichier, "\n".$title."\n"); - /* + /* fwrite($fichier, ""."\n". // "fr"."\n". "Dolibarr"."\n". @@ -372,91 +372,91 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt "Dolibarr"."\n"); */ - if (empty($url)) { - // Define $urlwithroot - $urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + if (empty($url)) { + // Define $urlwithroot + $urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - $url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY); - } + $url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY); + } - fwrite($fichier, ""."\n"); + fwrite($fichier, ""."\n"); - foreach ($events_array as $key => $event) - { - $eventqualified = true; + foreach ($events_array as $key => $event) + { + $eventqualified = true; - if ($filter) - { - // TODO Add a filter + if ($filter) + { + // TODO Add a filter - $eventqualified = false; - } + $eventqualified = false; + } - if ($eventqualified) - { - if (is_object($event) && get_class($event) == 'WebsitePage') { - // Convert object into an array - $tmpevent = array(); - $tmpevent['uid'] = $event->id; - $tmpevent['startdate'] = $event->date_creation; - $tmpevent['summary'] = $event->title; - $tmpevent['url'] = $event->fullpageurl ? $event->fullpageurl : $event->pageurl.'.php'; - $tmpevent['author'] = $event->author_alias ? $event->author_alias : 'unknown'; - //$tmpevent['category'] = ''; - $tmpevent['desc'] = $event->description; + if ($eventqualified) + { + if (is_object($event) && get_class($event) == 'WebsitePage') { + // Convert object into an array + $tmpevent = array(); + $tmpevent['uid'] = $event->id; + $tmpevent['startdate'] = $event->date_creation; + $tmpevent['summary'] = $event->title; + $tmpevent['url'] = $event->fullpageurl ? $event->fullpageurl : $event->pageurl.'.php'; + $tmpevent['author'] = $event->author_alias ? $event->author_alias : 'unknown'; + //$tmpevent['category'] = ''; + $tmpevent['desc'] = $event->description; - $event = $tmpevent; - } + $event = $tmpevent; + } - $uid = $event["uid"]; - $startdate = $event["startdate"]; - $summary = $event["summary"]; - $url = $event["url"]; - $author = $event["author"]; - $category = $event["category"]; + $uid = $event["uid"]; + $startdate = $event["startdate"]; + $summary = $event["summary"]; + $url = $event["url"]; + $author = $event["author"]; + $category = $event["category"]; - /* No place inside a RSS + /* No place inside a RSS $priority = $event["priority"]; $fulldayevent = $event["fulldayevent"]; $location = $event["location"]; $email = $event["email"]; */ - $description = dol_string_nohtmltag(preg_replace("//i", "\n", $event["desc"]), 0); + $description = dol_string_nohtmltag(preg_replace("//i", "\n", $event["desc"]), 0); - fwrite($fichier, "\n"); - fwrite($fichier, "<![CDATA[".$summary."]]>\n"); - fwrite($fichier, "\n"); - fwrite($fichier, "\n"); - fwrite($fichier, "\n"); - fwrite($fichier, "\n"); + fwrite($fichier, "<![CDATA[".$summary."]]>\n"); + fwrite($fichier, "\n"); + fwrite($fichier, "\n"); + fwrite($fichier, "\n"); + fwrite($fichier, "\n"); - fwrite($fichier, "".date("r", $startdate)."\n"); - fwrite($fichier, "\n"); - fwrite($fichier, "\n"); - fwrite($fichier, "\n"); - } - } + fwrite($fichier, "]]>\n"); + fwrite($fichier, "".date("r", $startdate)."\n"); + fwrite($fichier, "\n"); + fwrite($fichier, "\n"); + fwrite($fichier, "\n"); + } + } - fwrite($fichier, ""); - fwrite($fichier, "\n"); - fwrite($fichier, ""); + fwrite($fichier, ""); + fwrite($fichier, "\n"); + fwrite($fichier, ""); - fclose($fichier); + fclose($fichier); - if (!empty($conf->global->MAIN_UMASK)) - { - @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); - } - } + if (!empty($conf->global->MAIN_UMASK)) + { + @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); + } + } } /** @@ -468,27 +468,27 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt */ function format_cal($format, $string) { - global $conf; + global $conf; - $newstring = $string; + $newstring = $string; - if ($format === "vcal") - { - $newstring = quotedPrintEncode($newstring); - } + if ($format === "vcal") + { + $newstring = quotedPrintEncode($newstring); + } - if ($format === "ical") - { - // Replace new lines chars by "\n" - $newstring = preg_replace("/"."\r\n"."/i", "\\n", $newstring); - $newstring = preg_replace("/"."\n\r"."/i", "\\n", $newstring); - $newstring = preg_replace("/"."\n"."/i", "\\n", $newstring); + if ($format === "ical") + { + // Replace new lines chars by "\n" + $newstring = preg_replace("/"."\r\n"."/i", "\\n", $newstring); + $newstring = preg_replace("/"."\n\r"."/i", "\\n", $newstring); + $newstring = preg_replace("/"."\n"."/i", "\\n", $newstring); - // Must not exceed 75 char. Cut with "\r\n"+Space - $newstring = calEncode($newstring); - } + // Must not exceed 75 char. Cut with "\r\n"+Space + $newstring = calEncode($newstring); + } - return $newstring; + return $newstring; } /** @@ -500,56 +500,56 @@ function format_cal($format, $string) */ function calEncode($line) { - $out = ""; - $newpara = ""; + $out = ""; + $newpara = ""; - // If mb_ functions exists, it"s better to use them - if (function_exists("mb_strlen")) - { - $strlength = mb_strlen($line, "UTF-8"); + // If mb_ functions exists, it"s better to use them + if (function_exists("mb_strlen")) + { + $strlength = mb_strlen($line, "UTF-8"); - for ($j = 0; $j < $strlength; $j++) - { - // Take char at position $j - $char = mb_substr($line, $j, 1, "UTF-8"); + for ($j = 0; $j < $strlength; $j++) + { + // Take char at position $j + $char = mb_substr($line, $j, 1, "UTF-8"); - if ((mb_strlen($newpara, "UTF-8") + mb_strlen($char, "UTF-8")) >= 75) - { - // CRLF + Space for cal - $out .= $newpara."\r\n "; + if ((mb_strlen($newpara, "UTF-8") + mb_strlen($char, "UTF-8")) >= 75) + { + // CRLF + Space for cal + $out .= $newpara."\r\n "; - $newpara = ""; - } + $newpara = ""; + } - $newpara .= $char; - } + $newpara .= $char; + } - $out .= $newpara; - } - else - { - $strlength = dol_strlen($line); + $out .= $newpara; + } + else + { + $strlength = dol_strlen($line); - for ($j = 0; $j < $strlength; $j++) - { - // Take char at position $j - $char = substr($line, $j, 1); + for ($j = 0; $j < $strlength; $j++) + { + // Take char at position $j + $char = substr($line, $j, 1); - if ((dol_strlen($newpara) + dol_strlen($char)) >= 75) - { - // CRLF + Space for cal - $out .= $newpara."\r\n "; + if ((dol_strlen($newpara) + dol_strlen($char)) >= 75) + { + // CRLF + Space for cal + $out .= $newpara."\r\n "; - $newpara = ""; - } + $newpara = ""; + } - $newpara .= $char; - } + $newpara .= $char; + } - $out .= $newpara; - } + $out .= $newpara; + } - return trim($out); + return trim($out); } @@ -562,45 +562,45 @@ function calEncode($line) */ function quotedPrintEncode($str, $forcal = 0) { - $lines = preg_split("/\r\n/", $str); - $out = ""; + $lines = preg_split("/\r\n/", $str); + $out = ""; - foreach ($lines as $line) - { - $newpara = ""; + foreach ($lines as $line) + { + $newpara = ""; - // Do not use dol_strlen here, we need number of bytes - $strlength = strlen($line); + // Do not use dol_strlen here, we need number of bytes + $strlength = strlen($line); - for ($j = 0; $j < $strlength; $j++) - { - $char = substr($line, $j, 1); - $ascii = ord($char); + for ($j = 0; $j < $strlength; $j++) + { + $char = substr($line, $j, 1); + $ascii = ord($char); - if ($ascii < 32 || $ascii === 61 || $ascii > 126) - { - $char = "=".strtoupper(sprintf("%02X", $ascii)); - } + if ($ascii < 32 || $ascii === 61 || $ascii > 126) + { + $char = "=".strtoupper(sprintf("%02X", $ascii)); + } - // Do not use dol_strlen here, we need number of bytes - if ((strlen($newpara) + strlen($char)) >= 76) - { - // New line with carray-return (CR) and line-feed (LF) - $out .= $newpara."="."\r\n"; + // Do not use dol_strlen here, we need number of bytes + if ((strlen($newpara) + strlen($char)) >= 76) + { + // New line with carray-return (CR) and line-feed (LF) + $out .= $newpara."="."\r\n"; - // extra space for cal - if ($forcal) - $out .= " "; + // extra space for cal + if ($forcal) + $out .= " "; - $newpara = ""; - } + $newpara = ""; + } - $newpara .= $char; - } + $newpara .= $char; + } - $out .= $newpara; - } - return trim($out); + $out .= $newpara; + } + return trim($out); } /** @@ -611,5 +611,5 @@ function quotedPrintEncode($str, $forcal = 0) */ function quotedPrintDecode($str) { - return trim(quoted_printable_decode(preg_replace("/=\r?\n/", "", $str))); + return trim(quoted_printable_decode(preg_replace("/=\r?\n/", "", $str))); } diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 02d97e34ee6..f9951561f3e 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -141,22 +141,22 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1100__+MAX_llx_menu__, 'commercial', 'propals', 5__+MAX_llx_menu__, '/comm/propal/index.php?mainmenu=commercial&leftmenu=propals', 'Proposals', 0, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1101__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/card.php?mainmenu=commercial&action=create&leftmenu=propals', 'NewPropal', 1, 'propal', '$user->rights->propale->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1102__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', 'List', 1, 'propal', '$user->rights->propale->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1103__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=0', 'PropalsDraft', 1, 'propal', '$user->rights->propale->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1104__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=1', 'PropalsOpened', 1, 'propal', '$user->rights->propale->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1105__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=2', 'PropalStatusSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1106__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=3', 'PropalStatusNotSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1107__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=4', 'PropalStatusBilled', 1, 'propal', '$user->rights->propale->lire', '', 2, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1103__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=0', 'PropalsDraft', 1, 'propal', '$user->rights->propale->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1104__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=1', 'PropalsOpened', 1, 'propal', '$user->rights->propale->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1105__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=2', 'PropalStatusSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1106__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=3', 'PropalStatusNotSigned', 1, 'propal', '$user->rights->propale->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled && $leftmenu=="propals"', __HANDLER__, 'left', 1107__+MAX_llx_menu__, 'commercial', '', 1102__+MAX_llx_menu__, '/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&search_status=4', 'PropalStatusBilled', 1, 'propal', '$user->rights->propale->lire', '', 2, 6, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->propal->enabled', __HANDLER__, 'left', 1110__+MAX_llx_menu__, 'commercial', '', 1100__+MAX_llx_menu__, '/comm/propal/stats/index.php?mainmenu=commercial&leftmenu=propals', 'Statistics', 1, 'propal', '$user->rights->propale->lire', '', 2, 4, __ENTITY__); -- Commercial - Customer's orders insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1200__+MAX_llx_menu__, 'commercial', 'orders', 5__+MAX_llx_menu__, '/commande/index.php?mainmenu=commercial&leftmenu=orders', 'CustomersOrders', 0, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1201__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/card.php?mainmenu=commercial&action=create&leftmenu=orders', 'NewOrder', 1, 'orders', '$user->rights->commande->creer', '', 2, 0, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1202__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders', 'List', 1, 'orders', '$user->rights->commande->lire', '', 2, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1203__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=0', 'StatusOrderDraftShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1204__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=1', 'StatusOrderValidated', 1, 'orders', '$user->rights->commande->lire', '', 2, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1205__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=2', 'StatusOrderOnProcessShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1206__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=3', 'StatusOrderToBill', 1, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->lire', '', 2, 6, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 7, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1203__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=0', 'StatusOrderDraftShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 2, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1204__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=1', 'StatusOrderValidated', 1, 'orders', '$user->rights->commande->lire', '', 2, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1205__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=2', 'StatusOrderOnProcessShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1206__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=3', 'StatusOrderToBill', 1, 'orders', '$user->rights->commande->lire', '', 2, 5, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1207__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=4', 'StatusOrderProcessed', 1, 'orders', '$user->rights->commande->lire', '', 2, 6, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled && $leftmenu=="orders"', __HANDLER__, 'left', 1208__+MAX_llx_menu__, 'commercial', '', 1202__+MAX_llx_menu__, '/commande/list.php?mainmenu=commercial&leftmenu=orders&search_status=-1', 'StatusOrderCanceledShort', 1, 'orders', '$user->rights->commande->lire', '', 2, 7, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1209__+MAX_llx_menu__, 'commercial', '', 1200__+MAX_llx_menu__, '/commande/stats/index.php?mainmenu=commercial&leftmenu=orders', 'Statistics', 1, 'orders', '$user->rights->commande->lire', '', 2, 4, __ENTITY__); -- Commercial - Supplier's proposals insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->supplier_proposal->enabled', __HANDLER__, 'left', 1600__+MAX_llx_menu__, 'commercial', 'propals_supplier', 3__+MAX_llx_menu__, '/supplier_proposal/index.php?leftmenu=propals_supplier', 'SupplierProposalsShort', 0, 'supplier_proposal', '$user->rights->supplier_proposal->lire', '', 2, 4, __ENTITY__); @@ -214,7 +214,7 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1710__+MAX_llx_menu__, 'billing', 'customers_bills_reports', 1704__+MAX_llx_menu__, '/compta/paiement/rapport.php?mainmenu=billing&leftmenu=customers_bills_reports', 'Reportings', 2, 'bills', '$user->rights->facture->lire', '', 2, 1, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->facture->enabled', __HANDLER__, 'left', 1714__+MAX_llx_menu__, 'billing', 'customers_bills_stats', 1700__+MAX_llx_menu__, '/compta/facture/stats/index.php?mainmenu=billing&leftmenu=customers_bills_stats', 'Statistics', 1, 'bills', '$user->rights->facture->lire', '', 2, 8, __ENTITY__); -- Billing - Orders to bill -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?mainmenu=billing&leftmenu=orders&viewstatut=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->commande->enabled', __HANDLER__, 'left', 1900__+MAX_llx_menu__, 'billing', 'orders', 6__+MAX_llx_menu__, '/commande/list.php?mainmenu=billing&leftmenu=orders&search_status=3', 'MenuOrdersToBill', 0, 'orders', '$user->rights->commande->lire', '', 0, 3, __ENTITY__); -- Donations insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled', __HANDLER__, 'left', 2000__+MAX_llx_menu__, 'billing', 'donations', 6__+MAX_llx_menu__, '/don/index.php?mainmenu=billing&leftmenu=donations', 'Donations', 0, 'donations', '$user->rights->don->lire', '', 2, 4, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->don->enabled && $leftmenu=="donations"', __HANDLER__, 'left', 2001__+MAX_llx_menu__, 'billing', '', 2000__+MAX_llx_menu__, '/don/card.php?mainmenu=billing&leftmenu=donations&action=create', 'NewDonation', 1, 'donations', '$user->rights->don->creer', '', 2, 0, __ENTITY__); diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index a801b848cba..dba6dd2f4a4 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -908,12 +908,12 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/comm/propal/card.php?action=create&leftmenu=propals", $langs->trans("NewPropal"), 1, $user->rights->propale->creer); $newmenu->add("/comm/propal/list.php?leftmenu=propals", $langs->trans("List"), 1, $user->rights->propale->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu == "propals") { - $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); - $newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); - //$newmenu->add("/comm/propal/list.php?leftmenu=propals&viewstatut=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=0", $langs->trans("PropalsDraft"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=1", $langs->trans("PropalsOpened"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2", $langs->trans("PropalStatusSigned"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=3", $langs->trans("PropalStatusNotSigned"), 2, $user->rights->propale->lire); + $newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=4", $langs->trans("PropalStatusBilled"), 2, $user->rights->propale->lire); + //$newmenu->add("/comm/propal/list.php?leftmenu=propals&search_status=2,3,4", $langs->trans("PropalStatusClosedShort"), 2, $user->rights->propale->lire); } $newmenu->add("/comm/propal/stats/index.php?leftmenu=propals", $langs->trans("Statistics"), 1, $user->rights->propale->lire); } @@ -926,12 +926,12 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/commande/card.php?action=create&leftmenu=orders", $langs->trans("NewOrder"), 1, $user->rights->commande->creer); $newmenu->add("/commande/list.php?leftmenu=orders", $langs->trans("List"), 1, $user->rights->commande->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu == "orders") { - $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); - if (!empty($conf->expedition->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire); - //$newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); - $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=0", $langs->trans("StatusOrderDraftShort"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=1", $langs->trans("StatusOrderValidated"), 2, $user->rights->commande->lire); + if (!empty($conf->expedition->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&search_status=2", $langs->trans("StatusOrderSentShort"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=3", $langs->trans("StatusOrderDelivered"), 2, $user->rights->commande->lire); + //$newmenu->add("/commande/list.php?leftmenu=orders&search_status=4", $langs->trans("StatusOrderProcessed"), 2, $user->rights->commande->lire); + $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-1", $langs->trans("StatusOrderCanceledShort"), 2, $user->rights->commande->lire); } $newmenu->add("/commande/stats/index.php?leftmenu=orders", $langs->trans("Statistics"), 1, $user->rights->commande->lire); } @@ -1059,7 +1059,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM if (!empty($conf->commande->enabled)) { $langs->load("orders"); - if (!empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&viewstatut=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); + if (!empty($conf->facture->enabled)) $newmenu->add("/commande/list.php?leftmenu=orders&search_status=-3&billed=0&contextpage=billableorders", $langs->trans("MenuOrdersToBill2"), 0, $user->rights->commande->lire, '', $mainmenu, 'orders'); //if ($usemenuhider || empty($leftmenu) || $leftmenu=="orders") $newmenu->add("/commande/", $langs->trans("StatusOrderToBill"), 1, $user->rights->commande->lire); } @@ -1627,9 +1627,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/expedition/card.php?action=create2&leftmenu=sendings", $langs->trans("NewSending"), 1, $user->rights->expedition->creer); $newmenu->add("/expedition/list.php?leftmenu=sendings", $langs->trans("List"), 1, $user->rights->expedition->lire); if ($usemenuhider || empty($leftmenu) || $leftmenu == "sendings") { - $newmenu->add("/expedition/list.php?leftmenu=sendings&viewstatut=0", $langs->trans("StatusSendingDraftShort"), 2, $user->rights->expedition->lire); - $newmenu->add("/expedition/list.php?leftmenu=sendings&viewstatut=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->rights->expedition->lire); - $newmenu->add("/expedition/list.php?leftmenu=sendings&viewstatut=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->rights->expedition->lire); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=0", $langs->trans("StatusSendingDraftShort"), 2, $user->rights->expedition->lire); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=1", $langs->trans("StatusSendingValidatedShort"), 2, $user->rights->expedition->lire); + $newmenu->add("/expedition/list.php?leftmenu=sendings&search_status=2", $langs->trans("StatusSendingProcessedShort"), 2, $user->rights->expedition->lire); } $newmenu->add("/expedition/stats/index.php?leftmenu=sendings", $langs->trans("Statistics"), 1, $user->rights->expedition->lire); } @@ -1641,9 +1641,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/reception/index.php?leftmenu=receptions", $langs->trans("Receptions"), 0, $user->rights->reception->lire, '', $mainmenu, 'receptions'); $newmenu->add("/reception/card.php?action=create2&leftmenu=receptions", $langs->trans("NewReception"), 1, $user->rights->reception->creer); $newmenu->add("/reception/list.php?leftmenu=receptions", $langs->trans("List"), 1, $user->rights->reception->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&viewstatut=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&viewstatut=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); - if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&viewstatut=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=0", $langs->trans("StatusReceptionDraftShort"), 2, $user->rights->reception->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=1", $langs->trans("StatusReceptionValidatedShort"), 2, $user->rights->reception->lire); + if ($usemenuhider || empty($leftmenu) || $leftmenu == "receptions") $newmenu->add("/reception/list.php?leftmenu=receptions&search_status=2", $langs->trans("StatusReceptionProcessedShort"), 2, $user->rights->reception->lire); $newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 4e86435028f..1c2e1277ce8 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -43,82 +43,82 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_sponge extends ModelePDFFactures { - /** - * @var DoliDb Database handler - */ - public $db; + /** + * @var DoliDb Database handler + */ + public $db; /** - * @var string model name - */ - public $name; + * @var string model name + */ + public $name; /** - * @var string model description (short text) - */ - public $description; - - /** - * @var int Save the name of generated file as the main doc when generating a doc with this template - */ - public $update_main_doc_field; + * @var string model description (short text) + */ + public $description; /** - * @var string document type - */ - public $type; + * @var int Save the name of generated file as the main doc when generating a doc with this template + */ + public $update_main_doc_field; /** - * @var array Minimum version of PHP required by module. - * e.g.: PHP ≥ 5.5 = array(5, 5) - */ + * @var string document type + */ + public $type; + + /** + * @var array Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.5 = array(5, 5) + */ public $phpmin = array(5, 5); /** - * Dolibarr version of the loaded document - * @var string - */ + * Dolibarr version of the loaded document + * @var string + */ public $version = 'dolibarr'; - /** - * @var int page_largeur - */ - public $page_largeur; + /** + * @var int page_largeur + */ + public $page_largeur; /** - * @var int page_hauteur - */ - public $page_hauteur; + * @var int page_hauteur + */ + public $page_hauteur; /** - * @var array format - */ - public $format; + * @var array format + */ + public $format; /** - * @var int marge_gauche - */ + * @var int marge_gauche + */ public $marge_gauche; /** - * @var int marge_droite - */ + * @var int marge_droite + */ public $marge_droite; /** - * @var int marge_haute - */ + * @var int marge_haute + */ public $marge_haute; /** - * @var int marge_basse - */ + * @var int marge_basse + */ public $marge_basse; - /** - * Issuer - * @var Societe Object that emits - */ + /** + * Issuer + * @var Societe Object that emits + */ public $emetteur; /** @@ -376,7 +376,7 @@ class pdf_sponge extends ModelePDFFactures if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); // Set certificate - $cert=empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; + $cert = empty($user->conf->CERTIFICATE_CRT) ? '' : $user->conf->CERTIFICATE_CRT; // If use has no certificate, we try to take the company one if (!$cert) { $cert = empty($conf->global->CERTIFICATE_CRT) ? '' : $conf->global->CERTIFICATE_CRT; @@ -1204,13 +1204,13 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $account->proprio), 0, 'L', 0); $posy = $pdf->GetY() + 1; - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) - { + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($account->owner_address), 0, 'L', 0); $posy = $pdf->GetY() + 2; - } + } } if ($conf->global->FACTURE_CHQ_NUMBER == -1) { @@ -1219,13 +1219,13 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell(100, 3, $outputlangs->transnoentities('PaymentByChequeOrderedTo', $this->emetteur->name), 0, 'L', 0); $posy = $pdf->GetY() + 1; - if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) - { + if (empty($conf->global->MAIN_PDF_HIDE_CHQ_ADDRESS)) + { $pdf->SetXY($this->marge_gauche, $posy); $pdf->SetFont('', '', $default_font_size - $diffsizetitle); $pdf->MultiCell(100, 3, $outputlangs->convToOutputCharset($this->emetteur->getFullAddress()), 0, 'L', 0); $posy = $pdf->GetY() + 2; - } + } } } } @@ -1267,10 +1267,10 @@ class pdf_sponge extends ModelePDFFactures { global $conf, $mysoc, $hookmanager; - $sign = 1; - if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; + $sign = 1; + if ($object->type == 2 && !empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign = -1; - $default_font_size = pdf_getPDFFontSize($outputlangs); + $default_font_size = pdf_getPDFFontSize($outputlangs); $tab2_top = $posy; $tab2_hl = 4; @@ -1306,15 +1306,15 @@ class pdf_sponge extends ModelePDFFactures $i = 0; foreach ($object->lines as $line) { - $percent += $line->situation_percent; - $i++; + $percent += $line->situation_percent; + $i++; } if (!empty($i)) { - $avancementGlobal = $percent / $i; + $avancementGlobal = $percent / $i; } else { - $avancementGlobal = 0; + $avancementGlobal = 0; } $object->fetchPreviousNextSituationInvoice(); @@ -1323,98 +1323,98 @@ class pdf_sponge extends ModelePDFFactures $total_a_payer = 0; $total_a_payer_ttc = 0; foreach ($TPreviousIncoice as &$fac) { - $total_a_payer += $fac->total_ht; - $total_a_payer_ttc += $fac->total_ttc; + $total_a_payer += $fac->total_ht; + $total_a_payer_ttc += $fac->total_ttc; } $total_a_payer += $object->total_ht; $total_a_payer_ttc += $object->total_ttc; if (!empty($avancementGlobal)) { - $total_a_payer = $total_a_payer * 100 / $avancementGlobal; - $total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal; + $total_a_payer = $total_a_payer * 100 / $avancementGlobal; + $total_a_payer_ttc = $total_a_payer_ttc * 100 / $avancementGlobal; } else { - $total_a_payer = 0; - $total_a_payer_ttc = 0; + $total_a_payer = 0; + $total_a_payer_ttc = 0; } $i = 1; if (!empty($TPreviousIncoice)) { - $pdf->setY($tab2_top); - $posy = $pdf->GetY(); + $pdf->setY($tab2_top); + $posy = $pdf->GetY(); - foreach ($TPreviousIncoice as &$fac) { - if ($posy > $this->page_hauteur - 4) { - $this->_pagefoot($pdf, $object, $outputlangs, 1); - $pdf->addPage(); - $pdf->setY($this->marge_haute); - $posy = $pdf->GetY(); - } + foreach ($TPreviousIncoice as &$fac) { + if ($posy > $this->page_hauteur - 4) { + $this->_pagefoot($pdf, $object, $outputlangs, 1); + $pdf->addPage(); + $pdf->setY($this->marge_haute); + $posy = $pdf->GetY(); + } - // cumul TVA précédent - $index++; - $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $posy); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + // cumul TVA précédent + $index++; + $pdf->SetFillColor(255, 255, 255); + $pdf->SetXY($col1x, $posy); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $fac->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $pdf->SetXY($col2x, $posy); + $pdf->SetXY($col2x, $posy); - $facSign = ''; - if ($i > 1) { - $facSign = $fac->total_ht >= 0 ? '+' : ''; - } + $facSign = ''; + if ($i > 1) { + $facSign = $fac->total_ht >= 0 ? '+' : ''; + } - $displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs); + $displayAmount = ' '.$facSign.' '.price($fac->total_ht, 0, $outputlangs); - $pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1); + $pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1); - $i++; - $posy += $tab2_hl; + $i++; + $posy += $tab2_hl; - $pdf->setY($posy); - } + $pdf->setY($posy); + } - // Display current total - $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $posy); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); + // Display current total + $pdf->SetFillColor(255, 255, 255); + $pdf->SetXY($col1x, $posy); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFSituationTitle", $object->situation_counter).' '.$outputlangs->transnoentities("TotalHT"), 0, 'L', 1); - $pdf->SetXY($col2x, $posy); - $facSign = ''; - if ($i > 1) { - $facSign = $object->total_ht >= 0 ? '+' : ''; // management of a particular customer case - } + $pdf->SetXY($col2x, $posy); + $facSign = ''; + if ($i > 1) { + $facSign = $object->total_ht >= 0 ? '+' : ''; // management of a particular customer case + } - if ($fac->type === facture::TYPE_CREDIT_NOTE) { - $facSign = '-'; // les avoirs - } + if ($fac->type === facture::TYPE_CREDIT_NOTE) { + $facSign = '-'; // les avoirs + } - $displayAmount = ' '.$facSign.' '.price($object->total_ht, 0, $outputlangs); - $pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1); + $displayAmount = ' '.$facSign.' '.price($object->total_ht, 0, $outputlangs); + $pdf->MultiCell($largcol2, $tab2_hl, $displayAmount, 0, 'R', 1); - $posy += $tab2_hl; + $posy += $tab2_hl; - // Display all total - $pdf->SetFont('', '', $default_font_size - 1); - $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $posy); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1); + // Display all total + $pdf->SetFont('', '', $default_font_size - 1); + $pdf->SetFillColor(255, 255, 255); + $pdf->SetXY($col1x, $posy); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("SituationTotalProgress", $avancementGlobal), 0, 'L', 1); - $pdf->SetXY($col2x, $posy); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer * $avancementGlobal / 100, 0, $outputlangs), 0, 'R', 1); - $pdf->SetFont('', '', $default_font_size - 2); + $pdf->SetXY($col2x, $posy); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_a_payer * $avancementGlobal / 100, 0, $outputlangs), 0, 'R', 1); + $pdf->SetFont('', '', $default_font_size - 2); - $posy += $tab2_hl; + $posy += $tab2_hl; - if ($posy > $this->page_hauteur - 4) { - $pdf->addPage(); - $pdf->setY($this->marge_haute); - $posy = $pdf->GetY(); - } + if ($posy > $this->page_hauteur - 4) { + $pdf->addPage(); + $pdf->setY($this->marge_haute); + $posy = $pdf->GetY(); + } - $tab2_top = $posy; - $index = 0; + $tab2_top = $posy; + $index = 0; } $tab2_top += 3; @@ -1425,30 +1425,30 @@ class pdf_sponge extends ModelePDFFactures // Total remise $total_line_remise = 0; foreach ($object->lines as $i => $line) { - $total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib - // Gestion remise sous forme de ligne négative - if ($line->total_ht < 0) $total_line_remise += -$line->total_ht; + $total_line_remise += pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, 2); // TODO: add this methode to core/lib/pdf.lib + // Gestion remise sous forme de ligne négative + if ($line->total_ht < 0) $total_line_remise += -$line->total_ht; } if ($total_line_remise > 0) { - if (!empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) { - $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $tab2_top + $tab2_hl); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1); + if (!empty($conf->global->MAIN_SHOW_AMOUNT_DISCOUNT)) { + $pdf->SetFillColor(255, 255, 255); + $pdf->SetXY($col1x, $tab2_top + $tab2_hl); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalDiscount") : ''), 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise, 0, $outputlangs), 0, 'R', 1); - $index++; - } - // Show total NET before discount - if (!empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) { - $pdf->SetFillColor(255, 255, 255); - $pdf->SetXY($col1x, $tab2_top + 0); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + 0); - $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1); + $index++; + } + // Show total NET before discount + if (!empty($conf->global->MAIN_SHOW_AMOUNT_BEFORE_DISCOUNT)) { + $pdf->SetFillColor(255, 255, 255); + $pdf->SetXY($col1x, $tab2_top + 0); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("TotalHTBeforeDiscount").(is_object($outputlangsbis) ? ' / '.$outputlangsbis->transnoentities("TotalHTBeforeDiscount") : ''), 0, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + 0); + $pdf->MultiCell($largcol2, $tab2_hl, price($total_line_remise + $total_ht, 0, $outputlangs), 0, 'R', 1); - $index++; - } + $index++; + } } // Total HT @@ -1475,7 +1475,7 @@ class pdf_sponge extends ModelePDFFactures } else { - // FIXME amount of vat not supported with multicurrency + // FIXME amount of vat not supported with multicurrency //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') @@ -1510,7 +1510,7 @@ class pdf_sponge extends ModelePDFFactures } } } - //} + //} //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ @@ -1543,7 +1543,7 @@ class pdf_sponge extends ModelePDFFactures } } } - //} + //} // VAT // Situations totals migth be wrong on huge amounts @@ -1554,13 +1554,13 @@ class pdf_sponge extends ModelePDFFactures } if ($sum_pdf_tva != $object->total_tva) { // apply coef to recover the VAT object amount (the good one) - if (!empty($sum_pdf_tva)) - { + if (!empty($sum_pdf_tva)) + { $coef_fix_tva = $object->total_tva / $sum_pdf_tva; - } - else { - $coef_fix_tva = 1; - } + } + else { + $coef_fix_tva = 1; + } foreach ($this->tva as $tvakey => $tvaval) { @@ -1626,7 +1626,7 @@ class pdf_sponge extends ModelePDFFactures } } } - //} + //} //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ @@ -1636,7 +1636,7 @@ class pdf_sponge extends ModelePDFFactures foreach ($localtax_rate as $tvakey => $tvaval) { - // retrieve global local tax + // retrieve global local tax if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1702,49 +1702,49 @@ class pdf_sponge extends ModelePDFFactures // Retained warranty if (!empty($object->situation_final) && ($object->type == Facture::TYPE_SITUATION && (!empty($object->retained_warranty)))) { - $displayWarranty = false; + $displayWarranty = false; - // Check if this situation invoice is 100% for real - if (!empty($object->situation_final)) { - $displayWarranty = true; - } - elseif (!empty($object->lines) && $object->status == Facture::STATUS_DRAFT) { - // $object->situation_final need validation to be done so this test is need for draft - $displayWarranty = true; - foreach ($object->lines as $i => $line) { - if ($line->product_type < 2 && $line->situation_percent < 100) { - $displayWarranty = false; - break; + // Check if this situation invoice is 100% for real + if (!empty($object->situation_final)) { + $displayWarranty = true; + } + elseif (!empty($object->lines) && $object->status == Facture::STATUS_DRAFT) { + // $object->situation_final need validation to be done so this test is need for draft + $displayWarranty = true; + foreach ($object->lines as $i => $line) { + if ($line->product_type < 2 && $line->situation_percent < 100) { + $displayWarranty = false; + break; } } } - if ($displayWarranty) { - $pdf->SetTextColor(40, 40, 40); - $pdf->SetFillColor(255, 255, 255); + if ($displayWarranty) { + $pdf->SetTextColor(40, 40, 40); + $pdf->SetFillColor(255, 255, 255); - $retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100; - $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; + $retainedWarranty = $total_a_payer_ttc * $object->retained_warranty / 100; + $billedWithRetainedWarranty = $object->total_ttc - $retainedWarranty; - // Billed - retained warranty - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); + // Billed - retained warranty + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $outputlangs->transnoentities("PDFEVOLToPayOn", dol_print_date($object->date_lim_reglement, 'day')), $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($billedWithRetainedWarranty), $useborder, 'R', 1); - // retained warranty - $index++; - $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); + // retained warranty + $index++; + $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)'; - $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; + $retainedWarrantyToPayOn = $outputlangs->transnoentities("PDFEVOLRetainedWarranty").' ('.$object->retained_warranty.'%)'; + $retainedWarrantyToPayOn .= !empty($object->retained_warranty_date_limit) ? ' '.$outputlangs->transnoentities("PDFEVOLtoPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; - $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); - $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); - $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); - } + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $retainedWarrantyToPayOn, $useborder, 'L', 1); + $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); + $pdf->MultiCell($largcol2, $tab2_hl, price($retainedWarranty), $useborder, 'R', 1); + } } } } @@ -1878,7 +1878,7 @@ class pdf_sponge extends ModelePDFFactures $this->pdfTabTitles($pdf, $tab_top, $tab_height, $outputlangs, $hidetop); if (empty($hidetop)) { - $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter + $pdf->line($this->marge_gauche, $tab_top + $this->tabTitleHeight, $this->page_largeur - $this->marge_droite, $tab_top + $this->tabTitleHeight); // line takes a position y in 2nd parameter and 4th parameter } } @@ -1906,9 +1906,9 @@ class pdf_sponge extends ModelePDFFactures // Show Draft Watermark if ($object->statut == Facture::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK))) - { - pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); - } + { + pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); + } $pdf->SetTextColor(0, 0, 60); $pdf->SetFont('', 'B', $default_font_size + 3); @@ -1916,7 +1916,7 @@ class pdf_sponge extends ModelePDFFactures $w = 110; $posy = $this->marge_haute; - $posx = $this->page_largeur - $this->marge_droite - $w; + $posx = $this->page_largeur - $this->marge_droite - $w; $pdf->SetXY($this->marge_gauche, $posy); @@ -1936,7 +1936,7 @@ class pdf_sponge extends ModelePDFFactures } if (is_readable($logo)) { - $height = pdf_getHeightForLogo($logo); + $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } else @@ -2088,16 +2088,16 @@ class pdf_sponge extends ModelePDFFactures // Get contact if (!empty($conf->global->DOC_SHOW_FIRST_SALES_REP)) { - $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); - if (count($arrayidcontact) > 0) - { - $usertmp = new User($this->db); - $usertmp->fetch($arrayidcontact[0]); - $posy += 4; - $pdf->SetXY($posx, $posy); - $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); - } + $arrayidcontact = $object->getIdContact('internal', 'SALESREPFOLL'); + if (count($arrayidcontact) > 0) + { + $usertmp = new User($this->db); + $usertmp->fetch($arrayidcontact[0]); + $posy += 4; + $pdf->SetXY($posx, $posy); + $pdf->SetTextColor(0, 0, 60); + $pdf->MultiCell($w, 3, $langs->transnoentities("SalesRepresentative")." : ".$usertmp->getFullName($langs), '', 'R'); + } } $posy += 1; @@ -2203,7 +2203,7 @@ class pdf_sponge extends ModelePDFFactures // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Show footer of page. Need this->emetteur object - * + * * @param PDF $pdf PDF * @param Object $object Object to show * @param Translate $outputlangs Object lang for output @@ -2222,28 +2222,28 @@ class pdf_sponge extends ModelePDFFactures * * @param object $object common object * @param Translate $outputlangs langs - * @param int $hidedetails Do not show line details - * @param int $hidedesc Do not show desc - * @param int $hideref Do not show ref - * @return null - */ - public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) - { - global $conf, $hookmanager; + * @param int $hidedetails Do not show line details + * @param int $hidedesc Do not show desc + * @param int $hideref Do not show ref + * @return null + */ + public function defineColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) + { + global $conf, $hookmanager; - // Default field style for content - $this->defaultContentsFieldsStyle = array( - 'align' => 'R', // R,C,L - 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ); + // Default field style for content + $this->defaultContentsFieldsStyle = array( + 'align' => 'R', // R,C,L + 'padding' => array(1, 0.5, 1, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ); - // Default field style for content - $this->defaultTitlesFieldsStyle = array( - 'align' => 'C', // R,C,L - 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ); + // Default field style for content + $this->defaultTitlesFieldsStyle = array( + 'align' => 'C', // R,C,L + 'padding' => array(0.5, 0, 0.5, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ); - /* + /* * For exemple $this->cols['theColKey'] = array( 'rank' => $rank, // int : use for ordering columns @@ -2261,165 +2261,165 @@ class pdf_sponge extends ModelePDFFactures ); */ - $rank = 0; // do not use negative rank - $this->cols['desc'] = array( - 'rank' => $rank, - 'width' => false, // only for desc - 'status' => true, - 'title' => array( - 'textkey' => 'Designation', // use lang key is usefull in somme case with module - 'align' => 'L', - // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label - // 'label' => ' ', // the final label - 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - 'content' => array( - 'align' => 'L', - 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - ); + $rank = 0; // do not use negative rank + $this->cols['desc'] = array( + 'rank' => $rank, + 'width' => false, // only for desc + 'status' => true, + 'title' => array( + 'textkey' => 'Designation', // use lang key is usefull in somme case with module + 'align' => 'L', + // 'textkey' => 'yourLangKey', // if there is no label, yourLangKey will be translated to replace label + // 'label' => ' ', // the final label + 'padding' => array(0.5, 0.5, 0.5, 0.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'content' => array( + 'align' => 'L', + 'padding' => array(1, 0.5, 1, 1.5), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + ); - // PHOTO - $rank = $rank + 10; - $this->cols['photo'] = array( - 'rank' => $rank, - 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm - 'status' => false, - 'title' => array( - 'textkey' => 'Photo', - 'label' => ' ' - ), - 'content' => array( - 'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left - ), - 'border-left' => false, // remove left line separator - ); + // PHOTO + $rank = $rank + 10; + $this->cols['photo'] = array( + 'rank' => $rank, + 'width' => (empty($conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH) ? 20 : $conf->global->MAIN_DOCUMENTS_WITH_PICTURE_WIDTH), // in mm + 'status' => false, + 'title' => array( + 'textkey' => 'Photo', + 'label' => ' ' + ), + 'content' => array( + 'padding' => array(0, 0, 0, 0), // Like css 0 => top , 1 => right, 2 => bottom, 3 => left + ), + 'border-left' => false, // remove left line separator + ); - if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto)) - { - $this->cols['photo']['status'] = true; - } + if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE) && !empty($this->atleastonephoto)) + { + $this->cols['photo']['status'] = true; + } - $rank = $rank + 10; - $this->cols['vat'] = array( - 'rank' => $rank, - 'status' => false, - 'width' => 16, // in mm - 'title' => array( - 'textkey' => 'VAT' - ), - 'border-left' => true, // add left line separator - ); + $rank = $rank + 10; + $this->cols['vat'] = array( + 'rank' => $rank, + 'status' => false, + 'width' => 16, // in mm + 'title' => array( + 'textkey' => 'VAT' + ), + 'border-left' => true, // add left line separator + ); - if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) - { - $this->cols['vat']['status'] = true; - } + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT) && empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_COLUMN)) + { + $this->cols['vat']['status'] = true; + } - $rank = $rank + 10; - $this->cols['subprice'] = array( - 'rank' => $rank, - 'width' => 19, // in mm - 'status' => true, - 'title' => array( - 'textkey' => 'PriceUHT' - ), - 'border-left' => true, // add left line separator - ); + $rank = $rank + 10; + $this->cols['subprice'] = array( + 'rank' => $rank, + 'width' => 19, // in mm + 'status' => true, + 'title' => array( + 'textkey' => 'PriceUHT' + ), + 'border-left' => true, // add left line separator + ); - $rank = $rank + 10; - $this->cols['qty'] = array( - 'rank' => $rank, - 'width' => 16, // in mm - 'status' => true, - 'title' => array( - 'textkey' => 'Qty' - ), - 'border-left' => true, // add left line separator - ); + $rank = $rank + 10; + $this->cols['qty'] = array( + 'rank' => $rank, + 'width' => 16, // in mm + 'status' => true, + 'title' => array( + 'textkey' => 'Qty' + ), + 'border-left' => true, // add left line separator + ); - $rank = $rank + 10; - $this->cols['progress'] = array( - 'rank' => $rank, - 'width' => 19, // in mm - 'status' => false, - 'title' => array( - 'textkey' => 'Progress' - ), - 'border-left' => true, // add left line separator - ); + $rank = $rank + 10; + $this->cols['progress'] = array( + 'rank' => $rank, + 'width' => 19, // in mm + 'status' => false, + 'title' => array( + 'textkey' => 'Progress' + ), + 'border-left' => true, // add left line separator + ); - if ($this->situationinvoice) - { - $this->cols['progress']['status'] = true; - } + if ($this->situationinvoice) + { + $this->cols['progress']['status'] = true; + } - $rank = $rank + 10; - $this->cols['unit'] = array( - 'rank' => $rank, - 'width' => 11, // in mm - 'status' => false, - 'title' => array( - 'textkey' => 'Unit' - ), - 'border-left' => true, // add left line separator - ); - if ($conf->global->PRODUCT_USE_UNITS) { - $this->cols['unit']['status'] = true; - } + $rank = $rank + 10; + $this->cols['unit'] = array( + 'rank' => $rank, + 'width' => 11, // in mm + 'status' => false, + 'title' => array( + 'textkey' => 'Unit' + ), + 'border-left' => true, // add left line separator + ); + if ($conf->global->PRODUCT_USE_UNITS) { + $this->cols['unit']['status'] = true; + } - $rank = $rank + 10; - $this->cols['discount'] = array( - 'rank' => $rank, - 'width' => 13, // in mm - 'status' => false, - 'title' => array( - 'textkey' => 'ReductionShort' - ), - 'border-left' => true, // add left line separator - ); - if ($this->atleastonediscount) { - $this->cols['discount']['status'] = true; - } + $rank = $rank + 10; + $this->cols['discount'] = array( + 'rank' => $rank, + 'width' => 13, // in mm + 'status' => false, + 'title' => array( + 'textkey' => 'ReductionShort' + ), + 'border-left' => true, // add left line separator + ); + if ($this->atleastonediscount) { + $this->cols['discount']['status'] = true; + } - $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 - $this->cols['totalexcltax'] = array( - 'rank' => $rank, - 'width' => 26, // in mm - 'status' => true, - 'title' => array( - 'textkey' => 'TotalHT' - ), - 'border-left' => true, // add left line separator - ); + $rank = $rank + 1000; // add a big offset to be sure is the last col because default extrafield rank is 100 + $this->cols['totalexcltax'] = array( + 'rank' => $rank, + 'width' => 26, // in mm + 'status' => true, + 'title' => array( + 'textkey' => 'TotalHT' + ), + 'border-left' => true, // add left line separator + ); - // Add extrafields cols - if (!empty($object->lines)) { - $line = reset($object->lines); - $this->defineColumnExtrafield($line, $outputlangs, $hidedetails); - } + // Add extrafields cols + if (!empty($object->lines)) { + $line = reset($object->lines); + $this->defineColumnExtrafield($line, $outputlangs, $hidedetails); + } - $parameters = array( - 'object' => $object, - 'outputlangs' => $outputlangs, - 'hidedetails' => $hidedetails, - 'hidedesc' => $hidedesc, - 'hideref' => $hideref - ); + $parameters = array( + 'object' => $object, + 'outputlangs' => $outputlangs, + 'hidedetails' => $hidedetails, + 'hidedesc' => $hidedesc, + 'hideref' => $hideref + ); - $reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook - if ($reshook < 0) - { - setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - } - elseif (empty($reshook)) - { - $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys - } - else - { - $this->cols = $hookmanager->resArray; - } + $reshook = $hookmanager->executeHooks('defineColumnField', $parameters, $this); // Note that $object may have been modified by hook + if ($reshook < 0) + { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + elseif (empty($reshook)) + { + $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys + } + else + { + $this->cols = $hookmanager->resArray; + } } } diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 535eeb8b5d8..0d74fea9b24 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -128,14 +128,14 @@ class modSociete extends DolibarrModules $r++; $this->boxes[$r][1] = "box_prospect.php"; $r++; - $this->boxes[$r][1] = "box_contacts.php"; - $r++; - $this->boxes[$r][1] = "box_activity.php"; - $this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)'; - $r++; - $this->boxes[$r][1] = "box_goodcustomers.php"; - $this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)'; - $r++; + $this->boxes[$r][1] = "box_contacts.php"; + $r++; + $this->boxes[$r][1] = "box_activity.php"; + $this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)'; + $r++; + $this->boxes[$r][1] = "box_goodcustomers.php"; + $this->boxes[$r][2] = '(WarningUsingThisBoxSlowDown)'; + $r++; // Permissions $this->rights = array(); $this->rights_class = 'societe'; @@ -148,7 +148,7 @@ class modSociete extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'lire'; - /*$r++; + /*$r++; $this->rights[$r][0] = 241; $this->rights[$r][1] = 'Read thirdparties customers'; $this->rights[$r][2] = 'r'; @@ -172,7 +172,7 @@ class modSociete extends DolibarrModules $this->rights[$r][3] = 0; // La permission est-elle une permission par defaut $this->rights[$r][4] = 'creer'; - /* $r++; + /* $r++; $this->rights[$r][0] = 251; $this->rights[$r][1] = 'Create thirdparties customers'; $this->rights[$r][2] = 'r'; @@ -274,8 +274,8 @@ class modSociete extends DolibarrModules // Add multicompany field if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) { - $nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1 - if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r] += array('s.entity'=>'Entity'); + $nbofallowedentities = count(explode(',', getEntity('societe'))); // If project are shared, nb will be > 1 + if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r] += array('s.entity'=>'Entity'); } $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; @@ -304,7 +304,7 @@ class modSociete extends DolibarrModules $this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)'); $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id'; @@ -338,38 +338,38 @@ class modSociete extends DolibarrModules 's.rowid'=>"IdCompany", 's.nom'=>"CompanyName", 's.status'=>"Status", 's.code_client'=>"CustomerCode", 's.code_fournisseur'=>"SupplierCode", 's.code_compta'=>"AccountancyCode", 's.code_compta_fournisseur'=>"SupplierAccountancyCode", 's.client'=>'Customer', 's.fournisseur'=>'Supplier', - 's.address'=>'Address', 's.zip'=>"Zip", 's.town'=>"Town", 's.phone'=>'Phone', 's.email'=>"Email", - 't.libelle'=>"ThirdPartyType" + 's.address'=>'Address', 's.zip'=>"Zip", 's.town'=>"Town", 's.phone'=>'Phone', 's.email'=>"Email", + 't.libelle'=>"ThirdPartyType" ); $this->export_examplevalues_array[$r] = array('s.client'=>'0 (no customer no prospect)/1 (customer)/2 (prospect)/3 (customer and prospect)', 's.fournisseur'=>'0 (not a supplier) or 1 (supplier)'); $this->export_TypeFields_array[$r] = array( 'c.civility'=>"List:c_civility:label:code", 'c.lastname'=>'Text', 'c.firstname'=>'Text', 'c.poste'=>'Text', 'c.datec'=>"Date", 'c.priv'=>"Boolean", 'c.address'=>"Text", 'c.zip'=>"Text", 'c.town'=>"Text", 'd.nom'=>'Text', 'co.label'=>"List:c_country:label:rowid", 'co.code'=>"Text", 'c.phone'=>"Text", 'c.fax'=>"Text", 'c.email'=>"Text", - 'c.statut'=>"Status", - 's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>"Text", 's.status'=>"Status", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", + 'c.statut'=>"Status", + 's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>"Text", 's.status'=>"Status", 's.code_client'=>"Text", 's.code_fournisseur'=>"Text", 's.code_compta'=>"Text", 's.code_compta_fournisseur'=>"Text", 's.client'=>"Text", 's.fournisseur'=>"Text", - 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 's.phone'=>"Text", 's.email'=>"Text", - 't.libelle'=>"Text" + 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 's.phone'=>"Text", 's.email'=>"Text", + 't.libelle'=>"Text" ); $this->export_entities_array[$r] = array( 's.rowid'=>"company", 's.nom'=>"company", 's.status'=>'company', 's.code_client'=>"company", 's.code_fournisseur'=>"company", 's.code_compta'=>"company", 's.code_compta_fournisseur'=>"company", 's.client'=>"company", 's.fournisseur'=>"company", - 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 's.phone'=>"company", 's.email'=>"company", - 't.libelle'=>"company" + 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 's.phone'=>"company", 's.email'=>"company", + 't.libelle'=>"company" ); // We define here only fields that use another picto - if (empty($conf->fournisseur->enabled)) - { - unset($this->export_fields_array[$r]['s.code_fournisseur']); - unset($this->export_entities_array[$r]['s.code_fournisseur']); - } - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra'; - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extrasoc'; - include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_sql_start[$r] = 'SELECT DISTINCT '; + if (empty($conf->fournisseur->enabled)) + { + unset($this->export_fields_array[$r]['s.code_fournisseur']); + unset($this->export_entities_array[$r]['s.code_fournisseur']); + } + $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extrasoc'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'socpeople as c'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON c.fk_soc = s.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extrasoc ON s.rowid = extrasoc.fk_object'; @@ -377,7 +377,7 @@ class modSociete extends DolibarrModules $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON c.fk_departement = d.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON c.fk_pays = co.rowid'; $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = c.rowid'; - $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id'; $this->export_sql_end[$r] .= ' WHERE c.entity IN ('.getEntity('socpeople').')'; if (is_object($user) && empty($user->rights->societe->client->voir)) { $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.$user->id.' '; @@ -389,338 +389,338 @@ class modSociete extends DolibarrModules } - // Imports - //-------- - $r = 0; + // Imports + //-------- + $r = 0; - // Import list of third parties and attributes + // Import list of third parties and attributes - $r++; - $this->import_code[$r] = $this->rights_class.'_'.$r; - $this->import_label[$r] = 'ImportDataset_company_1'; - $this->import_icon[$r] = 'company'; - $this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon - $this->import_tables_array[$r] = array( - 's' => MAIN_DB_PREFIX.'societe', - 'extra' => MAIN_DB_PREFIX.'societe_extrafields' - ); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r] = array(//field order as per structure of table llx_societe - 's.nom' => "Name*", - 's.name_alias' => "AliasNameShort", - 's.status' => "Status", - 's.code_client' => "CustomerCode", - 's.code_fournisseur' => "SupplierCode", - 's.code_compta' => "CustomerAccountancyCode", - 's.code_compta_fournisseur' => "SupplierAccountancyCode", - 's.address' => "Address", - 's.zip' => "Zip", - 's.town' => "Town", - 's.fk_departement' => "StateCode", - 's.fk_pays' => "CountryCode", - 's.phone' => "Phone", - 's.fax' => "Fax", - 's.url' => "Url", - 's.email' => "Email", - 's.skype' => "Skype", - 's.fk_effectif' => "Staff", - 's.fk_typent' => "ThirdPartyType", - "s.fk_forme_juridique" => "JuridicalStatus", - 's.siren' => "ProfId1", - 's.siret' => "ProfId2", - 's.ape' => "ProfId3", - 's.idprof4' => "ProfId4", - 's.idprof5' => "ProfId5", - 's.idprof6' => "ProfId6", - 's.tva_intra' => "VATIntraShort", - 's.capital' => "Capital", - 's.fk_stcomm' => 'ProspectStatus', - 's.note_private' => "NotePrivate", - 's.note_public' => "NotePublic", - 's.client' => "Customer*", - 's.fournisseur' => "Supplier*", - 's.fk_prospectlevel' => 'ProspectLevel', - 's.mode_reglement' => 'PaymentTypeCustomer', - 's.cond_reglement' => "PaymentTermsCustomer", - 's.mode_reglement_supplier' => 'PaymentTypeSupplier', - 's.cond_reglement_supplier' => "PaymentTermsSupplier", - 's.tva_assuj' => 'VATIsUsed', - 's.barcode' => 'BarCode', - 's.default_lang' => 'DefaultLanguage', - 's.canvas' => "Canvas", - 's.datec' => "DateCreation", - 's.fk_multicurrency' => 'MulticurrencyUsed', - 's.multicurrency_code' => 'MulticurrencyCurrency' - ); - if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level']='PriceLevel'; - // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - if ($resql) // This can fail when class is used on old database (during migration for example) - { - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extra.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); - } - } - // End add extra fields - $this->import_fieldshidden_array[$r] = array( - 's.fk_user_creat' => 'user->id', - 'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'societe' - ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) - $this->import_convertvalue_array[$r] = array(//field order as per structure of table llx_societe - 's.code_client' => array('rule' => 'getcustomercodeifauto'), - 's.code_fournisseur' => array('rule' => 'getsuppliercodeifauto'), - 's.code_compta' => array('rule' => 'getcustomeraccountancycodeifauto'), - 's.code_compta_fournisseur' => array('rule' => 'getsupplieraccountancycodeifauto'), - 's.fk_departement' => array( - 'rule' => 'fetchidfromcodeid', - 'classfile' => '/core/class/cstate.class.php', - 'class' => 'Cstate', - 'method' => 'fetch', - 'dict' => 'DictionaryState' - ), - 's.fk_pays' => array( - 'rule' => 'fetchidfromcodeid', - 'classfile' => '/core/class/ccountry.class.php', - 'class' => 'Ccountry', - 'method' => 'fetch', - 'dict' => 'DictionaryCountry' - ), - 's.fk_typent' => array( - 'rule' => 'fetchidfromcodeorlabel', - 'classfile' => '/core/class/ctypent.class.php', - 'class' => 'Ctypent', - 'method' => 'fetch', - 'dict' => 'DictionaryCompanyType' - ), - 's.capital' => array('rule' => 'numeric'), - 's.fk_stcomm' => array('rule' => 'zeroifnull'), - ); - //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); - $this->import_regex_array[$r] = array(//field order as per structure of table llx_societe - 's.status' => '^[0|1]', - 's.fk_typent' => 'id@'.MAIN_DB_PREFIX.'c_typent', - 's.client' => '^[0|1|2|3]', - 's.fournisseur' => '^[0|1]', - 's.mode_reglement' => 'id@'.MAIN_DB_PREFIX.'c_paiement', - 's.cond_reglement' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term', - 's.mode_reglement_supplier' => 'id@'.MAIN_DB_PREFIX.'c_paiement', - 's.cond_reglement_supplier' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term', - 's.tva_assuj' => '^[0|1]', - 's.fk_multicurrency' => '^[0|1]', - 's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$', - 's.multicurrency_code' => 'code_iso@'.MAIN_DB_PREFIX.'c_currencies' - ); + $r++; + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = 'ImportDataset_company_1'; + $this->import_icon[$r] = 'company'; + $this->import_entities_array[$r] = array(); // We define here only fields that use a different icon from the one defined in import_icon + $this->import_tables_array[$r] = array( + 's' => MAIN_DB_PREFIX.'societe', + 'extra' => MAIN_DB_PREFIX.'societe_extrafields' + ); // List of tables to insert into (insert done in same order) + $this->import_fields_array[$r] = array(//field order as per structure of table llx_societe + 's.nom' => "Name*", + 's.name_alias' => "AliasNameShort", + 's.status' => "Status", + 's.code_client' => "CustomerCode", + 's.code_fournisseur' => "SupplierCode", + 's.code_compta' => "CustomerAccountancyCode", + 's.code_compta_fournisseur' => "SupplierAccountancyCode", + 's.address' => "Address", + 's.zip' => "Zip", + 's.town' => "Town", + 's.fk_departement' => "StateCode", + 's.fk_pays' => "CountryCode", + 's.phone' => "Phone", + 's.fax' => "Fax", + 's.url' => "Url", + 's.email' => "Email", + 's.skype' => "Skype", + 's.fk_effectif' => "Staff", + 's.fk_typent' => "ThirdPartyType", + "s.fk_forme_juridique" => "JuridicalStatus", + 's.siren' => "ProfId1", + 's.siret' => "ProfId2", + 's.ape' => "ProfId3", + 's.idprof4' => "ProfId4", + 's.idprof5' => "ProfId5", + 's.idprof6' => "ProfId6", + 's.tva_intra' => "VATIntraShort", + 's.capital' => "Capital", + 's.fk_stcomm' => 'ProspectStatus', + 's.note_private' => "NotePrivate", + 's.note_public' => "NotePublic", + 's.client' => "Customer*", + 's.fournisseur' => "Supplier*", + 's.fk_prospectlevel' => 'ProspectLevel', + 's.mode_reglement' => 'PaymentTypeCustomer', + 's.cond_reglement' => "PaymentTermsCustomer", + 's.mode_reglement_supplier' => 'PaymentTypeSupplier', + 's.cond_reglement_supplier' => "PaymentTermsSupplier", + 's.tva_assuj' => 'VATIsUsed', + 's.barcode' => 'BarCode', + 's.default_lang' => 'DefaultLanguage', + 's.canvas' => "Canvas", + 's.datec' => "DateCreation", + 's.fk_multicurrency' => 'MulticurrencyUsed', + 's.multicurrency_code' => 'MulticurrencyCurrency' + ); + if (! empty($conf->global->PRODUIT_MULTIPRICES)) $this->import_fields_array[$r]['s.price_level']='PriceLevel'; + // Add extra fields + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); + if ($resql) // This can fail when class is used on old database (during migration for example) + { + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); + } + } + // End add extra fields + $this->import_fieldshidden_array[$r] = array( + 's.fk_user_creat' => 'user->id', + 'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'societe' + ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_convertvalue_array[$r] = array(//field order as per structure of table llx_societe + 's.code_client' => array('rule' => 'getcustomercodeifauto'), + 's.code_fournisseur' => array('rule' => 'getsuppliercodeifauto'), + 's.code_compta' => array('rule' => 'getcustomeraccountancycodeifauto'), + 's.code_compta_fournisseur' => array('rule' => 'getsupplieraccountancycodeifauto'), + 's.fk_departement' => array( + 'rule' => 'fetchidfromcodeid', + 'classfile' => '/core/class/cstate.class.php', + 'class' => 'Cstate', + 'method' => 'fetch', + 'dict' => 'DictionaryState' + ), + 's.fk_pays' => array( + 'rule' => 'fetchidfromcodeid', + 'classfile' => '/core/class/ccountry.class.php', + 'class' => 'Ccountry', + 'method' => 'fetch', + 'dict' => 'DictionaryCountry' + ), + 's.fk_typent' => array( + 'rule' => 'fetchidfromcodeorlabel', + 'classfile' => '/core/class/ctypent.class.php', + 'class' => 'Ctypent', + 'method' => 'fetch', + 'dict' => 'DictionaryCompanyType' + ), + 's.capital' => array('rule' => 'numeric'), + 's.fk_stcomm' => array('rule' => 'zeroifnull'), + ); + //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); + $this->import_regex_array[$r] = array(//field order as per structure of table llx_societe + 's.status' => '^[0|1]', + 's.fk_typent' => 'id@'.MAIN_DB_PREFIX.'c_typent', + 's.client' => '^[0|1|2|3]', + 's.fournisseur' => '^[0|1]', + 's.mode_reglement' => 'id@'.MAIN_DB_PREFIX.'c_paiement', + 's.cond_reglement' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term', + 's.mode_reglement_supplier' => 'id@'.MAIN_DB_PREFIX.'c_paiement', + 's.cond_reglement_supplier' => 'rowid@'.MAIN_DB_PREFIX.'c_payment_term', + 's.tva_assuj' => '^[0|1]', + 's.fk_multicurrency' => '^[0|1]', + 's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$', + 's.multicurrency_code' => 'code_iso@'.MAIN_DB_PREFIX.'c_currencies' + ); - $this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe - 's.nom' => "TPBigCompany", - 's.name_alias' => "Alias for TPBigCompany", - 's.status' => "0 (closed) / 1 (active)", - 's.code_client' => 'eg. CU01-0001 / empty / "auto"', - 's.code_fournisseur' => 'eg. SU01-0001 / empty / "auto"', - 's.code_compta' => "Code or empty to be auto-created", - 's.code_compta_fournisseur' => "Code or empty to be auto-created", - 's.address' => "61 Jump Street", - 's.zip' => "123456", - 's.town' => "Bigtown", - 's.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"', - 's.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"', - 's.phone' => "eg: +34123456789", - 's.fax' => "eg. +34987654321", - 's.url' => "e.g. https://www.mybigcompany.com", - 's.email' => "e.g. test@mybigcompany.com", - 's.skype' => "Skype name", - 's.fk_effectif' => "1/2/3/5: represents one of the five ranges of employees", - 's.fk_typent' => 'matches field "id" (1-9 etc.) OR "code" (TE_SMALL etc.) in table "'.MAIN_DB_PREFIX.'c_typent"', - 's.fk_forme_juridique' => '1/2/3 etc...matches field "code" in table "'.MAIN_DB_PREFIX.'c_forme_juridique"', - 's.siret' => "", - 's.siren' => "", - 's.ape' => "", - 's.idprof4' => "", - 's.idprof5' => "", - 's.idprof6' => "", - 's.tva_intra' => 'VAT number e.g."FR0123456789"', - 's.capital' => "10000", - 's.fk_stcomm' => '-1/0/1/2 etc... matches field "id" in table "'.MAIN_DB_PREFIX.'c_stcomm"', - 's.note_private' => "Example of a PRIVATE note.", - 's.note_public' => "Example of a PUBLIC note.", - 's.client' => '0 (no customer no prospect) / 1 (customer) / 2 (prospect)/ 3 (customer and prospect)', - 's.fournisseur' => '0 (not supplier) / 1 (supplier)', - 's.fk_prospectlevel' => 'eg. "PL_MEDIUM" matches field "code" in table "'.MAIN_DB_PREFIX.'c_prospectlevel"', - 's.mode_reglement' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"', - 's.cond_reglement' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"', - 's.mode_reglement_supplier' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"', - 's.cond_reglement_supplier' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"', - 's.tva_assuj' => '0 (VAT not used) / 1 (VAT used)', - 's.barcode' => '123456789', - 's.default_lang' => 'en_US / es_ES etc...matches a language directory in htdocs/langs/', - 's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule", - 's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), - 's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)', - 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"' - ); - $this->import_updatekeys_array[$r] = array( - 's.nom' => 'Name', - 's.code_client' => 'CustomerCode', - 's.code_fournisseur' => 'SupplierCode', - 's.code_compta' => 'CustomerAccountancyCode', - 's.code_compta_fournisseur' => 'SupplierAccountancyCode' - ); + $this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe + 's.nom' => "TPBigCompany", + 's.name_alias' => "Alias for TPBigCompany", + 's.status' => "0 (closed) / 1 (active)", + 's.code_client' => 'eg. CU01-0001 / empty / "auto"', + 's.code_fournisseur' => 'eg. SU01-0001 / empty / "auto"', + 's.code_compta' => "Code or empty to be auto-created", + 's.code_compta_fournisseur' => "Code or empty to be auto-created", + 's.address' => "61 Jump Street", + 's.zip' => "123456", + 's.town' => "Bigtown", + 's.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"', + 's.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"', + 's.phone' => "eg: +34123456789", + 's.fax' => "eg. +34987654321", + 's.url' => "e.g. https://www.mybigcompany.com", + 's.email' => "e.g. test@mybigcompany.com", + 's.skype' => "Skype name", + 's.fk_effectif' => "1/2/3/5: represents one of the five ranges of employees", + 's.fk_typent' => 'matches field "id" (1-9 etc.) OR "code" (TE_SMALL etc.) in table "'.MAIN_DB_PREFIX.'c_typent"', + 's.fk_forme_juridique' => '1/2/3 etc...matches field "code" in table "'.MAIN_DB_PREFIX.'c_forme_juridique"', + 's.siret' => "", + 's.siren' => "", + 's.ape' => "", + 's.idprof4' => "", + 's.idprof5' => "", + 's.idprof6' => "", + 's.tva_intra' => 'VAT number e.g."FR0123456789"', + 's.capital' => "10000", + 's.fk_stcomm' => '-1/0/1/2 etc... matches field "id" in table "'.MAIN_DB_PREFIX.'c_stcomm"', + 's.note_private' => "Example of a PRIVATE note.", + 's.note_public' => "Example of a PUBLIC note.", + 's.client' => '0 (no customer no prospect) / 1 (customer) / 2 (prospect)/ 3 (customer and prospect)', + 's.fournisseur' => '0 (not supplier) / 1 (supplier)', + 's.fk_prospectlevel' => 'eg. "PL_MEDIUM" matches field "code" in table "'.MAIN_DB_PREFIX.'c_prospectlevel"', + 's.mode_reglement' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"', + 's.cond_reglement' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"', + 's.mode_reglement_supplier' => '1/2/3...matches field "id" in table "'.MAIN_DB_PREFIX.'c_paiement"', + 's.cond_reglement_supplier' => '1/2/3...matches field "rowid" in table "'.MAIN_DB_PREFIX.'c_payment_term"', + 's.tva_assuj' => '0 (VAT not used) / 1 (VAT used)', + 's.barcode' => '123456789', + 's.default_lang' => 'en_US / es_ES etc...matches a language directory in htdocs/langs/', + 's.canvas' => "empty / a custom canvas form layout url e.g. mycanvas@mymodule", + 's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), + 's.fk_multicurrency' => '0 (use system default currency) / 1 (use local currency)', + 's.multicurrency_code' => 'GBP/USD etc... matches field "code_iso" in table "'.MAIN_DB_PREFIX.'c_currencies"' + ); + $this->import_updatekeys_array[$r] = array( + 's.nom' => 'Name', + 's.code_client' => 'CustomerCode', + 's.code_fournisseur' => 'SupplierCode', + 's.code_compta' => 'CustomerAccountancyCode', + 's.code_compta_fournisseur' => 'SupplierAccountancyCode' + ); - // Import list of contacts/additional addresses and attributes - $r++; - $this->import_code[$r] = $this->rights_class.'_'.$r; - $this->import_label[$r] = 'ImportDataset_company_2'; - $this->import_icon[$r] = 'contact'; - $this->import_entities_array[$r] = array('s.fk_soc' => 'company'); // We define here only fields that use a different icon than the one defined in import_icon - $this->import_tables_array[$r] = array( - 's' => MAIN_DB_PREFIX.'socpeople', - 'extra' => MAIN_DB_PREFIX.'socpeople_extrafields' - ); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r] = array(//field order as per structure of table llx_socpeople - 's.datec' => "DateCreation", - 's.fk_soc' => 'ThirdPartyName', - 's.civility' => 'UserTitle', - 's.lastname' => "Lastname*", - 's.firstname' => "Firstname", - 's.address' => "Address", - 's.zip' => "Zip", - 's.town' => "Town", - 's.fk_departement' => "StateCode", - 's.fk_pays' => "CountryCode", - 's.birthday' => "BirthdayDate", - 's.poste' => "Role", - 's.phone' => "Phone", - 's.phone_perso' => "PhonePerso", - 's.phone_mobile' => "PhoneMobile", - 's.fax' => "Fax", - 's.email' => "Email", - 's.skype' => "Skype", - 's.note_private' => "NotePrivate", - 's.note_public' => "NotePublic" - ); - // Add extra fields - $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; - $resql = $this->db->query($sql); - if ($resql) // This can fail when class is used on an old database (during a migration for example) - { - while ($obj = $this->db->fetch_object($resql)) { - $fieldname = 'extra.'.$obj->name; - $fieldlabel = ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); - } - } - // End add extra fields - $this->import_fieldshidden_array[$r] = array( - 's.fk_user_creat' => 'user->id', - 'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'socpeople' - ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) - $this->import_convertvalue_array[$r] = array( - 's.fk_soc' => array( - 'rule' => 'fetchidfromref', - 'file' => '/societe/class/societe.class.php', - 'class' => 'Societe', - 'method' => 'fetch', - 'element' => 'ThirdParty' - ), - 's.fk_departement' => array( - 'rule' => 'fetchidfromcodeid', - 'classfile' => '/core/class/cstate.class.php', - 'class' => 'Cstate', - 'method' => 'fetch', - 'dict' => 'DictionaryState' - ), - 's.fk_pays' => array( - 'rule' => 'fetchidfromcodeid', - 'classfile' => '/core/class/ccountry.class.php', - 'class' => 'Ccountry', - 'method' => 'fetch', - 'dict' => 'DictionaryCountry' - ), - ); - //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); - $this->import_regex_array[$r] = array( - 's.birthday' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', - 's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$' - ); - $this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_socpeople - 's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), - 's.fk_soc' => 'Third Party name eg. TPBigCompany', - 's.civility' => 'Title of civility eg: MR...matches field "code" in table "'.MAIN_DB_PREFIX.'c_civility"', - 's.lastname' => "lastname or label", - 's.firstname' => 'John', - 's.address' => '61 Jump street', - 's.zip' => '75000', - 's.town' => 'Bigtown', - 's.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"', - 's.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"', - 's.birthday' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), - 's.poste' => "Director", - 's.phone' => "5551122", - 's.phone_perso' => "5551133", - 's.phone_mobile' => "5551144", - 's.fax' => "5551155", - 's.email' => "johnsmith@email.com", - 's.skype' => "skype username", - 's.note_private' => "My private note", - 's.note_public' => "My public note" - ); + // Import list of contacts/additional addresses and attributes + $r++; + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = 'ImportDataset_company_2'; + $this->import_icon[$r] = 'contact'; + $this->import_entities_array[$r] = array('s.fk_soc' => 'company'); // We define here only fields that use a different icon than the one defined in import_icon + $this->import_tables_array[$r] = array( + 's' => MAIN_DB_PREFIX.'socpeople', + 'extra' => MAIN_DB_PREFIX.'socpeople_extrafields' + ); // List of tables to insert into (insert done in same order) + $this->import_fields_array[$r] = array(//field order as per structure of table llx_socpeople + 's.datec' => "DateCreation", + 's.fk_soc' => 'ThirdPartyName', + 's.civility' => 'UserTitle', + 's.lastname' => "Lastname*", + 's.firstname' => "Firstname", + 's.address' => "Address", + 's.zip' => "Zip", + 's.town' => "Town", + 's.fk_departement' => "StateCode", + 's.fk_pays' => "CountryCode", + 's.birthday' => "BirthdayDate", + 's.poste' => "Role", + 's.phone' => "Phone", + 's.phone_perso' => "PhonePerso", + 's.phone_mobile' => "PhoneMobile", + 's.fax' => "Fax", + 's.email' => "Email", + 's.skype' => "Skype", + 's.note_private' => "NotePrivate", + 's.note_public' => "NotePublic" + ); + // Add extra fields + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); + if ($resql) // This can fail when class is used on an old database (during a migration for example) + { + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); + } + } + // End add extra fields + $this->import_fieldshidden_array[$r] = array( + 's.fk_user_creat' => 'user->id', + 'extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'socpeople' + ); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_convertvalue_array[$r] = array( + 's.fk_soc' => array( + 'rule' => 'fetchidfromref', + 'file' => '/societe/class/societe.class.php', + 'class' => 'Societe', + 'method' => 'fetch', + 'element' => 'ThirdParty' + ), + 's.fk_departement' => array( + 'rule' => 'fetchidfromcodeid', + 'classfile' => '/core/class/cstate.class.php', + 'class' => 'Cstate', + 'method' => 'fetch', + 'dict' => 'DictionaryState' + ), + 's.fk_pays' => array( + 'rule' => 'fetchidfromcodeid', + 'classfile' => '/core/class/ccountry.class.php', + 'class' => 'Ccountry', + 'method' => 'fetch', + 'dict' => 'DictionaryCountry' + ), + ); + //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); + $this->import_regex_array[$r] = array( + 's.birthday' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', + 's.datec' => '^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$' + ); + $this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_socpeople + 's.datec' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), + 's.fk_soc' => 'Third Party name eg. TPBigCompany', + 's.civility' => 'Title of civility eg: MR...matches field "code" in table "'.MAIN_DB_PREFIX.'c_civility"', + 's.lastname' => "lastname or label", + 's.firstname' => 'John', + 's.address' => '61 Jump street', + 's.zip' => '75000', + 's.town' => 'Bigtown', + 's.fk_departement' => 'matches field "code_departement" in table "'.MAIN_DB_PREFIX.'c_departements"', + 's.fk_pays' => 'US/FR/DE etc. matches field "code" in table "'.MAIN_DB_PREFIX.'c_country"', + 's.birthday' => 'formatted as '.dol_print_date(dol_now(), '%Y-%m-%d'), + 's.poste' => "Director", + 's.phone' => "5551122", + 's.phone_perso' => "5551133", + 's.phone_mobile' => "5551144", + 's.fax' => "5551155", + 's.email' => "johnsmith@email.com", + 's.skype' => "skype username", + 's.note_private' => "My private note", + 's.note_public' => "My public note" + ); - // Import Bank Accounts - $r++; - $this->import_code[$r] = $this->rights_class.'_'.$r; - $this->import_label[$r] = "ImportDataset_company_3"; // Translation key - $this->import_icon[$r] = 'company'; - $this->import_entities_array[$r] = array(); // We define here only fields that use a different icon to the one defined in import_icon - $this->import_tables_array[$r] = array('sr' => MAIN_DB_PREFIX.'societe_rib'); - $this->import_fields_array[$r] = array(//field order as per structure of table llx_societe_rib - 'sr.label' => "Label*", - 'sr.fk_soc' => "ThirdPartyName*", - 'sr.datec' => "DateCreation*", - 'sr.bank' => "Bank", - 'sr.code_banque' => "BankCode", - 'sr.code_guichet' => "DeskCode", - 'sr.number' => "BankAccountNumber*", - 'sr.cle_rib' => "BankAccountNumberKey", - 'sr.bic' => "BIC", - 'sr.iban_prefix' => "IBAN", - 'sr.domiciliation' => "BankAccountDomiciliation", - 'sr.proprio' => "BankAccountOwner", - 'sr.owner_address' => "BankAccountOwnerAddress", - 'sr.default_rib' => 'Default', - 'sr.rum' => 'RUM', + // Import Bank Accounts + $r++; + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "ImportDataset_company_3"; // Translation key + $this->import_icon[$r] = 'company'; + $this->import_entities_array[$r] = array(); // We define here only fields that use a different icon to the one defined in import_icon + $this->import_tables_array[$r] = array('sr' => MAIN_DB_PREFIX.'societe_rib'); + $this->import_fields_array[$r] = array(//field order as per structure of table llx_societe_rib + 'sr.label' => "Label*", + 'sr.fk_soc' => "ThirdPartyName*", + 'sr.datec' => "DateCreation*", + 'sr.bank' => "Bank", + 'sr.code_banque' => "BankCode", + 'sr.code_guichet' => "DeskCode", + 'sr.number' => "BankAccountNumber*", + 'sr.cle_rib' => "BankAccountNumberKey", + 'sr.bic' => "BIC", + 'sr.iban_prefix' => "IBAN", + 'sr.domiciliation' => "BankAccountDomiciliation", + 'sr.proprio' => "BankAccountOwner", + 'sr.owner_address' => "BankAccountOwnerAddress", + 'sr.default_rib' => 'Default', + 'sr.rum' => 'RUM', 'sr.type' => "Type ban is defaut", - ); + ); - $this->import_convertvalue_array[$r] = array( - 'sr.fk_soc' => array( - 'rule' => 'fetchidfromref', - 'classfile' => '/societe/class/societe.class.php', - 'class' => 'Societe', - 'method' => 'fetch', - 'element' => 'ThirdParty' - ) - ); - $this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe_rib - 'sr.label' => 'eg. "account1"', - 'sr.fk_soc' => 'eg. "TPBigCompany"', - 'sr.datec' => 'date used for creating direct debit UMR formatted as '.dol_print_date(dol_now(), - '%Y-%m-%d'), - 'sr.bank' => 'bank name eg: "ING-Direct"', - 'sr.code_banque' => 'account sort code (GB)/Routing number (US) eg. "8456"', - 'sr.code_guichet' => "bank code for office/branch", - 'sr.number' => 'account number eg. "3333333333"', - 'sr.cle_rib' => 'account checksum/control digits (if used) eg. "22"', - 'sr.bic' => 'bank identifier eg. "USHINGMMXXX"', - 'sr.iban_prefix' => 'complete account IBAN eg. "GB78CPBK08925068637123"', - 'sr.domiciliation' => 'bank branch address eg. "PARIS"', - 'sr.proprio' => 'name on the bank account', - 'sr.owner_address' => 'address of account holder', - 'sr.default_rib' => '1 (default account) / 0 (not default)', - 'sr.rum' => 'RUM code', + $this->import_convertvalue_array[$r] = array( + 'sr.fk_soc' => array( + 'rule' => 'fetchidfromref', + 'classfile' => '/societe/class/societe.class.php', + 'class' => 'Societe', + 'method' => 'fetch', + 'element' => 'ThirdParty' + ) + ); + $this->import_examplevalues_array[$r] = array(//field order as per structure of table llx_societe_rib + 'sr.label' => 'eg. "account1"', + 'sr.fk_soc' => 'eg. "TPBigCompany"', + 'sr.datec' => 'date used for creating direct debit UMR formatted as '.dol_print_date(dol_now(), + '%Y-%m-%d'), + 'sr.bank' => 'bank name eg: "ING-Direct"', + 'sr.code_banque' => 'account sort code (GB)/Routing number (US) eg. "8456"', + 'sr.code_guichet' => "bank code for office/branch", + 'sr.number' => 'account number eg. "3333333333"', + 'sr.cle_rib' => 'account checksum/control digits (if used) eg. "22"', + 'sr.bic' => 'bank identifier eg. "USHINGMMXXX"', + 'sr.iban_prefix' => 'complete account IBAN eg. "GB78CPBK08925068637123"', + 'sr.domiciliation' => 'bank branch address eg. "PARIS"', + 'sr.proprio' => 'name on the bank account', + 'sr.owner_address' => 'address of account holder', + 'sr.default_rib' => '1 (default account) / 0 (not default)', + 'sr.rum' => 'RUM code', 'sr.type' => 'ban', - ); + ); // Import Company Sales representatives $r++; @@ -739,16 +739,16 @@ class modSociete extends DolibarrModules } - /** + /** * Function called when module is enabled. * 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 - */ - public function init($options = '') - { + */ + public function init($options = '') + { global $conf, $langs; // We disable this to prevent pb of modules not correctly disabled diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 0167d900b3f..07074888409 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -923,7 +923,7 @@ class pdf_azur extends ModelePDFPropales } // Show payments conditions - if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) + if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM) && ($object->cond_reglement_code || $object->cond_reglement)) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -939,7 +939,7 @@ class pdf_azur extends ModelePDFPropales $posy = $pdf->GetY() + 3; } - if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMMODE)) + if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTMODE)) { // Check a payment mode is defined /* Not required on a proposal diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index cf9ad650039..1af66ca645e 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1053,7 +1053,7 @@ class pdf_cyan extends ModelePDFPropales } // Show payments conditions - if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMCOND) && ($object->cond_reglement_code || $object->cond_reglement)) + if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTTERM) && ($object->cond_reglement_code || $object->cond_reglement)) { $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->SetXY($this->marge_gauche, $posy); @@ -1069,7 +1069,7 @@ class pdf_cyan extends ModelePDFPropales $posy = $pdf->GetY() + 3; } - if (empty($conf->global->PROPALE_PDF_HIDE_PAYMENTTERMMODE)) + if (empty($conf->global->PROPOSAL_PDF_HIDE_PAYMENTMODE)) { // Check a payment mode is defined /* Not required on a proposal diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index b2bb69aa0bf..96620da28d9 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -113,8 +113,8 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel } print ''; } - print ''.img_edit().''; - print "  ".img_delete()."\n"; + print ''.img_edit().''; + print '  '.img_delete().''."\n"; print ""; } } diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 0ff43ff0029..e9f881accd2 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -74,7 +74,7 @@ if ($permission) print '
      '."\n"; print '
      '."\n"; - ?> + ?>
      trans("NatureOfContact"); ?>
      trans("ThirdParty"); ?>
      @@ -88,7 +88,7 @@ if ($permission) if (empty($hideaddcontactforuser)) { - ?> + ?> " /> @@ -113,7 +113,7 @@ if ($permission) if (empty($hideaddcontactforthirdparty)) { - ?> + ?> " /> @@ -128,7 +128,7 @@ if ($permission) // add company icon before select list if ($selectedCompany) { - echo img_object('', 'company', 'class="hideonsmartphone"'); + echo img_object('', 'company', 'class="hideonsmartphone"'); } ?> selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?> @@ -326,9 +326,9 @@ print "
      "; print "\n"; if (is_object($hookmanager)) { - $hookmanager->initHooks(array('contacttpl')); - $parameters = array(); - $reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action); + $hookmanager->initHooks(array('contacttpl')); + $parameters = array(); + $reshook = $hookmanager->executeHooks('formContactTpl', $parameters, $object, $action); } print "\n"; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 82509815f44..d316afb6966 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -251,8 +251,8 @@ $coldisplay++; - ">
      - "> + ">
      + "> diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index c84f334cc42..6bd33c5b2f9 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -30,168 +30,168 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; */ class InterfaceTicketEmail extends DolibarrTriggers { - /** - * @var DoliDB Database handler. - */ - public $db; + /** + * @var DoliDB Database handler. + */ + public $db; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; - $this->name = preg_replace('/^Interface/i', '', get_class($this)); - $this->family = "ticket"; - $this->description = "Triggers of the module ticket to send notifications to internal users and to third-parties"; - $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version - $this->picto = 'ticket'; - } + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "ticket"; + $this->description = "Triggers of the module ticket to send notifications to internal users and to third-parties"; + $this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version + $this->picto = 'ticket'; + } - /** - * Return name of trigger file - * - * @return string Name of trigger file - */ - public function getName() - { - return $this->name; - } + /** + * Return name of trigger file + * + * @return string Name of trigger file + */ + public function getName() + { + return $this->name; + } - /** - * Return description of trigger file - * - * @return string Description of trigger file - */ - public function getDesc() - { - return $this->description; - } + /** + * Return description of trigger file + * + * @return string Description of trigger file + */ + public function getDesc() + { + return $this->description; + } - /** - * Return version of trigger file - * - * @return string Version of trigger file - */ - public function getVersion() - { - global $langs; - $langs->load("admin"); + /** + * Return version of trigger file + * + * @return string Version of trigger file + */ + public function getVersion() + { + global $langs; + $langs->load("admin"); - 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"); - } - } + 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"); + } + } - /** - * Function called when a Dolibarrr business event is done. - * All functions "runTrigger" are triggered if file is inside directory htdocs/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 $user, Translate $langs, Conf $conf) - { + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/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 $user, Translate $langs, Conf $conf) + { $ok = 0; if (empty($conf->ticket->enabled)) return 0; // Module not active, we do nothing - switch ($action) { - case 'TICKET_ASSIGNED': - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + switch ($action) { + case 'TICKET_ASSIGNED': + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id) - { - $userstat = new User($this->db); - $res = $userstat->fetch($object->fk_user_assign); - if ($res > 0) - { - // Send email to notification email + if ($object->fk_user_assign > 0 && $object->fk_user_assign != $user->id) + { + $userstat = new User($this->db); + $res = $userstat->fetch($object->fk_user_assign); + if ($res > 0) + { + // Send email to notification email - if (empty($conf->global->TICKET_DISABLE_ALL_MAILS)) - { - // Init to avoid errors - $filepath = array(); - $filename = array(); - $mimetype = array(); + if (empty($conf->global->TICKET_DISABLE_ALL_MAILS)) + { + // Init to avoid errors + $filepath = array(); + $filename = array(); + $mimetype = array(); - // Send email to assigned user - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketAssignedToYou'); - $message = '

      '.$langs->transnoentities('TicketAssignedEmailBody', $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname))."

      "; - $message .= '
      • '.$langs->trans('Title').' : '.$object->subject.'
      • '; - $message .= '
      • '.$langs->trans('Type').' : '.$object->type_label.'
      • '; - $message .= '
      • '.$langs->trans('Category').' : '.$object->category_label.'
      • '; - $message .= '
      • '.$langs->trans('Severity').' : '.$object->severity_label.'
      • '; - // Extrafields - if (is_array($object->array_options) && count($object->array_options) > 0) { - foreach ($object->array_options as $key => $value) { - $message .= '
      • '.$langs->trans($key).' : '.$value.'
      • '; - } - } + // Send email to assigned user + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketAssignedToYou'); + $message = '

        '.$langs->transnoentities('TicketAssignedEmailBody', $object->track_id, dolGetFirstLastname($user->firstname, $user->lastname))."

        "; + $message .= '
        • '.$langs->trans('Title').' : '.$object->subject.'
        • '; + $message .= '
        • '.$langs->trans('Type').' : '.$object->type_label.'
        • '; + $message .= '
        • '.$langs->trans('Category').' : '.$object->category_label.'
        • '; + $message .= '
        • '.$langs->trans('Severity').' : '.$object->severity_label.'
        • '; + // Extrafields + if (is_array($object->array_options) && count($object->array_options) > 0) { + foreach ($object->array_options as $key => $value) { + $message .= '
        • '.$langs->trans($key).' : '.$value.'
        • '; + } + } - $message .= '
        '; - $message .= '

        '.$langs->trans('Message').' :
        '.$object->message.'

        '; - $message .= '

        '.$langs->trans('SeeThisTicketIntomanagementInterface').'

        '; + $message .= '
      '; + $message .= '

      '.$langs->trans('Message').' :
      '.$object->message.'

      '; + $message .= '

      '.$langs->trans('SeeThisTicketIntomanagementInterface').'

      '; - $sendto = $userstat->email; - $from = dolGetFirstLastname($user->firstname, $user->lastname).'<'.$user->email.'>'; + $sendto = $userstat->email; + $from = dolGetFirstLastname($user->firstname, $user->lastname).'<'.$user->email.'>'; - $message = dol_nl2br($message); + $message = dol_nl2br($message); - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1); - if ($mailfile->error) { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } else { - $result = $mailfile->sendfile(); - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, '', '', 0, -1); + if ($mailfile->error) { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } else { + $result = $mailfile->sendfile(); + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } + } - $ok = 1; - } - else - { - $this->error = $userstat->error; - $this->errors = $userstat->errors; - } - } - break; + $ok = 1; + } + else + { + $this->error = $userstat->error; + $this->errors = $userstat->errors; + } + } + break; - case 'TICKET_CREATE': - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + case 'TICKET_CREATE': + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - $langs->load('ticket'); + $langs->load('ticket'); - $object->fetch('', $object->track_id); // Should be useless + $object->fetch('', $object->track_id); // Should be useless - // Send email to notification email - $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) - { - if ($sendto) + // Send email to notification email + $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO) && empty($object->context['disableticketemail'])) + { + if ($sendto) { // Init to avoid errors $filepath = array(); @@ -199,146 +199,146 @@ class InterfaceTicketEmail extends DolibarrTriggers $mimetype = array(); /* Send email to admin */ - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin'); - $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; - $message_admin .= '
      • '.$langs->trans('Title').' : '.$object->subject.'
      • '; - $message_admin .= '
      • '.$langs->trans('Type').' : '.$object->type_label.'
      • '; - $message_admin .= '
      • '.$langs->trans('Category').' : '.$object->category_label.'
      • '; - $message_admin .= '
      • '.$langs->trans('Severity').' : '.$object->severity_label.'
      • '; - $message_admin .= '
      • '.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'
      • '; - // Extrafields - if (is_array($object->array_options) && count($object->array_options) > 0) { - foreach ($object->array_options as $key => $value) { - $message_admin .= '
      • '.$langs->trans($key).' : '.$value.'
      • '; - } - } - $message_admin .= '
      '; + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin'); + $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; + $message_admin .= '
      • '.$langs->trans('Title').' : '.$object->subject.'
      • '; + $message_admin .= '
      • '.$langs->trans('Type').' : '.$object->type_label.'
      • '; + $message_admin .= '
      • '.$langs->trans('Category').' : '.$object->category_label.'
      • '; + $message_admin .= '
      • '.$langs->trans('Severity').' : '.$object->severity_label.'
      • '; + $message_admin .= '
      • '.$langs->trans('From').' : '.($object->email_from ? $object->email_from : ($object->fk_user_create > 0 ? $langs->trans('Internal') : '')).'
      • '; + // Extrafields + if (is_array($object->array_options) && count($object->array_options) > 0) { + foreach ($object->array_options as $key => $value) { + $message_admin .= '
      • '.$langs->trans($key).' : '.$value.'
      • '; + } + } + $message_admin .= '
      '; - if ($object->fk_soc > 0) { - $object->fetch_thirdparty(); - $message_admin .= '

      '.$langs->trans('Company').' : '.$object->thirdparty->name.'

      '; - } + if ($object->fk_soc > 0) { + $object->fetch_thirdparty(); + $message_admin .= '

      '.$langs->trans('Company').' : '.$object->thirdparty->name.'

      '; + } - $message_admin .= '

      '.$langs->trans('Message').' :
      '.$object->message.'

      '; - $message_admin .= '

      '.$langs->trans('SeeThisTicketIntomanagementInterface').'

      '; + $message_admin .= '

      '.$langs->trans('Message').' :
      '.$object->message.'

      '; + $message_admin .= '

      '.$langs->trans('SeeThisTicketIntomanagementInterface').'

      '; - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; - $replyto = $from; + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $replyto = $from; - $message_admin = dol_nl2br($message_admin); + $message_admin = dol_nl2br($message_admin); - $trackid = 'tic'.$object->id; + $trackid = 'tic'.$object->id; - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); - if ($mailfile->error) { - dol_syslog($mailfile->error, LOG_DEBUG); - } else { - $result = $mailfile->sendfile(); - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); + if ($mailfile->error) { + dol_syslog($mailfile->error, LOG_DEBUG); + } else { + $result = $mailfile->sendfile(); + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } } - } + } // Send email to customer if (empty($conf->global->TICKET_DISABLE_CUSTOMER_MAILS) && empty($object->context['disableticketemail']) && $object->notify_tiers_at_create) - { - $sendto = ''; - if (empty($user->socid) && empty($user->email)) { - $object->fetch_thirdparty(); - $sendto = $object->thirdparty->email; - } else { - $sendto = $user->email; - } + { + $sendto = ''; + if (empty($user->socid) && empty($user->email)) { + $object->fetch_thirdparty(); + $sendto = $object->thirdparty->email; + } else { + $sendto = $user->email; + } - if ($sendto) { - // Init to avoid errors - $filepath = array(); - $filename = array(); - $mimetype = array(); + if ($sendto) { + // Init to avoid errors + $filepath = array(); + $filename = array(); + $mimetype = array(); - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectCustomer'); - $message_customer = $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id)."\n\n"; - $message_customer .= '
      • '.$langs->trans('Title').' : '.$object->subject.'
      • '; - $message_customer .= '
      • '.$langs->trans('Type').' : '.$object->type_label.'
      • '; - $message_customer .= '
      • '.$langs->trans('Category').' : '.$object->category_label.'
      • '; - $message_customer .= '
      • '.$langs->trans('Severity').' : '.$object->severity_label.'
      • '; + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectCustomer'); + $message_customer = $langs->transnoentities('TicketNewEmailBodyCustomer', $object->track_id)."\n\n"; + $message_customer .= '
        • '.$langs->trans('Title').' : '.$object->subject.'
        • '; + $message_customer .= '
        • '.$langs->trans('Type').' : '.$object->type_label.'
        • '; + $message_customer .= '
        • '.$langs->trans('Category').' : '.$object->category_label.'
        • '; + $message_customer .= '
        • '.$langs->trans('Severity').' : '.$object->severity_label.'
        • '; - // Extrafields - foreach ($this->attributes[$object->table_element]['label'] as $key => $value) - { - $enabled = 1; - if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) - { - $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1); - } - $perms = 1; - if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) - { - $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); - } + // Extrafields + foreach ($this->attributes[$object->table_element]['label'] as $key => $value) + { + $enabled = 1; + if ($enabled && isset($this->attributes[$object->table_element]['list'][$key])) + { + $enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1); + } + $perms = 1; + if ($perms && isset($this->attributes[$object->table_element]['perms'][$key])) + { + $perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1); + } - $qualified = true; - if (empty($enabled)) $qualified = false; - if (empty($perms)) $qualified = false; + $qualified = true; + if (empty($enabled)) $qualified = false; + if (empty($perms)) $qualified = false; - if ($qualified) $message_customer .= '
        • '.$langs->trans($key).' : '.$value.'
        • '; - } + if ($qualified) $message_customer .= '
        • '.$langs->trans($key).' : '.$value.'
        • '; + } - $message_customer .= '
        '; - $message_customer .= '

        '.$langs->trans('Message').' :
        '.$object->message.'

        '; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; - $message_customer .= '

        '.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.$url_public_ticket.'

        '; - $message_customer .= '

        '.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

        '; + $message_customer .= '
      '; + $message_customer .= '

      '.$langs->trans('Message').' :
      '.$object->message.'

      '; + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $message_customer .= '

      '.$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.$url_public_ticket.'

      '; + $message_customer .= '

      '.$langs->trans('TicketEmailPleaseDoNotReplyToThisEmail').'

      '; - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; - $replyto = $from; + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $replyto = $from; - $message_customer = dol_nl2br($message_customer); + $message_customer = dol_nl2br($message_customer); - $trackid = 'tic'.$object->id; + $trackid = 'tic'.$object->id; - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid); - if ($mailfile->error) { - dol_syslog($mailfile->error, LOG_DEBUG); - } else { - $result = $mailfile->sendfile(); - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - } - } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message_customer, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid); + if ($mailfile->error) { + dol_syslog($mailfile->error, LOG_DEBUG); + } else { + $result = $mailfile->sendfile(); + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } + } + } - $ok = 1; - break; + $ok = 1; + break; - case 'TICKET_DELETE': - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - break; + case 'TICKET_DELETE': + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + break; - case 'TICKET_MODIFY': - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - break; + case 'TICKET_MODIFY': + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + break; - case 'TICKET_CLOSE': - dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); - break; - } + case 'TICKET_CLOSE': + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + break; + } - return $ok; - } + return $ok; + } } diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index daebf19eb76..6f33c41c9dc 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -85,7 +85,7 @@ $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$viewstatut = GETPOST('viewstatut'); +$search_status = GETPOST('search_status'); $diroutputmassaction = $conf->expedition->dir_output.'/sending/temp/massgeneration/'.$user->id; @@ -178,8 +178,8 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_datedelivery_end = ''; $search_datereceipt_start = ''; $search_datereceipt_end = ''; - $viewstatut = ''; - $toselect = ''; + $search_status = ''; + $toselect = ''; $search_array_options = array(); $search_categ_cus = 0; } @@ -264,8 +264,8 @@ if ($socid) { $sql .= " AND e.fk_soc = ".$socid; } -if ($viewstatut <> '' && $viewstatut >= 0) { - $sql .= " AND e.fk_statut = ".$viewstatut; +if ($search_status <> '' && $search_status >= 0) { + $sql .= " AND e.fk_statut = ".$search_status; } if ($search_ref_customer != '') $sql .= natural_search('e.ref_customer', $search_ref_customer); if ($search_billed != '' && $search_billed >= 0) $sql .= ' AND e.billed = '.$search_billed; @@ -337,10 +337,11 @@ if ($resql) if ($search_datedelivery_end) $param .= '&search_datedelivery_end='.urlencode($search_datedelivery_end); if ($search_datereceipt_start) $param .= '&search_datereceipt_start='.urlencode($search_datereceipt_start); if ($search_datereceipt_end) $param .= '&search_datereceipt_end='.urlencode($search_datereceipt_end); + if ($search_product_category != '') $param .= '&search_product_category='.urlencode($search_product_category); if ($search_categ_cus > 0) $param .= '&search_categ_cus='.urlencode($search_categ_cus); - if ($viewstatut != '') $param .= '&viewstatut='.urlencode($viewstatut); - if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($search_status != '') $param .= '&viewstatut='.urlencode($search_status); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -551,7 +552,7 @@ if ($resql) if (!empty($arrayfields['e.fk_statut']['checked'])) { print ''; - print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusSendingDraftShort'), '1'=>$langs->trans('StatusSendingValidatedShort'), '2'=>$langs->trans('StatusSendingProcessedShort')), $viewstatut, 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('StatusSendingDraftShort'), '1'=>$langs->trans('StatusSendingValidatedShort'), '2'=>$langs->trans('StatusSendingProcessedShort')), $search_status, 1); print ''; } // Status billed diff --git a/htdocs/fichinter/index.php b/htdocs/fichinter/index.php index 8929da904f3..fdf5a222dee 100644 --- a/htdocs/fichinter/index.php +++ b/htdocs/fichinter/index.php @@ -165,7 +165,7 @@ if ($resql) { print ''; print ''.$fichinterstatic->LibStatut($status, $bool, 0).''; - print ''.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' '; + print ''.(isset($vals[$status.$bool]) ? $vals[$status.$bool] : 0).' '; print $fichinterstatic->LibStatut($status, $bool, 3); print ''; print ''; @@ -326,7 +326,7 @@ if (!empty($conf->ficheinter->enabled)) print '
      '; print ''; print ''; - print ''; + print ''; if ($num) { diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 78935ca2fb1..c00ee77df53 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -1057,7 +1057,8 @@ class ProductFournisseur extends Product $label = ''.$langs->trans("SupplierRef").''; $label .= '
      '; - $label .= ''.$langs->trans('Ref').': '.$this->ref_supplier; + $label .= ''.$langs->trans('Product').': '.$this->ref; + $label .= '
      '.$langs->trans('RefSupplier').': '.$this->ref_supplier; $logPrices = $this->listProductFournisseurPriceLog($this->product_fourn_price_id, 'pfpl.datec', 'DESC'); // set sort order here if (is_array($logPrices) && count($logPrices) > 0) { @@ -1095,7 +1096,7 @@ class ProductFournisseur extends Product $result .= $linkstart; if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= $this->fourn_ref; + if ($withpicto != 2) $result .= $this->ref.($this->ref_supplier ? ' ('.$this->ref_supplier.')' : ''); $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index 79ab8984f2f..c12d74e7045 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -371,7 +371,7 @@ $num = $db->num_rows($resql); print '
      '; print '
      '.$langs->trans("FichinterToProcess").' '.$num.'
      '.$langs->trans("FichinterToProcess").' '.$num.'
      '; print ''; -print ''; +print ''; if ($num) { diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 7cfdd99ce78..f1f64b996a5 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -92,7 +92,7 @@ $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); $status = GETPOST('statut', 'alpha'); -$viewstatut = GETPOST('viewstatut'); +$search_status = GETPOST('search_status'); // Security check $orderid = GETPOST('orderid', 'int'); @@ -639,12 +639,12 @@ if ($resql) if ($search_multicurrency_montant_ht != '') $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht); if ($search_multicurrency_montant_vat != '') $param .= '&search_multicurrency_montant_vat='.urlencode($search_multicurrency_montant_vat); if ($search_multicurrency_montant_ttc != '') $param .= '&search_multicurrency_montant_ttc='.urlencode($search_multicurrency_montant_ttc); - if ($search_refsupp) $param .= "&search_refsupp=".$search_refsupp; - if ($search_status >= 0) $param .= "&search_status=".$search_status; - if ($search_project_ref >= 0) $param .= "&search_project_ref=".$search_project_ref; - if ($search_billed != '') $param .= "&search_billed=".$search_billed; - if ($show_files) $param .= '&show_files='.$show_files; - if ($optioncss != '') $param .= '&optioncss='.$optioncss; + if ($search_refsupp) $param .= "&search_refsupp=".urlencode($search_refsupp); + if ($search_status >= 0) $param .= "&search_status=".urlencode($search_status); + if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref); + if ($search_billed != '') $param .= "&search_billed=".urlencode($search_billed); + if ($show_files) $param .= '&show_files='.urlencode($show_files); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; @@ -674,7 +674,6 @@ if ($resql) print ''; print ''; print ''; - print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/fourn/commande/orderstoinvoice.php b/htdocs/fourn/commande/orderstoinvoice.php index 0d011395b3e..909dec03796 100644 --- a/htdocs/fourn/commande/orderstoinvoice.php +++ b/htdocs/fourn/commande/orderstoinvoice.php @@ -58,7 +58,7 @@ $socid = GETPOST('socid', 'int'); $selected = GETPOST('orders_to_invoice'); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); -$viewstatut = GETPOST('viewstatut'); +$search_status = GETPOST('search_status'); if (!$sortfield) $sortfield = 'c.rowid'; diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 6197f6ba363..1c636cf116d 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -523,7 +523,6 @@ if ($resql) print ''; print ''; print ''; - print ''; print ''; print_barre_liste($langs->trans("BillsSuppliers").($socid ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'invoicing', 0, $newcardbutton, '', $limit, 0, 0, 1); diff --git a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php index 96ab2f4cbb6..7e12c501403 100644 --- a/htdocs/includes/tecnickcom/tcpdf/tcpdf.php +++ b/htdocs/includes/tecnickcom/tcpdf/tcpdf.php @@ -18888,8 +18888,21 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $imgsrc = '@'.base64_decode(substr($imgsrc, 1)); $type = ''; } else { - if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { - // fix image path + // @CHANGE LDR Add support for src="file://..." links + if (strpos($imgsrc, 'file://') === 0) { + $imgsrc = str_replace('file://', '/', $imgsrc); + $imgsrc = urldecode($imgsrc); + $testscrtype = @parse_url($imgsrc); + if (empty($testscrtype['query'])) { + // convert URL to server path + $imgsrc = str_replace(K_PATH_URL, K_PATH_MAIN, $imgsrc); + } elseif (preg_match('|^https?://|', $imgsrc) !== 1) { + // convert URL to server path + $imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc); + } + } + elseif (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + // fix image path $findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); if (($findroot === false) OR ($findroot > 1)) { if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') { @@ -18908,6 +18921,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc); } } + // get image type $type = TCPDF_IMAGES::getImageFileType($imgsrc); } diff --git a/htdocs/install/mysql/data/llx_accounting_account_ca.sql b/htdocs/install/mysql/data/llx_accounting_account_ca.sql new file mode 100644 index 00000000000..45d856414c5 --- /dev/null +++ b/htdocs/install/mysql/data/llx_accounting_account_ca.sql @@ -0,0 +1,188 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2009 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2011-2017 Alexandre Spangaro +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Note: INCOME = REVENUE +-- Note: EXPENSE = EXPENSES +-- Note: CAPITAL = EQUITY + +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l''install et tous les sigles '--' sont supprimés. + +-- Descriptif des plans comptables Canada CA-ENG-BASE +-- ID 1000 - 9999 +-- ADD 1400000 to rowid # Do no remove this comment -- + +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1000,'CA-ENG-BASE','ASSETS', 'XXXXXX', '1', '0', 'Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 2000,'CA-ENG-BASE','LIABILITIES', 'XXXXXX', '2', '0', 'Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 3000,'CA-ENG-BASE','CAPITAL', 'XXXXXX', '3', '0', 'Equity', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 4000,'CA-ENG-BASE','INCOME', 'XXXXXX', '4', '0', 'Revenue', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 5000,'CA-ENG-BASE','COGS', 'XXXXXX', '5', '0', 'Cost of Goods Sold', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 6000,'CA-ENG-BASE','EXPENSE', 'XXXXXX', '6', '0', 'Expenses', 1); + +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1010, 'CA-ENG-BASE', 'ASSETS', 'CASH', '1010', '1000', 'Cash', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1011, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1030', '1000', 'Investments and Securities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1012, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1100', '1000', 'Accounts Receivable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1013, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1120', '1000', 'Other Receivables', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1014, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1140', '1000', 'Allowance for Doubtful Accounts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1015, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1160', '1000', 'Customers Account Receivable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1016, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1200', '1000', 'Raw Materials Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1017, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1220', '1000', 'Supplies Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1018, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1240', '1000', 'Work in Progress Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1019, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1260', '1000', 'Finished Goods Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1020, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1300', '1000', 'Prepaid Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1021, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1350', '1000', 'Employee Advances', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1022, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1400', '1000', 'Notes Receivable - Current', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1023, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1430', '1000', 'Prepaid Interest', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1024, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1450', '1000', 'Other Current Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1025, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1500', '1000', 'Furniture and Fixtures', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1026, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1520', '1000', 'Equipment', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1027, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1540', '1000', 'Vehicles', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1028, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1560', '1000', 'Other Depreciable Property', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1029, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1580', '1000', 'Buildings', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1030, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1600', '1000', 'Building Improvements', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1031, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1620', '1000', 'Land', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1032, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1640', '1000', 'Accumulated Depreciation, Furniture and Fixtures', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1033, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1660', '1000', 'Accumulated Depreciation, Equipment', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1034, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1680', '1000', 'Accumulated Depreciation, Vehicles', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1035, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1700', '1000', 'Accumulated Depreciation, Buildings', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1036, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1720', '1000', 'Accumulated Depreciation, Building Improvements', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1037, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1740', '1000', 'Accumulated Depreciation, Other', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1038, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1760', '1000', 'Goods and Services Tax (GST) Receivable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1039, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1800', '1000', 'Harmonized Sales Tax (HST) Receivable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1040, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1820', '1000', 'Provincial Sales Tax (PST) Receivable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1041, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1840', '1000', 'Québec Sales Tax (QST) Receivable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1042, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1860', '1000', 'Deposits', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1043, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1880', '1000', 'Accumulated Amortization', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1044, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1900', '1000', 'Notes Receivable - Non-current', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1045, 'CA-ENG-BASE', 'ASSETS', 'XXXXXX', '1940', '1000', 'Other Non-current Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1046, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2100', '2000', 'Accounts Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1047, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2200', '2000', 'Accrued Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1048, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2300', '2000', 'Current Financial Debts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1049, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2320', '2000', 'Employment Insurance Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1050, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2321', '2000', 'Employment insurance (EI) Employees Contribution', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1051, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2322', '2000', 'Employment insurance (EI) Employer Contribution', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1052, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2340', '2000', 'Federal Income Tax', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1053, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2350', '2000', 'Annuities Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1054, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2351', '2000', 'Annuities - Employee Contribution', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1055, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2352', '2000', 'Annuities - Employer Contribution', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1056, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2360', '2000', 'Health Services Fund Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1057, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2370', '2000', 'Labour Health and Safety Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1058, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2380', '2000', 'Labour Standards to Pay', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1059, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2390', '2000', 'Parental Insurance Plan Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1060, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2391', '2000', 'Parental Insurance Plan Payable - Employee Contribution', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1061, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2392', '2000', 'Parental Insurance Plan Payable - Employer Contribution', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1062, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2400', '2000', 'Provincial Income Tax', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1063, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2410', '2000', 'Other Accounts Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1064, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2420', '2000', 'Goods and Services Tax (GST) Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2430', '2000', 'Harmonized Sales Tax (HST) Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2440', '2000', 'Provincial Sales Tax (PST) Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2450', '2000', 'Québec Sales Tax (QST) Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1068, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2460', '2000', 'Other Taxes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2470', '2000', 'Employee Benefits Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1070, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2480', '2000', 'Deposits from Customers', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1071, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2490', '2000', 'Other Current Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1072, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2500', '2000', 'Notes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1073, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2600', '2000', 'Land Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1074, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2630', '2000', 'Equipment Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1075, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2660', '2000', 'Vehicles Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1076, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2700', '2000', 'Bank Loans Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1077, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2730', '2000', 'Non-current Financial Debts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1078, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2760', '2000', 'Other Non-current Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1079, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2800', '2000', 'Deferred Revenue', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1080, 'CA-ENG-BASE', 'LIABILITIES', 'XXXXXX', '2900', '2000', 'Deferred Fees', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1081, 'CA-ENG-BASE', 'CAPITAL', 'XXXXXX', '3100', '3000', 'Common Shares', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1082, 'CA-ENG-BASE', 'CAPITAL', 'XXXXXX', '3200', '3000', 'Preferred Shares (Voting)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1083, 'CA-ENG-BASE', 'CAPITAL', 'XXXXXX', '3300', '3000', 'Preferred Shares (Non-voting)', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1084, 'CA-ENG-BASE', 'CAPITAL', 'XXXXXX', '3400', '3000', 'Contributed Surplus', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1085, 'CA-ENG-BASE', 'CAPITAL', 'XXXXXX', '3500', '3000', 'Retained Earnings', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1086, 'CA-ENG-BASE', 'CAPITAL', 'XXXXXX', '3600', '3000', 'Dividends', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1087, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4100', '4000', 'Harmonized Provinces Sales', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1088, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4200', '4000', 'Non-Harmonized Provinces Sales', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1089, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4300', '4000', 'Inside Sales', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1090, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4400', '4000', 'International Sales', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1091, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4500', '4000', 'Reimbursible Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1092, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4600', '4000', 'Shipping Charges Reimbursed', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1093, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4700', '4000', 'Other Operating Revenues', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1094, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4800', '4000', 'Interests', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1095, 'CA-ENG-BASE', 'INCOME', 'XXXXXX', '4900', '4000', 'Other Non-operating Revenues', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1096, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5010', '5000', 'Inside Purchases', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1097, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5050', '5000', 'International Purchases', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1098, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5100', '5000', 'Purchases in Harmonized Provinces', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1099, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5150', '5000', 'Purchases in Non-harmonized Provinces', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1100, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5200', '5000', 'Direct Labor Costs', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1101, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5250', '5000', 'Indirect Labor Costs', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1102, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5270', '5000', 'Heat and Power', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1103, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5300', '5000', 'Commissions', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1104, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5350', '5000', 'Miscellaneous Factory Costs', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1105, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5400', '5000', 'Cost of Goods Sold, Salaries and Wages', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1106, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5450', '5000', 'Cost of Goods Sold, Contract Labor', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1107, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5500', '5000', 'Cost of Goods Sold, Freight', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1108, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5550', '5000', 'Cost of Goods Sold, Other', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1109, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5600', '5000', 'Inventory Adjustments', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1110, 'CA-ENG-BASE', 'COGS', 'XXXXXX', '5700', '5000', 'Purchase Returns and Allowances', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1111, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6010', '6000', 'Federal Income Tax', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1112, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6020', '6000', 'Health Services Fund', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1113, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6030', '6000', 'Holidays', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1114, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6040', '6000', 'Labour Health and Safety', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1115, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6050', '6000', 'Labour Standards', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1116, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6060', '6000', 'Parental Insurance', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1117, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6080', '6000', 'Provincial Income Tax', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1118, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6100', '6000', 'Salaries, wages', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1119, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6130', '6000', 'Employee Benefit Expense, Pension Plans', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1120, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6160', '6000', 'Employee Benefit Expense, Profit Sharing Plan', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1121, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6180', '6000', 'Employee Benefit Expense, Other', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1122, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6200', '6000', 'Commissions and Fees Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1123, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6230', '6000', 'Annuities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1124, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6250', '6000', 'Employment Insurance', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1125, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6280', '6000', 'Insurance Expense, Product Liability', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1126, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6300', '6000', 'Insurance Expense, Vehicle', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1127, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6340', '6000', 'Payroll Tax Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1128, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6360', '6000', 'Penalties and Fines Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1129, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6380', '6000', 'Other Taxes', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1130, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6400', '6000', 'Advertising Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1131, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6420', '6000', 'Amortization Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1132, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6460', '6000', 'Auto Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1133, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6480', '6000', 'Legal and Professional Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1134, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6500', '6000', 'Licenses Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1135, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6520', '6000', 'Maintenance Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1136, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6540', '6000', 'Repair and Maintenance Expense, Office', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1137, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6560', '6000', 'Repair and Maintenance Expense, Vehicle', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1138, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6580', '6000', 'Office Supplies Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1139, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6600', '6000', 'Telephone Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1140, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6610', '6000', 'Training Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1141, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6630', '6000', 'Travel Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1142, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6650', '6000', 'Utilities Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1143, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6670', '6000', 'Postage Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1144, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6690', '6000', 'Freight Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1145, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6700', '6000', 'Rent or Lease Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1146, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6720', '6000', 'Meals and Entertainment Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1147, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6730', '6000', 'Gain/Loss on Sale of Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1148, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6740', '6000', 'Depreciation Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1149, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6750', '6000', 'Bad Debt Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1150, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6760', '6000', 'Bank Fees', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1151, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6790', '6000', 'Loss on Non-sufficient Funds Checks', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1152, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6800', '6000', 'Gifts Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1153, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6820', '6000', 'Charitable Contributions Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1154, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6840', '6000', 'Other Operating Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1155, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6860', '6000', 'Interests Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1156, 'CA-ENG-BASE', 'EXPENSE', 'XXXXXX', '6900', '6000', 'Other Non-operating Expense', 1); \ No newline at end of file diff --git a/htdocs/install/mysql/data/llx_accounting_account_fr.sql b/htdocs/install/mysql/data/llx_accounting_account_fr.sql index 1abc9a2edf7..34e8882609d 100644 --- a/htdocs/install/mysql/data/llx_accounting_account_fr.sql +++ b/htdocs/install/mysql/data/llx_accounting_account_fr.sql @@ -24,7 +24,7 @@ -- -- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors -- de l''install et tous les sigles '--' sont supprimés. --- Not: To replace a string thas is '__, 0' inot a increasing num, you can use vi with comment +-- Note: To replace a string thas is '__, 0' into an increasing number, you can use vi with comment -- :let @a=1 | %s/__, 0/\='__, '.(@a+setreg('a',@a+1))/g -- diff --git a/htdocs/install/mysql/data/llx_accounting_account_us.sql b/htdocs/install/mysql/data/llx_accounting_account_us.sql new file mode 100644 index 00000000000..a051453b42c --- /dev/null +++ b/htdocs/install/mysql/data/llx_accounting_account_us.sql @@ -0,0 +1,173 @@ +-- Copyright (C) 2001-2004 Rodolphe Quiedeville +-- Copyright (C) 2003 Jean-Louis Bergamo +-- Copyright (C) 2004-2009 Laurent Destailleur +-- Copyright (C) 2004 Benoit Mortier +-- Copyright (C) 2004 Guillaume Delecourt +-- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2007 Patrick Raguin +-- Copyright (C) 2011-2017 Alexandre Spangaro +-- +-- 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 +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . +-- +-- Note: INCOME = REVENUE +-- Note: EXPENSE = EXPENSES +-- Note: CAPITAL = EQUITY +-- +-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors +-- de l''install et tous les sigles '--' sont supprimés. +-- Note: To replace a string thas is '__, 0' into an increasing number, you can use vi with comment +-- :let @a=1 | %s/__, 0/\='__, '.(@a+setreg('a',@a+1))/g + +-- Descriptif des plans comptables USA US-BASE +-- ID 1000 - 9999 +-- ADD 1100000 to rowid # Do no remove this comment -- + +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1000,'US-BASE','ASSETS', 'XXXXXX', '1', '0', 'Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 2000,'US-BASE','LIABILITIES', 'XXXXXX', '2', '0', 'Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 3000,'US-BASE','EQUITY', 'XXXXXX', '3', '0', 'Equity', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 4000,'US-BASE','INCOME', 'XXXXXX', '4', '0', 'Revenue', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 5000,'US-BASE','COGS', 'XXXXXX', '5', '0', 'Cost of Goods Sold', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 6000,'US-BASE','EXPENSE', 'XXXXXX', '6', '0', 'Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 7000,'US-BASE','OTHER_REVENUE', 'XXXXXX', '7', '0', 'Other Revenue', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 8000,'US-BASE','OTHER_EXPENSES', 'XXXXXX', '8', '0', 'Other Expenses', 1); + +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1010, 'US-BASE', 'ASSETS', 'CASH', '1010', '1000', 'Cash on Hand', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1011, 'US-BASE', 'ASSETS', 'CASH', '1020', '1000', 'Checking Account', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1012, 'US-BASE', 'ASSETS', 'CASH', '1030', '1000', 'Savings Account', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1013, 'US-BASE', 'ASSETS', 'XXXXXX', '1040', '1000', 'Investments and Securities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1014, 'US-BASE', 'ASSETS', 'XXXXXX', '1100', '1000', 'Accounts Receivable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1015, 'US-BASE', 'ASSETS', 'XXXXXX', '1140', '1000', 'Other Receivables', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1016, 'US-BASE', 'ASSETS', 'XXXXXX', '1150', '1000', 'Allowance for Doubtful Accounts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1017, 'US-BASE', 'ASSETS', 'XXXXXX', '1200', '1000', 'Raw Materials Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1018, 'US-BASE', 'ASSETS', 'XXXXXX', '1205', '1000', 'Supplies Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1019, 'US-BASE', 'ASSETS', 'XXXXXX', '1210', '1000', 'Work in Progress Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1020, 'US-BASE', 'ASSETS', 'XXXXXX', '1215', '1000', 'Finished Goods Inventory', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1021, 'US-BASE', 'ASSETS', 'XXXXXX', '1400', '1000', 'Prepaid Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1022, 'US-BASE', 'ASSETS', 'XXXXXX', '1410', '1000', 'Employee Advances', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1023, 'US-BASE', 'ASSETS', 'XXXXXX', '1420', '1000', 'Notes Receivable - Current', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1024, 'US-BASE', 'ASSETS', 'XXXXXX', '1430', '1000', 'Prepaid Interest', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1025, 'US-BASE', 'ASSETS', 'XXXXXX', '1470', '1000', 'Other Current Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1026, 'US-BASE', 'ASSETS', 'XXXXXX', '1500', '1000', 'Furniture and Fixtures', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1027, 'US-BASE', 'ASSETS', 'XXXXXX', '1510', '1000', 'Equipment', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1028, 'US-BASE', 'ASSETS', 'XXXXXX', '1520', '1000', 'Vehicles', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1029, 'US-BASE', 'ASSETS', 'XXXXXX', '1530', '1000', 'Other Depreciable Property', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1030, 'US-BASE', 'ASSETS', 'XXXXXX', '1550', '1000', 'Buildings', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1031, 'US-BASE', 'ASSETS', 'XXXXXX', '1560', '1000', 'Building Improvements', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1032, 'US-BASE', 'ASSETS', 'XXXXXX', '1690', '1000', 'Land', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1033, 'US-BASE', 'ASSETS', 'XXXXXX', '1700', '1000', 'Accumulated Depreciation, Furniture and Fixtures', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1034, 'US-BASE', 'ASSETS', 'XXXXXX', '1710', '1000', 'Accumulated Depreciation, Equipment', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1035, 'US-BASE', 'ASSETS', 'XXXXXX', '1720', '1000', 'Accumulated Depreciation, Vehicles', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1036, 'US-BASE', 'ASSETS', 'XXXXXX', '1730', '1000', 'Accumulated Depreciation, Buildings', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1037, 'US-BASE', 'ASSETS', 'XXXXXX', '1740', '1000', 'Accumulated Depreciation, Building Improvements', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1038, 'US-BASE', 'ASSETS', 'XXXXXX', '1750', '1000', 'Accumulated Depreciation, Other', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1039, 'US-BASE', 'ASSETS', 'XXXXXX', '1900', '1000', 'Deposits', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1040, 'US-BASE', 'ASSETS', 'XXXXXX', '1910', '1000', 'Accumulated Amortization', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1041, 'US-BASE', 'ASSETS', 'XXXXXX', '1920', '1000', 'Notes Receivable - Non-current', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1042, 'US-BASE', 'ASSETS', 'XXXXXX', '1990', '1000', 'Other Non-current Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1043, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2100', '2000', 'Accounts Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1044, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2300', '2000', 'Accrued Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1045, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2310', '2000', 'Sales Tax Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1046, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2320', '2000', 'Wages Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1047, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2330', '2000', '401-K Deductions Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1048, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2335', '2000', 'Health Insurance Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1049, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2340', '2000', 'Federal Payroll Taxes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1050, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2350', '2000', 'Federal Unemployment Tax Act - Tax Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1051, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2360', '2000', 'State Payroll Taxes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1052, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2370', '2000', 'State Unemployment Tax Act - Tax Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1053, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2380', '2000', 'Local Payroll Taxes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1054, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2390', '2000', 'Income Taxes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1055, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2400', '2000', 'Other Taxes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1056, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2410', '2000', 'Employee Benefits Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1057, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2420', '2000', 'Current Portion of Long-term Debt', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1058, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2440', '2000', 'Deposits from Customers', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1059, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2480', '2000', 'Other Current Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1060, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2700', '2000', 'Notes Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1061, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2702', '2000', 'Land Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1062, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2704', '2000', 'Equipment Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1063, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2706', '2000', 'Vehicles Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1064, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2708', '2000', 'Bank Loans Payable', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1065, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2710', '2000', 'Deferred Revenue', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1066, 'US-BASE', 'LIABILITIES', 'XXXXXX', '2740', '2000', 'Other Long-term Liabilities', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1067, 'US-BASE', 'CAPITAL', 'XXXXXX', '3010', '3000', 'Stated Capital', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1068, 'US-BASE', 'CAPITAL', 'XXXXXX', '3020', '3000', 'Capital Surplus', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1069, 'US-BASE', 'CAPITAL', 'XXXXXX', '3030', '3000', 'Retained Earnings', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1070, 'US-BASE', 'INCOME', 'XXXXXX', '4010', '4000', 'Product Sales', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1071, 'US-BASE', 'INCOME', 'XXXXXX', '4060', '4000', 'Reimbursible Expenses', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1072, 'US-BASE', 'INCOME', 'XXXXXX', '4061', '4000', 'Reimbursible Expenses - Meals and Entertainment ', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1073, 'US-BASE', 'INCOME', 'XXXXXX', '4540', '4000', 'Finance Charge Income', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1074, 'US-BASE', 'INCOME', 'XXXXXX', '4550', '4000', 'Shipping Charges Reimbursed', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1075, 'US-BASE', 'INCOME', 'XXXXXX', '4800', '4000', 'Sales Returns and Allowances', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1076, 'US-BASE', 'INCOME', 'XXXXXX', '4900', '4000', 'Sales Discounts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1077, 'US-BASE', 'COGS', 'XXXXXX', '5010', '5000', 'Product Cost', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1078, 'US-BASE', 'COGS', 'XXXXXX', '5050', '5000', 'Raw Material Purchases', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1079, 'US-BASE', 'COGS', 'XXXXXX', '5100', '5000', 'Direct Labor Costs', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1080, 'US-BASE', 'COGS', 'XXXXXX', '5150', '5000', 'Indirect Labor Costs', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1081, 'US-BASE', 'COGS', 'XXXXXX', '5200', '5000', 'Heat and Power', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1082, 'US-BASE', 'COGS', 'XXXXXX', '5250', '5000', 'Commissions', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1083, 'US-BASE', 'COGS', 'XXXXXX', '5300', '5000', 'Miscellaneous Factory Costs', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1084, 'US-BASE', 'COGS', 'XXXXXX', '5700', '5000', 'Cost of Goods Sold, Salaries and Wages', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1085, 'US-BASE', 'COGS', 'XXXXXX', '5730', '5000', 'Cost of Goods Sold, Contract Labor', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1086, 'US-BASE', 'COGS', 'XXXXXX', '5750', '5000', 'Cost of Goods Sold, Freight', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1087, 'US-BASE', 'COGS', 'XXXXXX', '5800', '5000', 'Cost of Goods Sold, Other', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1088, 'US-BASE', 'COGS', 'XXXXXX', '5850', '5000', 'Inventory Adjustments', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1089, 'US-BASE', 'COGS', 'XXXXXX', '5900', '5000', 'Purchase Returns and Allowances', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1090, 'US-BASE', 'COGS', 'XXXXXX', '5950', '5000', 'Purchase Discounts', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1091, 'US-BASE', 'EXPENSE', 'XXXXXX', '6010', '6000', 'Default Purchase Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1092, 'US-BASE', 'EXPENSE', 'XXXXXX', '6020', '6000', 'Advertising Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1093, 'US-BASE', 'EXPENSE', 'XXXXXX', '6050', '6000', 'Amortization Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1094, 'US-BASE', 'EXPENSE', 'XXXXXX', '6100', '6000', 'Auto EXPENSE', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1095, 'US-BASE', 'EXPENSE', 'XXXXXX', '6150', '6000', 'Bad Debt Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1096, 'US-BASE', 'EXPENSE', 'XXXXXX', '6200', '6000', 'Bank Fees', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1097, 'US-BASE', 'EXPENSE', 'XXXXXX', '6250', '6000', 'Cash Over and Short', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1098, 'US-BASE', 'EXPENSE', 'XXXXXX', '6300', '6000', 'Charitable Contributions Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1099, 'US-BASE', 'EXPENSE', 'XXXXXX', '6350', '6000', 'Commissions and Fees Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1100, 'US-BASE', 'EXPENSE', 'XXXXXX', '6450', '6000', 'Dues and Subscriptions Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1101, 'US-BASE', 'EXPENSE', 'XXXXXX', '6500', '6000', 'Employee Benefit Expense, Health Insurance', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1102, 'US-BASE', 'EXPENSE', 'XXXXXX', '6510', '6000', 'Employee Benefit Expense, Pension Plans', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1103, 'US-BASE', 'EXPENSE', 'XXXXXX', '6520', '6000', 'Employee Benefit Expense, Profit Sharing Plan', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1104, 'US-BASE', 'EXPENSE', 'XXXXXX', '6530', '6000', 'Employee Benefit Expense, Other', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1105, 'US-BASE', 'EXPENSE', 'XXXXXX', '6550', '6000', 'Freight Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1106, 'US-BASE', 'EXPENSE', 'XXXXXX', '6600', '6000', 'Gifts Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1107, 'US-BASE', 'EXPENSE', 'XXXXXX', '6650', '6000', 'Income Tax Expense, Federal', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1108, 'US-BASE', 'EXPENSE', 'XXXXXX', '6660', '6000', 'Income Tax Expense, State', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1109, 'US-BASE', 'EXPENSE', 'XXXXXX', '6670', '6000', 'Income Tax Expense, Local', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1110, 'US-BASE', 'EXPENSE', 'XXXXXX', '6700', '6000', 'Insurance Expense, Product Liability', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1111, 'US-BASE', 'EXPENSE', 'XXXXXX', '6710', '6000', 'Insurance Expense, Vehicle', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1112, 'US-BASE', 'EXPENSE', 'XXXXXX', '6800', '6000', 'Laundry and Dry Cleaning Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1113, 'US-BASE', 'EXPENSE', 'XXXXXX', '6850', '6000', 'Legal and Professional Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1114, 'US-BASE', 'EXPENSE', 'XXXXXX', '6900', '6000', 'Licenses Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1115, 'US-BASE', 'EXPENSE', 'XXXXXX', '6950', '6000', 'Loss on Non-sufficient Funds Checks', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1116, 'US-BASE', 'OTHER_REVENUE', 'XXXXXX', '7010', '7000', 'Interest Income', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1117, 'US-BASE', 'OTHER_REVENUE', 'XXXXXX', '7030', '7000', 'Other Income', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1118, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8010', '8000', 'Depreciation Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1119, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8020', '8000', 'Interest Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1120, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8030', '8000', 'Maintenance Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1121, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8050', '8000', 'Meals and Entertainment Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1122, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8100', '8000', 'Office Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1123, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8200', '8000', 'Payroll Tax Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1124, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8250', '8000', 'Penalties and Fines Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1125, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8300', '8000', 'Other Taxes', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1126, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8350', '8000', 'Postage Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1127, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8400', '8000', 'Rent or Lease Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1128, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8450', '8000', 'Repair and Maintenance Expense, Office', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1129, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8460', '8000', 'Repair and Maintenance Expense, Vehicle', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1130, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8550', '8000', 'Supplies Expense, Office', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1131, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8600', '8000', 'Telephone Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1132, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8620', '8000', 'Training Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1133, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8650', '8000', 'Travel Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1134, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8700', '8000', 'Salaries Expense, Officers', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1135, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8750', '8000', 'Wages Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1136, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8800', '8000', 'Utilities Expense', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1137, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8900', '8000', 'Gain/Loss on Sale of Assets', 1); +INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, pcg_subtype, account_number, account_parent, label, active) VALUES (__ENTITY__, 1138, 'US-BASE', 'OTHER_EXPENSES', 'XXXXXX', '8950', '8000', 'Other Expense', 1); \ No newline at end of file diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index bc239743e7a..58e5cecf39d 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -212,6 +212,7 @@ CompatibleUpTo=Compatible with version %s NotCompatible=This module does not seem compatible with your Dolibarr %s (Min %s - Max %s). CompatibleAfterUpdate=This module requires an update to your Dolibarr %s (Min %s - Max %s). SeeInMarkerPlace=See in Market place +SeeSetupOfModule=See setup of module %s Updated=Updated Nouveauté=Novelty AchatTelechargement=Buy / Download @@ -1304,7 +1305,7 @@ BillsPDFModules=Invoice documents models BillsPDFModulesAccordindToInvoiceType=Invoice documents models according to invoice type PaymentsPDFModules=Payment documents models ForceInvoiceDate=Force invoice date to validation date -SuggestedPaymentModesIfNotDefinedInInvoice=Suggested payments mode on invoice by default if not defined for invoice +SuggestedPaymentModesIfNotDefinedInInvoice=Suggested payments mode on invoice by default if not defined on the invoice SuggestPaymentByRIBOnAccount=Suggest payment by withdrawal on account SuggestPaymentByChequeToAddress=Suggest payment by check to FreeLegalTextOnInvoices=Free text on invoices @@ -1316,7 +1317,7 @@ SupplierPaymentSetup=Vendor payments setup PropalSetup=Commercial proposals module setup ProposalsNumberingModules=Commercial proposal numbering models ProposalsPDFModules=Commercial proposal documents models -SuggestedPaymentModesIfNotDefinedInProposal=Suggested payments mode on proposal by default if not defined for proposal +SuggestedPaymentModesIfNotDefinedInProposal=Suggested payments mode on proposal by default if not defined on the proposal FreeLegalTextOnProposal=Free text on commercial proposals WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty) BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal @@ -1331,6 +1332,7 @@ WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER=Ask for Warehouse Source for order ##### Suppliers Orders ##### BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER=Ask for bank account destination of purchase order ##### Orders ##### +SuggestedPaymentModesIfNotDefinedInOrder=Suggested payments mode on sale order by default if not defined on the order OrdersSetup=Sales Orders management setup OrdersNumberingModules=Orders numbering models OrdersModelModule=Order documents models diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index d363d7f03b5..f2bc989b953 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -90,7 +90,7 @@ HeadBar=Head Bar SortProductField=Field for sorting products Browser=Browser BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters to configure the receipt. Print via browser. -TakeposConnectorMethodDescription=External module with extra features. Posibility to print from de cloud. +TakeposConnectorMethodDescription=External module with extra features. Posibility to print from the cloud. PrintMethod=Print method ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. ByTerminal=By terminal diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 609ea0efdf2..f8b3d0354e2 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -446,6 +446,7 @@ SaleRepresentativeFirstname=First name of sales representative SaleRepresentativeLastname=Last name of sales representative ErrorThirdpartiesMerge=There was an error when deleting the third parties. Please check the log. Changes have been reverted. NewCustomerSupplierCodeProposed=Customer or Vendor code already used, a new code is suggested +KeepEmptyIfGenericAddress=Keep this field empty if this address is a generic address #Imports PaymentTypeCustomer=Payment Type - Customer PaymentTermsCustomer=Payment Terms - Customer diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 0ea2940911b..739ecb88591 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -235,7 +235,7 @@ ErrorLanguageOfTranslatedPageIsSameThanThisPage=Error, language of translated pa ErrorBatchNoFoundForProductInWarehouse=No lot/serial found for product "%s" in warehouse "%s". ErrorBatchNoFoundEnoughQuantityForProductInWarehouse=No enough quantity for this lot/serial for product "%s" in warehouse "%s". ErrorOnlyOneFieldForGroupByIsPossible=Only 1 field for the 'Group by' is possible (others are discarded) -ErrorTooManyDifferentValueForSelectedGroupBy=Found too many different value (more than %s) for the field '%s', so we can't user it as a 'Group by' for graphics. The field 'Group By' has been removed. May be you wanted to use it as an X-Axis ? +ErrorTooManyDifferentValueForSelectedGroupBy=Found too many different value (more than %s) for the field '%s', so we can't use it as a 'Group by' for graphics. The field 'Group By' has been removed. May be you wanted to use it as an X-Axis ? ErrorReplaceStringEmpty=Error, the string to replace into is empty # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. diff --git a/htdocs/langs/en_US/link.lang b/htdocs/langs/en_US/link.lang index fdcf07aeff4..1ffcd41a18b 100644 --- a/htdocs/langs/en_US/link.lang +++ b/htdocs/langs/en_US/link.lang @@ -8,3 +8,4 @@ LinkRemoved=The link %s has been removed ErrorFailedToDeleteLink= Failed to remove link '%s' ErrorFailedToUpdateLink= Failed to update link '%s' URLToLink=URL to link +OverwriteIfExists=Overwrite file if exists diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index f31118ab8d7..a31243a07b6 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -23,7 +23,7 @@ MassBarcodeInit=Mass barcode init MassBarcodeInitDesc=This page can be used to initialize a barcode on objects that does not have barcode defined. Check before that setup of module barcode is complete. ProductAccountancyBuyCode=Accounting code (purchase) ProductAccountancyBuyIntraCode=Accounting code (purchase intra-community) -ProductAccountancyBuyExportCode=Accounting code (purchase export) +ProductAccountancyBuyExportCode=Accounting code (purchase import) ProductAccountancySellCode=Accounting code (sale) ProductAccountancySellIntraCode=Accounting code (sale intra-Community) ProductAccountancySellExportCode=Accounting code (sale export) diff --git a/htdocs/langs/en_US/stripe.lang b/htdocs/langs/en_US/stripe.lang index 7ad58edecac..0eac6842199 100644 --- a/htdocs/langs/en_US/stripe.lang +++ b/htdocs/langs/en_US/stripe.lang @@ -69,4 +69,4 @@ ToOfferALinkForTestWebhook=Link to setup Stripe WebHook to call the IPN (test mo ToOfferALinkForLiveWebhook=Link to setup Stripe WebHook to call the IPN (live mode) PaymentWillBeRecordedForNextPeriod=Payment will be recorded for the next period. ClickHereToTryAgain=Click here to try again... -CreationOfPaymentModeMustBeDoneFromStripeInterface=Due to Strong Customer Authenticatin rules, creation of a card must be done from Stripe backoffice. You can click here to switch on Stripe customer record: %s \ No newline at end of file +CreationOfPaymentModeMustBeDoneFromStripeInterface=Due to Strong Customer Authentication rules, creation of a card must be done from Stripe backoffice. You can click here to switch on Stripe customer record: %s \ No newline at end of file diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 3b3710fee89..aea4e7676e4 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -113,3 +113,5 @@ CantDisableYourself=You can't disable your own user record ForceUserExpenseValidator=Force expense report validator ForceUserHolidayValidator=Force leave request validator ValidatorIsSupervisorByDefault=By default, the validator is the supervisor of the user. Keep empty to keep this behaviour. +UserPersonalEmail=Personal email +UserPersonalMobile=Personal mobile phone diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index fcadfea6ef1..8fac5fb3028 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4806,11 +4806,12 @@ class Product extends CommonObject * This function need a lot of load. If you use it on list, use a cache to execute it once for each product id. * If ENTREPOT_EXTRA_STATUS set, filtering on warehouse status possible. * - * @param string $option '' = Load all stock info, also from closed and internal warehouses, 'nobatch', 'novirtual' - * @return int < 0 if KO, > 0 if OK - * @see load_virtual_stock(), loadBatchInfo() + * @param string $option '' = Load all stock info, also from closed and internal warehouses, 'nobatch', 'novirtual' + * @param int $includedraftpoforvirtual Include draft status of PO for virtual stock calculation + * @return int < 0 if KO, > 0 if OK + * @see load_virtual_stock(), loadBatchInfo() */ - public function load_stock($option = '') + public function load_stock($option = '', $includedraftpoforvirtual = null) { // phpcs:enable global $conf; @@ -4863,7 +4864,7 @@ class Product extends CommonObject $this->db->free($result); if (!preg_match('/novirtual/', $option)) { - $this->load_virtual_stock(); // This also load stats_commande_fournisseur, ... + $this->load_virtual_stock($includedraftpoforvirtual); // This also load stats_commande_fournisseur, ... } return 1; @@ -4878,13 +4879,14 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load value ->stock_theorique of a product. Property this->id must be defined. - * This function need a lot of load. If you use it on list, use a cache to execute it one for each product id. + * Load value ->stock_theorique of a product. Property this->id must be defined. + * This function need a lot of load. If you use it on list, use a cache to execute it one for each product id. * - * @return int < 0 if KO, > 0 if OK - * @see load_stock(), loadBatchInfo() + * @param int $includedraftpoforvirtual Include draft status of PO for virtual stock calculation + * @return int < 0 if KO, > 0 if OK + * @see load_stock(), loadBatchInfo() */ - public function load_virtual_stock() + public function load_virtual_stock($includedraftpoforvirtual = null) { // phpcs:enable global $conf, $hookmanager, $action; @@ -4918,19 +4920,25 @@ class Product extends CommonObject } if (!empty($conf->fournisseur->enabled)) { - $result = $this->load_stats_commande_fournisseur(0, '1,2,3,4', 1); + $filterStatus = '1,2,3,4'; + if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus; + $result = $this->load_stats_commande_fournisseur(0, $filterStatus, 1); if ($result < 0) dol_print_error($this->db, $this->error); $stock_commande_fournisseur = $this->stats_commande_fournisseur['qty']; } if (!empty($conf->fournisseur->enabled) && empty($conf->reception->enabled)) { - $result = $this->load_stats_reception(0, '4', 1); + $filterStatus = '4'; + if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus; + $result = $this->load_stats_reception(0, $filterStatus, 1); if ($result < 0) dol_print_error($this->db, $this->error); $stock_reception_fournisseur = $this->stats_reception['qty']; } if (!empty($conf->fournisseur->enabled) && !empty($conf->reception->enabled)) { - $result = $this->load_stats_reception(0, '4', 1); // Use same tables than when module reception is not used. + $filterStatus = '4'; + if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus; + $result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used. if ($result < 0) dol_print_error($this->db, $this->error); $stock_reception_fournisseur = $this->stats_reception['qty']; } @@ -4972,7 +4980,7 @@ class Product extends CommonObject $hookmanager = new HookManager($this->db); } $hookmanager->initHooks(array('productdao')); - $parameters = array('id'=>$this->id); + $parameters = array('id'=>$this->id, 'includedraftpoforvirtual' => $includedraftpoforvirtual); // Note that $action and $object may have been modified by some hooks $reshook = $hookmanager->executeHooks('loadvirtualstock', $parameters, $this, $action); if ($reshook > 0) $this->stock_theorique = $hookmanager->resArray['stock_theorique']; diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index f4df99e131e..0d244785479 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -87,12 +87,13 @@ class Warehouses extends DolibarrApi * @param string $sortorder Sort order * @param int $limit Limit for list * @param int $page Page number + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.label:like:'WH-%') and (t.date_creation:<:'20160101')" * @return array Array of warehouse objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $category = 0, $sqlfilters = '') { global $db, $conf; @@ -104,7 +105,15 @@ class Warehouses extends DolibarrApi $sql = "SELECT t.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."entrepot as t"; + if ($category > 0) { + $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c"; + } $sql .= ' WHERE t.entity IN ('.getEntity('stock').')'; + // Select warehouses of given category + if ($category > 0) { + $sql .= " AND c.fk_categorie = ".$db->escape($category); + $sql .= " AND c.fk_warehouse = t.rowid "; + } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 89c7c6d0e86..220f35659f3 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -648,7 +648,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) if (!empty($conf->global->STOCK_SUPPORTS_SERVICES) || $objp->fk_product_type == 0) { $prod->fetch($objp->rowid); - $prod->load_stock('warehouseopen, warehouseinternal'); + $prod->load_stock('warehouseopen, warehouseinternal', $draftchecked); // Multilangs if (!empty($conf->global->MAIN_MULTILANGS)) diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 3e9df24d237..f8a076c89ee 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -95,10 +95,11 @@ class Projects extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter projects of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} - * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" + * @param int $category Use this param to filter list by category + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of project objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '') { global $db, $conf; @@ -114,7 +115,9 @@ class Projects extends DolibarrApi $sql = "SELECT t.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql .= " FROM ".MAIN_DB_PREFIX."projet as t"; - + if ($category > 0) { + $sql .= ", ".MAIN_DB_PREFIX."categorie_project as c"; + } if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql .= ' WHERE t.entity IN ('.getEntity('project').')'; @@ -126,6 +129,10 @@ class Projects extends DolibarrApi { $sql .= " AND sc.fk_user = ".$search_sale; } + // Select projects of given category + if ($category > 0) { + $sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_project = t.rowid "; + } // Add sql filters if ($sqlfilters) { diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 803e6796c9e..cb004bc33a0 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -142,27 +142,27 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e if (empty($reshook)) { - // Selection of new fields - include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; // Purge search criteria if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers { - $search_user_id = ""; - $search_taskref = ''; - $search_tasklabel = ''; - $search_dtstartday = ''; - $search_dtstartmonth = ''; - $search_dtstartyear = ''; - $search_dtendday = ''; - $search_dtendmonth = ''; - $search_dtendyear = ''; - $search_planedworkload = ''; - $search_timespend = ''; - $search_progresscalc = ''; - $search_progressdeclare = ''; - $toselect = ''; - $search_array_options = array(); + $search_user_id = ""; + $search_taskref = ''; + $search_tasklabel = ''; + $search_dtstartday = ''; + $search_dtstartmonth = ''; + $search_dtstartyear = ''; + $search_dtendday = ''; + $search_dtendmonth = ''; + $search_dtendyear = ''; + $search_planedworkload = ''; + $search_timespend = ''; + $search_progresscalc = ''; + $search_progressdeclare = ''; + $toselect = ''; + $search_array_options = array(); } // Mass actions @@ -217,8 +217,8 @@ if ($action == 'createtask' && $user->rights->projet->creer) { $error = 0; - // If we use user timezone, we must change also view/list to use user timezone everywhere - //$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user'); + // If we use user timezone, we must change also view/list to use user timezone everywhere + //$date_start = dol_mktime($_POST['dateohour'],$_POST['dateomin'],0,$_POST['dateomonth'],$_POST['dateoday'],$_POST['dateoyear'],'user'); //$date_end = dol_mktime($_POST['dateehour'],$_POST['dateemin'],0,$_POST['dateemonth'],$_POST['dateeday'],$_POST['dateeyear'],'user'); $date_start = dol_mktime($_POST['dateohour'], $_POST['dateomin'], 0, $_POST['dateomonth'], $_POST['dateoday'], $_POST['dateoyear']); $date_end = dol_mktime($_POST['dateehour'], $_POST['dateemin'], 0, $_POST['dateemonth'], $_POST['dateeday'], $_POST['dateeyear']); @@ -231,7 +231,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) $action = 'create'; $error++; } - if (empty($label)) + if (empty($label)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action = 'create'; @@ -379,116 +379,116 @@ if ($id > 0 || !empty($ref)) // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - // Project card + // Project card - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref = '
      '; - // Title - $morehtmlref .= $object->title; - // Thirdparty - if ($object->thirdparty->id > 0) - { - $morehtmlref .= '
      '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); - } - $morehtmlref .= '
      '; + $morehtmlref = '
      '; + // Title + $morehtmlref .= $object->title; + // Thirdparty + if ($object->thirdparty->id > 0) + { + $morehtmlref .= '
      '.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref .= '
      '; - // Define a complementary filter for search of next/prev ref. - if (!$user->rights->projet->all->lire) - { - $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); - $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; - } + // Define a complementary filter for search of next/prev ref. + if (!$user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user, 0, 0); + $object->next_prev_filter = " rowid in (".(count($objectsListId) ?join(',', array_keys($objectsListId)) : '0').")"; + } - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - print '
      '; - print '
      '; - print '
      '; + print '
      '; + print '
      '; + print '
      '; - print '
      '.$langs->trans("OrdersToProcess").' ('.$num.')
      '.$langs->trans("OrdersToProcess").' ('.$num.')
      '; + print '
      '; - // Usage - print ''; - print ''; + // Usage + print ''; + print ''; - // Visibility - print ''; + // Visibility + print ''; - // Date start - end - print ''; + // Date start - end + print ''; - // Budget - print ''; + // Budget + print ''; - // Other attributes - $cols = 2; - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Other attributes + $cols = 2; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print '
      '; - print $langs->trans("Usage"); - print ''; - if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowOpportunity"); - print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); - print '
      '; - } - if (empty($conf->global->PROJECT_HIDE_TASKS)) - { - print 'usage_task ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectFollowTasks"); - print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); - print '
      '; - } - if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) - { - print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; - $htmltext = $langs->trans("ProjectBillTimeDescription"); - print $form->textwithpicto($langs->trans("BillTime"), $htmltext); - print '
      '; - } - print '
      '; + print $langs->trans("Usage"); + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) + { + print 'usage_opportunity ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowOpportunity"); + print $form->textwithpicto($langs->trans("ProjectFollowOpportunity"), $htmltext); + print '
      '; + } + if (empty($conf->global->PROJECT_HIDE_TASKS)) + { + print 'usage_task ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectFollowTasks"); + print $form->textwithpicto($langs->trans("ProjectFollowTasks"), $htmltext); + print '
      '; + } + if (!empty($conf->global->PROJECT_BILL_TIME_SPENT)) + { + print 'usage_bill_time ? ' checked="checked"' : '')).'"> '; + $htmltext = $langs->trans("ProjectBillTimeDescription"); + print $form->textwithpicto($langs->trans("BillTime"), $htmltext); + print '
      '; + } + print '
      '.$langs->trans("Visibility").''; - if ($object->public) print $langs->trans('SharedProject'); - else print $langs->trans('PrivateProject'); - print '
      '.$langs->trans("Visibility").''; + if ($object->public) print $langs->trans('SharedProject'); + else print $langs->trans('PrivateProject'); + print '
      '.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; - $start = dol_print_date($object->date_start, 'day'); - print ($start ? $start : '?'); - $end = dol_print_date($object->date_end, 'day'); - print ' - '; - print ($end ? $end : '?'); - if ($object->hasDelay()) print img_warning("Late"); - print '
      '.$langs->trans("DateStart").' - '.$langs->trans("DateEnd").''; + $start = dol_print_date($object->date_start, 'day'); + print ($start ? $start : '?'); + $end = dol_print_date($object->date_end, 'day'); + print ' - '; + print ($end ? $end : '?'); + if ($object->hasDelay()) print img_warning("Late"); + print '
      '.$langs->trans("Budget").''; - if (strcmp($object->budget_amount, '')) print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); - print '
      '.$langs->trans("Budget").''; + if (strcmp($object->budget_amount, '')) print price($object->budget_amount, '', $langs, 1, 0, 0, $conf->currency); + print '
      '; + print ''; - print '
      '; - print '
      '; - print '
      '; - print '
      '; + print '
      '; + print '
      '; + print '
      '; + print '
      '; - print ''; + print '
      '; - // Description - print ''; + // Description + print ''; - // Categories - if ($conf->categorie->enabled) { - print '"; - } + // Categories + if ($conf->categorie->enabled) { + print '"; + } - print '
      '.$langs->trans("Description").''; - print nl2br($object->description); - print '
      '.$langs->trans("Description").''; + print nl2br($object->description); + print '
      '.$langs->trans("Categories").''; - print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); - print "
      '.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_PROJECT, 1); + print "
      '; + print ''; - print '
      '; - print '
      '; - print '
      '; + print '
      '; + print '
      '; + print '
'; - print '
'; + print '
'; dol_fiche_end(); @@ -594,9 +594,9 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third // Other options $parameters = array(); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $taskstatic, $action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + print $hookmanager->resPrint; - if (empty($reshook) && !empty($extrafields->attributes[$taskstatic->table_element]['label'])) + if (empty($reshook) && !empty($extrafields->attributes[$taskstatic->table_element]['label'])) { print $taskstatic->showOptionals($extrafields, 'edit'); // Do not use $object here that is object of project but use $taskstatic } @@ -625,17 +625,17 @@ elseif ($id > 0 || !empty($ref)) print '
'; // Link to create task - $linktocreatetaskParam = array(); - $linktocreatetaskUserRight = false; - if ($user->rights->projet->all->creer || $user->rights->projet->creer) { - if ($object->public || $userWrite > 0) { - $linktocreatetaskUserRight = true; - } else { - $linktocreatetaskParam['attr']['title'] = $langs->trans("NotOwnerOfProject"); - } - } + $linktocreatetaskParam = array(); + $linktocreatetaskUserRight = false; + if ($user->rights->projet->all->creer || $user->rights->projet->creer) { + if ($object->public || $userWrite > 0) { + $linktocreatetaskUserRight = true; + } else { + $linktocreatetaskParam['attr']['title'] = $langs->trans("NotOwnerOfProject"); + } + } - $linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); + $linktocreatetask = dolGetButtonTitle($langs->trans('AddTask'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/projet/tasks.php?action=create'.$param.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.$object->id), '', $linktocreatetaskUserRight, $linktocreatetaskParam); print '
'; if ($optioncss != '') print ''; @@ -644,7 +644,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''; print ''; - print ''; + print ''; print ''; $title = $langs->trans("ListOfTasks"); @@ -750,8 +750,8 @@ elseif ($id > 0 || !empty($ref)) print ''; } - // progress resume not searchable - print ''; + // progress resume not searchable + print ''; if ($object->usage_bill_time) { @@ -808,14 +808,14 @@ elseif ($id > 0 || !empty($ref)) if (count($tasksarray) > 0) { - // Show all lines in taskarray (recursive function to go down on tree) + // Show all lines in taskarray (recursive function to go down on tree) $j = 0; $level = 0; $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields); } else { - $colspan = 10; - if ($object->usage_bill_time) $colspan += 2; + $colspan = 10; + if ($object->usage_bill_time) $colspan += 2; print ''.$langs->trans("NoTasks").''; } diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index a2ea4efec12..29ec7983930 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -61,268 +61,268 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Add file in email form if (GETPOST('addfile', 'alpha') && !GETPOST('add', 'alpha')) { - ////$res = $object->fetch('','',GETPOST('track_id')); - ////if($res > 0) - ////{ - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + ////$res = $object->fetch('','',GETPOST('track_id')); + ////if($res > 0) + ////{ + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - // Set tmp directory TODO Use a dedicated directory for temp mails files - $vardir = $conf->ticket->dir_output; - $upload_dir_tmp = $vardir.'/temp/'.session_id(); - if (!dol_is_dir($upload_dir_tmp)) { - dol_mkdir($upload_dir_tmp); - } + // Set tmp directory TODO Use a dedicated directory for temp mails files + $vardir = $conf->ticket->dir_output; + $upload_dir_tmp = $vardir.'/temp/'.session_id(); + if (!dol_is_dir($upload_dir_tmp)) { + dol_mkdir($upload_dir_tmp); + } - dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0); - $action = 'create_ticket'; - ////} + dol_add_file_process($upload_dir_tmp, 0, 0, 'addedfile', '', null, '', 0); + $action = 'create_ticket'; + ////} } // Remove file if (GETPOST('removedfile', 'alpha') && !GETPOST('add', 'alpha')) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - // Set tmp directory - $vardir = $conf->ticket->dir_output.'/'; - $upload_dir_tmp = $vardir.'/temp/'.session_id(); + // Set tmp directory + $vardir = $conf->ticket->dir_output.'/'; + $upload_dir_tmp = $vardir.'/temp/'.session_id(); - // TODO Delete only files that was uploaded from email form - dol_remove_file_process($_POST['removedfile'], 0, 0); - $action = 'create_ticket'; + // TODO Delete only files that was uploaded from email form + dol_remove_file_process($_POST['removedfile'], 0, 0); + $action = 'create_ticket'; } if ($action == 'create_ticket' && GETPOST('add', 'alpha')) { - $error = 0; - $origin_email = GETPOST('email', 'alpha'); - if (empty($origin_email)) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); - $action = ''; - } else { - // Search company saved with email - $searched_companies = $object->searchSocidByEmail($origin_email, '0'); + $error = 0; + $origin_email = GETPOST('email', 'alpha'); + if (empty($origin_email)) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); + $action = ''; + } else { + // Search company saved with email + $searched_companies = $object->searchSocidByEmail($origin_email, '0'); - // Chercher un contact existant avec cette adresse email - // Le premier contact trouvé est utilisé pour déterminer le contact suivi - $contacts = $object->searchContactByEmail($origin_email); + // Chercher un contact existant avec cette adresse email + // Le premier contact trouvé est utilisé pour déterminer le contact suivi + $contacts = $object->searchContactByEmail($origin_email); - // Option to require email exists to create ticket - if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) { - $error++; - array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); - $action = ''; - } - } + // Option to require email exists to create ticket + if (!empty($conf->global->TICKET_EMAIL_MUST_EXISTS) && !$contacts[0]->socid) { + $error++; + array_push($object->errors, $langs->trans("ErrorEmailMustExistToCreateTicket")); + $action = ''; + } + } - if (!GETPOST("subject", "none")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); - $action = ''; - } elseif (!GETPOST("message", "none")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message"))); - $action = ''; - } + if (!GETPOST("subject", "none")) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); + $action = ''; + } elseif (!GETPOST("message", "none")) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message"))); + $action = ''; + } - // Check email address - if (!isValidEmail($origin_email)) { - $error++; - array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email"))); - $action = ''; - } + // Check email address + if (!isValidEmail($origin_email)) { + $error++; + array_push($object->errors, $langs->trans("ErrorBadEmailAddress", $langs->transnoentities("email"))); + $action = ''; + } - if (!$error) { - $object->db->begin(); + if (!$error) { + $object->db->begin(); - $object->track_id = generate_random_id(16); + $object->track_id = generate_random_id(16); - $object->subject = GETPOST("subject", "none"); - $object->message = GETPOST("message", "none"); - $object->origin_email = $origin_email; + $object->subject = GETPOST("subject", "none"); + $object->message = GETPOST("message", "none"); + $object->origin_email = $origin_email; - $object->type_code = GETPOST("type_code", 'aZ09'); - $object->category_code = GETPOST("category_code", 'aZ09'); - $object->severity_code = GETPOST("severity_code", 'aZ09'); - if (is_array($searched_companies)) { - $object->fk_soc = $searched_companies[0]->id; - } + $object->type_code = GETPOST("type_code", 'aZ09'); + $object->category_code = GETPOST("category_code", 'aZ09'); + $object->severity_code = GETPOST("severity_code", 'aZ09'); + if (is_array($searched_companies)) { + $object->fk_soc = $searched_companies[0]->id; + } - if (is_array($contacts) and count($contacts) > 0) { - $object->fk_soc = $contacts[0]->socid; - $usertoassign = $contacts[0]->id; - } + if (is_array($contacts) and count($contacts) > 0) { + $object->fk_soc = $contacts[0]->socid; + $usertoassign = $contacts[0]->id; + } - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object); - // Generate new ref - $object->ref = $object->getDefaultRef(); - if (!is_object($user)) { - $user = new User($db); - } + // Generate new ref + $object->ref = $object->getDefaultRef(); + if (!is_object($user)) { + $user = new User($db); + } - $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later + $object->context['disableticketemail'] = 1; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later - $id = $object->create($user); - if ($id <= 0) { - $error++; - $errors = ($object->error ? array($object->error) : $object->errors); - array_push($object->errors, $object->error ? array($object->error) : $object->errors); - $action = 'create_ticket'; - } + $id = $object->create($user); + if ($id <= 0) { + $error++; + $errors = ($object->error ? array($object->error) : $object->errors); + array_push($object->errors, $object->error ? array($object->error) : $object->errors); + $action = 'create_ticket'; + } - if (!$error && $id > 0) { - if ($usertoassign > 0) { - $object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0); - } - } + if (!$error && $id > 0) { + if ($usertoassign > 0) { + $object->add_contact($usertoassign, "SUPPORTCLI", 'external', 0); + } + } - if (!$error) - { - $object->db->commit(); - $action = "infos_success"; - } else { - $object->db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); - $action = 'create_ticket'; - } + if (!$error) + { + $object->db->commit(); + $action = "infos_success"; + } else { + $object->db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); + $action = 'create_ticket'; + } - if (!$error) - { - $res = $object->fetch($id); - if ($res) { - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $formmail = new FormMail($db); + if (!$error) + { + $res = $object->fetch($id); + if ($res) { + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $formmail = new FormMail($db); - // Init to avoid errors - $filepath = array(); - $filename = array(); - $mimetype = array(); + // Init to avoid errors + $filepath = array(); + $filename = array(); + $mimetype = array(); - $attachedfiles = $formmail->get_attached_files(); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; + $attachedfiles = $formmail->get_attached_files(); + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; - // Send email to customer + // Send email to customer - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id); - $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; - $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubject', $object->ref, $object->track_id); + $message .= ($conf->global->TICKET_MESSAGE_MAIL_NEW ? $conf->global->TICKET_MESSAGE_MAIL_NEW : $langs->transnoentities('TicketNewEmailBody'))."\n\n"; + $message .= $langs->transnoentities('TicketNewEmailBodyInfosTicket')."\n"; - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; - $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'')."\n"; - $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n"; + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$object->track_id; + $infos_new_ticket = $langs->transnoentities('TicketNewEmailBodyInfosTrackId', ''.$object->track_id.'')."\n"; + $infos_new_ticket .= $langs->transnoentities('TicketNewEmailBodyInfosTrackUrl')."\n\n"; - $message .= dol_nl2br($infos_new_ticket); - $message .= $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->transnoentities('TicketMessageMailSignatureText'); + $message .= dol_nl2br($infos_new_ticket); + $message .= $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE ? $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE : $langs->transnoentities('TicketMessageMailSignatureText'); - $sendto = GETPOST('email', 'alpha'); + $sendto = GETPOST('email', 'alpha'); - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; - $replyto = $from; + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $replyto = $from; $sendtocc = ''; $deliveryreceipt = 0; - $message = dol_nl2br($message); + $message = dol_nl2br($message); - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); - if ($mailfile->error || $mailfile->errors) { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } else { - $result = $mailfile->sendfile(); - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); + if ($mailfile->error || $mailfile->errors) { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } else { + $result = $mailfile->sendfile(); + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } - // Send email to TICKET_NOTIFICATION_EMAIL_TO - $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - if ($sendto) - { - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id); - $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; - $message_admin .= '
  • '.$langs->trans('Title').' : '.$object->subject.'
  • '; - $message_admin .= '
  • '.$langs->trans('Type').' : '.$object->type_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('Category').' : '.$object->category_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('Severity').' : '.$object->severity_label.'
  • '; - $message_admin .= '
  • '.$langs->trans('From').' : '.$object->origin_email.'
  • '; + // Send email to TICKET_NOTIFICATION_EMAIL_TO + $sendto = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + if ($sendto) + { + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNewEmailSubjectAdmin', $object->ref, $object->track_id); + $message_admin = $langs->transnoentities('TicketNewEmailBodyAdmin', $object->track_id)."\n\n"; + $message_admin .= '
    • '.$langs->trans('Title').' : '.$object->subject.'
    • '; + $message_admin .= '
    • '.$langs->trans('Type').' : '.$object->type_label.'
    • '; + $message_admin .= '
    • '.$langs->trans('Category').' : '.$object->category_label.'
    • '; + $message_admin .= '
    • '.$langs->trans('Severity').' : '.$object->severity_label.'
    • '; + $message_admin .= '
    • '.$langs->trans('From').' : '.$object->origin_email.'
    • '; - if (is_array($extrafields->attributes[$object->table_element]['label'])) - { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) - { - $enabled = 1; - if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key])) - { - $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); - } - $perms = 1; - if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) - { - $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); - } + if (is_array($extrafields->attributes[$object->table_element]['label'])) + { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) + { + $enabled = 1; + if ($qualified && isset($extrafields->attributes[$object->table_element]['list'][$key])) + { + $enabled = dol_eval($extrafields->attributes[$object->table_element]['list'][$key], 1); + } + $perms = 1; + if ($perms && isset($extrafields->attributes[$object->table_element]['perms'][$key])) + { + $perms = dol_eval($extrafields->attributes[$object->table_element]['perms'][$key], 1); + } - $qualified = true; - if (empty($enabled) || $enabled == 2) $qualified = false; - if (empty($perms)) $qualified = false; - if ($qualified) $message_admin .= '
    • '.$langs->trans($key).' : '.$value.'
    • '; - } - } + $qualified = true; + if (empty($enabled) || $enabled == 2) $qualified = false; + if (empty($perms)) $qualified = false; + if ($qualified) $message_admin .= '
    • '.$langs->trans($key).' : '.$value.'
    • '; + } + } - $message_admin .= '
    '; - $message_admin .= '

    '.$langs->trans('Message').' :
    '.$object->message.'

    '; - $message_admin .= '

    '.$langs->trans('SeeThisTicketIntomanagementInterface').'

    '; + $message_admin .= '
'; + $message_admin .= '

'.$langs->trans('Message').' :
'.$object->message.'

'; + $message_admin .= '

'.$langs->trans('SeeThisTicketIntomanagementInterface').'

'; - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; - $replyto = $from; + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $replyto = $from; - $message_admin = dol_nl2br($message_admin); + $message_admin = dol_nl2br($message_admin); - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); - if ($mailfile->error || $mailfile->errors) { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } else { - $result = $mailfile->sendfile(); - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - } - } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message_admin, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1); + if ($mailfile->error || $mailfile->errors) { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } else { + $result = $mailfile->sendfile(); + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } + } + } - // Copy files into ticket directory - $destdir = $conf->ticket->dir_output.'/'.$object->ref; - if (!dol_is_dir($destdir)) { - dol_mkdir($destdir); - } - foreach ($filename as $i => $val) { - dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1); - $formmail->remove_attached_files($i); - } + // Copy files into ticket directory + $destdir = $conf->ticket->dir_output.'/'.$object->ref; + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } + foreach ($filename as $i => $val) { + dol_move($filepath[$i], $destdir.'/'.$filename[$i], 0, 1); + $formmail->remove_attached_files($i); + } - //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); + //setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs'); - // Make a redirect to avoid to have ticket submitted twice if we make back - setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', ''.$object->track_id.'', ''.$object->ref.''), null, 'warnings'); - setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); - header("Location: index.php"); + // Make a redirect to avoid to have ticket submitted twice if we make back + setEventMessages($langs->trans('MesgInfosPublicTicketCreatedWithTrackId', ''.$object->track_id.'', ''.$object->ref.''), null, 'warnings'); + setEventMessages($langs->trans('PleaseRememberThisId'), null, 'warnings'); + header("Location: index.php"); exit; - } - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } } @@ -336,9 +336,9 @@ $formticket = new FormTicket($db); if (!$conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) { - print '
'.$langs->trans('TicketPublicInterfaceForbidden').'
'; - $db->close(); - exit(); + print '
'.$langs->trans('TicketPublicInterfaceForbidden').'
'; + $db->close(); + exit(); } $arrayofjs = array(); @@ -350,31 +350,31 @@ llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss print '
'; if ($action != "infos_success") { - $formticket->withfromsocid = isset($socid) ? $socid : $user->socid; - $formticket->withtitletopic = 1; - $formticket->withcompany = 0; - $formticket->withusercreate = 1; - $formticket->fk_user_create = 0; - $formticket->withemail = 1; - $formticket->ispublic = 1; - $formticket->withfile = 2; - $formticket->action = 'create_ticket'; + $formticket->withfromsocid = isset($socid) ? $socid : $user->socid; + $formticket->withtitletopic = 1; + $formticket->withcompany = 0; + $formticket->withusercreate = 1; + $formticket->fk_user_create = 0; + $formticket->withemail = 1; + $formticket->ispublic = 1; + $formticket->withfile = 2; + $formticket->action = 'create_ticket'; - $formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : '')); + $formticket->param = array('returnurl' => $_SERVER['PHP_SELF'].($conf->entity > 1 ? '?entity='.$conf->entity : '')); - print load_fiche_titre($langs->trans('NewTicket'), '', '', 0, 0, 'marginleftonly'); + print load_fiche_titre($langs->trans('NewTicket'), '', '', 0, 0, 'marginleftonly'); - if (empty($conf->global->TICKET_NOTIFICATION_EMAIL_FROM)) { - $langs->load("errors"); - print '
'; - print $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'
'; - print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket")); - print '
'; - } - else { - print '
'.$langs->trans('TicketPublicInfoCreateTicket').'
'; - $formticket->showForm(); - } + if (empty($conf->global->TICKET_NOTIFICATION_EMAIL_FROM)) { + $langs->load("errors"); + print '
'; + print $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'
'; + print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket")); + print '
'; + } + else { + print '
'.$langs->trans('TicketPublicInfoCreateTicket').'
'; + $formticket->showForm(); + } } print '
'; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index a4cc33f5506..1938c68de3e 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -23,15 +23,15 @@ */ if (!defined('NOCSRFCHECK')) { - define('NOCSRFCHECK', '1'); + define('NOCSRFCHECK', '1'); } // Do not check anti CSRF attack test if (!defined('NOREQUIREMENU')) { - define('NOREQUIREMENU', '1'); + define('NOREQUIREMENU', '1'); } // If there is no need to load and show top and left menu if (!defined("NOLOGIN")) { - define("NOLOGIN", '1'); + define("NOLOGIN", '1'); } // If this page is public (can be called outside logged session) @@ -54,10 +54,10 @@ $action = GETPOST('action', 'aZ09'); $email = GETPOST('email', 'alpha'); if (GETPOST('btn_view_ticket')) { - unset($_SESSION['email_customer']); + unset($_SESSION['email_customer']); } if (isset($_SESSION['email_customer'])) { - $email = $_SESSION['email_customer']; + $email = $_SESSION['email_customer']; } $object = new ActionsTicket($db); @@ -78,121 +78,121 @@ if ($cancel) } if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close" || $action == "add_message") { - $error = 0; - $display_ticket = false; - if (!strlen($track_id)) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTrackId"))); - $action = ''; - } - if (!strlen($email)) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); - $action = ''; - } else { - if (!isValidEmail($email)) { - $error++; - array_push($object->errors, $langs->trans("ErrorEmailInvalid")); - $action = ''; - } - } + $error = 0; + $display_ticket = false; + if (!strlen($track_id)) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("TicketTrackId"))); + $action = ''; + } + if (!strlen($email)) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Email"))); + $action = ''; + } else { + if (!isValidEmail($email)) { + $error++; + array_push($object->errors, $langs->trans("ErrorEmailInvalid")); + $action = ''; + } + } - if (!$error) { - $ret = $object->fetch('', '', $track_id); - if ($ret && $object->dao->id > 0) { - // Check if emails provided is the one of author - $emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2); - if ($emailofticket == $email) - { - $display_ticket = true; - $_SESSION['email_customer'] = $email; - } - // Check if emails provided is inside list of contacts - else { - $contacts = $object->dao->liste_contact(-1, 'external'); - foreach ($contacts as $contact) { - if ($contact['email'] == $email) { - $display_ticket = true; - $_SESSION['email_customer'] = $email; - break; - } else { - $display_ticket = false; - } - } - } - // Check email of thirdparty of ticket - if ($object->dao->fk_soc > 0 || $object->dao->socid > 0) { - $object->dao->fetch_thirdparty(); - if ($email == $object->dao->thirdparty->email) { - $display_ticket = true; - $_SESSION['email_customer'] = $email; - } - } - // Check if email is email of creator - if ($object->dao->fk_user_create > 0) - { - $tmpuser = new User($db); - $tmpuser->fetch($object->dao->fk_user_create); - if ($email == $tmpuser->email) { - $display_ticket = true; - $_SESSION['email_customer'] = $email; - } - } - // Check if email is email of creator - if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create) - { - $tmpuser = new User($db); - $tmpuser->fetch($object->dao->fk_user_assign); - if ($email == $tmpuser->email) { - $display_ticket = true; - $_SESSION['email_customer'] = $email; - } - } - } else { - $error++; - array_push($object->errors, $langs->trans("ErrorTicketNotFound", $track_id)); - $action = ''; - } - } + if (!$error) { + $ret = $object->fetch('', '', $track_id); + if ($ret && $object->dao->id > 0) { + // Check if emails provided is the one of author + $emailofticket = CMailFile::getValidAddress($object->dao->origin_email, 2); + if ($emailofticket == $email) + { + $display_ticket = true; + $_SESSION['email_customer'] = $email; + } + // Check if emails provided is inside list of contacts + else { + $contacts = $object->dao->liste_contact(-1, 'external'); + foreach ($contacts as $contact) { + if ($contact['email'] == $email) { + $display_ticket = true; + $_SESSION['email_customer'] = $email; + break; + } else { + $display_ticket = false; + } + } + } + // Check email of thirdparty of ticket + if ($object->dao->fk_soc > 0 || $object->dao->socid > 0) { + $object->dao->fetch_thirdparty(); + if ($email == $object->dao->thirdparty->email) { + $display_ticket = true; + $_SESSION['email_customer'] = $email; + } + } + // Check if email is email of creator + if ($object->dao->fk_user_create > 0) + { + $tmpuser = new User($db); + $tmpuser->fetch($object->dao->fk_user_create); + if ($email == $tmpuser->email) { + $display_ticket = true; + $_SESSION['email_customer'] = $email; + } + } + // Check if email is email of creator + if ($object->dao->fk_user_assign > 0 && $object->dao->fk_user_assign != $object->dao->fk_user_create) + { + $tmpuser = new User($db); + $tmpuser->fetch($object->dao->fk_user_assign); + if ($email == $tmpuser->email) { + $display_ticket = true; + $_SESSION['email_customer'] = $email; + } + } + } else { + $error++; + array_push($object->errors, $langs->trans("ErrorTicketNotFound", $track_id)); + $action = ''; + } + } - if (!$error && $action == 'confirm_public_close' && $display_ticket) - { - if ($object->dao->close($user)) { - setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs'); + if (!$error && $action == 'confirm_public_close' && $display_ticket) + { + if ($object->dao->close($user)) { + setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs'); - $url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha'); - header("Location: ".$url); - } else { - $action = ''; - setEventMessages($object->error, $object->errors, 'errors'); - } - } + $url = 'view.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha'); + header("Location: ".$url); + } else { + $action = ''; + setEventMessages($object->error, $object->errors, 'errors'); + } + } - if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message')) - { - // TODO Add message... - $ret = $object->dao->newMessage($user, $action, 0); + if (!$error && $action == "add_message" && $display_ticket && GETPOSTISSET('btn_add_message')) + { + // TODO Add message... + $ret = $object->dao->newMessage($user, $action, 0); - if (!$error) - { - $action = 'view_ticket'; - } - } + if (!$error) + { + $action = 'view_ticket'; + } + } - if ($error || $errors) { - setEventMessages($object->error, $object->errors, 'errors'); - if ($action == "add_message") - { - $action = 'presend'; - } - else - { - $action = ''; - } - } + if ($error || $errors) { + setEventMessages($object->error, $object->errors, 'errors'); + if ($action == "add_message") + { + $action = 'presend'; + } + else + { + $action = ''; + } + } } //var_dump($action); //$object->doActions($action); @@ -227,178 +227,178 @@ llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); print '
'; if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") { - if ($display_ticket) - { - // Confirmation close - if ($action == 'close') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1); - } + if ($display_ticket) + { + // Confirmation close + if ($action == 'close') { + print $form->formconfirm($_SERVER["PHP_SELF"]."?track_id=".$track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_public_close", '', '', 1); + } - print '
'; + print '
'; - print ''; + print '
'; - // Ref - print ''; + // Ref + print ''; - // Tracking ID - print ''; + // Tracking ID + print ''; - // Subject - print ''; + // Subject + print ''; - // Statut - print ''; + // Statut + print ''; - // Type - print ''; + // Type + print ''; - // Category - print ''; + // Category + print ''; - // Severity - print ''; + // Severity + print ''; - // Creation date - print ''; + // Creation date + print ''; - // Author - print ''; + print ''; - // Read date - if (!empty($object->dao->date_read)) { - print ''; - } + // Read date + if (!empty($object->dao->date_read)) { + print ''; + } - // Close date - if (!empty($object->dao->date_close)) { - print ''; - } + // Close date + if (!empty($object->dao->date_close)) { + print ''; + } - // User assigned - print ''; + // User assigned + print ''; - // Progression - print ''; + // Progression + print ''; - print '
'.$langs->trans("Ref").''; - print $object->dao->ref; - print '
'.$langs->trans("Ref").''; + print $object->dao->ref; + print '
'.$langs->trans("TicketTrackId").''; - print $object->dao->track_id; - print '
'.$langs->trans("TicketTrackId").''; + print $object->dao->track_id; + print '
'.$langs->trans("Subject").''; - print $object->dao->subject; - print '
'.$langs->trans("Subject").''; + print $object->dao->subject; + print '
'.$langs->trans("Status").''; - print $object->dao->getLibStatut(2); - print '
'.$langs->trans("Status").''; + print $object->dao->getLibStatut(2); + print '
'.$langs->trans("Type").''; - print $object->dao->type_label; - print '
'.$langs->trans("Type").''; + print $object->dao->type_label; + print '
'.$langs->trans("Category").''; - print $object->dao->category_label; - print '
'.$langs->trans("Category").''; + print $object->dao->category_label; + print '
'.$langs->trans("Severity").''; - print $object->dao->severity_label; - print '
'.$langs->trans("Severity").''; + print $object->dao->severity_label; + print '
'.$langs->trans("DateCreation").''; - print dol_print_date($object->dao->datec, 'dayhour'); - print '
'.$langs->trans("DateCreation").''; + print dol_print_date($object->dao->datec, 'dayhour'); + print '
'.$langs->trans("Author").''; - if ($object->dao->fk_user_create > 0) { - $langs->load("users"); - $fuser = new User($db); - $fuser->fetch($object->dao->fk_user_create); - print $fuser->getFullName($langs); - } else { - print dol_escape_htmltag($object->dao->origin_email); - } + // Author + print '
'.$langs->trans("Author").''; + if ($object->dao->fk_user_create > 0) { + $langs->load("users"); + $fuser = new User($db); + $fuser->fetch($object->dao->fk_user_create); + print $fuser->getFullName($langs); + } else { + print dol_escape_htmltag($object->dao->origin_email); + } - print '
'.$langs->trans("TicketReadOn").''; - print dol_print_date($object->dao->date_read, 'dayhour'); - print '
'.$langs->trans("TicketReadOn").''; + print dol_print_date($object->dao->date_read, 'dayhour'); + print '
'.$langs->trans("TicketCloseOn").''; - print dol_print_date($object->dao->date_close, 'dayhour'); - print '
'.$langs->trans("TicketCloseOn").''; + print dol_print_date($object->dao->date_close, 'dayhour'); + print '
'.$langs->trans("AssignedTo").''; - if ($object->dao->fk_user_assign > 0) { - $fuser = new User($db); - $fuser->fetch($object->dao->fk_user_assign); - print $fuser->getFullName($langs, 1); - } - print '
'.$langs->trans("AssignedTo").''; + if ($object->dao->fk_user_assign > 0) { + $fuser = new User($db); + $fuser->fetch($object->dao->fk_user_assign); + print $fuser->getFullName($langs, 1); + } + print '
'.$langs->trans("Progression").''; - print ($object->dao->progress > 0 ? $object->dao->progress : '0').'%'; - print '
'.$langs->trans("Progression").''; + print ($object->dao->progress > 0 ? $object->dao->progress : '0').'%'; + print '
'; + print ''; - print '
'; + print '
'; - print '
'; + print '
'; - if ($action == 'presend') { - print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket'); + if ($action == 'presend') { + print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket'); - $formticket = new FormTicket($db); + $formticket = new FormTicket($db); - $formticket->action = "add_message"; - $formticket->track_id = $object->dao->track_id; - $formticket->id = $object->dao->id; + $formticket->action = "add_message"; + $formticket->track_id = $object->dao->track_id; + $formticket->id = $object->dao->id; - $formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1', 'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php'); + $formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1', 'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php'); - $formticket->withfile = 2; - $formticket->withcancel = 1; + $formticket->withfile = 2; + $formticket->withcancel = 1; - $formticket->showMessageForm('100%'); - } + $formticket->showMessageForm('100%'); + } - if ($action != 'presend') { - print ''; - print ''; - print ''; - print ''; - print ''; - //print ''; - print "\n"; + if ($action != 'presend') { + print '
'; + print ''; + print ''; + print ''; + print ''; + //print ''; + print "
\n"; - print '
'; + print '
'; - // List ticket - print ''; + // List ticket + print ''; - if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) { - // New message - print ''; + if ($object->dao->fk_statut < Ticket::STATUS_CLOSED) { + // New message + print ''; - // Close ticket - if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { - print ''; - } - } + // Close ticket + if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { + print ''; + } + } - print '
'; - } + print '
'; + } - // Message list - print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket'); - $object->viewTicketMessages(false, true, $object->dao); - } - else - { - print ''; - } + // Message list + print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket'); + $object->viewTicketMessages(false, true, $object->dao); + } + else + { + print ''; + } } else { - print '
'.$langs->trans("TicketPublicMsgViewLogIn").'
'; + print '
'.$langs->trans("TicketPublicMsgViewLogIn").'
'; - print '
'; - print '
'; - print ''; - print ''; + print '
'; + print ''; + print ''; + print ''; - print '

'; - print ''; - print '

'; + print '

'; + print ''; + print '

'; - print '

'; - print ''; - print '

'; + print '

'; + print ''; + print '

'; - print '

'; - print ''; - print "

\n"; + print '

'; + print ''; + print "

\n"; - print "\n"; - print "
\n"; + print "\n"; + print "
\n"; } print "
"; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 7b2ce169d33..f370c9ed9cf 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -74,7 +74,7 @@ $pagenext = $page + 1; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $contextpage = 'receptionlist'; -$viewstatut = GETPOST('viewstatut'); +$search_status = GETPOST('search_status'); $object = new Reception($db); @@ -149,7 +149,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_country = ''; $search_type_thirdparty = ''; $search_billed = ''; - $viewstatut = ''; + $search_status = ''; $search_array_options = array(); } @@ -453,8 +453,8 @@ if ($socid) { $sql .= " AND e.fk_soc = ".$socid; } -if ($viewstatut <> '' && $viewstatut >= 0) { - $sql .= " AND e.fk_statut = ".$viewstatut; +if ($search_status <> '' && $search_status >= 0) { + $sql .= " AND e.fk_statut = ".$search_status; } if ($search_billed != '' && $search_billed >= 0) $sql .= ' AND e.billed = '.$search_billed; if ($search_town) $sql .= natural_search('s.town', $search_town); @@ -519,7 +519,7 @@ if ($resql) if ($search_town) $param .= "&search_town=".$search_town; if ($search_zip) $param .= "&search_zip=".$search_zip; if ($search_state) $param .= "&search_state=".$search_state; - if ($viewstatut) $param .= "&viewstatut=".$viewstatut; + if ($search_status) $param .= "&search_status=".$search_status; if ($search_country) $param .= "&search_country=".$search_country; if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".$search_type_thirdparty; if ($search_ref_supplier) $param .= "&search_ref_supplier=".$search_ref_supplier; @@ -716,7 +716,7 @@ if ($resql) if (!empty($arrayfields['e.fk_statut']['checked'])) { print ''; - print $form->selectarray('viewstatut', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $viewstatut, 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('StatusReceptionDraftShort'), '1'=>$langs->trans('StatusReceptionValidatedShort'), '2'=>$langs->trans('StatusReceptionProcessedShort')), $search_status, 1); print ''; } // Status billed diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index d8efc00f85e..bfaed41f21b 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -108,13 +108,14 @@ class Contacts extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $thirdparty_ids Thirdparty ids to filter contacts of (example '1' or '1,2,3') {@pattern /^[0-9,]*$/i} + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @param int $includecount Count and return also number of elements the contact is used as a link for * @return array Array of contact objects * * @throws RestException */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $includecount = 0) + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $category = 0, $sqlfilters = '', $includecount = 0) { global $db, $conf; @@ -135,6 +136,9 @@ class Contacts extends DolibarrApi $sql = "SELECT t.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; + if ($category > 0) { + $sql .= ", ".MAIN_DB_PREFIX."categorie_contact as c"; + } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as te ON te.fk_object = t.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) { // We need this table joined to the select in order to filter by sale @@ -153,6 +157,13 @@ class Contacts extends DolibarrApi { $sql .= " AND sc.fk_user = ".$search_sale; } + + // Select contacts of given category + if ($category > 0) { + $sql .= " AND c.fk_categorie = ".$db->escape($category); + $sql .= " AND c.fk_socpeople = t.rowid "; + } + // Add sql filters if ($sqlfilters) { diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 5206e345193..1100432c854 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -107,10 +107,11 @@ class Thirdparties extends DolibarrApi * Set to 2 to show only prospects * Set to 3 to show only those are not customer neither prospect * Set to 4 to show only suppliers + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.nom:like:'TheCompany%') and (t.date_creation:<:'20160101')" * @return array Array of thirdparty objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $mode = 0, $category = 0, $sqlfilters = '') { global $db; @@ -126,15 +127,27 @@ class Thirdparties extends DolibarrApi $sql = "SELECT t.rowid"; if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) $sql .= " FROM ".MAIN_DB_PREFIX."societe as t"; - + if ($category > 0) { + if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c"; + if (!in_array($mode, array(1,2,3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc"; + } if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st"; - $sql .= " WHERE t.fk_stcomm = st.id"; + $sql .= " WHERE t.entity IN ('.getEntity('societe').')"; + $sql .= " AND t.fk_stcomm = st.id"; + if ($mode == 1) $sql .= " AND t.client IN (1, 3)"; if ($mode == 2) $sql .= " AND t.client IN (2, 3)"; if ($mode == 3) $sql .= " AND t.client IN (0)"; if ($mode == 4) $sql .= " AND t.fournisseur IN (1)"; - $sql .= ' AND t.entity IN ('.getEntity('societe').')'; + + // Select thirdparties of given category + if ($category > 0) { + if (!empty($mode) && $mode != 4) { $sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_soc = t.rowid"; } + elseif (!empty($mode) && $mode == 4) { $sql .= " AND cc.fk_categorie = ".$db->escape($category)." AND cc.fk_soc = t.rowid"; } + else { $sql .= " AND ((c.fk_categorie = ".$db->escape($category)." AND c.fk_soc = t.rowid) OR (cc.fk_categorie = ".$db->escape($category)." AND cc.fk_soc = t.rowid))"; } + } + if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; //if ($email != NULL) $sql.= " AND s.email = \"".$email."\""; if ($socids) $sql .= " AND t.rowid IN (".$socids.")"; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 21c7ea4c6dc..19c36bcaa22 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2321,7 +2321,7 @@ class SupplierProposal extends CommonObject $response->warning_delay = $delay_warning / 60 / 60 / 24; $response->label = $label; $response->labelShort = $labelShort; - $response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?viewstatut='.$status; + $response->url = DOL_URL_ROOT.'/supplier_proposal/list.php?search_status='.$status; $response->img = img_object('', "propal"); // This assignment in condition is not a bug. It allows walking the results. diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index b0c589010aa..e337f11dfe9 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -332,7 +332,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa { print '
'; print ''; - print ''; + print ''; $nbofloop = min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD) ? 500 : $conf->global->MAIN_MAXLIST_OVERLOAD)); while ($i < $nbofloop) diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index eaae3be5e84..c778536685e 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -73,7 +73,8 @@ $search_multicurrency_tx = GETPOST('search_multicurrency_tx', 'alpha'); $search_multicurrency_montant_ht = GETPOST('search_multicurrency_montant_ht', 'alpha'); $search_multicurrency_montant_vat = GETPOST('search_multicurrency_montant_vat', 'alpha'); $search_multicurrency_montant_ttc = GETPOST('search_multicurrency_montant_ttc', 'alpha'); -$search_status = GETPOST('viewstatut', 'alpha') ?GETPOST('viewstatut', 'alpha') : GETPOST('search_status', 'int'); +$search_status = GETPOST('search_status', 'int'); + $object_statut = $db->escape(GETPOST('supplier_proposal_statut')); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 561a491f1d1..dbdb15bfedc 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -31,14 +31,14 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; if (!empty($conf->projet->enabled)) { - include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; } if (!empty($conf->contrat->enabled)) { - include_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formcontract.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formcontract.class.php'; } // Load translation files required by the page @@ -127,422 +127,422 @@ if ($cancel) } if (GETPOST('add', 'alpha') && $user->rights->ticket->write) { - $error = 0; + $error = 0; - if (!GETPOST("subject", 'alpha')) { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")), null, 'errors'); - $action = 'create'; - } elseif (!GETPOST("message", 'alpha')) { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors'); - $action = 'create'; - } + if (!GETPOST("subject", 'alpha')) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")), null, 'errors'); + $action = 'create'; + } elseif (!GETPOST("message", 'alpha')) { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Message")), null, 'errors'); + $action = 'create'; + } - if (!$error) { - $db->begin(); + if (!$error) { + $db->begin(); - $object->ref = GETPOST("ref", 'alpha'); - $object->fk_soc = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0; - $object->subject = GETPOST("subject", 'alpha'); - $object->message = GETPOST("message", 'none'); + $object->ref = GETPOST("ref", 'alpha'); + $object->fk_soc = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0; + $object->subject = GETPOST("subject", 'alpha'); + $object->message = GETPOST("message", 'none'); - $object->type_code = GETPOST("type_code", 'alpha'); - $object->category_code = GETPOST("category_code", 'alpha'); - $object->severity_code = GETPOST("severity_code", 'alpha'); - $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); - $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1; + $object->type_code = GETPOST("type_code", 'alpha'); + $object->category_code = GETPOST("category_code", 'alpha'); + $object->severity_code = GETPOST("severity_code", 'alpha'); + $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); + $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1; - $object->fk_project = GETPOST('projectid', 'int'); + $object->fk_project = GETPOST('projectid', 'int'); - $ret = $extrafields->setOptionalsFromPost(null, $object); + $ret = $extrafields->setOptionalsFromPost(null, $object); - $id = $object->create($user); - if ($id <= 0) { - $error++; - setEventMessage($object->error, $object->errors, 'errors'); - $action = 'create'; - } + $id = $object->create($user); + if ($id <= 0) { + $error++; + setEventMessage($object->error, $object->errors, 'errors'); + $action = 'create'; + } - if (!$error) - { - // Add contact - $contactid = GETPOST('contactid', 'int'); - $type_contact = GETPOST("type", 'alpha'); + if (!$error) + { + // Add contact + $contactid = GETPOST('contactid', 'int'); + $type_contact = GETPOST("type", 'alpha'); - if ($contactid > 0 && $type_contact) { - $result = $object->add_contact($contactid, GETPOST("type"), 'external'); - } + if ($contactid > 0 && $type_contact) { + $result = $object->add_contact($contactid, GETPOST("type"), 'external'); + } - // altairis: link ticket to project - if (GETPOST('projectid') > 0) { - $object->setProject(GETPOST('projectid')); - } + // altairis: link ticket to project + if (GETPOST('projectid') > 0) { + $object->setProject(GETPOST('projectid')); + } - // Auto assign user - if ($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE) { - $result = $object->assignUser($user, $user->id, 1); - $object->add_contact($user->id, "SUPPORTTEC", 'internal'); - } + // Auto assign user + if ($conf->global->TICKET_AUTO_ASSIGN_USER_CREATE) { + $result = $object->assignUser($user, $user->id, 1); + $object->add_contact($user->id, "SUPPORTTEC", 'internal'); + } - // Auto assign contrat - $contractid = 0; - if ($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE) { - $contrat = new Contrat($db); - $contrat->socid = $object->fk_soc; - $list = $contrat->getListOfContracts(); + // Auto assign contrat + $contractid = 0; + if ($conf->global->TICKET_AUTO_ASSIGN_CONTRACT_CREATE) { + $contrat = new Contrat($db); + $contrat->socid = $object->fk_soc; + $list = $contrat->getListOfContracts(); - if (is_array($list) && !empty($list)) { - if (count($list) == 1) { - $contractid = $list[0]->id; - $object->setContract($contractid); - } else { - } - } - } + if (is_array($list) && !empty($list)) { + if (count($list) == 1) { + $contractid = $list[0]->id; + $object->setContract($contractid); + } else { + } + } + } - // Auto create fiche intervention - if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE) - { - $fichinter = new Fichinter($db); - $fichinter->socid = $object->fk_soc; - $fichinter->fk_project = GETPOST('projectid', 'int'); - $fichinter->fk_contrat = $contractid; - $fichinter->author = $user->id; - $fichinter->modelpdf = 'soleil'; - $fichinter->origin = $object->element; - $fichinter->origin_id = $object->id; + // Auto create fiche intervention + if ($conf->global->TICKET_AUTO_CREATE_FICHINTER_CREATE) + { + $fichinter = new Fichinter($db); + $fichinter->socid = $object->fk_soc; + $fichinter->fk_project = GETPOST('projectid', 'int'); + $fichinter->fk_contrat = $contractid; + $fichinter->author = $user->id; + $fichinter->modelpdf = 'soleil'; + $fichinter->origin = $object->element; + $fichinter->origin_id = $object->id; - // Extrafields - $extrafields->fetch_name_optionals_label($fichinter->table_element); - $array_options = $extrafields->getOptionalsFromPost($fichinter->table_element); - $fichinter->array_options = $array_options; + // Extrafields + $extrafields->fetch_name_optionals_label($fichinter->table_element); + $array_options = $extrafields->getOptionalsFromPost($fichinter->table_element); + $fichinter->array_options = $array_options; - $id = $fichinter->create($user); - if ($id <= 0) { - setEventMessages($fichinter->error, null, 'errors'); - } - } - } + $id = $fichinter->create($user); + if ($id <= 0) { + setEventMessages($fichinter->error, null, 'errors'); + } + } + } - if (!$error) - { - // File transfer - $object->copyFilesForTicket(); - } + if (!$error) + { + // File transfer + $object->copyFilesForTicket(); + } - if (!$error) - { - $db->commit(); + if (!$error) + { + $db->commit(); - if (!empty($backtopage)) { - $url = $backtopage; - } else { - $url = 'card.php?track_id='.$object->track_id; - } + if (!empty($backtopage)) { + $url = $backtopage; + } else { + $url = 'card.php?track_id='.$object->track_id; + } - header("Location: ".$url); - exit; - } else { - $db->rollback(); - setEventMessages($object->error, $object->errors, 'errors'); - } - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } + header("Location: ".$url); + exit; + } else { + $db->rollback(); + setEventMessages($object->error, $object->errors, 'errors'); + } + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } } if ($action == 'edit' && $user->rights->ticket->write) { - $error = 0; + $error = 0; - if ($object->fetch(GETPOST('id', 'int')) < 0) { - $error++; - array_push($object->errors, $langs->trans("ErrorTicketIsNotValid")); - $_GET["action"] = $_POST["action"] = ''; - } + if ($object->fetch(GETPOST('id', 'int')) < 0) { + $error++; + array_push($object->errors, $langs->trans("ErrorTicketIsNotValid")); + $_GET["action"] = $_POST["action"] = ''; + } } if (GETPOST('update', 'alpha') && GETPOST('id', 'int') && $user->rights->ticket->write) { - $error = 0; + $error = 0; - $ret = $object->fetch(GETPOST('id', 'int')); - if ($ret < 0) { - $error++; - array_push($object->errors, $langs->trans("ErrorTicketIsNotValid")); - $action = ''; - } elseif (!GETPOST("label")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"))); - $action = 'edit'; - } elseif (!GETPOST("subject")) { - $error++; - array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); - $action = 'edit'; - } + $ret = $object->fetch(GETPOST('id', 'int')); + if ($ret < 0) { + $error++; + array_push($object->errors, $langs->trans("ErrorTicketIsNotValid")); + $action = ''; + } elseif (!GETPOST("label")) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Label"))); + $action = 'edit'; + } elseif (!GETPOST("subject")) { + $error++; + array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject"))); + $action = 'edit'; + } - if (!$error) { - $db->begin(); + if (!$error) { + $db->begin(); - $object->label = GETPOST("label", 'alphanohtml'); - $object->description = GETPOST("description", 'none'); + $object->label = GETPOST("label", 'alphanohtml'); + $object->description = GETPOST("description", 'none'); - //... - $ret = $object->update($user); - if ($ret <= 0) { - $error++; - setEventMessage($object->error, $object->errors, 'errors'); - $action = 'edit'; - } + //... + $ret = $object->update($user); + if ($ret <= 0) { + $error++; + setEventMessage($object->error, $object->errors, 'errors'); + $action = 'edit'; + } - if (!$error && $ret > 0) { - $db->commit(); - } else { - $db->rollback(); - } - } + if (!$error && $ret > 0) { + $db->commit(); + } else { + $db->rollback(); + } + } } // Mark as Read if ($action == "mark_ticket_read" && $user->rights->ticket->write) { - $object->fetch('', '', GETPOST("track_id", 'alpha')); + $object->fetch('', '', GETPOST("track_id", 'alpha')); - if ($object->markAsRead($user) > 0) - { - setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs'); + if ($object->markAsRead($user) > 0) + { + setEventMessages($langs->trans('TicketMarkedAsRead'), null, 'mesgs'); - header("Location: card.php?track_id=".$object->track_id."&action=view"); - exit; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - } - $action = 'view'; + header("Location: card.php?track_id=".$object->track_id."&action=view"); + exit; + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + $action = 'view'; } // Assign to someone if ($action == "assign_user" && GETPOST('btn_assign_user', 'alpha') && $user->rights->ticket->write) { - $object->fetch('', '', GETPOST("track_id", 'alpha')); - $useroriginassign = $object->fk_user_assign; - $usertoassign = GETPOST('fk_user_assign', 'int'); + $object->fetch('', '', GETPOST("track_id", 'alpha')); + $useroriginassign = $object->fk_user_assign; + $usertoassign = GETPOST('fk_user_assign', 'int'); - /*if (! ($usertoassign > 0)) { + /*if (! ($usertoassign > 0)) { $error++; array_push($object->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("AssignedTo"))); $action = 'view'; }*/ - if (!$error) - { - $ret = $object->assignUser($user, $usertoassign); - if ($ret < 0) $error++; - } + if (!$error) + { + $ret = $object->assignUser($user, $usertoassign); + if ($ret < 0) $error++; + } - if (!$error) // Update list of contacts - { - // Si déjà un user assigné on le supprime des contacts - if ($useroriginassign > 0) { - $internal_contacts = $object->listeContact(-1, 'internal'); + if (!$error) // Update list of contacts + { + // Si déjà un user assigné on le supprime des contacts + if ($useroriginassign > 0) { + $internal_contacts = $object->listeContact(-1, 'internal'); - foreach ($internal_contacts as $key => $contact) { - if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) { - } - { - //print "user à effacer : ".$useroriginassign; - $object->delete_contact($contact['rowid']); - } - } - } + foreach ($internal_contacts as $key => $contact) { + if ($contact['code'] == "SUPPORTTEC" && $contact['id'] == $useroriginassign) { + } + { + //print "user à effacer : ".$useroriginassign; + $object->delete_contact($contact['rowid']); + } + } + } - if ($usertoassign > 0) $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0); - } + if ($usertoassign > 0) $object->add_contact($usertoassign, "SUPPORTTEC", 'internal', $notrigger = 0); + } - if (!$error) - { - // Log action in ticket logs table - $object->fetch_user($usertoassign); - $log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs)); + if (!$error) + { + // Log action in ticket logs table + $object->fetch_user($usertoassign); + $log_action = $langs->trans('TicketLogAssignedTo', $object->user->getFullName($langs)); - setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs'); + setEventMessages($langs->trans('TicketAssigned'), null, 'mesgs'); - header("Location: card.php?track_id=".$object->track_id."&action=view"); - exit; - } else { - array_push($object->errors, $object->error); - } - $action = 'view'; + header("Location: card.php?track_id=".$object->track_id."&action=view"); + exit; + } else { + array_push($object->errors, $object->error); + } + $action = 'view'; } if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $user->rights->ticket->read) { - $ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "on" ? 1 : 0)); + $ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "on" ? 1 : 0)); - if ($ret > 0) { - if (!empty($backtopage)) { - $url = $backtopage; - } else { - $url = 'card.php?action=view&track_id='.$object->track_id; - } + if ($ret > 0) { + if (!empty($backtopage)) { + $url = $backtopage; + } else { + $url = 'card.php?action=view&track_id='.$object->track_id; + } - header("Location: ".$url); - exit; - } else { - setEventMessages($object->error, null, 'errors'); - $action = 'presend'; - } + header("Location: ".$url); + exit; + } else { + setEventMessages($object->error, null, 'errors'); + $action = 'presend'; + } } if ($action == "confirm_close" && GETPOST('confirm', 'alpha') == 'yes' && $user->rights->ticket->write) { - $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); + $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); - if ($object->close($user)) { - setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs'); + if ($object->close($user)) { + setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs'); - $url = 'card.php?action=view&track_id='.GETPOST('track_id', 'alpha'); - header("Location: ".$url); - } else { - $action = ''; - setEventMessages($object->error, $object->errors, 'errors'); - } + $url = 'card.php?action=view&track_id='.GETPOST('track_id', 'alpha'); + header("Location: ".$url); + } else { + $action = ''; + setEventMessages($object->error, $object->errors, 'errors'); + } } if ($action == "confirm_public_close" && GETPOST('confirm', 'alpha') == 'yes') { - $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); - if ($_SESSION['email_customer'] == $object->origin_email || $_SESSION['email_customer'] == $object->thirdparty->email) { - $object->close($user); + $object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')); + if ($_SESSION['email_customer'] == $object->origin_email || $_SESSION['email_customer'] == $object->thirdparty->email) { + $object->close($user); - // Log action in ticket logs table - $log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']); + // Log action in ticket logs table + $log_action = $langs->trans('TicketLogClosedBy', $_SESSION['email_customer']); - setEventMessages('
'.$langs->trans('TicketMarkedAsClosed').'
', null, 'mesgs'); + setEventMessages('
'.$langs->trans('TicketMarkedAsClosed').'
', null, 'mesgs'); - $url = 'card.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha'); - header("Location: ".$url); - } else { - setEventMessages($object->error, $object->errors, 'errors'); - $action = ''; - } + $url = 'card.php?action=view_ticket&track_id='.GETPOST('track_id', 'alpha'); + header("Location: ".$url); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + $action = ''; + } } if ($action == 'confirm_delete_ticket' && GETPOST('confirm', 'alpha') == "yes" && $user->rights->ticket->delete) { - if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { - if ($object->delete($user) > 0) { - setEventMessages('
'.$langs->trans('TicketDeletedSuccess').'
', null, 'mesgs'); - Header("Location: ".DOL_URL_ROOT."/ticket/list.php"); - exit; - } else { - $langs->load("errors"); - $mesg = '
'.$langs->trans($object->error).'
'; - $action = ''; - } - } + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + if ($object->delete($user) > 0) { + setEventMessages('
'.$langs->trans('TicketDeletedSuccess').'
', null, 'mesgs'); + Header("Location: ".DOL_URL_ROOT."/ticket/list.php"); + exit; + } else { + $langs->load("errors"); + $mesg = '
'.$langs->trans($object->error).'
'; + $action = ''; + } + } } // Set parent company if ($action == 'set_thirdparty' && $user->rights->societe->creer) { - if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { - $result = $object->setCustomer(GETPOST('editcustomer', 'int')); - $url = 'card.php?action=view&track_id='.GETPOST('track_id', 'alpha'); - header("Location: ".$url); - exit(); - } + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $result = $object->setCustomer(GETPOST('editcustomer', 'int')); + $url = 'card.php?action=view&track_id='.GETPOST('track_id', 'alpha'); + header("Location: ".$url); + exit(); + } } if ($action == 'set_progression' && $user->rights->ticket->write) { - if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { - $result = $object->setProgression(GETPOST('progress', 'alpha')); + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $result = $object->setProgression(GETPOST('progress', 'alpha')); - $url = 'card.php?action=view&track_id='.$object->track_id; - header("Location: ".$url); - exit(); - } + $url = 'card.php?action=view&track_id='.$object->track_id; + header("Location: ".$url); + exit(); + } } if ($action == 'setsubject') { - if ($object->fetch(GETPOST('id', 'int'))) { - if ($action == 'setsubject') { - $object->subject = trim(GETPOST('subject', 'alpha')); - } + if ($object->fetch(GETPOST('id', 'int'))) { + if ($action == 'setsubject') { + $object->subject = trim(GETPOST('subject', 'alpha')); + } - if ($action == 'setsubject' && empty($object->subject)) { - $mesg .= ($mesg ? '
' : '').$langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")); - } + if ($action == 'setsubject' && empty($object->subject)) { + $mesg .= ($mesg ? '
' : '').$langs->trans("ErrorFieldRequired", $langs->transnoentities("Subject")); + } - if (!$mesg) { - if ($object->update($user) >= 0) { - header("Location: ".$_SERVER['PHP_SELF']."?track_id=".$object->track_id); - exit; - } - $mesg = $object->error; - } - } + if (!$mesg) { + if ($object->update($user) >= 0) { + header("Location: ".$_SERVER['PHP_SELF']."?track_id=".$object->track_id); + exit; + } + $mesg = $object->error; + } + } } if ($action == 'confirm_reopen' && $user->rights->ticket->manage && !GETPOST('cancel')) { - if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { - // prevent browser refresh from reopening ticket several times - if ($object->fk_statut == Ticket::STATUS_CLOSED) { - $res = $object->setStatut(Ticket::STATUS_ASSIGNED); - if ($res) { - // Log action in ticket logs table - $log_action = $langs->trans('TicketLogReopen'); + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + // prevent browser refresh from reopening ticket several times + if ($object->fk_statut == Ticket::STATUS_CLOSED) { + $res = $object->setStatut(Ticket::STATUS_ASSIGNED); + if ($res) { + // Log action in ticket logs table + $log_action = $langs->trans('TicketLogReopen'); - $url = 'card.php?action=view&track_id='.$object->track_id; - header("Location: ".$url); - exit(); - } - } - } + $url = 'card.php?action=view&track_id='.$object->track_id; + header("Location: ".$url); + exit(); + } + } + } } // Categorisation dans projet elseif ($action == 'classin' && $user->rights->ticket->write) { - if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { - $object->setProject(GETPOST('projectid', 'int')); - $url = 'card.php?action=view&track_id='.$object->track_id; - header("Location: ".$url); - exit(); - } + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $object->setProject(GETPOST('projectid', 'int')); + $url = 'card.php?action=view&track_id='.$object->track_id; + header("Location: ".$url); + exit(); + } } // Categorisation dans contrat elseif ($action == 'setcontract' && $user->rights->ticket->write) { - if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { - $object->setContract(GETPOST('contractid', 'int')); - $url = 'card.php?action=view&track_id='.$object->track_id; - header("Location: ".$url); - exit(); - } + if ($object->fetch(GETPOST('id', 'int'), '', GETPOST('track_id', 'alpha')) >= 0) { + $object->setContract(GETPOST('contractid', 'int')); + $url = 'card.php?action=view&track_id='.$object->track_id; + header("Location: ".$url); + exit(); + } } elseif ($action == "set_message" && $user->rights->ticket->manage) { - // altairis: manage cancel button - if (!GETPOST('cancel')) { - $object->fetch('', '', GETPOST('track_id', 'alpha')); - $oldvalue_message = $object->message; - $fieldtomodify = GETPOST('message_initial'); + // altairis: manage cancel button + if (!GETPOST('cancel')) { + $object->fetch('', '', GETPOST('track_id', 'alpha')); + $oldvalue_message = $object->message; + $fieldtomodify = GETPOST('message_initial'); - $object->message = $fieldtomodify; - $ret = $object->update($user); - if ($ret > 0) { - $log_action = $langs->trans('TicketInitialMessageModified')." \n"; - // include the Diff class - dol_include_once('/ticket/class/utils_diff.class.php'); - // output the result of comparing two files as plain text - $log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message))); + $object->message = $fieldtomodify; + $ret = $object->update($user); + if ($ret > 0) { + $log_action = $langs->trans('TicketInitialMessageModified')." \n"; + // include the Diff class + dol_include_once('/ticket/class/utils_diff.class.php'); + // output the result of comparing two files as plain text + $log_action .= Diff::toString(Diff::compare(strip_tags($oldvalue_message), strip_tags($object->message))); - setEventMessages($langs->trans('TicketMessageSuccesfullyUpdated'), null, 'mesgs'); - } - } + setEventMessages($langs->trans('TicketMessageSuccesfullyUpdated'), null, 'mesgs'); + } + } - $action = 'view'; + $action = 'view'; } // Reopen ticket elseif ($action == 'confirm_set_status' && $user->rights->ticket->write && !GETPOST('cancel')) { - if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { - $new_status = GETPOST('new_status', 'int'); - $old_status = $object->fk_statut; - $res = $object->setStatut($new_status); - if ($res) { - // Log action in ticket logs table - $log_action = $langs->trans('TicketLogStatusChanged', $langs->transnoentities($object->statuts_short[$old_status]), $langs->transnoentities($object->statuts_short[$new_status])); + if ($object->fetch(GETPOST('id', 'int'), GETPOST('track_id', 'alpha')) >= 0) { + $new_status = GETPOST('new_status', 'int'); + $old_status = $object->fk_statut; + $res = $object->setStatut($new_status); + if ($res) { + // Log action in ticket logs table + $log_action = $langs->trans('TicketLogStatusChanged', $langs->transnoentities($object->statuts_short[$old_status]), $langs->transnoentities($object->statuts_short[$new_status])); - $url = 'card.php?action=view&track_id='.$object->track_id; - header("Location: ".$url); - exit(); - } - } + $url = 'card.php?action=view&track_id='.$object->track_id; + header("Location: ".$url); + exit(); + } + } } // Action to update one extrafield @@ -619,544 +619,544 @@ llxHeader('', $page_title, $help_url); if ($action == 'create' || $action == 'presend') { - $formticket = new FormTicket($db); + $formticket = new FormTicket($db); - print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); + print load_fiche_titre($langs->trans('NewTicket'), '', 'ticket'); - $formticket->withfromsocid = $socid ? $socid : $user->socid; - $formticket->withfromcontactid = $contactid ? $contactid : ''; - $formticket->withtitletopic = 1; - $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : 0); - $formticket->withusercreate = 1; - $formticket->withref = 1; - $formticket->fk_user_create = $user->id; - $formticket->withfile = 2; - $formticket->withextrafields = 1; - $formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid')); - if (empty($defaultref)) { - $defaultref = ''; - } + $formticket->withfromsocid = $socid ? $socid : $user->socid; + $formticket->withfromcontactid = $contactid ? $contactid : ''; + $formticket->withtitletopic = 1; + $formticket->withnotifytiersatcreate = ($notifyTiers ? 1 : 0); + $formticket->withusercreate = 1; + $formticket->withref = 1; + $formticket->fk_user_create = $user->id; + $formticket->withfile = 2; + $formticket->withextrafields = 1; + $formticket->param = array('origin' => GETPOST('origin'), 'originid' => GETPOST('originid')); + if (empty($defaultref)) { + $defaultref = ''; + } - $formticket->showForm(1, 'create'); + $formticket->showForm(1, 'create'); } if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'presend' || $action == 'presend_addmessage' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { - if ($res > 0) - { - // or for unauthorized internals users - if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { - accessforbidden('', 0, 1); - } + if ($res > 0) + { + // or for unauthorized internals users + if (!$user->socid && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { + accessforbidden('', 0, 1); + } - // Confirmation close - if ($action == 'close') { - print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", '', '', 1); - if ($ret == 'html') { - print '
'; - } - } - // Confirmation delete - if ($action == 'delete') { - print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("Delete"), $langs->trans("ConfirmDeleteTicket"), "confirm_delete_ticket", '', '', 1); - } - // Confirm reopen - if ($action == 'reopen') { - print $form->formconfirm($url_page_current.'?track_id='.$object->track_id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenTicket'), 'confirm_reopen', '', '', 1); - } - // Confirmation status change - if ($action == 'set_status') { - $new_status = GETPOST('new_status'); - //var_dump($url_page_current . "?track_id=" . $object->track_id); - print $form->formconfirm($url_page_current."?track_id=".$object->track_id."&new_status=".GETPOST('new_status'), $langs->trans("TicketChangeStatus"), $langs->trans("TicketConfirmChangeStatus", $langs->transnoentities($object->statuts_short[$new_status])), "confirm_set_status", '', '', 1); - } + // Confirmation close + if ($action == 'close') { + print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", '', '', 1); + if ($ret == 'html') { + print '
'; + } + } + // Confirmation delete + if ($action == 'delete') { + print $form->formconfirm($url_page_current."?track_id=".$object->track_id, $langs->trans("Delete"), $langs->trans("ConfirmDeleteTicket"), "confirm_delete_ticket", '', '', 1); + } + // Confirm reopen + if ($action == 'reopen') { + print $form->formconfirm($url_page_current.'?track_id='.$object->track_id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenTicket'), 'confirm_reopen', '', '', 1); + } + // Confirmation status change + if ($action == 'set_status') { + $new_status = GETPOST('new_status'); + //var_dump($url_page_current . "?track_id=" . $object->track_id); + print $form->formconfirm($url_page_current."?track_id=".$object->track_id."&new_status=".GETPOST('new_status'), $langs->trans("TicketChangeStatus"), $langs->trans("TicketConfirmChangeStatus", $langs->transnoentities($object->statuts_short[$new_status])), "confirm_set_status", '', '', 1); + } - // project info - if ($projectid) { - $projectstat = new Project($db); - if ($projectstat->fetch($projectid) > 0) { - $projectstat->fetch_thirdparty(); + // project info + if ($projectid) { + $projectstat = new Project($db); + if ($projectstat->fetch($projectid) > 0) { + $projectstat->fetch_thirdparty(); - // To verify role of users - //$userAccess = $object->restrictedProjectArea($user,'read'); - $userWrite = $projectstat->restrictedProjectArea($user, 'write'); - //$userDelete = $object->restrictedProjectArea($user,'delete'); - //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; + // To verify role of users + //$userAccess = $object->restrictedProjectArea($user,'read'); + $userWrite = $projectstat->restrictedProjectArea($user, 'write'); + //$userDelete = $object->restrictedProjectArea($user,'delete'); + //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; - $head = project_prepare_head($projectstat); - dol_fiche_head($head, 'ticket', $langs->trans("Project"), 0, ($projectstat->public ? 'projectpub' : 'project')); + $head = project_prepare_head($projectstat); + dol_fiche_head($head, 'ticket', $langs->trans("Project"), 0, ($projectstat->public ? 'projectpub' : 'project')); - /* + /* * Projet synthese pour rappel */ - print '
'.$langs->trans("RequestsOpened").' '.$num.'
'.$langs->trans("RequestsOpened").' '.$num.'
'; + print '
'; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; - // Ref - print ''; + // Ref + print ''; - // Label - print ''; + // Label + print ''; - // Customer - print ""; - print '"; + print ''; + print ''; - // Visibility - print ''; + print ''; - // Statut - print ''; + // Statut + print ''; - print "
'.$langs->trans('Ref').''; - // Define a complementary filter for search of next/prev ref. - if (!$user->rights->projet->all->lire) { - $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0); - $projectstat->next_prev_filter = " rowid in (".(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; - } - print $form->showrefnav($projectstat, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
'.$langs->trans('Ref').''; + // Define a complementary filter for search of next/prev ref. + if (!$user->rights->projet->all->lire) { + $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0); + $projectstat->next_prev_filter = " rowid in (".(count($objectsListId) ? join(',', array_keys($objectsListId)) : '0').")"; + } + print $form->showrefnav($projectstat, 'ref', $linkback, 1, 'ref', 'ref', ''); + print '
'.$langs->trans("Label").''.$projectstat->title.'
'.$langs->trans("Label").''.$projectstat->title.'
".$langs->trans("ThirdParty")."'; - if ($projectstat->thirdparty->id > 0) { - print $projectstat->thirdparty->getNomUrl(1); - } else { - print ' '; - } + // Customer + print "
".$langs->trans("ThirdParty")."'; + if ($projectstat->thirdparty->id > 0) { + print $projectstat->thirdparty->getNomUrl(1); + } else { + print ' '; + } - print '
'.$langs->trans("Visibility").''; - if ($projectstat->public) { - print $langs->trans('SharedProject'); - } else { - print $langs->trans('PrivateProject'); - } + // Visibility + print '
'.$langs->trans("Visibility").''; + if ($projectstat->public) { + print $langs->trans('SharedProject'); + } else { + print $langs->trans('PrivateProject'); + } - print '
'.$langs->trans("Status").''.$projectstat->getLibStatut(4).'
'.$langs->trans("Status").''.$projectstat->getLibStatut(4).'
"; + print ""; - print '
'; - } else { - print "ErrorRecordNotFound"; - } - } elseif ($socid > 0) { - $object->fetch_thirdparty(); - $head = societe_prepare_head($object->thirdparty); + print '
'; + } else { + print "ErrorRecordNotFound"; + } + } elseif ($socid > 0) { + $object->fetch_thirdparty(); + $head = societe_prepare_head($object->thirdparty); - dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company'); + dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($object->thirdparty, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom'); - dol_fiche_end(); - } + dol_fiche_end(); + } - if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { - $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; - } elseif ($user->socid > 0) { - $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; - } + if (!$user->socid && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { + $object->next_prev_filter = "te.fk_user_assign = '".$user->id."'"; + } elseif ($user->socid > 0) { + $object->next_prev_filter = "te.fk_soc = '".$user->socid."'"; + } - $head = ticket_prepare_head($object); + $head = ticket_prepare_head($object); - dol_fiche_head($head, 'tabTicket', $langs->trans("Ticket"), -1, 'ticket'); + dol_fiche_head($head, 'tabTicket', $langs->trans("Ticket"), -1, 'ticket'); - $morehtmlref = '
'; - $morehtmlref .= $object->subject; - // Author - if ($object->fk_user_create > 0) { - $morehtmlref .= '
'.$langs->trans("CreatedBy").' : '; + $morehtmlref = '
'; + $morehtmlref .= $object->subject; + // Author + if ($object->fk_user_create > 0) { + $morehtmlref .= '
'.$langs->trans("CreatedBy").' : '; - $langs->load("users"); - $fuser = new User($db); - $fuser->fetch($object->fk_user_create); - $morehtmlref .= $fuser->getNomUrl(0); - } - if (!empty($object->origin_email)) { - $morehtmlref .= '
'.$langs->trans("CreatedBy").' : '; - $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$langs->trans("TicketEmailOriginIssuer").')'; - } + $langs->load("users"); + $fuser = new User($db); + $fuser->fetch($object->fk_user_create); + $morehtmlref .= $fuser->getNomUrl(0); + } + if (!empty($object->origin_email)) { + $morehtmlref .= '
'.$langs->trans("CreatedBy").' : '; + $morehtmlref .= dol_escape_htmltag($object->origin_email).' ('.$langs->trans("TicketEmailOriginIssuer").')'; + } - // Thirdparty - if (!empty($conf->societe->enabled)) - { - $morehtmlref .= '
'.$langs->trans('ThirdParty').' '; - if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : '; - } - if ($action == 'editcustomer') { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); - } - } + // Thirdparty + if (!empty($conf->societe->enabled)) + { + $morehtmlref .= '
'.$langs->trans('ThirdParty').' '; + if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('Edit'), 0).' : '; + } + if ($action == 'editcustomer') { + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); + } else { + $morehtmlref .= $form->form_thirdparty($url_page_current.'?track_id='.$object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + } + } - // Project - if (!empty($conf->projet->enabled)) - { - $langs->load("projects"); - $morehtmlref .= '
'.$langs->trans('Project').' '; - if ($user->rights->ticket->write) - { - if ($action != 'classify') - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; - $morehtmlref .= ' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref .= '
'; - $morehtmlref .= ''; - $morehtmlref .= ''; - $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); - $morehtmlref .= ''; - $morehtmlref .= '
'; - } else { - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= $proj->getNomUrl(1); - } else { - $morehtmlref .= ''; - } - } - } + // Project + if (!empty($conf->projet->enabled)) + { + $langs->load("projects"); + $morehtmlref .= '
'.$langs->trans('Project').' '; + if ($user->rights->ticket->write) + { + if ($action != 'classify') + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; + $morehtmlref .= ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1, 0, 'maxwidth500'); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } else { + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + } else { + $morehtmlref .= ''; + } + } + } - $morehtmlref .= '
'; + $morehtmlref .= '
'; - $linkback = ''.$langs->trans("BackToList").' '; + $linkback = ''.$langs->trans("BackToList").' '; - dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', 'ref', $morehtmlref); - print '
'; - print '
'; - print '
'; + print '
'; + print '
'; + print '
'; - print ''; + print '
'; - // Track ID - print ''; + // Track ID + print ''; - // Subject - print ''; + // Subject + print ''; - // Creation date - print ''; + // Creation date + print ''; - // Read date - print ''; + // Read date + print ''; - // Close date - print ''; + // Close date + print ''; - // User assigned - print ''; + // Show user list to assignate one if status is "read" + if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { + print ''; + print ''; + print ''; + print ''; + print ' '; + print $form->select_dolusers($user->id, 'fk_user_assign', 1); + print ' '; + print ''; + } + print ''; - // Progression - print ''; - print ''; + // Progression + print ''; + print ''; - // Timing (Duration sum of linked fichinter) - if ($conf->fichinter->enabled) - { - $object->fetchObjectLinked(); - $num = count($object->linkedObjects); - $timing = 0; - if ($num) { - foreach ($object->linkedObjects as $objecttype => $objects) { - if ($objecttype = "fichinter") { - foreach ($objects as $fichinter) { - $timing += $fichinter->duration; - } - } - } - } - print ''; - } + print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1); + print ''; + } - // Other attributes - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; + // Other attributes + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; - print '
'.$langs->trans("TicketTrackId").''; - if (!empty($object->track_id)) { - if (empty($object->ref)) { - $object->ref = $object->id; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'track_id'); - } else { - print $object->track_id; - } - } else { - print $langs->trans('None'); - } - print '
'.$langs->trans("TicketTrackId").''; + if (!empty($object->track_id)) { + if (empty($object->ref)) { + $object->ref = $object->id; + print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'track_id'); + } else { + print $object->track_id; + } + } else { + print $langs->trans('None'); + } + print '
'; - print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string'); - print ''; - print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string'); - print '
'; + print $form->editfieldkey("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string'); + print ''; + print $form->editfieldval("Subject", 'subject', $object->subject, $object, $user->rights->ticket->write && !$user->socid, 'string'); + print '
'.$langs->trans("DateCreation").''; - print dol_print_date($object->datec, 'dayhour'); - print ' - '.$langs->trans("TimeElapsedSince").': '.''.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).''; - print '
'.$langs->trans("DateCreation").''; + print dol_print_date($object->datec, 'dayhour'); + print ' - '.$langs->trans("TimeElapsedSince").': '.''.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).''; + print '
'.$langs->trans("TicketReadOn").''; - if (!empty($object->date_read)) { - print dol_print_date($object->date_read, 'dayhour'); - print ' - '.$langs->trans("TicketTimeToRead").': '.convertSecondToTime(roundUpToNextMultiple($object->date_read - $object->datec, 60)).''; - print ' - '.$langs->trans("TimeElapsedSince").': '.''.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).''; - } - print '
'.$langs->trans("TicketReadOn").''; + if (!empty($object->date_read)) { + print dol_print_date($object->date_read, 'dayhour'); + print ' - '.$langs->trans("TicketTimeToRead").': '.convertSecondToTime(roundUpToNextMultiple($object->date_read - $object->datec, 60)).''; + print ' - '.$langs->trans("TimeElapsedSince").': '.''.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).''; + } + print '
'.$langs->trans("TicketCloseOn").''; - if (!empty($object->date_close)) { - print dol_print_date($object->date_close, 'dayhour'); - } - print '
'.$langs->trans("TicketCloseOn").''; + if (!empty($object->date_close)) { + print dol_print_date($object->date_close, 'dayhour'); + } + print '
'; - print ''; - } - print '
'; - print $langs->trans("AssignedTo"); - if ($object->fk_statut < 8 && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { - print ''.img_edit($langs->trans('Modify'), '').'
'; - print '
'; - if ($object->fk_user_assign > 0) { - $userstat->fetch($object->fk_user_assign); - print $userstat->getNomUrl(1); - } else { - print $langs->trans('None'); - } + // User assigned + print '
'; + print ''; + } + print '
'; + print $langs->trans("AssignedTo"); + if ($object->fk_statut < 8 && GETPOST('set', 'alpha') != "assign_ticket" && $user->rights->ticket->manage) { + print ''.img_edit($langs->trans('Modify'), '').'
'; + print '
'; + if ($object->fk_user_assign > 0) { + $userstat->fetch($object->fk_user_assign); + print $userstat->getNomUrl(1); + } else { + print $langs->trans('None'); + } - // Show user list to assignate one if status is "read" - if (GETPOST('set', 'alpha') == "assign_ticket" && $object->fk_statut < 8 && !$user->socid && $user->rights->ticket->write) { - print '
'; - print ''; - print ''; - print ''; - print ' '; - print $form->select_dolusers($user->id, 'fk_user_assign', 1); - print ' '; - print '
'; - } - print '
'; - print ''; - if ($action != 'progression' && $object->fk_statut < 8 && !$user->socid) { - print ''; - } - print '
'; - print $langs->trans('Progression').''; - print ''.img_edit($langs->trans('Modify')).'
'; - print '
'; - if ($user->rights->ticket->write && $action == 'progression') { - print '
'; - print ''; - print ''; - print ''; - print ''; - print ' '; - print '
'; - } else { - print($object->progress > 0 ? $object->progress : '0').'%'; - } - print '
'; + print ''; + if ($action != 'progression' && $object->fk_statut < 8 && !$user->socid) { + print ''; + } + print '
'; + print $langs->trans('Progression').''; + print ''.img_edit($langs->trans('Modify')).'
'; + print '
'; + if ($user->rights->ticket->write && $action == 'progression') { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ' '; + print '
'; + } else { + print($object->progress > 0 ? $object->progress : '0').'%'; + } + print '
'; + // Timing (Duration sum of linked fichinter) + if ($conf->fichinter->enabled) + { + $object->fetchObjectLinked(); + $num = count($object->linkedObjects); + $timing = 0; + if ($num) { + foreach ($object->linkedObjects as $objecttype => $objects) { + if ($objecttype = "fichinter") { + foreach ($objects as $fichinter) { + $timing += $fichinter->duration; + } + } + } + } + print '
'; - print $form->textwithpicto($langs->trans("TicketDurationAuto"), $langs->trans("TicketDurationAutoInfos"), 1); - print ''; - print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); - print '
'; + print convertSecondToTime($timing, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); + print '
'; + print ''; - // Fin colonne gauche et début colonne droite - print '
'; + // Fin colonne gauche et début colonne droite + print '
'; - // View Original message - $actionobject->viewTicketOriginalMessage($user, $action, $object); + // View Original message + $actionobject->viewTicketOriginalMessage($user, $action, $object); - // Classification of ticket - print '
'; - print ''; - print ''; - print ''; - print ''; + // Classification of ticket + print ''; + print ''; + print ''; + print ''; + print ''; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; - print ''; - print ''; - print ''; - print ''; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; - print $langs->trans('Properties'); - print ''; - if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) { - print ''; - } - else { - // Button to edit Properties - if ($object->fk_statut < 5 && $user->rights->ticket->write) { - print ''.img_edit($langs->trans('Modify')).''; - } - } - print '
'; + print ''; + print ''; + print ''; + print ''; - if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) { - print ''; - // Type - print ''; - print ''; - // Group - print ''; - print ''; - print ''; - // Severity - print ''; - print ''; - print ''; - } else { - // Type - print ''; - // Group - print ''; - // Severity - print ''; - } - print '
'; + print $langs->trans('Properties'); + print ''; + if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) { + print ''; + } + else { + // Button to edit Properties + if ($object->fk_statut < 5 && $user->rights->ticket->write) { + print ''.img_edit($langs->trans('Modify')).''; + } + } + print '
'; - print $langs->trans('TicketChangeType'); - print ''; - $formticket->selectTypesTickets($object->type_code, 'update_value_type', '', 2); - print '
'; - print $langs->trans('TicketChangeCategory'); - print ''; - $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2); - print '
'; - print $langs->trans('TicketChangeSeverity'); - print ''; - $formticket->selectSeveritiesTickets($object->severity_code, 'update_value_severity', '', 2); - print '
'.$langs->trans("Type").''; - print $langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label'); - print '
'.$langs->trans("TicketGroup").''; - print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label'); - print '
'.$langs->trans("TicketSeverity").''; - print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label'); - print '
'; // End table actions - print '
'; + if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) { + print ''; + // Type + print ''; + print $langs->trans('TicketChangeType'); + print ''; + $formticket->selectTypesTickets($object->type_code, 'update_value_type', '', 2); + print ''; + print ''; + // Group + print ''; + print ''; + print $langs->trans('TicketChangeCategory'); + print ''; + $formticket->selectGroupTickets($object->category_code, 'update_value_category', '', 2); + print ''; + print ''; + // Severity + print ''; + print ''; + print $langs->trans('TicketChangeSeverity'); + print ''; + $formticket->selectSeveritiesTickets($object->severity_code, 'update_value_severity', '', 2); + print ''; + print ''; + } else { + // Type + print ''.$langs->trans("Type").''; + print $langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label'); + print ''; + // Group + print ''.$langs->trans("TicketGroup").''; + print $langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label'); + print ''; + // Severity + print ''.$langs->trans("TicketSeverity").''; + print $langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label'); + print ''; + } + print ''; // End table actions + print '
'; - print ''; + print ''; - // Display navbar with links to change ticket status - print ''; - if (!$user->socid && $user->rights->ticket->write && $object->fk_statut < 8 && GETPOST('set') !== 'properties') { - $actionobject->viewStatusActions($object); - } + // Display navbar with links to change ticket status + print ''; + if (!$user->socid && $user->rights->ticket->write && $object->fk_statut < 8 && GETPOST('set') !== 'properties') { + $actionobject->viewStatusActions($object); + } - if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) - { - print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png'); + if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) + { + print load_fiche_titre($langs->trans('Contacts'), '', 'title_companies.png'); - print '
'; - print '
'; + print '
'; + print '
'; - print '
'; - print '
'.$langs->trans("Source").'
+ print '
'; + print '
'.$langs->trans("Source").'
' . $langs->trans("Company").'
' . $langs->trans("Contacts").'
' . $langs->trans("ContactType").'
' . $langs->trans("Phone").'
' . $langs->trans("Status").'
'; - print '
'; + print '
'; - // Contact list - $companystatic = new Societe($db); - $contactstatic = new Contact($db); - $userstatic = new User($db); - foreach (array('internal', 'external') as $source) { - $tmpobject = $object; - $tab = $tmpobject->listeContact(-1, $source); - $num = count($tab); - $i = 0; - while ($i < $num) { - $var = !$var; - print '
'; + // Contact list + $companystatic = new Societe($db); + $contactstatic = new Contact($db); + $userstatic = new User($db); + foreach (array('internal', 'external') as $source) { + $tmpobject = $object; + $tab = $tmpobject->listeContact(-1, $source); + $num = count($tab); + $i = 0; + while ($i < $num) { + $var = !$var; + print '
'; - print '
'; - if ($tab[$i]['source'] == 'internal') { - echo $langs->trans("User"); - } + print '
'; + if ($tab[$i]['source'] == 'internal') { + echo $langs->trans("User"); + } - if ($tab[$i]['source'] == 'external') { - echo $langs->trans("ThirdPartyContact"); - } + if ($tab[$i]['source'] == 'external') { + echo $langs->trans("ThirdPartyContact"); + } - print '
'; - print '
'; + print '
'; + print '
'; - if ($tab[$i]['socid'] > 0) { - $companystatic->fetch($tab[$i]['socid']); - echo $companystatic->getNomUrl(1); - } - if ($tab[$i]['socid'] < 0) { - echo $conf->global->MAIN_INFO_SOCIETE_NOM; - } - if (!$tab[$i]['socid']) { - echo ' '; - } - print '
'; + if ($tab[$i]['socid'] > 0) { + $companystatic->fetch($tab[$i]['socid']); + echo $companystatic->getNomUrl(1); + } + if ($tab[$i]['socid'] < 0) { + echo $conf->global->MAIN_INFO_SOCIETE_NOM; + } + if (!$tab[$i]['socid']) { + echo ' '; + } + print '
'; - print '
'; - if ($tab[$i]['source'] == 'internal') { - if ($userstatic->fetch($tab[$i]['id'])) { - print $userstatic->getNomUrl(1); - } - } - if ($tab[$i]['source'] == 'external') { - if ($contactstatic->fetch($tab[$i]['id'])) { - print $contactstatic->getNomUrl(1); - } - } - print '
+ print '
'; + if ($tab[$i]['source'] == 'internal') { + if ($userstatic->fetch($tab[$i]['id'])) { + print $userstatic->getNomUrl(1); + } + } + if ($tab[$i]['source'] == 'external') { + if ($contactstatic->fetch($tab[$i]['id'])) { + print $contactstatic->getNomUrl(1); + } + } + print '
' . $tab[$i]['libelle'].'
'; - print '
'; + print '
'; - print dol_print_phone($tab[$i]['phone'], '', '', '', 'AC_TEL').'
'; + print dol_print_phone($tab[$i]['phone'], '', '', '', 'AC_TEL').'
'; - if (!empty($tab[$i]['phone_perso'])) { - //print img_picto($langs->trans('PhonePerso'),'object_phoning.png','',0,0,0).' '; - print '
'.dol_print_phone($tab[$i]['phone_perso'], '', '', '', 'AC_TEL').'
'; - } - if (!empty($tab[$i]['phone_mobile'])) { - //print img_picto($langs->trans('PhoneMobile'),'object_phoning.png','',0,0,0).' '; - print dol_print_phone($tab[$i]['phone_mobile'], '', '', '', 'AC_TEL').'
'; - } - print '
'; + if (!empty($tab[$i]['phone_perso'])) { + //print img_picto($langs->trans('PhonePerso'),'object_phoning.png','',0,0,0).' '; + print '
'.dol_print_phone($tab[$i]['phone_perso'], '', '', '', 'AC_TEL').'
'; + } + if (!empty($tab[$i]['phone_mobile'])) { + //print img_picto($langs->trans('PhoneMobile'),'object_phoning.png','',0,0,0).' '; + print dol_print_phone($tab[$i]['phone_mobile'], '', '', '', 'AC_TEL').'
'; + } + print '
'; - print '
'; - if ($object->statut >= 0) { - echo ''; - } + print '
'; + if ($object->statut >= 0) { + echo ''; + } - if ($tab[$i]['source'] == 'internal') { - $userstatic->id = $tab[$i]['id']; - $userstatic->lastname = $tab[$i]['lastname']; - $userstatic->firstname = $tab[$i]['firstname']; - echo $userstatic->LibStatut($tab[$i]['statuscontact'], 3); - } - if ($tab[$i]['source'] == 'external') { - $contactstatic->id = $tab[$i]['id']; - $contactstatic->lastname = $tab[$i]['lastname']; - $contactstatic->firstname = $tab[$i]['firstname']; - echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3); - } - if ($object->statut >= 0) { - echo ''; - } + if ($tab[$i]['source'] == 'internal') { + $userstatic->id = $tab[$i]['id']; + $userstatic->lastname = $tab[$i]['lastname']; + $userstatic->firstname = $tab[$i]['firstname']; + echo $userstatic->LibStatut($tab[$i]['statuscontact'], 3); + } + if ($tab[$i]['source'] == 'external') { + $contactstatic->id = $tab[$i]['id']; + $contactstatic->lastname = $tab[$i]['lastname']; + $contactstatic->firstname = $tab[$i]['firstname']; + echo $contactstatic->LibStatut($tab[$i]['statuscontact'], 3); + } + if ($object->statut >= 0) { + echo ''; + } - print '
'; + print '
'; - print '
'; + print '
'; - $i++; - } - } + $i++; + } + } - print '
'; + print '
'; print '
'; - } + } - print '
'; - print '
'; + print '
'; + print '
'; dol_fiche_end(); @@ -1172,34 +1172,34 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd { // Show link to add a message (if read and not closed) if ($object->fk_statut < Ticket::STATUS_CLOSED && $action != "presend" && $action != "presend_addmessage") { - print ''; - } + print ''; + } - // Link to create an intervention - // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ - if (!$object->fk_soc && $user->rights->ficheinter->creer) { - print ''; - } - if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { - print ''; - } + // Link to create an intervention + // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ + if (!$object->fk_soc && $user->rights->ficheinter->creer) { + print ''; + } + if ($object->fk_soc > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ficheinter->creer) { + print ''; + } - // Close ticket if statut is read - if ($object->fk_statut > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { - print ''; - } + // Close ticket if statut is read + if ($object->fk_statut > 0 && $object->fk_statut < Ticket::STATUS_CLOSED && $user->rights->ticket->write) { + print ''; + } - // Re-open ticket - if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->socid) { - print ''; - } + // Re-open ticket + if (!$user->socid && $object->fk_statut == Ticket::STATUS_CLOSED && !$user->socid) { + print ''; + } - // Delete ticket - if ($user->rights->ticket->delete && !$user->socid) { - print ''; - } + // Delete ticket + if ($user->rights->ticket->delete && !$user->socid) { + print ''; + } } - print '
'."\n"; + print '
'."\n"; } else { @@ -1242,35 +1242,35 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd // Substitution array $morehtmlright = ''; - $help = ""; - $substitutionarray = array(); - if ($object->fk_soc > 0) { - $object->fetch_thirdparty(); - $substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name; - } - $substitutionarray['__SIGNATURE__'] = $user->signature; - $substitutionarray['__TICKET_TRACKID__'] = $object->track_id; - $substitutionarray['__TICKET_REF__'] = $object->ref; - $substitutionarray['__TICKET_SUBJECT__'] = $object->subject; - $substitutionarray['__TICKET_TYPE__'] = $object->type_code; - $substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code; - $substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility - $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code; - $substitutionarray['__TICKET_MESSAGE__'] = $object->message; - $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress; - if ($object->fk_user_assign > 0) { - $userstat->fetch($object->fk_user_assign); - $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); - } + $help = ""; + $substitutionarray = array(); + if ($object->fk_soc > 0) { + $object->fetch_thirdparty(); + $substitutionarray['__THIRDPARTY_NAME__'] = $object->thirdparty->name; + } + $substitutionarray['__SIGNATURE__'] = $user->signature; + $substitutionarray['__TICKET_TRACKID__'] = $object->track_id; + $substitutionarray['__TICKET_REF__'] = $object->ref; + $substitutionarray['__TICKET_SUBJECT__'] = $object->subject; + $substitutionarray['__TICKET_TYPE__'] = $object->type_code; + $substitutionarray['__TICKET_SEVERITY__'] = $object->severity_code; + $substitutionarray['__TICKET_CATEGORY__'] = $object->category_code; // For backward compatibility + $substitutionarray['__TICKET_ANALYTIC_CODE__'] = $object->category_code; + $substitutionarray['__TICKET_MESSAGE__'] = $object->message; + $substitutionarray['__TICKET_PROGRESSION__'] = $object->progress; + if ($object->fk_user_assign > 0) { + $userstat->fetch($object->fk_user_assign); + $substitutionarray['__TICKET_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); + } - if ($object->fk_user_create > 0) { - $userstat->fetch($object->fk_user_create); - $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); - } - foreach ($substitutionarray as $key => $val) { - $help .= $key.' -> '.$langs->trans($val).'
'; - } - $morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution'); + if ($object->fk_user_create > 0) { + $userstat->fetch($object->fk_user_create); + $substitutionarray['__TICKET_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); + } + foreach ($substitutionarray as $key => $val) { + $help .= $key.' -> '.$langs->trans($val).'
'; + } + $morehtmlright .= $form->textwithpicto(''.$langs->trans("TicketMessageSubstitutionReplacedByGenericValues").'', $help, 1, 'helpclickable', '', 0, 3, 'helpsubstitution'); print '
'; print load_fiche_titre($langs->trans('TicketAddMessage'), $morehtmlright, 'messages@ticket'); @@ -1309,7 +1309,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd $formticket->substit = $substitutionarray; $formticket->showMessageForm('100%'); print '
'; - } + } } } diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 522ca766c62..9a67c3dd574 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -35,406 +35,406 @@ require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; */ class ActionsTicket { - /** - * @var DoliDB Database handler. - */ - public $db; + /** + * @var DoliDB Database handler. + */ + public $db; - public $dao; + public $dao; - public $mesg; + public $mesg; - /** - * @var string Error code (or message) - */ - public $error; + /** + * @var string Error code (or message) + */ + public $error; - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); + /** + * @var string[] Error codes (or messages) + */ + public $errors = array(); - //! Numero de l'erreur - public $errno = 0; + //! Numero de l'erreur + public $errno = 0; - public $template_dir; - public $template; + public $template_dir; + public $template; - /** - * @var string ticket action label - */ - public $label; + /** + * @var string ticket action label + */ + public $label; - /** - * @var string description - */ - public $description; + /** + * @var string description + */ + public $description; - /** - * @var int ID - */ - public $fk_statut; + /** + * @var int ID + */ + public $fk_statut; - /** - * @var int Thirdparty ID - */ - public $fk_soc; + /** + * @var int Thirdparty ID + */ + public $fk_soc; - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - } + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } - /** - * Instantiation of DAO class - * - * @return void - */ - public function getInstanceDao() - { - if (!is_object($this->dao)) { - $this->dao = new Ticket($this->db); - } - } + /** + * Instantiation of DAO class + * + * @return void + */ + public function getInstanceDao() + { + if (!is_object($this->dao)) { + $this->dao = new Ticket($this->db); + } + } - /** - * Fetch object - * - * @param int $id ID of ticket - * @param string $ref Reference of ticket - * @param string $track_id Track ID of ticket (for public area) - * @return void - */ - public function fetch($id = 0, $ref = '', $track_id = '') - { - $this->getInstanceDao(); - return $this->dao->fetch($id, $ref, $track_id); - } + /** + * Fetch object + * + * @param int $id ID of ticket + * @param string $ref Reference of ticket + * @param string $track_id Track ID of ticket (for public area) + * @return void + */ + public function fetch($id = 0, $ref = '', $track_id = '') + { + $this->getInstanceDao(); + return $this->dao->fetch($id, $ref, $track_id); + } - /** - * Print statut - * - * @param int $mode Display mode - * @return string Label of status - */ - public function getLibStatut($mode = 0) - { - $this->getInstanceDao(); - $this->dao->fk_statut = $this->fk_statut; - return $this->dao->getLibStatut($mode); - } + /** + * Print statut + * + * @param int $mode Display mode + * @return string Label of status + */ + public function getLibStatut($mode = 0) + { + $this->getInstanceDao(); + $this->dao->fk_statut = $this->fk_statut; + return $this->dao->getLibStatut($mode); + } - /** - * Get ticket info - * - * @param int $id Object id - * @return void - */ - public function getInfo($id) - { - $this->getInstanceDao(); - $this->dao->fetch($id, '', $track_id); + /** + * Get ticket info + * + * @param int $id Object id + * @return void + */ + public function getInfo($id) + { + $this->getInstanceDao(); + $this->dao->fetch($id, '', $track_id); - $this->label = $this->dao->label; - $this->description = $this->dao->description; - } + $this->label = $this->dao->label; + $this->description = $this->dao->description; + } - /** - * Get action title - * - * @param string $action Type of action - * @return string Title of action - */ - public function getTitle($action = '') - { - global $langs; + /** + * Get action title + * + * @param string $action Type of action + * @return string Title of action + */ + public function getTitle($action = '') + { + global $langs; - if ($action == 'create') { - return $langs->trans("CreateTicket"); - } elseif ($action == 'edit') { - return $langs->trans("EditTicket"); - } elseif ($action == 'view') { - return $langs->trans("TicketCard"); - } elseif ($action == 'add_message') { - return $langs->trans("AddMessage"); - } else { - return $langs->trans("TicketsManagement"); - } - } + if ($action == 'create') { + return $langs->trans("CreateTicket"); + } elseif ($action == 'edit') { + return $langs->trans("EditTicket"); + } elseif ($action == 'view') { + return $langs->trans("TicketCard"); + } elseif ($action == 'add_message') { + return $langs->trans("AddMessage"); + } else { + return $langs->trans("TicketsManagement"); + } + } - /** - * Show ticket original message - * - * @param User $user User wich display - * @param string $action Action mode - * @param Ticket $object Object ticket - * @return void - */ - public function viewTicketOriginalMessage($user, $action, $object) - { - global $conf, $langs; + /** + * Show ticket original message + * + * @param User $user User wich display + * @param string $action Action mode + * @param Ticket $object Object ticket + * @return void + */ + public function viewTicketOriginalMessage($user, $action, $object) + { + global $conf, $langs; - print ''."\n"; - if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') { - // MESSAGE + print ''."\n"; + if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') { + // MESSAGE - print '
'; - print ''; - print ''; - print ''; - } + print ''; + print ''; + print ''; + print ''; + } - // Initial message - print '
'; - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print ''; - print ''; + // Initial message + print '
'; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print '
'; - print $langs->trans("InitialMessage"); - print ''; - if ($user->rights->ticket->manage) { - print ''.img_edit($langs->trans('Modify')).''; - } - print '
'; + print ''; - print ''; - print ''; + print ''; - print ''; - print '
'; + print $langs->trans("InitialMessage"); + print ''; + if ($user->rights->ticket->manage) { + print ''.img_edit($langs->trans('Modify')).''; + } + print '
'; - if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') { - // MESSAGE - $msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message; - include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $uselocalbrowser = true; - $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_4, '95%'); - $doleditor->Create(); - } else { - // Deal with format differences (text / HTML) - if (dol_textishtml($object->message)) { - print $object->message; - } else { - print dol_nl2br($object->message); - } + print '
'; + if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') { + // MESSAGE + $msg = GETPOST('message_initial', 'alpha') ? GETPOST('message_initial', 'alpha') : $object->message; + include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; + $uselocalbrowser = true; + $doleditor = new DolEditor('message_initial', $msg, '100%', 250, 'dolibarr_details', 'In', true, $uselocalbrowser, $conf->global->FCKEDITOR_ENABLE_TICKET, ROWS_4, '95%'); + $doleditor->Create(); + } else { + // Deal with format differences (text / HTML) + if (dol_textishtml($object->message)) { + print $object->message; + } else { + print dol_nl2br($object->message); + } - //print '
' . $object->message . '
'; - } - if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') { - print '
'; - print ' '; - print ' '; - print '
'; - } - print '
'; - print '
'; + //print '
' . $object->message . '
'; + } + if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') { + print '
'; + print ' '; + print ' '; + print '
'; + } + print ''; + print ''; + print ''; + print '
'; - if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') { - // MESSAGE - print ''; - } - } + if (!empty($user->rights->ticket->manage) && $action == 'edit_message_init') { + // MESSAGE + print ''; + } + } - /** - * View html list of message for ticket - * - * @param boolean $show_private Show private messages - * @param boolean $show_user Show user who make action - * @param Ticket $object Object ticket - * @return void - */ - public function viewTicketMessages($show_private, $show_user, $object) - { - global $conf, $langs, $user; + /** + * View html list of message for ticket + * + * @param boolean $show_private Show private messages + * @param boolean $show_user Show user who make action + * @param Ticket $object Object ticket + * @return void + */ + public function viewTicketMessages($show_private, $show_user, $object) + { + global $conf, $langs, $user; - // Load logs in cache - $ret = $this->dao->loadCacheMsgsTicket(); - if ($ret < 0) dol_print_error($this->dao->db); + // Load logs in cache + $ret = $this->dao->loadCacheMsgsTicket(); + if ($ret < 0) dol_print_error($this->dao->db); - $action = GETPOST('action', 'alpha'); + $action = GETPOST('action', 'alpha'); - $this->viewTicketOriginalMessage($user, $action, $object); + $this->viewTicketOriginalMessage($user, $action, $object); - if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) - { - print ''; + if (is_array($this->dao->cache_msgs_ticket) && count($this->dao->cache_msgs_ticket) > 0) + { + print '
'; - print ''; + print ''; - print ''; + print ''; - if ($show_user) { - print ''; - } + if ($show_user) { + print ''; + } - foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) { - if (!$arraymsgs['private'] - || ($arraymsgs['private'] == "1" && $show_private) - ) { - //print ''; - print ''; - print ''; - if ($show_user) { - print ''; - } - print ''; - print ''; - print ''; - print ''; - } - } + foreach ($this->dao->cache_msgs_ticket as $id => $arraymsgs) { + if (!$arraymsgs['private'] + || ($arraymsgs['private'] == "1" && $show_private) + ) { + //print ''; + print ''; + print ''; + if ($show_user) { + print ''; + } + print ''; + print ''; + print ''; + print ''; + } + } - print '
'; - print $langs->trans('TicketMessagesList'); - print ''; + print $langs->trans('TicketMessagesList'); + print ''; - print $langs->trans('User'); - print ''; + print $langs->trans('User'); + print '
'; - print dol_print_date($arraymsgs['datec'], 'dayhour'); - print ''; - if ($arraymsgs['fk_user_author'] > 0) { - $userstat = new User($this->db); - $res = $userstat->fetch($arraymsgs['fk_user_author']); - if ($res) { - print $userstat->getNomUrl(0); - } - } else { - print $langs->trans('Customer'); - } - print '
'; - print $arraymsgs['message']; - print '
'; + print dol_print_date($arraymsgs['datec'], 'dayhour'); + print ''; + if ($arraymsgs['fk_user_author'] > 0) { + $userstat = new User($this->db); + $res = $userstat->fetch($arraymsgs['fk_user_author']); + if ($res) { + print $userstat->getNomUrl(0); + } + } else { + print $langs->trans('Customer'); + } + print '
'; + print $arraymsgs['message']; + print '
'; - } else { - print '
'.$langs->trans('NoMsgForThisTicket').'
'; - } - } + print ''; + } else { + print '
'.$langs->trans('NoMsgForThisTicket').'
'; + } + } - /** - * View list of message for ticket with timeline display - * - * @param boolean $show_private Show private messages - * @param boolean $show_user Show user who make action - * @param Ticket $object Object ticket - * @return void - */ - public function viewTicketTimelineMessages($show_private, $show_user, Ticket $object) - { - global $conf, $langs, $user; + /** + * View list of message for ticket with timeline display + * + * @param boolean $show_private Show private messages + * @param boolean $show_user Show user who make action + * @param Ticket $object Object ticket + * @return void + */ + public function viewTicketTimelineMessages($show_private, $show_user, Ticket $object) + { + global $conf, $langs, $user; - // Load logs in cache - $ret = $object->loadCacheMsgsTicket(); - $action = GETPOST('action'); + // Load logs in cache + $ret = $object->loadCacheMsgsTicket(); + $action = GETPOST('action'); - if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) { - print '
'; + if (is_array($object->cache_msgs_ticket) && count($object->cache_msgs_ticket) > 0) { + print '
'; - foreach ($object->cache_msgs_ticket as $id => $arraymsgs) { - if (!$arraymsgs['private'] - || ($arraymsgs['private'] == "1" && $show_private) - ) { - print '
'; - print '
'; - print ''; - print '
'; + foreach ($object->cache_msgs_ticket as $id => $arraymsgs) { + if (!$arraymsgs['private'] + || ($arraymsgs['private'] == "1" && $show_private) + ) { + print '
'; + print '
'; + print ''; + print '
'; - print '
'; - print $arraymsgs['message']; + print '
'; + print $arraymsgs['message']; - print ''; - print dol_print_date($arraymsgs['datec'], 'dayhour'); + print ''; + print dol_print_date($arraymsgs['datec'], 'dayhour'); - if ($show_user) { - if ($arraymsgs['fk_user_action'] > 0) { - $userstat = new User($this->db); - $res = $userstat->fetch($arraymsgs['fk_user_action']); - if ($res) { - print '
'; - print $userstat->getNomUrl(1); - } - } else { - print '
'; - print $langs->trans('Customer'); - } - } - print '
'; - print '
'; - print '
'; - } - } - print '
'; - } else { - print '
'.$langs->trans('NoMsgForThisTicket').'
'; - } - } + if ($show_user) { + if ($arraymsgs['fk_user_action'] > 0) { + $userstat = new User($this->db); + $res = $userstat->fetch($arraymsgs['fk_user_action']); + if ($res) { + print '
'; + print $userstat->getNomUrl(1); + } + } else { + print '
'; + print $langs->trans('Customer'); + } + } + print ''; + print '
'; + print ' '; + } + } + print ''; + } else { + print '
'.$langs->trans('NoMsgForThisTicket').'
'; + } + } - /** - * Print html navbar with link to set ticket status - * - * @param Ticket $object Ticket sup - * @return void - */ - public function viewStatusActions(Ticket $object) - { - global $langs; + /** + * Print html navbar with link to set ticket status + * + * @param Ticket $object Ticket sup + * @return void + */ + public function viewStatusActions(Ticket $object) + { + global $langs; - print '
'; - print '
'; - print '
'; - // Exclude status which requires specific method - $exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED); - // Exclude actual status - $exclude_status = array_merge($exclude_status, array(intval($object->fk_statut))); + print '
'; + print '
'; + print '
'; + // Exclude status which requires specific method + $exclude_status = array(Ticket::STATUS_CLOSED, Ticket::STATUS_CANCELED); + // Exclude actual status + $exclude_status = array_merge($exclude_status, array(intval($object->fk_statut))); - // Sort results to be similar to status object list - //sort($exclude_status); + // Sort results to be similar to status object list + //sort($exclude_status); - foreach ($object->statuts_short as $status => $status_label) { - if (!in_array($status, $exclude_status)) { - print '
'; + foreach ($object->statuts_short as $status => $status_label) { + if (!in_array($status, $exclude_status)) { + print '
'; - if ($status == 1) - { - $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=mark_ticket_read'; // To set as read, we use a dedicated action - } - else - { - $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=set_status&new_status='.$status; - } + if ($status == 1) + { + $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=mark_ticket_read'; // To set as read, we use a dedicated action + } + else + { + $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=set_status&new_status='.$status; + } - print ''; - print img_picto($langs->trans($object->statuts_short[$status]), 'statut'.$status.'.png@ticket').' '.$langs->trans($object->statuts_short[$status]); - print ''; - print '
'; - } - } - print '

'; - } + print ''; + print img_picto($langs->trans($object->statuts_short[$status]), 'statut'.$status.'.png@ticket').' '.$langs->trans($object->statuts_short[$status]); + print ''; + print '
'; + } + } + print '

'; + } - /** - * Hook to add email element template - * - * @param array $parameters Parameters - * @param Ticket $object Object for action - * @param string $action Action string - * @param HookManager $hookmanager Hookmanager object - * @return int - */ - public function emailElementlist($parameters, &$object, &$action, $hookmanager) - { - global $langs; + /** + * Hook to add email element template + * + * @param array $parameters Parameters + * @param Ticket $object Object for action + * @param string $action Action string + * @param HookManager $hookmanager Hookmanager object + * @return int + */ + public function emailElementlist($parameters, &$object, &$action, $hookmanager) + { + global $langs; - $error = 0; + $error = 0; - if (in_array('admin', explode(':', $parameters['context']))) { - $this->results = array('ticket_send' => $langs->trans('MailToSendTicketMessage')); - } + if (in_array('admin', explode(':', $parameters['context']))) { + $this->results = array('ticket_send' => $langs->trans('MailToSendTicketMessage')); + } - if (!$error) { - return 0; // or return 1 to replace standard code - } else { - $this->errors[] = 'Error message'; - return -1; - } - } + if (!$error) { + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index ea30a7c7996..4ce5948f0b3 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -34,1552 +34,1552 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/ticket.lib.php'; */ class Ticket extends CommonObject { - /** - * @var string ID to identify managed object - */ - public $element = 'ticket'; - - /** - * @var string Name of table without prefix where object is stored - */ - public $table_element = 'ticket'; - - /** - * @var string Name of field for link to tickets - */ - public $fk_element = 'fk_ticket'; - - /** - * @var int Does ticketcore support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does ticketcore support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** - * @var string String with name of icon for ticketcore. Must be the part after the 'object_' into object_ticketcore.png - */ - public $picto = 'ticket'; - - - /** - * @var string Hash to identify ticket publically - */ - public $track_id; - - /** - * @var int Thirdparty ID - */ - public $fk_soc; - - /** - * @var int Project ID - */ - public $fk_project; - - /** - * @var string Person email who have create ticket - */ - public $origin_email; - - /** - * @var int User id who have create ticket - */ - public $fk_user_create; - - /** - * @var int User id who have ticket assigned - */ - public $fk_user_assign; - - /** - * var string Ticket subject - */ - public $subject; - - /** - * @var string Ticket message - */ - public $message; - - /** - * @var int Ticket statut - */ - public $fk_statut; - - /** - * @var string State resolution - */ - public $resolution; - - /** - * @var int Progress in percent - */ - public $progress; - - /** - * @var string Duration for ticket - */ - public $timing; - - /** - * @var string Type code - */ - public $type_code; - - /** - * @var string Category code - */ - public $category_code; - - /** - * @var string Severity code - */ - public $severity_code; - - /** - * @var int Création date - */ - public $datec = ''; - - /** - * @var int Read date - */ - public $date_read = ''; - - /** - * @var int Close ticket date - */ - public $date_close = ''; - - /** - * @var array cache_types_tickets - */ - public $cache_types_tickets; - - /** - * @var array tickets categories - */ - public $cache_category_tickets; - - /** - * @var int Notify tiers at create - */ - public $notify_tiers_at_create; - - public $lines; - - /** - * @var string Regex pour les images - */ - public $regeximgext = '\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff'; - - public $fields = array( - 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), - 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), - 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), - 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), - 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), - 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth75'), - 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), - 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), - 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), - 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), - 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), - 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), - 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), - 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1), - 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), - 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), - 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), - 'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1), - 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1), - 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), - ); - - /** - * Status - */ - const STATUS_NOT_READ = 0; - const STATUS_READ = 1; - const STATUS_ASSIGNED = 2; - const STATUS_IN_PROGRESS = 3; - const STATUS_NEED_MORE_INFO = 5; - const STATUS_WAITING = 7; - const STATUS_CLOSED = 8; - const STATUS_CANCELED = 9; - - - /** - * Constructor - * - * @param DoliDb $db Database handler - */ - public function __construct($db) - { - $this->db = $db; - - $this->statuts_short = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Suspended', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled'); - $this->statuts = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Suspended', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled'); - } - - /** - * Check properties of ticket are ok (like ref, track_id, ...). - * All properties must be already loaded on object (this->ref, this->track_id, ...). - * - * @return int 0 if OK, <0 if KO - */ - private function verify() - { - $this->errors = array(); - - $result = 0; - - // Clean parameters - if (isset($this->ref)) { - $this->ref = trim($this->ref); - } - - if (isset($this->track_id)) { - $this->track_id = trim($this->track_id); - } - - if (isset($this->fk_soc)) { - $this->fk_soc = (int) $this->fk_soc; - } - - if (isset($this->fk_project)) { - $this->fk_project = (int) $this->fk_project; - } - - if (isset($this->origin_email)) { - $this->origin_email = trim($this->origin_email); - } - - if (isset($this->fk_user_create)) { - $this->fk_user_create = (int) $this->fk_user_create; - } - - if (isset($this->fk_user_assign)) { - $this->fk_user_assign = (int) $this->fk_user_assign; - } - - if (isset($this->subject)) { - $this->subject = trim($this->subject); - } - - if (isset($this->message)) { - $this->message = trim($this->message); - } - - if (isset($this->fk_statut)) { - $this->fk_statut = (int) $this->fk_statut; - } - - if (isset($this->resolution)) { - $this->resolution = trim($this->resolution); - } - - if (isset($this->progress)) { - $this->progress = trim($this->progress); - } - - if (isset($this->timing)) { - $this->timing = trim($this->timing); - } - - if (isset($this->type_code)) { - $this->type_code = trim($this->type_code); - } - - if (isset($this->category_code)) { - $this->category_code = trim($this->category_code); - } - - if (isset($this->severity_code)) { - $this->severity_code = trim($this->severity_code); - } - - if (empty($this->ref)) { - $this->errors[] = 'ErrorTicketRefRequired'; - dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR); - $result = -1; - } - - return $result; - } - - /** - * Create object into database - * - * @param User $user User that creates - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, Id of created object if OK - */ - public function create($user, $notrigger = 0) - { - global $conf, $langs; - $error = 0; - - // Clean parameters - $this->datec = dol_now(); - if (empty($this->track_id)) $this->track_id = generate_random_id(16); - - // Check more parameters - // If error, this->errors[] is filled - $result = $this->verify(); - - if ($result >= 0) { - // Insert request - $sql = "INSERT INTO ".MAIN_DB_PREFIX."ticket("; - $sql .= "ref,"; - $sql .= "track_id,"; - $sql .= "fk_soc,"; - $sql .= "fk_project,"; - $sql .= "origin_email,"; - $sql .= "fk_user_create,"; - $sql .= "fk_user_assign,"; - $sql .= "subject,"; - $sql .= "message,"; - $sql .= "fk_statut,"; - $sql .= "resolution,"; - $sql .= "progress,"; - $sql .= "timing,"; - $sql .= "type_code,"; - $sql .= "category_code,"; - $sql .= "severity_code,"; - $sql .= "datec,"; - $sql .= "date_read,"; - $sql .= "date_close,"; - $sql .= "entity,"; - $sql .= "notify_tiers_at_create"; - $sql .= ") VALUES ("; - $sql .= " ".(!isset($this->ref) ? '' : "'".$this->db->escape($this->ref)."'").","; - $sql .= " ".(!isset($this->track_id) ? 'NULL' : "'".$this->db->escape($this->track_id)."'").","; - $sql .= " ".($this->fk_soc > 0 ? $this->db->escape($this->fk_soc) : "null").","; - $sql .= " ".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "null").","; - $sql .= " ".(!isset($this->origin_email) ? 'NULL' : "'".$this->db->escape($this->origin_email)."'").","; - $sql .= " ".($this->fk_user_create > 0 ? $this->fk_user_create : ($user->id > 0 ? $user->id : 'NULL')).","; - $sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').","; - $sql .= " ".(!isset($this->subject) ? 'NULL' : "'".$this->db->escape($this->subject)."'").","; - $sql .= " ".(!isset($this->message) ? 'NULL' : "'".$this->db->escape($this->message)."'").","; - $sql .= " ".(!isset($this->fk_statut) ? '0' : "'".$this->db->escape($this->fk_statut)."'").","; - $sql .= " ".(!isset($this->resolution) ? 'NULL' : "'".$this->db->escape($this->resolution)."'").","; - $sql .= " ".(!isset($this->progress) ? '0' : "'".$this->db->escape($this->progress)."'").","; - $sql .= " ".(!isset($this->timing) ? 'NULL' : "'".$this->db->escape($this->timing)."'").","; - $sql .= " ".(!isset($this->type_code) ? 'NULL' : "'".$this->db->escape($this->type_code)."'").","; - $sql .= " ".(!isset($this->category_code) ? 'NULL' : "'".$this->db->escape($this->category_code)."'").","; - $sql .= " ".(!isset($this->severity_code) ? 'NULL' : "'".$this->db->escape($this->severity_code)."'").","; - $sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").","; - $sql .= " ".(!isset($this->date_read) || dol_strlen($this->date_read) == 0 ? 'NULL' : "'".$this->db->idate($this->date_read)."'").","; - $sql .= " ".(!isset($this->date_close) || dol_strlen($this->date_close) == 0 ? 'NULL' : "'".$this->db->idate($this->date_close)."'").""; - $sql .= ", ".$conf->entity; - $sql .= ", ".(!isset($this->notify_tiers_at_create) ? '1' : "'".$this->db->escape($this->notify_tiers_at_create)."'"); - $sql .= ")"; - - $this->db->begin(); - - dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->errors[] = "Error ".$this->db->lasterror(); - } - - if (!$error) { - $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ticket"); - - if (!$notrigger) { - // Call trigger - $result = $this->call_trigger('TICKET_CREATE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - } - - //Update extrafield - if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } - } - } - - // Commit or rollback - if ($error) { - foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return $this->id; - } - } else { - $this->db->rollback(); - dol_syslog(get_class($this)."::Create fails verify ".join(',', $this->errors), LOG_WARNING); - return -3; - } - } - - /** - * Load object in memory from the database - * - * @param int $id Id object - * @param string $ref Ref - * @param string $track_id Track id, a hash like ref - * @return int <0 if KO, >0 if OK - */ - public function fetch($id = '', $ref = '', $track_id = '') - { - global $langs; - - // Check parameters - if (!$id && !$track_id && !$ref) { - $this->error = 'ErrorWrongParameters'; - dol_print_error(get_class($this)."::fetch ".$this->error); - return -1; - } - - $sql = "SELECT"; - $sql .= " t.rowid,"; - $sql .= " t.ref,"; - $sql .= " t.track_id,"; - $sql .= " t.fk_soc,"; - $sql .= " t.fk_project,"; - $sql .= " t.origin_email,"; - $sql .= " t.fk_user_create,"; - $sql .= " t.fk_user_assign,"; - $sql .= " t.subject,"; - $sql .= " t.message,"; - $sql .= " t.fk_statut,"; - $sql .= " t.resolution,"; - $sql .= " t.progress,"; - $sql .= " t.timing,"; - $sql .= " t.type_code,"; - $sql .= " t.category_code,"; - $sql .= " t.severity_code,"; - $sql .= " t.datec,"; - $sql .= " t.date_read,"; - $sql .= " t.date_close,"; - $sql .= " t.tms"; - $sql .= ", type.code as type_code, type.label as type_label, category.code as category_code, category.label as category_label, severity.code as severity_code, severity.label as severity_label"; - $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; - - if ($id) { - $sql .= " WHERE t.rowid = ".$this->db->escape($id); - } else { - $sql .= " WHERE t.entity IN (".getEntity($this->element, 1).")"; - if ($track_id) { - $sql .= " AND t.track_id = '".$this->db->escape($track_id)."'"; - } elseif ($ref) { - $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; - } - } - - dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - if ($this->db->num_rows($resql)) - { - $obj = $this->db->fetch_object($resql); - - $this->id = $obj->rowid; - $this->ref = $obj->ref; - $this->track_id = $obj->track_id; - $this->fk_soc = $obj->fk_soc; - $this->socid = $obj->fk_soc; // for fetch_thirdparty() method - $this->fk_project = $obj->fk_project; - $this->origin_email = $obj->origin_email; - $this->fk_user_create = $obj->fk_user_create; - $this->fk_user_assign = $obj->fk_user_assign; - $this->subject = $obj->subject; - $this->message = $obj->message; - $this->fk_statut = $obj->fk_statut; - $this->resolution = $obj->resolution; - $this->progress = $obj->progress; - $this->timing = $obj->timing; - - $this->type_code = $obj->type_code; - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label_type = ($langs->trans("TicketTypeShort".$obj->type_code) != ("TicketTypeShort".$obj->type_code) ? $langs->trans("TicketTypeShort".$obj->type_code) : ($obj->type_label != '-' ? $obj->type_label : '')); - $this->type_label = $label_type; - - $this->category_code = $obj->category_code; - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label_category = ($langs->trans("TicketCategoryShort".$obj->category_code) != ("TicketCategoryShort".$obj->category_code) ? $langs->trans("TicketCategoryShort".$obj->category_code) : ($obj->category_label != '-' ? $obj->category_label : '')); - $this->category_label = $label_category; - - $this->severity_code = $obj->severity_code; - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label_severity = ($langs->trans("TicketSeverityShort".$obj->severity_code) != ("TicketSeverityShort".$obj->severity_code) ? $langs->trans("TicketSeverityShort".$obj->severity_code) : ($obj->severity_label != '-' ? $obj->severity_label : '')); - $this->severity_label = $label_severity; - - $this->datec = $this->db->jdate($obj->datec); - $this->date_creation = $this->db->jdate($obj->datec); - $this->date_read = $this->db->jdate($obj->date_read); - $this->date_validation = $this->db->jdate($obj->date_read); - $this->date_close = $this->db->jdate($obj->date_close); - $this->tms = $this->db->jdate($obj->tms); - $this->date_modification = $this->db->jdate($obj->tms); - - $this->fetch_optionals(); - - $this->db->free($resql); - return 1; - } - else - { - return 0; - } - } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); - return -1; - } - } - - /** - * Load all objects in memory from database - * - * @param User $user User for action - * @param string $sortorder Sort order - * @param string $sortfield Sort field - * @param int $limit page number - * @param int $offset Offset for query - * @param int $arch archive or not (not used) - * @param array $filter Filter for query - * output - * @return int <0 if KO, >0 if OK - */ - public function fetchAll($user, $sortorder = 'ASC', $sortfield = 't.datec', $limit = '', $offset = 0, $arch = '', $filter = '') - { - global $langs; - - $extrafields = new ExtraFields($this->db); - - // fetch optionals attributes and labels - $extrafields->fetch_name_optionals_label($this->table_element); - - $sql = "SELECT"; - $sql .= " t.rowid,"; - $sql .= " t.ref,"; - $sql .= " t.track_id,"; - $sql .= " t.fk_soc,"; - $sql .= " t.fk_project,"; - $sql .= " t.origin_email,"; - $sql .= " t.fk_user_create, uc.lastname as user_create_lastname, uc.firstname as user_create_firstname,"; - $sql .= " t.fk_user_assign, ua.lastname as user_assign_lastname, ua.firstname as user_assign_firstname,"; - $sql .= " t.subject,"; - $sql .= " t.message,"; - $sql .= " t.fk_statut,"; - $sql .= " t.resolution,"; - $sql .= " t.progress,"; - $sql .= " t.timing,"; - $sql .= " t.type_code,"; - $sql .= " t.category_code,"; - $sql .= " t.severity_code,"; - $sql .= " t.datec,"; - $sql .= " t.date_read,"; - $sql .= " t.date_close,"; - $sql .= " t.tms"; - $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; - // Add fields for extrafields - foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$this->table_element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); - } - $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid=t.fk_user_create"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid=t.fk_user_assign"; - if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label'])) { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as ef on (t.rowid = ef.fk_object)"; - } - if (!$user->rights->societe->client->voir && !$user->socid) { - $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - } - - $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; - - // Manage filter - if (!empty($filter)) { - foreach ($filter as $key => $value) { - if (strpos($key, 'date')) { // To allow $filter['YEAR(s.dated)']=>$year - $sql .= ' AND '.$key.' = \''.$value.'\''; - } elseif (($key == 't.fk_user_assign') || ($key == 't.type_code') || ($key == 't.category_code') || ($key == 't.severity_code') || ($key == 't.fk_soc')) { - $sql .= " AND ".$key." = '".$this->db->escape($value)."'"; - } elseif ($key == 't.fk_statut') { - if (is_array($value) && count($value) > 0) { - $sql .= 'AND '.$key.' IN ('.implode(',', $value).')'; - } else { - $sql .= ' AND '.$key.' = '.$this->db->escape($value); - } - } else { - $sql .= ' AND '.$key.' LIKE \'%'.$value.'%\''; - } - } - } - if (!$user->rights->societe->client->voir && !$user->socid) { - $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; - } elseif ($user->socid) { - $sql .= " AND t.fk_soc = ".$user->socid; - } - - $sql .= " ORDER BY ".$sortfield.' '.$sortorder; - if (!empty($limit)) { - $sql .= ' '.$this->db->plimit($limit + 1, $offset); - } - - dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - - if ($resql) { - $this->lines = array(); - - $num = $this->db->num_rows($resql); - $i = 0; - - if ($num) { - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - - $line = new TicketsLine(); - - $line->id = $obj->rowid; - $line->rowid = $obj->rowid; - $line->ref = $obj->ref; - $line->track_id = $obj->track_id; - $line->fk_soc = $obj->fk_soc; - $line->fk_project = $obj->fk_project; - $line->origin_email = $obj->origin_email; - - $line->fk_user_create = $obj->fk_user_create; - $line->user_create_lastname = $obj->user_create_lastname; - $line->user_create_firstname = $obj->user_create_firstname; - - $line->fk_user_assign = $obj->fk_user_assign; - $line->user_assign_lastname = $obj->user_assign_lastname; - $line->user_assign_firstname = $obj->user_assign_firstname; - - $line->subject = $obj->subject; - $line->message = $obj->message; - $line->fk_statut = $obj->fk_statut; - $line->resolution = $obj->resolution; - $line->progress = $obj->progress; - $line->timing = $obj->timing; - - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label_type = ($langs->trans("TicketTypeShort".$obj->type_code) != ("TicketTypeShort".$obj->type_code) ? $langs->trans("TicketTypeShort".$obj->type_code) : ($obj->type_label != '-' ? $obj->type_label : '')); - $line->type_label = $label_type; - - $this->category_code = $obj->category_code; - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label_category = ($langs->trans("TicketCategoryShort".$obj->category_code) != ("TicketCategoryShort".$obj->category_code) ? $langs->trans("TicketCategoryShort".$obj->category_code) : ($obj->category_label != '-' ? $obj->category_label : '')); - $line->category_label = $label_category; - - $this->severity_code = $obj->severity_code; - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label_severity = ($langs->trans("TicketSeverityShort".$obj->severity_code) != ("TicketSeverityShort".$obj->severity_code) ? $langs->trans("TicketSeverityShort".$obj->severity_code) : ($obj->severity_label != '-' ? $obj->severity_label : '')); - $line->severity_label = $label_severity; - - $line->datec = $this->db->jdate($obj->datec); - $line->date_read = $this->db->jdate($obj->date_read); - $line->date_close = $this->db->jdate($obj->date_close); - - // Extra fields - if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label'])) { - foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { - $tmpkey = 'options_'.$key; - $line->{$tmpkey} = $obj->$tmpkey; - } - } - - $this->lines[$i] = $line; - $i++; - } - } - $this->db->free($resql); - return $num; - } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::fetch_all ".$this->error, LOG_ERR); - return -1; - } - } - - /** - * Update object into database - * - * @param User $user User that modifies - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function update($user = 0, $notrigger = 0) - { - global $conf, $langs, $hookmanager; - $error = 0; - - // Clean parameters - if (isset($this->ref)) { - $this->ref = trim($this->ref); - } - - if (isset($this->track_id)) { - $this->track_id = trim($this->track_id); - } - - if (isset($this->fk_soc)) { - $this->fk_soc = (int) $this->fk_soc; - } - - if (isset($this->fk_project)) { - $this->fk_project = (int) $this->fk_project; - } - - if (isset($this->origin_email)) { - $this->origin_email = trim($this->origin_email); - } - - if (isset($this->fk_user_create)) { - $this->fk_user_create = (int) $this->fk_user_create; - } - - if (isset($this->fk_user_assign)) { - $this->fk_user_assign = (int) $this->fk_user_assign; - } - - if (isset($this->subject)) { - $this->subject = trim($this->subject); - } - - if (isset($this->message)) { - $this->message = trim($this->message); - } - - if (isset($this->fk_statut)) { - $this->fk_statut = (int) $this->fk_statut; - } - - if (isset($this->resolution)) { - $this->resolution = trim($this->resolution); - } - - if (isset($this->progress)) { - $this->progress = trim($this->progress); - } - - if (isset($this->timing)) { - $this->timing = trim($this->timing); - } - - if (isset($this->type_code)) { - $this->timing = trim($this->type_code); - } - - if (isset($this->category_code)) { - $this->timing = trim($this->category_code); - } - - if (isset($this->severity_code)) { - $this->timing = trim($this->severity_code); - } - - // Check parameters - // Put here code to add a control on parameters values - // Update request - $sql = "UPDATE ".MAIN_DB_PREFIX."ticket SET"; - $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "").","; - $sql .= " track_id=".(isset($this->track_id) ? "'".$this->db->escape($this->track_id)."'" : "null").","; - $sql .= " fk_soc=".(isset($this->fk_soc) ? "'".$this->db->escape($this->fk_soc)."'" : "null").","; - $sql .= " fk_project=".(isset($this->fk_project) ? "'".$this->db->escape($this->fk_project)."'" : "null").","; - $sql .= " origin_email=".(isset($this->origin_email) ? "'".$this->db->escape($this->origin_email)."'" : "null").","; - $sql .= " fk_user_create=".(isset($this->fk_user_create) ? $this->fk_user_create : "null").","; - $sql .= " fk_user_assign=".(isset($this->fk_user_assign) ? $this->fk_user_assign : "null").","; - $sql .= " subject=".(isset($this->subject) ? "'".$this->db->escape($this->subject)."'" : "null").","; - $sql .= " message=".(isset($this->message) ? "'".$this->db->escape($this->message)."'" : "null").","; - $sql .= " fk_statut=".(isset($this->fk_statut) ? $this->fk_statut : "null").","; - $sql .= " resolution=".(isset($this->resolution) ? $this->resolution : "null").","; - $sql .= " progress=".(isset($this->progress) ? "'".$this->db->escape($this->progress)."'" : "null").","; - $sql .= " timing=".(isset($this->timing) ? "'".$this->db->escape($this->timing)."'" : "null").","; - $sql .= " type_code=".(isset($this->type_code) ? "'".$this->db->escape($this->type_code)."'" : "null").","; - $sql .= " category_code=".(isset($this->category_code) ? "'".$this->db->escape($this->category_code)."'" : "null").","; - $sql .= " severity_code=".(isset($this->severity_code) ? "'".$this->db->escape($this->severity_code)."'" : "null").","; - $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; - $sql .= " date_read=".(dol_strlen($this->date_read) != 0 ? "'".$this->db->idate($this->date_read)."'" : 'null').","; - $sql .= " date_close=".(dol_strlen($this->date_close) != 0 ? "'".$this->db->idate($this->date_close)."'" : 'null').""; - $sql .= " WHERE rowid=".$this->id; - - $this->db->begin(); - - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->errors[] = "Error ".$this->db->lasterror(); - } - - if (!$error) { - // Update extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } - } - } - - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('TICKET_MODIFY', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - - // Commit or rollback - if ($error) { - foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return 1; - } - } - - /** - * Delete object in database - * - * @param User $user User that deletes - * @param int $notrigger 0=launch triggers after, 1=disable triggers - * @return int <0 if KO, >0 if OK - */ - public function delete($user, $notrigger = 0) - { - global $conf, $langs; - $error = 0; - - $this->db->begin(); - - if (!$error) { - if (!$notrigger) { - // Call trigger - $result = $this->call_trigger('TICKET_DELETE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - } - - if (!$error) { - // Delete linked contacts - $res = $this->delete_linked_contact(); - if ($res < 0) { - dol_syslog(get_class($this)."::delete error", LOG_ERR); - $error++; - } - } - - if (!$error) { - // Delete linked object - $res = $this->deleteObjectLinked(); - if ($res < 0) $error++; - } - - // Removed extrafields - if (!$error) { - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); - } - } - - if (!$error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."ticket"; - $sql .= " WHERE rowid=".$this->id; - - dol_syslog(get_class($this)."::delete sql=".$sql); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->errors[] = "Error ".$this->db->lasterror(); - } - } - - // Commit or rollback - if ($error) { - foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return 1; - } - } - - /** - * Load an object from its id and create a new one in database - * - * @param User $user User that clone - * @param int $fromid Id of object to clone - * @return int New id of clone - */ - public function createFromClone(User $user, $fromid) - { - $error = 0; - - $object = new Ticket($this->db); - - $this->db->begin(); - - // Load source object - $object->fetch($fromid); - $object->id = 0; - $object->statut = 0; - - // Clear fields - // ... - // Create clone - $object->context['createfromclone'] = 'createfromclone'; - $result = $object->create($user); - - // Other options - if ($result < 0) { - $this->error = $object->error; - $error++; - } - - if (!$error) { - } - - unset($object->context['createfromclone']); - - // End - if (!$error) { - $this->db->commit(); - return $object->id; - } else { - $this->db->rollback(); - return -1; - } - } - - /** - * Initialise object with example values - * Id must be 0 if object instance is a specimen - * - * @return void - */ - public function initAsSpecimen() - { - $this->id = 0; - - $this->ref = 'TI0501-001'; - $this->track_id = 'XXXXaaaa'; - $this->origin_email = 'email@email.com'; - $this->fk_project = 1; - $this->fk_user_create = 1; - $this->fk_user_assign = 1; - $this->subject = 'Subject of ticket'; - $this->message = 'Message of ticket'; - $this->fk_statut = 0; - $this->resolution = '1'; - $this->progress = '10'; - $this->timing = '30'; - $this->type_code = 'TYPECODE'; - $this->category_code = 'CATEGORYCODE'; - $this->severity_code = 'SEVERITYCODE'; - $this->datec = ''; - $this->date_read = ''; - $this->date_close = ''; - $this->tms = ''; - } - - /** - * print selected status - * - * @param string $selected selected status - * @return void - */ - public function printSelectStatus($selected = "") - { - print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = ''); - } - - - /** - * Charge dans cache la liste des types de tickets (paramétrable dans dictionnaire) - * - * @return int Number of lines loaded, 0 if already loaded, <0 if KO - */ - public function loadCacheTypesTickets() - { - global $langs; - - if (!empty($this->cache_types_tickets) && count($this->cache_types_tickets)) { - return 0; - } - // Cache deja charge - - $sql = "SELECT rowid, code, label, use_default, pos, description"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type"; - $sql .= " WHERE active > 0"; - $sql .= " ORDER BY pos"; - dol_syslog(get_class($this)."::load_cache_type_tickets sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label = ($langs->trans("TicketTypeShort".$obj->code) != ("TicketTypeShort".$obj->code) ? $langs->trans("TicketTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); - $this->cache_types_tickets[$obj->rowid]['code'] = $obj->code; - $this->cache_types_tickets[$obj->rowid]['label'] = $label; - $this->cache_types_tickets[$obj->rowid]['use_default'] = $obj->use_default; - $this->cache_types_tickets[$obj->rowid]['pos'] = $obj->pos; - $i++; - } - return $num; - } else { - dol_print_error($this->db); - return -1; - } - } - - /** - * Charge dans cache la liste des catégories de tickets (paramétrable dans dictionnaire) - * - * @return int Number of lines loaded, 0 if already loaded, <0 if KO - */ - public function loadCacheCategoriesTickets() - { - global $langs; - - if (!empty($this->cache_category_ticket) && count($this->cache_category_tickets)) { - return 0; - } - // Cache deja charge - - $sql = "SELECT rowid, code, label, use_default, pos, description"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category"; - $sql .= " WHERE active > 0"; - $sql .= " ORDER BY pos"; - dol_syslog(get_class($this)."::load_cache_categories_tickets sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - $this->cache_category_tickets[$obj->rowid]['code'] = $obj->code; - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label = ($langs->trans("TicketCategoryShort".$obj->code) != ("TicketCategoryShort".$obj->code) ? $langs->trans("TicketCategoryShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); - $this->cache_category_tickets[$obj->rowid]['label'] = $label; - $this->cache_category_tickets[$obj->rowid]['use_default'] = $obj->use_default; - $this->cache_category_tickets[$obj->rowid]['pos'] = $obj->pos; - $i++; - } - return $num; - } else { - dol_print_error($this->db); - return -1; - } - } - - /** - * Charge dans cache la liste des sévérité de tickets (paramétrable dans dictionnaire) - * - * @return int Number of lines loaded, 0 if already loaded, <0 if KO - */ - public function loadCacheSeveritiesTickets() - { - global $langs; - - if (!empty($this->cache_severity_tickets) && count($this->cache_severity_tickets)) { - return 0; - } - // Cache deja charge - - $sql = "SELECT rowid, code, label, use_default, pos, description"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity"; - $sql .= " WHERE active > 0"; - $sql .= " ORDER BY pos"; - dol_syslog(get_class($this)."::loadCacheSeveritiesTickets sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - - $this->cache_severity_tickets[$obj->rowid]['code'] = $obj->code; - // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut - $label = ($langs->trans("TicketSeverityShort".$obj->code) != ("TicketSeverityShort".$obj->code) ? $langs->trans("TicketSeverityShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); - $this->cache_severity_tickets[$obj->rowid]['label'] = $label; - $this->cache_severity_tickets[$obj->rowid]['use_default'] = $obj->use_default; - $this->cache_severity_tickets[$obj->rowid]['pos'] = $obj->pos; - $i++; - } - return $num; - } else { - dol_print_error($this->db); - return -1; - } - } - - - /** - * Return status label of object - * - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto - * @return string Label - */ - public function getLibStatut($mode = 0) - { - return $this->libStatut($this->fk_statut, $mode); - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return status label of object - * - * @param string $status Id status - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto - * @return string Label - */ - public function LibStatut($status, $mode = 0) - { - // phpcs:enable - global $langs; - - if ($mode == 0) { - return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 2) { - if ($status == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - } - elseif ($mode == 3) { - if ($status == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket'); - } - elseif ($status == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket'); - } - elseif ($status == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket'); - } - elseif ($status == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket'); - } - elseif ($status == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket'); - } - elseif ($status == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket'); - } - elseif ($status == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket'); - } - elseif ($status == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket'); - } - } - elseif ($mode == 4) { - if ($status == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - } - elseif ($mode == 5 || $mode == 6) { - if ($status == self::STATUS_NOT_READ) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket'); - } - elseif ($status == self::STATUS_READ) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket'); - } - elseif ($status == self::STATUS_ASSIGNED) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket'); - } - elseif ($status == self::STATUS_IN_PROGRESS) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket'); - } - elseif ($status == self::STATUS_NEED_MORE_INFO) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket'); - } - elseif ($status == self::STATUS_WAITING) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket'); - } - elseif ($status == self::STATUS_CLOSED) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket'); - } - elseif ($status == self::STATUS_CANCELED) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket'); - } - } - } - - - /** - * Return a link to the object card (with optionaly the picto) - * - * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) - * @param string $option On what the link point to ('nolink', ...) - * @param int $notooltip 1=Disable tooltip - * @param string $morecss Add more css on link - * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking - * @return string String with URL - */ - public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) - { - global $db, $conf, $langs; - global $dolibarr_main_authentication, $dolibarr_main_demo; - global $menumanager; - - if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - - $result = ''; - $companylink = ''; - - $label = ''.$langs->trans("Ticket").''; - $label .= '
'; - $label .= ''.$langs->trans('Ref').': '.$this->ref.'
'; - $label .= ''.$langs->trans('TicketTrackId').': '.$this->track_id.'
'; - $label .= ''.$langs->trans('Subject').': '.$this->subject; - - $url = dol_buildpath('/ticket/card.php', 1).'?id='.$this->id; - - if ($option != 'nolink') - { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; - if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; - } - - $linkclose = ''; - if (empty($notooltip)) - { - if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label = $langs->trans("ShowTicket"); - $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); - - $linkstart = ''; - $linkend = ''; - - $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); - if ($withpicto != 2) $result .= $this->ref; - $result .= $linkend; - //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); - - return $result; - } - - - /** - * Mark a message as read - * - * @param User $user Object user - * @param int $notrigger No trigger - * @return int <0 if KO, >0 if OK - */ - public function markAsRead($user, $notrigger = 0) - { - global $conf, $langs; - - $error = 0; - - if ($this->statut != self::STATUS_CANCELED) { // no closed - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET fk_statut = ".Ticket::STATUS_READ.", date_read='".$this->db->idate(dol_now())."'"; - $sql .= " WHERE rowid = ".$this->id; - - dol_syslog(get_class($this)."::markAsRead"); - $resql = $this->db->query($sql); - if ($resql) { - $this->actionmsg = $langs->trans('TicketLogMesgReadBy', $this->ref, $user->getFullName($langs)); - $this->actionmsg2 = $langs->trans('TicketLogMesgReadBy', $this->ref, $user->getFullName($langs)); - - if (!$error && !$notrigger) { - // Call trigger - $result = $this->call_trigger('TICKET_MODIFY', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - - if (!$error) { - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - $this->error = join(',', $this->errors); - dol_syslog(get_class($this)."::markAsRead ".$this->error, LOG_ERR); - return -1; - } - } else { - $this->db->rollback(); - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::markAsRead ".$this->error, LOG_ERR); - return -1; - } - } - } - - /** - * Mark a message as read - * - * @param User $user Object user - * @param int $id_assign_user ID of user assigned - * @param int $notrigger Disable trigger - * @return int <0 if KO, 0=Nothing done, >0 if OK - */ - public function assignUser($user, $id_assign_user, $notrigger = 0) - { - global $conf, $langs; - - $error = 0; - $this->db->begin(); - - $this->oldcopy = dol_clone($this); - - $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - if ($id_assign_user > 0) - { - $sql .= " SET fk_user_assign=".$id_assign_user.", fk_statut = ".Ticket::STATUS_ASSIGNED; - } - else - { - $sql .= " SET fk_user_assign=null, fk_statut = ".Ticket::STATUS_READ; - } - $sql .= " WHERE rowid = ".$this->id; - - dol_syslog(get_class($this)."::assignUser sql=".$sql); - $resql = $this->db->query($sql); - if ($resql) - { - $this->fk_user_assign = $id_assign_user; // May be used by trigger - - if (!$notrigger) { - // Call trigger - $result = $this->call_trigger('TICKET_ASSIGNED', $user); - if ($result < 0) { - $error++; - } - // End call triggers - } - - if (!$error) { - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - $this->error = join(',', $this->errors); - dol_syslog(get_class($this)."::assignUser ".$this->error, LOG_ERR); - return -1; - } - } else { - $this->db->rollback(); - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::assignUser ".$this->error, LOG_ERR); - return -1; - } - } - - - /** - * Send notification of changes by email - * - * @param User $user User that create - * @param string $message Log message - * @return int <0 if KO, >0 if OK (number of emails sent) - */ - private function sendLogByEmail($user, $message) - { - global $conf, $langs; - - $nb_sent = 0; - - $langs->load('ticket'); - - // Retrieve email of all contacts (internal and external) - $contacts = $this->listeContact(-1, 'internal'); - $contacts = array_merge($contacts, $this->listeContact(-1, 'external')); - - /* If origin_email and no socid, we add email to the list * */ - if (!empty($this->origin_email) && empty($this->fk_soc)) { - $array_ext = array(array('firstname' => '', 'lastname' => '', 'email' => $this->origin_email, 'libelle' => $langs->transnoentities('TicketEmailOriginIssuer'), 'socid' => "-1")); - $contacts = array_merge($contacts, $array_ext); - } - - if (!empty($this->fk_soc)) { - $this->fetch_thirdparty($this->fk_soc); - $array_company = array(array('firstname' => '', 'lastname' => $this->client->name, 'email' => $this->client->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $this->client->id)); - $contacts = array_merge($contacts, $array_company); - } - - // foreach contact send email with notification message - if (count($contacts) > 0) { - foreach ($contacts as $key => $info_sendto) { - $message = ''; - $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNotificationEmailSubject', $this->track_id); - $message .= $langs->transnoentities('TicketNotificationEmailBody', $this->track_id)."\n\n"; - $message .= $langs->transnoentities('Title').' : '.$this->subject."\n"; - - $recipient_name = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1'); - $recipient = (!empty($recipient_name) ? $recipient_name : $info_sendto['email']).' ('.strtolower($info_sendto['libelle']).')'; - $message .= $langs->transnoentities('TicketNotificationRecipient').' : '.$recipient."\n"; - $message .= "\n"; - $message .= '* '.$langs->transnoentities('TicketNotificationLogMessage').' *'."\n"; - $message .= dol_html_entity_decode($log_message, ENT_QUOTES)."\n"; - - if ($info_sendto['source'] == 'internal') { - $url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$this->track_id; - $message .= "\n".$langs->transnoentities('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.''.$this->track_id.''."\n"; - } else { - $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$this->track_id; - $message .= "\n".$langs->transnoentities('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.''.$this->track_id.''."\n"; - } - - $message .= "\n"; - $message .= $langs->transnoentities('TicketEmailPleaseDoNotReplyToThisEmail')."\n"; - - $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; - $replyto = $from; - - // Init to avoid errors - $filepath = array(); - $filename = array(); - $mimetype = array(); - - $message = dol_nl2br($message); - - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject, $info_sendto['email'], $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, 0); - if ($mailfile->error || $mailfile->errors) { - setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - } else { - $result = $mailfile->sendfile(); - if ($result > 0) { - $nb_sent++; - } - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - } - - setEventMessages($langs->trans('TicketNotificationNumberEmailSent', $nb_sent), null, 'mesgs'); - } - - return $nb_sent; - } - - /** - * Charge la liste des actions sur le ticket - * - * @return int Number of lines loaded, 0 if already loaded, <0 if KO - */ - public function loadCacheLogsTicket() - { - global $langs; - - if (is_array($this->cache_logs_ticket) && count($this->cache_logs_ticket)) { - return 0; - } - // Cache deja charge - - // TODO Read the table llx_actioncomm - /* + /** + * @var string ID to identify managed object + */ + public $element = 'ticket'; + + /** + * @var string Name of table without prefix where object is stored + */ + public $table_element = 'ticket'; + + /** + * @var string Name of field for link to tickets + */ + public $fk_element = 'fk_ticket'; + + /** + * @var int Does ticketcore support multicompany module ? 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + */ + public $ismultientitymanaged = 1; + + /** + * @var int Does ticketcore support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 1; + + /** + * @var string String with name of icon for ticketcore. Must be the part after the 'object_' into object_ticketcore.png + */ + public $picto = 'ticket'; + + + /** + * @var string Hash to identify ticket publically + */ + public $track_id; + + /** + * @var int Thirdparty ID + */ + public $fk_soc; + + /** + * @var int Project ID + */ + public $fk_project; + + /** + * @var string Person email who have create ticket + */ + public $origin_email; + + /** + * @var int User id who have create ticket + */ + public $fk_user_create; + + /** + * @var int User id who have ticket assigned + */ + public $fk_user_assign; + + /** + * var string Ticket subject + */ + public $subject; + + /** + * @var string Ticket message + */ + public $message; + + /** + * @var int Ticket statut + */ + public $fk_statut; + + /** + * @var string State resolution + */ + public $resolution; + + /** + * @var int Progress in percent + */ + public $progress; + + /** + * @var string Duration for ticket + */ + public $timing; + + /** + * @var string Type code + */ + public $type_code; + + /** + * @var string Category code + */ + public $category_code; + + /** + * @var string Severity code + */ + public $severity_code; + + /** + * @var int Création date + */ + public $datec = ''; + + /** + * @var int Read date + */ + public $date_read = ''; + + /** + * @var int Close ticket date + */ + public $date_close = ''; + + /** + * @var array cache_types_tickets + */ + public $cache_types_tickets; + + /** + * @var array tickets categories + */ + public $cache_category_tickets; + + /** + * @var int Notify tiers at create + */ + public $notify_tiers_at_create; + + public $lines; + + /** + * @var string Regex pour les images + */ + public $regeximgext = '\.jpg|\.jpeg|\.bmp|\.gif|\.png|\.tiff'; + + public $fields = array( + 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"), + 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), + 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), + 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), + 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), + 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth75'), + 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth100'), + 'category_code' => array('type'=>'varchar(32)', 'label'=>'TicketGroup', 'visible'=>-1, 'enabled'=>1, 'position'=>21, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), + 'severity_code' => array('type'=>'varchar(32)', 'label'=>'Severity', 'visible'=>1, 'enabled'=>1, 'position'=>22, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth100'), + 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty", 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'notify_tiers_at_create' => array('type'=>'integer', 'label'=>'NotifyThirdparty', 'visible'=>-1, 'enabled'=>0, 'position'=>51, 'notnull'=>1, 'index'=>1), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php', 'label'=>'Project', 'visible'=>-1, 'enabled'=>1, 'position'=>52, 'notnull'=>-1, 'index'=>1, 'help'=>"LinkToProject"), + 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), + 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), + 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), + 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1), + 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), + 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), + 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), + 'progress' => array('type'=>'varchar(100)', 'label'=>'Progression', 'visible'=>-1, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'css'=>'right', 'help'=>"", 'isameasure'=>1), + 'resolution' => array('type'=>'integer', 'label'=>'Resolution', 'visible'=>-1, 'enabled'=>1, 'position'=>550, 'notnull'=>1), + 'fk_statut' => array('type'=>'integer', 'label'=>'Status', 'visible'=>1, 'enabled'=>1, 'position'=>600, 'notnull'=>1, 'index'=>1, 'arrayofkeyval'=>array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted')), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>900), + ); + + /** + * Status + */ + const STATUS_NOT_READ = 0; + const STATUS_READ = 1; + const STATUS_ASSIGNED = 2; + const STATUS_IN_PROGRESS = 3; + const STATUS_NEED_MORE_INFO = 5; + const STATUS_WAITING = 7; + const STATUS_CLOSED = 8; + const STATUS_CANCELED = 9; + + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + + $this->statuts_short = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Suspended', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled'); + $this->statuts = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Suspended', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled'); + } + + /** + * Check properties of ticket are ok (like ref, track_id, ...). + * All properties must be already loaded on object (this->ref, this->track_id, ...). + * + * @return int 0 if OK, <0 if KO + */ + private function verify() + { + $this->errors = array(); + + $result = 0; + + // Clean parameters + if (isset($this->ref)) { + $this->ref = trim($this->ref); + } + + if (isset($this->track_id)) { + $this->track_id = trim($this->track_id); + } + + if (isset($this->fk_soc)) { + $this->fk_soc = (int) $this->fk_soc; + } + + if (isset($this->fk_project)) { + $this->fk_project = (int) $this->fk_project; + } + + if (isset($this->origin_email)) { + $this->origin_email = trim($this->origin_email); + } + + if (isset($this->fk_user_create)) { + $this->fk_user_create = (int) $this->fk_user_create; + } + + if (isset($this->fk_user_assign)) { + $this->fk_user_assign = (int) $this->fk_user_assign; + } + + if (isset($this->subject)) { + $this->subject = trim($this->subject); + } + + if (isset($this->message)) { + $this->message = trim($this->message); + } + + if (isset($this->fk_statut)) { + $this->fk_statut = (int) $this->fk_statut; + } + + if (isset($this->resolution)) { + $this->resolution = trim($this->resolution); + } + + if (isset($this->progress)) { + $this->progress = trim($this->progress); + } + + if (isset($this->timing)) { + $this->timing = trim($this->timing); + } + + if (isset($this->type_code)) { + $this->type_code = trim($this->type_code); + } + + if (isset($this->category_code)) { + $this->category_code = trim($this->category_code); + } + + if (isset($this->severity_code)) { + $this->severity_code = trim($this->severity_code); + } + + if (empty($this->ref)) { + $this->errors[] = 'ErrorTicketRefRequired'; + dol_syslog(get_class($this)."::create error -1 ref null", LOG_ERR); + $result = -1; + } + + return $result; + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create($user, $notrigger = 0) + { + global $conf, $langs; + $error = 0; + + // Clean parameters + $this->datec = dol_now(); + if (empty($this->track_id)) $this->track_id = generate_random_id(16); + + // Check more parameters + // If error, this->errors[] is filled + $result = $this->verify(); + + if ($result >= 0) { + // Insert request + $sql = "INSERT INTO ".MAIN_DB_PREFIX."ticket("; + $sql .= "ref,"; + $sql .= "track_id,"; + $sql .= "fk_soc,"; + $sql .= "fk_project,"; + $sql .= "origin_email,"; + $sql .= "fk_user_create,"; + $sql .= "fk_user_assign,"; + $sql .= "subject,"; + $sql .= "message,"; + $sql .= "fk_statut,"; + $sql .= "resolution,"; + $sql .= "progress,"; + $sql .= "timing,"; + $sql .= "type_code,"; + $sql .= "category_code,"; + $sql .= "severity_code,"; + $sql .= "datec,"; + $sql .= "date_read,"; + $sql .= "date_close,"; + $sql .= "entity,"; + $sql .= "notify_tiers_at_create"; + $sql .= ") VALUES ("; + $sql .= " ".(!isset($this->ref) ? '' : "'".$this->db->escape($this->ref)."'").","; + $sql .= " ".(!isset($this->track_id) ? 'NULL' : "'".$this->db->escape($this->track_id)."'").","; + $sql .= " ".($this->fk_soc > 0 ? $this->db->escape($this->fk_soc) : "null").","; + $sql .= " ".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "null").","; + $sql .= " ".(!isset($this->origin_email) ? 'NULL' : "'".$this->db->escape($this->origin_email)."'").","; + $sql .= " ".($this->fk_user_create > 0 ? $this->fk_user_create : ($user->id > 0 ? $user->id : 'NULL')).","; + $sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').","; + $sql .= " ".(!isset($this->subject) ? 'NULL' : "'".$this->db->escape($this->subject)."'").","; + $sql .= " ".(!isset($this->message) ? 'NULL' : "'".$this->db->escape($this->message)."'").","; + $sql .= " ".(!isset($this->fk_statut) ? '0' : "'".$this->db->escape($this->fk_statut)."'").","; + $sql .= " ".(!isset($this->resolution) ? 'NULL' : "'".$this->db->escape($this->resolution)."'").","; + $sql .= " ".(!isset($this->progress) ? '0' : "'".$this->db->escape($this->progress)."'").","; + $sql .= " ".(!isset($this->timing) ? 'NULL' : "'".$this->db->escape($this->timing)."'").","; + $sql .= " ".(!isset($this->type_code) ? 'NULL' : "'".$this->db->escape($this->type_code)."'").","; + $sql .= " ".(!isset($this->category_code) ? 'NULL' : "'".$this->db->escape($this->category_code)."'").","; + $sql .= " ".(!isset($this->severity_code) ? 'NULL' : "'".$this->db->escape($this->severity_code)."'").","; + $sql .= " ".(!isset($this->datec) || dol_strlen($this->datec) == 0 ? 'NULL' : "'".$this->db->idate($this->datec)."'").","; + $sql .= " ".(!isset($this->date_read) || dol_strlen($this->date_read) == 0 ? 'NULL' : "'".$this->db->idate($this->date_read)."'").","; + $sql .= " ".(!isset($this->date_close) || dol_strlen($this->date_close) == 0 ? 'NULL' : "'".$this->db->idate($this->date_close)."'").""; + $sql .= ", ".$conf->entity; + $sql .= ", ".(!isset($this->notify_tiers_at_create) ? '1' : "'".$this->db->escape($this->notify_tiers_at_create)."'"); + $sql .= ")"; + + $this->db->begin(); + + dol_syslog(get_class($this)."::create sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); + } + + if (!$error) { + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ticket"); + + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('TICKET_CREATE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + } + + //Update extrafield + if (!$error) { + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } + } + } + + // Commit or rollback + if ($error) { + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; + } else { + $this->db->commit(); + return $this->id; + } + } else { + $this->db->rollback(); + dol_syslog(get_class($this)."::Create fails verify ".join(',', $this->errors), LOG_WARNING); + return -3; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @param string $ref Ref + * @param string $track_id Track id, a hash like ref + * @return int <0 if KO, >0 if OK + */ + public function fetch($id = '', $ref = '', $track_id = '') + { + global $langs; + + // Check parameters + if (!$id && !$track_id && !$ref) { + $this->error = 'ErrorWrongParameters'; + dol_print_error(get_class($this)."::fetch ".$this->error); + return -1; + } + + $sql = "SELECT"; + $sql .= " t.rowid,"; + $sql .= " t.ref,"; + $sql .= " t.track_id,"; + $sql .= " t.fk_soc,"; + $sql .= " t.fk_project,"; + $sql .= " t.origin_email,"; + $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_assign,"; + $sql .= " t.subject,"; + $sql .= " t.message,"; + $sql .= " t.fk_statut,"; + $sql .= " t.resolution,"; + $sql .= " t.progress,"; + $sql .= " t.timing,"; + $sql .= " t.type_code,"; + $sql .= " t.category_code,"; + $sql .= " t.severity_code,"; + $sql .= " t.datec,"; + $sql .= " t.date_read,"; + $sql .= " t.date_close,"; + $sql .= " t.tms"; + $sql .= ", type.code as type_code, type.label as type_label, category.code as category_code, category.label as category_label, severity.code as severity_code, severity.label as severity_label"; + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; + + if ($id) { + $sql .= " WHERE t.rowid = ".$this->db->escape($id); + } else { + $sql .= " WHERE t.entity IN (".getEntity($this->element, 1).")"; + if ($track_id) { + $sql .= " AND t.track_id = '".$this->db->escape($track_id)."'"; + } elseif ($ref) { + $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; + } + } + + dol_syslog(get_class($this)."::fetch sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + if ($this->db->num_rows($resql)) + { + $obj = $this->db->fetch_object($resql); + + $this->id = $obj->rowid; + $this->ref = $obj->ref; + $this->track_id = $obj->track_id; + $this->fk_soc = $obj->fk_soc; + $this->socid = $obj->fk_soc; // for fetch_thirdparty() method + $this->fk_project = $obj->fk_project; + $this->origin_email = $obj->origin_email; + $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_assign = $obj->fk_user_assign; + $this->subject = $obj->subject; + $this->message = $obj->message; + $this->fk_statut = $obj->fk_statut; + $this->resolution = $obj->resolution; + $this->progress = $obj->progress; + $this->timing = $obj->timing; + + $this->type_code = $obj->type_code; + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label_type = ($langs->trans("TicketTypeShort".$obj->type_code) != ("TicketTypeShort".$obj->type_code) ? $langs->trans("TicketTypeShort".$obj->type_code) : ($obj->type_label != '-' ? $obj->type_label : '')); + $this->type_label = $label_type; + + $this->category_code = $obj->category_code; + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label_category = ($langs->trans("TicketCategoryShort".$obj->category_code) != ("TicketCategoryShort".$obj->category_code) ? $langs->trans("TicketCategoryShort".$obj->category_code) : ($obj->category_label != '-' ? $obj->category_label : '')); + $this->category_label = $label_category; + + $this->severity_code = $obj->severity_code; + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label_severity = ($langs->trans("TicketSeverityShort".$obj->severity_code) != ("TicketSeverityShort".$obj->severity_code) ? $langs->trans("TicketSeverityShort".$obj->severity_code) : ($obj->severity_label != '-' ? $obj->severity_label : '')); + $this->severity_label = $label_severity; + + $this->datec = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); + $this->date_read = $this->db->jdate($obj->date_read); + $this->date_validation = $this->db->jdate($obj->date_read); + $this->date_close = $this->db->jdate($obj->date_close); + $this->tms = $this->db->jdate($obj->tms); + $this->date_modification = $this->db->jdate($obj->tms); + + $this->fetch_optionals(); + + $this->db->free($resql); + return 1; + } + else + { + return 0; + } + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); + return -1; + } + } + + /** + * Load all objects in memory from database + * + * @param User $user User for action + * @param string $sortorder Sort order + * @param string $sortfield Sort field + * @param int $limit page number + * @param int $offset Offset for query + * @param int $arch archive or not (not used) + * @param array $filter Filter for query + * output + * @return int <0 if KO, >0 if OK + */ + public function fetchAll($user, $sortorder = 'ASC', $sortfield = 't.datec', $limit = '', $offset = 0, $arch = '', $filter = '') + { + global $langs; + + $extrafields = new ExtraFields($this->db); + + // fetch optionals attributes and labels + $extrafields->fetch_name_optionals_label($this->table_element); + + $sql = "SELECT"; + $sql .= " t.rowid,"; + $sql .= " t.ref,"; + $sql .= " t.track_id,"; + $sql .= " t.fk_soc,"; + $sql .= " t.fk_project,"; + $sql .= " t.origin_email,"; + $sql .= " t.fk_user_create, uc.lastname as user_create_lastname, uc.firstname as user_create_firstname,"; + $sql .= " t.fk_user_assign, ua.lastname as user_assign_lastname, ua.firstname as user_assign_firstname,"; + $sql .= " t.subject,"; + $sql .= " t.message,"; + $sql .= " t.fk_statut,"; + $sql .= " t.resolution,"; + $sql .= " t.progress,"; + $sql .= " t.timing,"; + $sql .= " t.type_code,"; + $sql .= " t.category_code,"; + $sql .= " t.severity_code,"; + $sql .= " t.datec,"; + $sql .= " t.date_read,"; + $sql .= " t.date_close,"; + $sql .= " t.tms"; + $sql .= ", type.label as type_label, category.label as category_label, severity.label as severity_label"; + // Add fields for extrafields + foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { + $sql .= ($extrafields->attributes[$this->table_element]['type'][$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); + } + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as t"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_type as type ON type.code=t.type_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_category as category ON category.code=t.category_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_ticket_severity as severity ON severity.code=t.severity_code"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid=t.fk_soc"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as uc ON uc.rowid=t.fk_user_create"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as ua ON ua.rowid=t.fk_user_assign"; + if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label'])) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."ticket_extrafields as ef on (t.rowid = ef.fk_object)"; + } + if (!$user->rights->societe->client->voir && !$user->socid) { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + + $sql .= " WHERE t.entity IN (".getEntity('ticket').")"; + + // Manage filter + if (!empty($filter)) { + foreach ($filter as $key => $value) { + if (strpos($key, 'date')) { // To allow $filter['YEAR(s.dated)']=>$year + $sql .= ' AND '.$key.' = \''.$value.'\''; + } elseif (($key == 't.fk_user_assign') || ($key == 't.type_code') || ($key == 't.category_code') || ($key == 't.severity_code') || ($key == 't.fk_soc')) { + $sql .= " AND ".$key." = '".$this->db->escape($value)."'"; + } elseif ($key == 't.fk_statut') { + if (is_array($value) && count($value) > 0) { + $sql .= 'AND '.$key.' IN ('.implode(',', $value).')'; + } else { + $sql .= ' AND '.$key.' = '.$this->db->escape($value); + } + } else { + $sql .= ' AND '.$key.' LIKE \'%'.$value.'%\''; + } + } + } + if (!$user->rights->societe->client->voir && !$user->socid) { + $sql .= " AND t.fk_soc = sc.fk_soc AND sc.fk_user = ".$user->id; + } elseif ($user->socid) { + $sql .= " AND t.fk_soc = ".$user->socid; + } + + $sql .= " ORDER BY ".$sortfield.' '.$sortorder; + if (!empty($limit)) { + $sql .= ' '.$this->db->plimit($limit + 1, $offset); + } + + dol_syslog(get_class($this)."::fetch_all sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + + if ($resql) { + $this->lines = array(); + + $num = $this->db->num_rows($resql); + $i = 0; + + if ($num) { + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + $line = new TicketsLine(); + + $line->id = $obj->rowid; + $line->rowid = $obj->rowid; + $line->ref = $obj->ref; + $line->track_id = $obj->track_id; + $line->fk_soc = $obj->fk_soc; + $line->fk_project = $obj->fk_project; + $line->origin_email = $obj->origin_email; + + $line->fk_user_create = $obj->fk_user_create; + $line->user_create_lastname = $obj->user_create_lastname; + $line->user_create_firstname = $obj->user_create_firstname; + + $line->fk_user_assign = $obj->fk_user_assign; + $line->user_assign_lastname = $obj->user_assign_lastname; + $line->user_assign_firstname = $obj->user_assign_firstname; + + $line->subject = $obj->subject; + $line->message = $obj->message; + $line->fk_statut = $obj->fk_statut; + $line->resolution = $obj->resolution; + $line->progress = $obj->progress; + $line->timing = $obj->timing; + + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label_type = ($langs->trans("TicketTypeShort".$obj->type_code) != ("TicketTypeShort".$obj->type_code) ? $langs->trans("TicketTypeShort".$obj->type_code) : ($obj->type_label != '-' ? $obj->type_label : '')); + $line->type_label = $label_type; + + $this->category_code = $obj->category_code; + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label_category = ($langs->trans("TicketCategoryShort".$obj->category_code) != ("TicketCategoryShort".$obj->category_code) ? $langs->trans("TicketCategoryShort".$obj->category_code) : ($obj->category_label != '-' ? $obj->category_label : '')); + $line->category_label = $label_category; + + $this->severity_code = $obj->severity_code; + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label_severity = ($langs->trans("TicketSeverityShort".$obj->severity_code) != ("TicketSeverityShort".$obj->severity_code) ? $langs->trans("TicketSeverityShort".$obj->severity_code) : ($obj->severity_label != '-' ? $obj->severity_label : '')); + $line->severity_label = $label_severity; + + $line->datec = $this->db->jdate($obj->datec); + $line->date_read = $this->db->jdate($obj->date_read); + $line->date_close = $this->db->jdate($obj->date_close); + + // Extra fields + if (is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label'])) { + foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { + $tmpkey = 'options_'.$key; + $line->{$tmpkey} = $obj->$tmpkey; + } + } + + $this->lines[$i] = $line; + $i++; + } + } + $this->db->free($resql); + return $num; + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::fetch_all ".$this->error, LOG_ERR); + return -1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update($user = 0, $notrigger = 0) + { + global $conf, $langs, $hookmanager; + $error = 0; + + // Clean parameters + if (isset($this->ref)) { + $this->ref = trim($this->ref); + } + + if (isset($this->track_id)) { + $this->track_id = trim($this->track_id); + } + + if (isset($this->fk_soc)) { + $this->fk_soc = (int) $this->fk_soc; + } + + if (isset($this->fk_project)) { + $this->fk_project = (int) $this->fk_project; + } + + if (isset($this->origin_email)) { + $this->origin_email = trim($this->origin_email); + } + + if (isset($this->fk_user_create)) { + $this->fk_user_create = (int) $this->fk_user_create; + } + + if (isset($this->fk_user_assign)) { + $this->fk_user_assign = (int) $this->fk_user_assign; + } + + if (isset($this->subject)) { + $this->subject = trim($this->subject); + } + + if (isset($this->message)) { + $this->message = trim($this->message); + } + + if (isset($this->fk_statut)) { + $this->fk_statut = (int) $this->fk_statut; + } + + if (isset($this->resolution)) { + $this->resolution = trim($this->resolution); + } + + if (isset($this->progress)) { + $this->progress = trim($this->progress); + } + + if (isset($this->timing)) { + $this->timing = trim($this->timing); + } + + if (isset($this->type_code)) { + $this->timing = trim($this->type_code); + } + + if (isset($this->category_code)) { + $this->timing = trim($this->category_code); + } + + if (isset($this->severity_code)) { + $this->timing = trim($this->severity_code); + } + + // Check parameters + // Put here code to add a control on parameters values + // Update request + $sql = "UPDATE ".MAIN_DB_PREFIX."ticket SET"; + $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "").","; + $sql .= " track_id=".(isset($this->track_id) ? "'".$this->db->escape($this->track_id)."'" : "null").","; + $sql .= " fk_soc=".(isset($this->fk_soc) ? "'".$this->db->escape($this->fk_soc)."'" : "null").","; + $sql .= " fk_project=".(isset($this->fk_project) ? "'".$this->db->escape($this->fk_project)."'" : "null").","; + $sql .= " origin_email=".(isset($this->origin_email) ? "'".$this->db->escape($this->origin_email)."'" : "null").","; + $sql .= " fk_user_create=".(isset($this->fk_user_create) ? $this->fk_user_create : "null").","; + $sql .= " fk_user_assign=".(isset($this->fk_user_assign) ? $this->fk_user_assign : "null").","; + $sql .= " subject=".(isset($this->subject) ? "'".$this->db->escape($this->subject)."'" : "null").","; + $sql .= " message=".(isset($this->message) ? "'".$this->db->escape($this->message)."'" : "null").","; + $sql .= " fk_statut=".(isset($this->fk_statut) ? $this->fk_statut : "null").","; + $sql .= " resolution=".(isset($this->resolution) ? $this->resolution : "null").","; + $sql .= " progress=".(isset($this->progress) ? "'".$this->db->escape($this->progress)."'" : "null").","; + $sql .= " timing=".(isset($this->timing) ? "'".$this->db->escape($this->timing)."'" : "null").","; + $sql .= " type_code=".(isset($this->type_code) ? "'".$this->db->escape($this->type_code)."'" : "null").","; + $sql .= " category_code=".(isset($this->category_code) ? "'".$this->db->escape($this->category_code)."'" : "null").","; + $sql .= " severity_code=".(isset($this->severity_code) ? "'".$this->db->escape($this->severity_code)."'" : "null").","; + $sql .= " datec=".(dol_strlen($this->datec) != 0 ? "'".$this->db->idate($this->datec)."'" : 'null').","; + $sql .= " date_read=".(dol_strlen($this->date_read) != 0 ? "'".$this->db->idate($this->date_read)."'" : 'null').","; + $sql .= " date_close=".(dol_strlen($this->date_close) != 0 ? "'".$this->db->idate($this->date_close)."'" : 'null').""; + $sql .= " WHERE rowid=".$this->id; + + $this->db->begin(); + + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); + } + + if (!$error) { + // Update extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } + } + } + + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('TICKET_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + // Commit or rollback + if ($error) { + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; + } else { + $this->db->commit(); + return 1; + } + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete($user, $notrigger = 0) + { + global $conf, $langs; + $error = 0; + + $this->db->begin(); + + if (!$error) { + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('TICKET_DELETE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + } + + if (!$error) { + // Delete linked contacts + $res = $this->delete_linked_contact(); + if ($res < 0) { + dol_syslog(get_class($this)."::delete error", LOG_ERR); + $error++; + } + } + + if (!$error) { + // Delete linked object + $res = $this->deleteObjectLinked(); + if ($res < 0) $error++; + } + + // Removed extrafields + if (!$error) { + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + dol_syslog(get_class($this)."::delete error -3 ".$this->error, LOG_ERR); + } + } + + if (!$error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."ticket"; + $sql .= " WHERE rowid=".$this->id; + + dol_syslog(get_class($this)."::delete sql=".$sql); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); + } + } + + // Commit or rollback + if ($error) { + foreach ($this->errors as $errmsg) { + dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } + $this->db->rollback(); + return -1 * $error; + } else { + $this->db->commit(); + return 1; + } + } + + /** + * Load an object from its id and create a new one in database + * + * @param User $user User that clone + * @param int $fromid Id of object to clone + * @return int New id of clone + */ + public function createFromClone(User $user, $fromid) + { + $error = 0; + + $object = new Ticket($this->db); + + $this->db->begin(); + + // Load source object + $object->fetch($fromid); + $object->id = 0; + $object->statut = 0; + + // Clear fields + // ... + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->create($user); + + // Other options + if ($result < 0) { + $this->error = $object->error; + $error++; + } + + if (!$error) { + } + + unset($object->context['createfromclone']); + + // End + if (!$error) { + $this->db->commit(); + return $object->id; + } else { + $this->db->rollback(); + return -1; + } + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->id = 0; + + $this->ref = 'TI0501-001'; + $this->track_id = 'XXXXaaaa'; + $this->origin_email = 'email@email.com'; + $this->fk_project = 1; + $this->fk_user_create = 1; + $this->fk_user_assign = 1; + $this->subject = 'Subject of ticket'; + $this->message = 'Message of ticket'; + $this->fk_statut = 0; + $this->resolution = '1'; + $this->progress = '10'; + $this->timing = '30'; + $this->type_code = 'TYPECODE'; + $this->category_code = 'CATEGORYCODE'; + $this->severity_code = 'SEVERITYCODE'; + $this->datec = ''; + $this->date_read = ''; + $this->date_close = ''; + $this->tms = ''; + } + + /** + * print selected status + * + * @param string $selected selected status + * @return void + */ + public function printSelectStatus($selected = "") + { + print Form::selectarray('search_fk_statut', $this->statuts_short, $selected, $show_empty = 1, $key_in_label = 0, $value_as_key = 0, $option = '', $translate = 1, $maxlen = 0, $disabled = 0, $sort = '', $morecss = ''); + } + + + /** + * Charge dans cache la liste des types de tickets (paramétrable dans dictionnaire) + * + * @return int Number of lines loaded, 0 if already loaded, <0 if KO + */ + public function loadCacheTypesTickets() + { + global $langs; + + if (!empty($this->cache_types_tickets) && count($this->cache_types_tickets)) { + return 0; + } + // Cache deja charge + + $sql = "SELECT rowid, code, label, use_default, pos, description"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_type"; + $sql .= " WHERE active > 0"; + $sql .= " ORDER BY pos"; + dol_syslog(get_class($this)."::load_cache_type_tickets sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label = ($langs->trans("TicketTypeShort".$obj->code) != ("TicketTypeShort".$obj->code) ? $langs->trans("TicketTypeShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); + $this->cache_types_tickets[$obj->rowid]['code'] = $obj->code; + $this->cache_types_tickets[$obj->rowid]['label'] = $label; + $this->cache_types_tickets[$obj->rowid]['use_default'] = $obj->use_default; + $this->cache_types_tickets[$obj->rowid]['pos'] = $obj->pos; + $i++; + } + return $num; + } else { + dol_print_error($this->db); + return -1; + } + } + + /** + * Charge dans cache la liste des catégories de tickets (paramétrable dans dictionnaire) + * + * @return int Number of lines loaded, 0 if already loaded, <0 if KO + */ + public function loadCacheCategoriesTickets() + { + global $langs; + + if (!empty($this->cache_category_ticket) && count($this->cache_category_tickets)) { + return 0; + } + // Cache deja charge + + $sql = "SELECT rowid, code, label, use_default, pos, description"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_category"; + $sql .= " WHERE active > 0"; + $sql .= " ORDER BY pos"; + dol_syslog(get_class($this)."::load_cache_categories_tickets sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + $this->cache_category_tickets[$obj->rowid]['code'] = $obj->code; + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label = ($langs->trans("TicketCategoryShort".$obj->code) != ("TicketCategoryShort".$obj->code) ? $langs->trans("TicketCategoryShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); + $this->cache_category_tickets[$obj->rowid]['label'] = $label; + $this->cache_category_tickets[$obj->rowid]['use_default'] = $obj->use_default; + $this->cache_category_tickets[$obj->rowid]['pos'] = $obj->pos; + $i++; + } + return $num; + } else { + dol_print_error($this->db); + return -1; + } + } + + /** + * Charge dans cache la liste des sévérité de tickets (paramétrable dans dictionnaire) + * + * @return int Number of lines loaded, 0 if already loaded, <0 if KO + */ + public function loadCacheSeveritiesTickets() + { + global $langs; + + if (!empty($this->cache_severity_tickets) && count($this->cache_severity_tickets)) { + return 0; + } + // Cache deja charge + + $sql = "SELECT rowid, code, label, use_default, pos, description"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_ticket_severity"; + $sql .= " WHERE active > 0"; + $sql .= " ORDER BY pos"; + dol_syslog(get_class($this)."::loadCacheSeveritiesTickets sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + $this->cache_severity_tickets[$obj->rowid]['code'] = $obj->code; + // Si traduction existe, on l'utilise, sinon on prend le libelle par defaut + $label = ($langs->trans("TicketSeverityShort".$obj->code) != ("TicketSeverityShort".$obj->code) ? $langs->trans("TicketSeverityShort".$obj->code) : ($obj->label != '-' ? $obj->label : '')); + $this->cache_severity_tickets[$obj->rowid]['label'] = $label; + $this->cache_severity_tickets[$obj->rowid]['use_default'] = $obj->use_default; + $this->cache_severity_tickets[$obj->rowid]['pos'] = $obj->pos; + $i++; + } + return $num; + } else { + dol_print_error($this->db); + return -1; + } + } + + + /** + * Return status label of object + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label + */ + public function getLibStatut($mode = 0) + { + return $this->libStatut($this->fk_statut, $mode); + } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return status label of object + * + * @param string $status Id status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto + * @return string Label + */ + public function LibStatut($status, $mode = 0) + { + // phpcs:enable + global $langs; + + if ($mode == 0) { + return $langs->trans($this->statuts[$status]); + } + elseif ($mode == 1) { + return $langs->trans($this->statuts_short[$status]); + } + elseif ($mode == 2) { + if ($status == self::STATUS_NOT_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_IN_PROGRESS) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_NEED_MORE_INFO) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_WAITING) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_CLOSED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_CANCELED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + } + elseif ($mode == 3) { + if ($status == self::STATUS_NOT_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket'); + } + elseif ($status == self::STATUS_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket'); + } + elseif ($status == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket'); + } + elseif ($status == self::STATUS_IN_PROGRESS) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket'); + } + elseif ($status == self::STATUS_NEED_MORE_INFO) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket'); + } + elseif ($status == self::STATUS_WAITING) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket'); + } + elseif ($status == self::STATUS_CLOSED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket'); + } + elseif ($status == self::STATUS_CANCELED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket'); + } + } + elseif ($mode == 4) { + if ($status == self::STATUS_NOT_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_READ) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_IN_PROGRESS) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_NEED_MORE_INFO) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_WAITING) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_CLOSED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + elseif ($status == self::STATUS_CANCELED) { + return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket').' '.$langs->trans($this->statuts_short[$status]); + } + } + elseif ($mode == 5 || $mode == 6) { + if ($status == self::STATUS_NOT_READ) { + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket'); + } + elseif ($status == self::STATUS_READ) { + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket'); + } + elseif ($status == self::STATUS_ASSIGNED) { + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket'); + } + elseif ($status == self::STATUS_IN_PROGRESS) { + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket'); + } + elseif ($status == self::STATUS_NEED_MORE_INFO) { + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket'); + } + elseif ($status == self::STATUS_WAITING) { + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket'); + } + elseif ($status == self::STATUS_CLOSED) { + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket'); + } + elseif ($status == self::STATUS_CANCELED) { + return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket'); + } + } + } + + + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) + { + global $db, $conf, $langs; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips + + $result = ''; + $companylink = ''; + + $label = ''.$langs->trans("Ticket").''; + $label .= '
'; + $label .= ''.$langs->trans('Ref').': '.$this->ref.'
'; + $label .= ''.$langs->trans('TicketTrackId').': '.$this->track_id.'
'; + $label .= ''.$langs->trans('Subject').': '.$this->subject; + + $url = dol_buildpath('/ticket/card.php', 1).'?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; + } + + $linkclose = ''; + if (empty($notooltip)) + { + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label = $langs->trans("ShowTicket"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; + } + else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + + $linkstart = ''; + $linkend = ''; + + $result .= $linkstart; + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + return $result; + } + + + /** + * Mark a message as read + * + * @param User $user Object user + * @param int $notrigger No trigger + * @return int <0 if KO, >0 if OK + */ + public function markAsRead($user, $notrigger = 0) + { + global $conf, $langs; + + $error = 0; + + if ($this->statut != self::STATUS_CANCELED) { // no closed + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; + $sql .= " SET fk_statut = ".Ticket::STATUS_READ.", date_read='".$this->db->idate(dol_now())."'"; + $sql .= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::markAsRead"); + $resql = $this->db->query($sql); + if ($resql) { + $this->actionmsg = $langs->trans('TicketLogMesgReadBy', $this->ref, $user->getFullName($langs)); + $this->actionmsg2 = $langs->trans('TicketLogMesgReadBy', $this->ref, $user->getFullName($langs)); + + if (!$error && !$notrigger) { + // Call trigger + $result = $this->call_trigger('TICKET_MODIFY', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + if (!$error) { + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + $this->error = join(',', $this->errors); + dol_syslog(get_class($this)."::markAsRead ".$this->error, LOG_ERR); + return -1; + } + } else { + $this->db->rollback(); + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this)."::markAsRead ".$this->error, LOG_ERR); + return -1; + } + } + } + + /** + * Mark a message as read + * + * @param User $user Object user + * @param int $id_assign_user ID of user assigned + * @param int $notrigger Disable trigger + * @return int <0 if KO, 0=Nothing done, >0 if OK + */ + public function assignUser($user, $id_assign_user, $notrigger = 0) + { + global $conf, $langs; + + $error = 0; + $this->db->begin(); + + $this->oldcopy = dol_clone($this); + + $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; + if ($id_assign_user > 0) + { + $sql .= " SET fk_user_assign=".$id_assign_user.", fk_statut = ".Ticket::STATUS_ASSIGNED; + } + else + { + $sql .= " SET fk_user_assign=null, fk_statut = ".Ticket::STATUS_READ; + } + $sql .= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::assignUser sql=".$sql); + $resql = $this->db->query($sql); + if ($resql) + { + $this->fk_user_assign = $id_assign_user; // May be used by trigger + + if (!$notrigger) { + // Call trigger + $result = $this->call_trigger('TICKET_ASSIGNED', $user); + if ($result < 0) { + $error++; + } + // End call triggers + } + + if (!$error) { + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + $this->error = join(',', $this->errors); + dol_syslog(get_class($this)."::assignUser ".$this->error, LOG_ERR); + return -1; + } + } else { + $this->db->rollback(); + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this)."::assignUser ".$this->error, LOG_ERR); + return -1; + } + } + + + /** + * Send notification of changes by email + * + * @param User $user User that create + * @param string $message Log message + * @return int <0 if KO, >0 if OK (number of emails sent) + */ + private function sendLogByEmail($user, $message) + { + global $conf, $langs; + + $nb_sent = 0; + + $langs->load('ticket'); + + // Retrieve email of all contacts (internal and external) + $contacts = $this->listeContact(-1, 'internal'); + $contacts = array_merge($contacts, $this->listeContact(-1, 'external')); + + /* If origin_email and no socid, we add email to the list * */ + if (!empty($this->origin_email) && empty($this->fk_soc)) { + $array_ext = array(array('firstname' => '', 'lastname' => '', 'email' => $this->origin_email, 'libelle' => $langs->transnoentities('TicketEmailOriginIssuer'), 'socid' => "-1")); + $contacts = array_merge($contacts, $array_ext); + } + + if (!empty($this->fk_soc)) { + $this->fetch_thirdparty($this->fk_soc); + $array_company = array(array('firstname' => '', 'lastname' => $this->client->name, 'email' => $this->client->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $this->client->id)); + $contacts = array_merge($contacts, $array_company); + } + + // foreach contact send email with notification message + if (count($contacts) > 0) { + foreach ($contacts as $key => $info_sendto) { + $message = ''; + $subject = '['.$conf->global->MAIN_INFO_SOCIETE_NOM.'] '.$langs->transnoentities('TicketNotificationEmailSubject', $this->track_id); + $message .= $langs->transnoentities('TicketNotificationEmailBody', $this->track_id)."\n\n"; + $message .= $langs->transnoentities('Title').' : '.$this->subject."\n"; + + $recipient_name = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1'); + $recipient = (!empty($recipient_name) ? $recipient_name : $info_sendto['email']).' ('.strtolower($info_sendto['libelle']).')'; + $message .= $langs->transnoentities('TicketNotificationRecipient').' : '.$recipient."\n"; + $message .= "\n"; + $message .= '* '.$langs->transnoentities('TicketNotificationLogMessage').' *'."\n"; + $message .= dol_html_entity_decode($log_message, ENT_QUOTES)."\n"; + + if ($info_sendto['source'] == 'internal') { + $url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$this->track_id; + $message .= "\n".$langs->transnoentities('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.''.$this->track_id.''."\n"; + } else { + $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$this->track_id; + $message .= "\n".$langs->transnoentities('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.''.$this->track_id.''."\n"; + } + + $message .= "\n"; + $message .= $langs->transnoentities('TicketEmailPleaseDoNotReplyToThisEmail')."\n"; + + $from = $conf->global->MAIN_INFO_SOCIETE_NOM.'<'.$conf->global->TICKET_NOTIFICATION_EMAIL_FROM.'>'; + $replyto = $from; + + // Init to avoid errors + $filepath = array(); + $filename = array(); + $mimetype = array(); + + $message = dol_nl2br($message); + + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $info_sendto['email'], $from, $message, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, 0); + if ($mailfile->error || $mailfile->errors) { + setEventMessages($mailfile->error, $mailfile->errors, 'errors'); + } else { + $result = $mailfile->sendfile(); + if ($result > 0) { + $nb_sent++; + } + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } + } + + setEventMessages($langs->trans('TicketNotificationNumberEmailSent', $nb_sent), null, 'mesgs'); + } + + return $nb_sent; + } + + /** + * Charge la liste des actions sur le ticket + * + * @return int Number of lines loaded, 0 if already loaded, <0 if KO + */ + public function loadCacheLogsTicket() + { + global $langs; + + if (is_array($this->cache_logs_ticket) && count($this->cache_logs_ticket)) { + return 0; + } + // Cache deja charge + + // TODO Read the table llx_actioncomm + /* $sql = "SELECT rowid, fk_user_create, datec, message"; $sql .= " FROM " . MAIN_DB_PREFIX . "ticket_logs"; $sql .= " WHERE fk_track_id ='" . $this->db->escape($this->track_id) . "'"; @@ -1604,1298 +1604,1298 @@ class Ticket extends CommonObject return -1; }*/ - return 0; - } + return 0; + } - /** - * Add message into database - * - * @param User $user User that creates - * @param int $notrigger 0=launch triggers after, 1=disable triggers + /** + * Add message into database + * + * @param User $user User that creates + * @param int $notrigger 0=launch triggers after, 1=disable triggers * @param array $filename_list List of files to attach (full path of filename on file system) * @param array $mimetype_list List of MIME type of attached files * @param array $mimefilename_list List of attached file name in message - * @return int <0 if KO, >0 if OK - */ - public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array()) - { - global $conf, $langs; - $error = 0; + * @return int <0 if KO, >0 if OK + */ + public function createTicketMessage($user, $notrigger = 0, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array()) + { + global $conf, $langs; + $error = 0; - $now = dol_now(); + $now = dol_now(); - // Clean parameters - if (isset($this->fk_track_id)) { - $this->fk_track_id = trim($this->fk_track_id); - } + // Clean parameters + if (isset($this->fk_track_id)) { + $this->fk_track_id = trim($this->fk_track_id); + } - if (isset($this->message)) { - $this->message = trim($this->message); - } + if (isset($this->message)) { + $this->message = trim($this->message); + } - $this->db->begin(); + $this->db->begin(); - // Insert entry into agenda with code 'TICKET_MSG' - include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; - $actioncomm = new ActionComm($this->db); - $actioncomm->type_code = 'AC_OTH_AUTO'; - $actioncomm->code = 'TICKET_MSG'; + // Insert entry into agenda with code 'TICKET_MSG' + include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + $actioncomm = new ActionComm($this->db); + $actioncomm->type_code = 'AC_OTH_AUTO'; + $actioncomm->code = 'TICKET_MSG'; if ($this->private) { $actioncomm->code = 'TICKET_MSG_PRIVATE'; } - $actioncomm->socid = $this->socid; - $actioncomm->label = $this->subject; - $actioncomm->note_private = $this->message; - $actioncomm->userassigned = array($user->id); - $actioncomm->userownerid = $user->id; - $actioncomm->datep = $now; - $actioncomm->percentage = 100; - $actioncomm->elementtype = 'ticket'; - $actioncomm->fk_element = $this->id; - - $attachedfiles = array(); - $attachedfiles['paths'] = $filename_list; - $attachedfiles['names'] = $mimefilename_list; - $attachedfiles['mimes'] = $mimetype_list; - if (is_array($attachedfiles) && count($attachedfiles) > 0) { - $actioncomm->attachedfiles = $attachedfiles; - } - - if (!empty($mimefilename_list) && is_array($mimefilename_list)) - { - $actioncomm->note_private = dol_concatdesc($actioncomm->note_private, "\n".$langs->transnoentities("AttachedFiles").': '.join(';', $mimefilename_list)); - } - - $actionid = $actioncomm->create($user); - if ($actionid <= 0) - { - $error++; - $this->error = $actioncomm->error; - $this->errors = $actioncomm->errors; - } - - // Commit or rollback - if ($error) { - $this->db->rollback(); - return -1 * $error; - } else { - $this->db->commit(); - return 1; - } - } - - /** - * Load the list of event on ticket into ->cache_msgs_ticket - * - * @return int Number of lines loaded, 0 if already loaded, <0 if KO - */ - public function loadCacheMsgsTicket() - { - if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) { - return 0; - } - - // Cache already loaded - - $sql = "SELECT id as rowid, fk_user_author, datec, label, note as message, code"; - $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; - $sql .= " WHERE fk_element = ".(int) $this->id; - $sql .= " AND elementtype = 'ticket'"; - $sql .= " ORDER BY datec DESC"; - - dol_syslog(get_class($this)."::load_cache_actions_ticket sql=".$sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - $this->cache_msgs_ticket[$i]['id'] = $obj->rowid; - $this->cache_msgs_ticket[$i]['fk_user_author'] = $obj->fk_user_author; - $this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec); - $this->cache_msgs_ticket[$i]['subject'] = $obj->label; - $this->cache_msgs_ticket[$i]['message'] = $obj->message; - $this->cache_msgs_ticket[$i]['private'] = ($obj->code == 'TICKET_MSG_PRIVATE' ? 1 : 0); - $i++; - } - return $num; - } else { - $this->error = "Error ".$this->db->lasterror(); - dol_syslog(get_class($this)."::load_cache_actions_ticket ".$this->error, LOG_ERR); - return -1; - } - } - - /** - * Close a ticket - * - * @param User $user User that close - * @return int <0 if KO, >0 if OK - */ - public function close(User $user) - { - global $conf, $langs; - - if ($this->fk_statut != Ticket::STATUS_CLOSED) { // not closed - $this->db->begin(); - - $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET fk_statut=".Ticket::STATUS_CLOSED.", progress=100, date_close='".$this->db->idate(dol_now())."'"; - $sql .= " WHERE rowid = ".$this->id; - - dol_syslog(get_class($this)."::close sql=".$sql); - $resql = $this->db->query($sql); - if ($resql) { - $error = 0; - - // Valid and close fichinter linked - $this->fetchObjectLinked($this->id, $this->element, null, 'fichinter'); - if ($this->linkedObjectsIds) - { - foreach ($this->linkedObjectsIds['fichinter'] as $fichinter_id) { - $fichinter = new Fichinter($this->db); - $fichinter->fetch($fichinter_id); - if ($fichinter->statut == 0) { - $result = $fichinter->setValid($user); - if (!$result) { - $this->errors[] = $fichinter->error; - $error++; - } - } - if ($fichinter->statut < 3) { - $result = $fichinter->setStatut(3); - if (!$result) { - $this->errors[] = $fichinter->error; - $error++; - } - } - } - } - - // Call trigger - $result = $this->call_trigger('TICKET_CLOSE', $user); - if ($result < 0) { - $error++; - } - // End call triggers - - if (!$error) { - $this->db->commit(); - return 1; - } else { - $this->db->rollback(); - $this->error = join(',', $this->errors); - dol_syslog(get_class($this)."::close ".$this->error, LOG_ERR); - return -1; - } - } else { - $this->db->rollback(); - $this->error = $this->db->lasterror(); - dol_syslog(get_class($this)."::close ".$this->error, LOG_ERR); - return -1; - } - } - } - - /** - * Search and fetch thirparties by email - * - * @param string $email Email - * @param int $type Type of thirdparties (0=any, 1=customer, 2=prospect, 3=supplier) - * @param array $filters Array of couple field name/value to filter the companies with the same name - * @param string $clause Clause for filters - * @return array Array of thirdparties object - */ - public function searchSocidByEmail($email, $type = '0', $filters = array(), $clause = 'AND') - { - $thirdparties = array(); - - // Generation requete recherche - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; - $sql .= " WHERE entity IN (".getEntity('ticket', 1).")"; - if (!empty($type)) { - if ($type == 1 || $type == 2) { - $sql .= " AND client = ".$type; - } elseif ($type == 3) { - $sql .= " AND fournisseur = 1"; - } - } - if (!empty($email)) { - if (!$exact) { - if (preg_match('/^([\*])?[^*]+([\*])?$/', $email, $regs) && count($regs) > 1) { - $email = str_replace('*', '%', $email); - } else { - $email = '%'.$email.'%'; - } - } - $sql .= " AND "; - if (is_array($filters) && !empty($filters)) { - $sql .= "("; - } - - if (!$case) { - $sql .= "email LIKE '".$this->db->escape($email)."'"; - } else { - $sql .= "email LIKE BINARY '".$this->db->escape($email)."'"; - } - } - if (is_array($filters) && !empty($filters)) { - foreach ($filters as $field => $value) { - $sql .= " ".$clause." ".$field." LIKE BINARY '".$this->db->escape($value)."'"; - } - if (!empty($email)) { - $sql .= ")"; - } - } - - $res = $this->db->query($sql); - if ($res) { - while ($rec = $this->db->fetch_array($res)) { - $soc = new Societe($this->db); - $soc->fetch($rec['rowid']); - $thirdparties[] = $soc; - } - - return $thirdparties; - } else { - $this->error = $this->db->error().' sql='.$sql; - dol_syslog(get_class($this)."::searchSocidByEmail ".$this->error, LOG_ERR); - return -1; - } - } - - /** - * Search and fetch contacts by email - * - * @param string $email Email - * @param array $socid Limit to a thirdparty - * @param string $case Respect case - * @return array Array of contacts object - */ - public function searchContactByEmail($email, $socid = '', $case = '') - { - $contacts = array(); - - // Generation requete recherche - $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople"; - $sql .= " WHERE entity IN (".getEntity('socpeople').")"; - if (!empty($socid)) { - $sql .= " AND fk_soc='".$this->db->escape($socid)."'"; - } - - if (!empty($email)) { - $sql .= " AND "; - - if (!$case) { - $sql .= "email LIKE '".$this->db->escape($email)."'"; - } else { - $sql .= "email LIKE BINARY '".$this->db->escape($email)."'"; - } - } - - $res = $this->db->query($sql); - if ($res) { - while ($rec = $this->db->fetch_array($res)) { - include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - $contactstatic = new Contact($this->db); - $contactstatic->fetch($rec['rowid']); - $contacts[] = $contactstatic; - } - - return $contacts; - } else { - $this->error = $this->db->error().' sql='.$sql; - dol_syslog(get_class($this)."::searchContactByEmail ".$this->error, LOG_ERR); - return -1; - } - } - - /** - * Define parent commany of current ticket - * - * @param int $id Id of thirdparty to set or '' to remove - * @return int <0 if KO, >0 if OK - */ - public function setCustomer($id) - { - if ($this->id) { - $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET fk_soc = ".($id > 0 ? $id : "null"); - $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this).'::setCustomer sql='.$sql); - $resql = $this->db->query($sql); - if ($resql) { - return 1; - } else { - return -1; - } - } else { - return -1; - } - } - - /** - * Define progression of current ticket - * - * @param int $percent Progression percent - * @return int <0 if KO, >0 if OK - */ - public function setProgression($percent) - { - if ($this->id) { - $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; - $sql .= " SET progress = ".($percent > 0 ? $percent : "null"); - $sql .= " WHERE rowid = ".$this->id; - dol_syslog(get_class($this).'::set_progression sql='.$sql); - $resql = $this->db->query($sql); - if ($resql) { - return 1; - } else { - return -1; - } - } else { - return -1; - } - } - - /** - * Link element with a project - * Override core function because of key name 'fk_project' used for this module - * - * @param int $projectid Project id to link element to - * @return int <0 if KO, >0 if OK - */ - public function setProject($projectid) - { - if (!$this->table_element) { - dol_syslog(get_class($this)."::setProject was called on objet with property table_element not defined", LOG_ERR); - return -1; - } - - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; - if ($projectid) { - $sql .= ' SET fk_project = '.$projectid; - } else { - $sql .= ' SET fk_project = NULL'; - } - - $sql .= ' WHERE rowid = '.$this->id; - - dol_syslog(get_class($this)."::setProject sql=".$sql); - if ($this->db->query($sql)) { - $this->fk_project = $projectid; - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } - - /** - * Link element with a contract - * - * @param int $contractid Contract id to link element to - * @return int <0 if KO, >0 if OK - */ - public function setContract($contractid) - { - if (!$this->table_element) { - dol_syslog(get_class($this)."::setContract was called on objet with property table_element not defined", LOG_ERR); - return -1; - } - - $result = $this->add_object_linked('contrat', $contractid); - if ($result) { - $this->fk_contract = $contractid; - return 1; - } else { - dol_print_error($this->db); - return -1; - } - } - - /* gestion des contacts d'un ticket */ - - /** - * Return id des contacts interne de suivi - * - * @return array Liste des id contacts suivi ticket - */ - public function getIdTicketInternalContact() - { - return $this->getIdContact('internal', 'SUPPORTTEC'); - } - - /** - * Retrieve informations about internal contacts - * - * @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status - */ - public function getInfosTicketInternalContact() - { - return $this->listeContact(-1, 'internal'); - } - - /** - * Return id des contacts clients pour le suivi ticket - * - * @return array Liste des id contacts suivi ticket - */ - public function getIdTicketCustomerContact() - { - return $this->getIdContact('external', 'SUPPORTCLI'); - } - - /** - * Retrieve informations about external contacts - * - * @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status - */ - public function getInfosTicketExternalContact() - { - return $this->listeContact(-1, 'external'); - } - - /** - * Return id des contacts clients des intervenants - * - * @return array Liste des id contacts intervenants - */ - public function getIdTicketInternalInvolvedContact() - { - return $this->getIdContact('internal', 'CONTRIBUTOR'); - } - - /** - * Return id des contacts clients des intervenants - * - * @return array Liste des id contacts intervenants - */ - public function getIdTicketCustomerInvolvedContact() - { - return $this->getIdContact('external', 'CONTRIBUTOR'); - } - - /** - * Return id of all contacts for ticket - * - * @return array Array of contacts for tickets - */ - public function getTicketAllContacts() - { - $array_contact = array(); - - $array_contact = $this->getIdTicketInternalContact($exclude_self); - - $array_contact = array_merge($array_contact, $this->getIdTicketCustomerContact($exclude_self)); - - $array_contact = array_merge($array_contact, $this->getIdTicketInternalInvolvedContact($exclude_self)); - $array_contact = array_merge($array_contact, $this->getIdTicketCustomerInvolvedContact($exclude_self)); - - return $array_contact; - } - - /** - * Return id of all contacts for ticket - * - * @return array Array of contacts - */ - public function getTicketAllCustomerContacts() - { - $array_contact = array(); - - $array_contact = array_merge($array_contact, $this->getIdTicketCustomerContact($exclude_self)); - $array_contact = array_merge($array_contact, $this->getIdTicketCustomerInvolvedContact($exclude_self)); - - return $array_contact; - } - - /** - * Send message - * - * @param string $subject Subject - * @param string $texte Message to send - * @return int <0 if KO, or number of changes if OK - */ - public function messageSend($subject, $texte) - { - global $conf, $langs, $mysoc, $dolibarr_main_url_root; - - $langs->load("other"); - - dol_syslog(get_class($this)."::message_send action=$action, socid=$socid, texte=$texte, objet_type=$objet_type, objet_id=$objet_id, file=$file"); - - $internal_contacts = $this->getIdContact('internal', 'SUPPORTTEC'); - $external_contacts = $this->getIdContact('external', 'SUPPORTTEC'); - - if ($result) { - $num = $this->db->num_rows($result); - $i = 0; - while ($i < $num) { // For each notification couple defined (third party/actioncode) - $obj = $this->db->fetch_object($result); - - $sendto = $obj->firstname." ".$obj->lastname." <".$obj->email.">"; - $actiondefid = $obj->adid; - - if (dol_strlen($sendto)) - { - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $application = ($conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE : 'Dolibarr ERP/CRM'); - - $subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification"); - - $message = $langs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n"; - $message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n"; - $message .= "\n"; - $message .= $texte; - // Add link - $link = ''; - switch ($objet_type) { - case 'ficheinter': - $link = '/fichinter/card.php?id='.$objet_id; - break; - case 'propal': - $link = '/comm/propal.php?id='.$objet_id; - break; - case 'facture': - $link = '/compta/facture/card.php?facid='.$objet_id; - break; - case 'order': - $link = '/commande/card.php?facid='.$objet_id; - break; - case 'order_supplier': - $link = '/fourn/commande/card.php?facid='.$objet_id; - break; - } - // Define $urlwithroot - $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file - //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current - if ($link) { - $message .= "\n".$urlwithroot.$link; - } - - $filename = basename($file); - - $mimefile = dol_mimetype($file); - - $msgishtml = 0; - - $replyto = $conf->notification->email_from; - - $message = dol_nl2br($message); - - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - $mailfile = new CMailFile( - $subject, - $sendto, - $replyto, - $message, - array($file), - array($mimefile), - array($filename[count($filename) - 1]), - '', - '', - 0, - $msgishtml - ); - - if ($mailfile->sendfile()) { - $now = dol_now(); - $sendto = htmlentities($sendto); - - $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)"; - $sql .= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$this->db->escape($objet_type)."', ".$objet_id.", '".$this->db->escape($obj->email)."')"; - dol_syslog("Notify::send sql=".$sql); - if (!$this->db->query($sql)) { - dol_print_error($this->db); - } - } else { - $this->error = $mailfile->error; - //dol_syslog("Notify::send ".$this->error, LOG_ERR); - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - } - $i++; - } - return $i; - } else { - $this->error = $this->db->error(); - return -1; - } - } - - /** - * Get array of all contacts for a ticket - * Override method of file commonobject.class.php to add phone number - * - * @param int $status Status of lines to get (-1=all) - * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) - * @param int $list 0:Return array contains all properties, 1:Return array contains just id - * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) - * @return array Array of contacts - */ - public function listeContact($status = -1, $source = 'external', $list = 0, $code = '') - { - global $langs; - - $tab = array(); - - $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user - if ($source == 'internal') { - $sql .= ", '-1' as socid, t.statut as statuscontact"; - } - - if ($source == 'external' || $source == 'thirdparty') { - $sql .= ", t.fk_soc as socid, t.statut as statuscontact"; - } - - $sql .= ", t.civility, t.lastname as lastname, t.firstname, t.email"; - if ($source == 'internal') { - $sql .= ", t.office_phone as phone, t.user_mobile as phone_mobile"; - } - - if ($source == 'external') { - $sql .= ", t.phone as phone, t.phone_mobile as phone_mobile, t.phone_perso as phone_perso"; - } - - $sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_contact_label"; - $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; - $sql .= ", ".MAIN_DB_PREFIX."element_contact ec"; - if ($source == 'internal') { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user t on ec.fk_socpeople = t.rowid"; - } - - if ($source == 'external' || $source == 'thirdparty') { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople t on ec.fk_socpeople = t.rowid"; - } - - $sql .= " WHERE ec.element_id =".$this->id; - $sql .= " AND ec.fk_c_type_contact=tc.rowid"; - $sql .= " AND tc.element='".$this->db->escape($this->element)."'"; - if ($source == 'internal') { - $sql .= " AND tc.source = 'internal'"; - } - - if ($source == 'external' || $source == 'thirdparty') { - $sql .= " AND tc.source = 'external'"; - } - - $sql .= " AND tc.active=1"; - if ($status >= 0) { - $sql .= " AND ec.statut = '".$status."'"; - } - - $sql .= " ORDER BY t.lastname ASC"; - - $resql = $this->db->query($sql); - if ($resql) { - $num = $this->db->num_rows($resql); - $i = 0; - while ($i < $num) { - $obj = $this->db->fetch_object($resql); - - if (!$list) { - $transkey = "TypeContact_".$obj->element."_".$obj->source."_".$obj->code; - $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->type_contact_label); - $tab[$i] = array( - 'source' => $obj->source, - 'socid' => $obj->socid, - 'id' => $obj->id, - 'nom' => $obj->lastname, // For backward compatibility - 'civility' => $obj->civility, - 'lastname' => $obj->lastname, - 'firstname' => $obj->firstname, - 'email' => $obj->email, - 'rowid' => $obj->rowid, - 'code' => $obj->code, - 'libelle' => $libelle_type, - 'status' => $obj->statuslink, - 'statuscontact'=>$obj->statuscontact, - 'fk_c_type_contact' => $obj->fk_c_type_contact, - 'phone' => $obj->phone, - 'phone_mobile' => $obj->phone_mobile); - } else { - $tab[$i] = $obj->id; - } - - $i++; - } - - return $tab; - } else { - $this->error = $this->db->error(); - dol_print_error($this->db); - return -1; - } - } - - /** - * Get a default reference. - * - * @param Societe $thirdparty Thirdparty - * @return string Reference - */ - public function getDefaultRef($thirdparty = '') - { - global $conf; - - $defaultref = ''; - $modele = empty($conf->global->TICKET_ADDON) ? 'mod_ticket_simple' : $conf->global->TICKET_ADDON; - - // Search template files - $file = ''; - $classname = ''; - $filefound = 0; - $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); - foreach ($dirmodels as $reldir) { - $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); - if (file_exists($file)) { - $filefound = 1; - $classname = $modele; - break; - } - } - - if ($filefound) { - $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); - $modTicket = new $classname; - - $defaultref = $modTicket->getNextValue($thirdparty, $this); - } - - if (is_numeric($defaultref) && $defaultref <= 0) { - $defaultref = ''; - } - - return $defaultref; - } - - - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Return if at least one photo is available - * - * @param string $sdir Directory to scan - * @return boolean True if at least one photo is available, False if not - */ - public function is_photo_available($sdir) - { - // phpcs:enable - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - - global $conf; - - $dir = $sdir.'/'; - $nbphoto = 0; - - $dir_osencoded = dol_osencode($dir); - if (file_exists($dir_osencoded)) { - $handle = opendir($dir_osencoded); - if (is_resource($handle)) { - while (($file = readdir($handle)) !== false) { - if (!utf8_check($file)) { - $file = utf8_encode($file); - } - // To be sure data is stored in UTF8 in memory - if (dol_is_file($dir.$file)) { - return true; - } - } - } - } - return false; - } - - - /** - * Copy files defined into $_SESSION array into the ticket directory of attached files. - * Used for files linked into messages. - * Files may be renamed during copy to avoid overwriting existing files. - * - * @return array Array with final path/name/mime of files. - */ - public function copyFilesForTicket() - { - global $conf; - - // Create form object - include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - - $maxwidthsmall = 270; - $maxheightsmall = 150; - $maxwidthmini = 128; - $maxheightmini = 72; - - $formmail = new FormMail($this->db); - - $attachedfiles = $formmail->get_attached_files(); - - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; - - // Copy files into ticket directory - $destdir = $conf->ticket->dir_output.'/'.$this->ref; - - if (!dol_is_dir($destdir)) { - dol_mkdir($destdir); - } - - $listofpaths = array(); - $listofnames = array(); - foreach ($filename as $i => $val) { - $destfile = $destdir.'/'.$filename[$i]; - // If destination file already exists, we add a suffix to avoid to overwrite - if (is_file($destfile)) - { - $now = dol_now(); - $destfile .= '.'.dol_print_date($now, 'dayhourlog'); - } - - $res = dol_move($filepath[$i], $destfile, 0, 1); - - if (image_format_supported($destfile) == 1) { - // Create small thumbs for image (Ratio is near 16/9) - // Used on logon for example - $imgThumbSmall = vignette($destfile, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); - // Create mini thumbs for image (Ratio is near 16/9) - // Used on menu or for setup page for example - $imgThumbMini = vignette($destfile, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); - } - - $formmail->remove_attached_files($i); - - // Fill array with new names - $listofpaths[$i] = $destfile; - $listofnames[$i] = basename($destfile); - } - - return array('listofpaths'=>$listofpaths, 'listofnames'=>$listofnames, 'listofmimes'=>$mimetype); - } - - - /** - * Add new message on a ticket (private area). Can also send it be email if GETPOST('send_email', 'int') is set. - * - * @param User $user User for action - * @param string $action Action string - * @param int $private 1=Message is private. TODO Implement this. What does this means ? - * @return int - */ - public function newMessage($user, &$action, $private = 1) - { - global $mysoc, $conf, $langs; - - $error = 0; - - $object = new Ticket($this->db); - - $ret = $object->fetch('', '', GETPOST('track_id', 'alpha')); - - $object->socid = $object->fk_soc; - $object->fetch_thirdparty(); - - if ($ret < 0) { - $error++; - array_push($this->errors, $langs->trans("ErrorTicketIsNotValid")); - $action = ''; - } - - if (!GETPOST("message")) { - $error++; - array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message"))); - $action = 'add_message'; - } - - if (!$error) { - $object->subject = GETPOST('subject', 'alphanohtml'); - $object->message = GETPOST("message", "none"); - $object->private = GETPOST("private_message", "alpha"); - - $send_email = GETPOST('send_email', 'int'); - - // Copy attached files (saved into $_SESSION) as linked files to ticket. Return array with final name used. - $resarray = $object->copyFilesForTicket(); - - $listofpaths = $resarray['listofpaths']; - $listofnames = $resarray['listofnames']; - $listofmimes = $resarray['listofmimes']; + $actioncomm->socid = $this->socid; + $actioncomm->label = $this->subject; + $actioncomm->note_private = $this->message; + $actioncomm->userassigned = array($user->id); + $actioncomm->userownerid = $user->id; + $actioncomm->datep = $now; + $actioncomm->percentage = 100; + $actioncomm->elementtype = 'ticket'; + $actioncomm->fk_element = $this->id; + + $attachedfiles = array(); + $attachedfiles['paths'] = $filename_list; + $attachedfiles['names'] = $mimefilename_list; + $attachedfiles['mimes'] = $mimetype_list; + if (is_array($attachedfiles) && count($attachedfiles) > 0) { + $actioncomm->attachedfiles = $attachedfiles; + } + + if (!empty($mimefilename_list) && is_array($mimefilename_list)) + { + $actioncomm->note_private = dol_concatdesc($actioncomm->note_private, "\n".$langs->transnoentities("AttachedFiles").': '.join(';', $mimefilename_list)); + } + + $actionid = $actioncomm->create($user); + if ($actionid <= 0) + { + $error++; + $this->error = $actioncomm->error; + $this->errors = $actioncomm->errors; + } + + // Commit or rollback + if ($error) { + $this->db->rollback(); + return -1 * $error; + } else { + $this->db->commit(); + return 1; + } + } + + /** + * Load the list of event on ticket into ->cache_msgs_ticket + * + * @return int Number of lines loaded, 0 if already loaded, <0 if KO + */ + public function loadCacheMsgsTicket() + { + if (is_array($this->cache_msgs_ticket) && count($this->cache_msgs_ticket)) { + return 0; + } + + // Cache already loaded + + $sql = "SELECT id as rowid, fk_user_author, datec, label, note as message, code"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; + $sql .= " WHERE fk_element = ".(int) $this->id; + $sql .= " AND elementtype = 'ticket'"; + $sql .= " ORDER BY datec DESC"; + + dol_syslog(get_class($this)."::load_cache_actions_ticket sql=".$sql, LOG_DEBUG); + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + $this->cache_msgs_ticket[$i]['id'] = $obj->rowid; + $this->cache_msgs_ticket[$i]['fk_user_author'] = $obj->fk_user_author; + $this->cache_msgs_ticket[$i]['datec'] = $this->db->jdate($obj->datec); + $this->cache_msgs_ticket[$i]['subject'] = $obj->label; + $this->cache_msgs_ticket[$i]['message'] = $obj->message; + $this->cache_msgs_ticket[$i]['private'] = ($obj->code == 'TICKET_MSG_PRIVATE' ? 1 : 0); + $i++; + } + return $num; + } else { + $this->error = "Error ".$this->db->lasterror(); + dol_syslog(get_class($this)."::load_cache_actions_ticket ".$this->error, LOG_ERR); + return -1; + } + } + + /** + * Close a ticket + * + * @param User $user User that close + * @return int <0 if KO, >0 if OK + */ + public function close(User $user) + { + global $conf, $langs; + + if ($this->fk_statut != Ticket::STATUS_CLOSED) { // not closed + $this->db->begin(); + + $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; + $sql .= " SET fk_statut=".Ticket::STATUS_CLOSED.", progress=100, date_close='".$this->db->idate(dol_now())."'"; + $sql .= " WHERE rowid = ".$this->id; + + dol_syslog(get_class($this)."::close sql=".$sql); + $resql = $this->db->query($sql); + if ($resql) { + $error = 0; + + // Valid and close fichinter linked + $this->fetchObjectLinked($this->id, $this->element, null, 'fichinter'); + if ($this->linkedObjectsIds) + { + foreach ($this->linkedObjectsIds['fichinter'] as $fichinter_id) { + $fichinter = new Fichinter($this->db); + $fichinter->fetch($fichinter_id); + if ($fichinter->statut == 0) { + $result = $fichinter->setValid($user); + if (!$result) { + $this->errors[] = $fichinter->error; + $error++; + } + } + if ($fichinter->statut < 3) { + $result = $fichinter->setStatut(3); + if (!$result) { + $this->errors[] = $fichinter->error; + $error++; + } + } + } + } + + // Call trigger + $result = $this->call_trigger('TICKET_CLOSE', $user); + if ($result < 0) { + $error++; + } + // End call triggers + + if (!$error) { + $this->db->commit(); + return 1; + } else { + $this->db->rollback(); + $this->error = join(',', $this->errors); + dol_syslog(get_class($this)."::close ".$this->error, LOG_ERR); + return -1; + } + } else { + $this->db->rollback(); + $this->error = $this->db->lasterror(); + dol_syslog(get_class($this)."::close ".$this->error, LOG_ERR); + return -1; + } + } + } + + /** + * Search and fetch thirparties by email + * + * @param string $email Email + * @param int $type Type of thirdparties (0=any, 1=customer, 2=prospect, 3=supplier) + * @param array $filters Array of couple field name/value to filter the companies with the same name + * @param string $clause Clause for filters + * @return array Array of thirdparties object + */ + public function searchSocidByEmail($email, $type = '0', $filters = array(), $clause = 'AND') + { + $thirdparties = array(); + + // Generation requete recherche + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe"; + $sql .= " WHERE entity IN (".getEntity('ticket', 1).")"; + if (!empty($type)) { + if ($type == 1 || $type == 2) { + $sql .= " AND client = ".$type; + } elseif ($type == 3) { + $sql .= " AND fournisseur = 1"; + } + } + if (!empty($email)) { + if (!$exact) { + if (preg_match('/^([\*])?[^*]+([\*])?$/', $email, $regs) && count($regs) > 1) { + $email = str_replace('*', '%', $email); + } else { + $email = '%'.$email.'%'; + } + } + $sql .= " AND "; + if (is_array($filters) && !empty($filters)) { + $sql .= "("; + } + + if (!$case) { + $sql .= "email LIKE '".$this->db->escape($email)."'"; + } else { + $sql .= "email LIKE BINARY '".$this->db->escape($email)."'"; + } + } + if (is_array($filters) && !empty($filters)) { + foreach ($filters as $field => $value) { + $sql .= " ".$clause." ".$field." LIKE BINARY '".$this->db->escape($value)."'"; + } + if (!empty($email)) { + $sql .= ")"; + } + } + + $res = $this->db->query($sql); + if ($res) { + while ($rec = $this->db->fetch_array($res)) { + $soc = new Societe($this->db); + $soc->fetch($rec['rowid']); + $thirdparties[] = $soc; + } + + return $thirdparties; + } else { + $this->error = $this->db->error().' sql='.$sql; + dol_syslog(get_class($this)."::searchSocidByEmail ".$this->error, LOG_ERR); + return -1; + } + } + + /** + * Search and fetch contacts by email + * + * @param string $email Email + * @param array $socid Limit to a thirdparty + * @param string $case Respect case + * @return array Array of contacts object + */ + public function searchContactByEmail($email, $socid = '', $case = '') + { + $contacts = array(); + + // Generation requete recherche + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople"; + $sql .= " WHERE entity IN (".getEntity('socpeople').")"; + if (!empty($socid)) { + $sql .= " AND fk_soc='".$this->db->escape($socid)."'"; + } + + if (!empty($email)) { + $sql .= " AND "; + + if (!$case) { + $sql .= "email LIKE '".$this->db->escape($email)."'"; + } else { + $sql .= "email LIKE BINARY '".$this->db->escape($email)."'"; + } + } + + $res = $this->db->query($sql); + if ($res) { + while ($rec = $this->db->fetch_array($res)) { + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + $contactstatic = new Contact($this->db); + $contactstatic->fetch($rec['rowid']); + $contacts[] = $contactstatic; + } + + return $contacts; + } else { + $this->error = $this->db->error().' sql='.$sql; + dol_syslog(get_class($this)."::searchContactByEmail ".$this->error, LOG_ERR); + return -1; + } + } + + /** + * Define parent commany of current ticket + * + * @param int $id Id of thirdparty to set or '' to remove + * @return int <0 if KO, >0 if OK + */ + public function setCustomer($id) + { + if ($this->id) { + $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; + $sql .= " SET fk_soc = ".($id > 0 ? $id : "null"); + $sql .= " WHERE rowid = ".$this->id; + dol_syslog(get_class($this).'::setCustomer sql='.$sql); + $resql = $this->db->query($sql); + if ($resql) { + return 1; + } else { + return -1; + } + } else { + return -1; + } + } + + /** + * Define progression of current ticket + * + * @param int $percent Progression percent + * @return int <0 if KO, >0 if OK + */ + public function setProgression($percent) + { + if ($this->id) { + $sql = "UPDATE ".MAIN_DB_PREFIX."ticket"; + $sql .= " SET progress = ".($percent > 0 ? $percent : "null"); + $sql .= " WHERE rowid = ".$this->id; + dol_syslog(get_class($this).'::set_progression sql='.$sql); + $resql = $this->db->query($sql); + if ($resql) { + return 1; + } else { + return -1; + } + } else { + return -1; + } + } + + /** + * Link element with a project + * Override core function because of key name 'fk_project' used for this module + * + * @param int $projectid Project id to link element to + * @return int <0 if KO, >0 if OK + */ + public function setProject($projectid) + { + if (!$this->table_element) { + dol_syslog(get_class($this)."::setProject was called on objet with property table_element not defined", LOG_ERR); + return -1; + } + + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; + if ($projectid) { + $sql .= ' SET fk_project = '.$projectid; + } else { + $sql .= ' SET fk_project = NULL'; + } + + $sql .= ' WHERE rowid = '.$this->id; + + dol_syslog(get_class($this)."::setProject sql=".$sql); + if ($this->db->query($sql)) { + $this->fk_project = $projectid; + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } + + /** + * Link element with a contract + * + * @param int $contractid Contract id to link element to + * @return int <0 if KO, >0 if OK + */ + public function setContract($contractid) + { + if (!$this->table_element) { + dol_syslog(get_class($this)."::setContract was called on objet with property table_element not defined", LOG_ERR); + return -1; + } + + $result = $this->add_object_linked('contrat', $contractid); + if ($result) { + $this->fk_contract = $contractid; + return 1; + } else { + dol_print_error($this->db); + return -1; + } + } + + /* gestion des contacts d'un ticket */ + + /** + * Return id des contacts interne de suivi + * + * @return array Liste des id contacts suivi ticket + */ + public function getIdTicketInternalContact() + { + return $this->getIdContact('internal', 'SUPPORTTEC'); + } + + /** + * Retrieve informations about internal contacts + * + * @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status + */ + public function getInfosTicketInternalContact() + { + return $this->listeContact(-1, 'internal'); + } + + /** + * Return id des contacts clients pour le suivi ticket + * + * @return array Liste des id contacts suivi ticket + */ + public function getIdTicketCustomerContact() + { + return $this->getIdContact('external', 'SUPPORTCLI'); + } + + /** + * Retrieve informations about external contacts + * + * @return array Array with datas : firstname, lastname, socid (-1 for internal users), email, code, libelle, status + */ + public function getInfosTicketExternalContact() + { + return $this->listeContact(-1, 'external'); + } + + /** + * Return id des contacts clients des intervenants + * + * @return array Liste des id contacts intervenants + */ + public function getIdTicketInternalInvolvedContact() + { + return $this->getIdContact('internal', 'CONTRIBUTOR'); + } + + /** + * Return id des contacts clients des intervenants + * + * @return array Liste des id contacts intervenants + */ + public function getIdTicketCustomerInvolvedContact() + { + return $this->getIdContact('external', 'CONTRIBUTOR'); + } + + /** + * Return id of all contacts for ticket + * + * @return array Array of contacts for tickets + */ + public function getTicketAllContacts() + { + $array_contact = array(); + + $array_contact = $this->getIdTicketInternalContact($exclude_self); + + $array_contact = array_merge($array_contact, $this->getIdTicketCustomerContact($exclude_self)); + + $array_contact = array_merge($array_contact, $this->getIdTicketInternalInvolvedContact($exclude_self)); + $array_contact = array_merge($array_contact, $this->getIdTicketCustomerInvolvedContact($exclude_self)); + + return $array_contact; + } + + /** + * Return id of all contacts for ticket + * + * @return array Array of contacts + */ + public function getTicketAllCustomerContacts() + { + $array_contact = array(); + + $array_contact = array_merge($array_contact, $this->getIdTicketCustomerContact($exclude_self)); + $array_contact = array_merge($array_contact, $this->getIdTicketCustomerInvolvedContact($exclude_self)); + + return $array_contact; + } + + /** + * Send message + * + * @param string $subject Subject + * @param string $texte Message to send + * @return int <0 if KO, or number of changes if OK + */ + public function messageSend($subject, $texte) + { + global $conf, $langs, $mysoc, $dolibarr_main_url_root; + + $langs->load("other"); + + dol_syslog(get_class($this)."::message_send action=$action, socid=$socid, texte=$texte, objet_type=$objet_type, objet_id=$objet_id, file=$file"); + + $internal_contacts = $this->getIdContact('internal', 'SUPPORTTEC'); + $external_contacts = $this->getIdContact('external', 'SUPPORTTEC'); + + if ($result) { + $num = $this->db->num_rows($result); + $i = 0; + while ($i < $num) { // For each notification couple defined (third party/actioncode) + $obj = $this->db->fetch_object($result); + + $sendto = $obj->firstname." ".$obj->lastname." <".$obj->email.">"; + $actiondefid = $obj->adid; + + if (dol_strlen($sendto)) + { + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $application = ($conf->global->MAIN_APPLICATION_TITLE ? $conf->global->MAIN_APPLICATION_TITLE : 'Dolibarr ERP/CRM'); + + $subject = '['.$application.'] '.$langs->transnoentitiesnoconv("DolibarrNotification"); + + $message = $langs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n"; + $message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n"; + $message .= "\n"; + $message .= $texte; + // Add link + $link = ''; + switch ($objet_type) { + case 'ficheinter': + $link = '/fichinter/card.php?id='.$objet_id; + break; + case 'propal': + $link = '/comm/propal.php?id='.$objet_id; + break; + case 'facture': + $link = '/compta/facture/card.php?facid='.$objet_id; + break; + case 'order': + $link = '/commande/card.php?facid='.$objet_id; + break; + case 'order_supplier': + $link = '/fourn/commande/card.php?facid='.$objet_id; + break; + } + // Define $urlwithroot + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + if ($link) { + $message .= "\n".$urlwithroot.$link; + } + + $filename = basename($file); + + $mimefile = dol_mimetype($file); + + $msgishtml = 0; + + $replyto = $conf->notification->email_from; + + $message = dol_nl2br($message); + + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + $mailfile = new CMailFile( + $subject, + $sendto, + $replyto, + $message, + array($file), + array($mimefile), + array($filename[count($filename) - 1]), + '', + '', + 0, + $msgishtml + ); + + if ($mailfile->sendfile()) { + $now = dol_now(); + $sendto = htmlentities($sendto); + + $sql = "INSERT INTO ".MAIN_DB_PREFIX."notify (daten, fk_action, fk_contact, objet_type, objet_id, email)"; + $sql .= " VALUES ('".$this->db->idate($now)."', ".$actiondefid.", ".$obj->cid.", '".$this->db->escape($objet_type)."', ".$objet_id.", '".$this->db->escape($obj->email)."')"; + dol_syslog("Notify::send sql=".$sql); + if (!$this->db->query($sql)) { + dol_print_error($this->db); + } + } else { + $this->error = $mailfile->error; + //dol_syslog("Notify::send ".$this->error, LOG_ERR); + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } + } + $i++; + } + return $i; + } else { + $this->error = $this->db->error(); + return -1; + } + } + + /** + * Get array of all contacts for a ticket + * Override method of file commonobject.class.php to add phone number + * + * @param int $status Status of lines to get (-1=all) + * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) + * @param int $list 0:Return array contains all properties, 1:Return array contains just id + * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) + * @return array Array of contacts + */ + public function listeContact($status = -1, $source = 'external', $list = 0, $code = '') + { + global $langs; + + $tab = array(); + + $sql = "SELECT ec.rowid, ec.statut as statuslink, ec.fk_socpeople as id, ec.fk_c_type_contact"; // This field contains id of llx_socpeople or id of llx_user + if ($source == 'internal') { + $sql .= ", '-1' as socid, t.statut as statuscontact"; + } + + if ($source == 'external' || $source == 'thirdparty') { + $sql .= ", t.fk_soc as socid, t.statut as statuscontact"; + } + + $sql .= ", t.civility, t.lastname as lastname, t.firstname, t.email"; + if ($source == 'internal') { + $sql .= ", t.office_phone as phone, t.user_mobile as phone_mobile"; + } + + if ($source == 'external') { + $sql .= ", t.phone as phone, t.phone_mobile as phone_mobile, t.phone_perso as phone_perso"; + } + + $sql .= ", tc.source, tc.element, tc.code, tc.libelle as type_contact_label"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; + $sql .= ", ".MAIN_DB_PREFIX."element_contact ec"; + if ($source == 'internal') { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user t on ec.fk_socpeople = t.rowid"; + } + + if ($source == 'external' || $source == 'thirdparty') { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople t on ec.fk_socpeople = t.rowid"; + } + + $sql .= " WHERE ec.element_id =".$this->id; + $sql .= " AND ec.fk_c_type_contact=tc.rowid"; + $sql .= " AND tc.element='".$this->db->escape($this->element)."'"; + if ($source == 'internal') { + $sql .= " AND tc.source = 'internal'"; + } + + if ($source == 'external' || $source == 'thirdparty') { + $sql .= " AND tc.source = 'external'"; + } + + $sql .= " AND tc.active=1"; + if ($status >= 0) { + $sql .= " AND ec.statut = '".$status."'"; + } + + $sql .= " ORDER BY t.lastname ASC"; + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + + if (!$list) { + $transkey = "TypeContact_".$obj->element."_".$obj->source."_".$obj->code; + $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->type_contact_label); + $tab[$i] = array( + 'source' => $obj->source, + 'socid' => $obj->socid, + 'id' => $obj->id, + 'nom' => $obj->lastname, // For backward compatibility + 'civility' => $obj->civility, + 'lastname' => $obj->lastname, + 'firstname' => $obj->firstname, + 'email' => $obj->email, + 'rowid' => $obj->rowid, + 'code' => $obj->code, + 'libelle' => $libelle_type, + 'status' => $obj->statuslink, + 'statuscontact'=>$obj->statuscontact, + 'fk_c_type_contact' => $obj->fk_c_type_contact, + 'phone' => $obj->phone, + 'phone_mobile' => $obj->phone_mobile); + } else { + $tab[$i] = $obj->id; + } + + $i++; + } + + return $tab; + } else { + $this->error = $this->db->error(); + dol_print_error($this->db); + return -1; + } + } + + /** + * Get a default reference. + * + * @param Societe $thirdparty Thirdparty + * @return string Reference + */ + public function getDefaultRef($thirdparty = '') + { + global $conf; + + $defaultref = ''; + $modele = empty($conf->global->TICKET_ADDON) ? 'mod_ticket_simple' : $conf->global->TICKET_ADDON; + + // Search template files + $file = ''; + $classname = ''; + $filefound = 0; + $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); + foreach ($dirmodels as $reldir) { + $file = dol_buildpath($reldir."core/modules/ticket/".$modele.'.php', 0); + if (file_exists($file)) { + $filefound = 1; + $classname = $modele; + break; + } + } + + if ($filefound) { + $result = dol_include_once($reldir."core/modules/ticket/".$modele.'.php'); + $modTicket = new $classname; + + $defaultref = $modTicket->getNextValue($thirdparty, $this); + } + + if (is_numeric($defaultref) && $defaultref <= 0) { + $defaultref = ''; + } + + return $defaultref; + } + + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Return if at least one photo is available + * + * @param string $sdir Directory to scan + * @return boolean True if at least one photo is available, False if not + */ + public function is_photo_available($sdir) + { + // phpcs:enable + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + + global $conf; + + $dir = $sdir.'/'; + $nbphoto = 0; + + $dir_osencoded = dol_osencode($dir); + if (file_exists($dir_osencoded)) { + $handle = opendir($dir_osencoded); + if (is_resource($handle)) { + while (($file = readdir($handle)) !== false) { + if (!utf8_check($file)) { + $file = utf8_encode($file); + } + // To be sure data is stored in UTF8 in memory + if (dol_is_file($dir.$file)) { + return true; + } + } + } + } + return false; + } + + + /** + * Copy files defined into $_SESSION array into the ticket directory of attached files. + * Used for files linked into messages. + * Files may be renamed during copy to avoid overwriting existing files. + * + * @return array Array with final path/name/mime of files. + */ + public function copyFilesForTicket() + { + global $conf; + + // Create form object + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + + $maxwidthsmall = 270; + $maxheightsmall = 150; + $maxwidthmini = 128; + $maxheightmini = 72; + + $formmail = new FormMail($this->db); + + $attachedfiles = $formmail->get_attached_files(); + + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; + + // Copy files into ticket directory + $destdir = $conf->ticket->dir_output.'/'.$this->ref; + + if (!dol_is_dir($destdir)) { + dol_mkdir($destdir); + } + + $listofpaths = array(); + $listofnames = array(); + foreach ($filename as $i => $val) { + $destfile = $destdir.'/'.$filename[$i]; + // If destination file already exists, we add a suffix to avoid to overwrite + if (is_file($destfile)) + { + $now = dol_now(); + $destfile .= '.'.dol_print_date($now, 'dayhourlog'); + } + + $res = dol_move($filepath[$i], $destfile, 0, 1); + + if (image_format_supported($destfile) == 1) { + // Create small thumbs for image (Ratio is near 16/9) + // Used on logon for example + $imgThumbSmall = vignette($destfile, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs"); + // Create mini thumbs for image (Ratio is near 16/9) + // Used on menu or for setup page for example + $imgThumbMini = vignette($destfile, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); + } + + $formmail->remove_attached_files($i); + + // Fill array with new names + $listofpaths[$i] = $destfile; + $listofnames[$i] = basename($destfile); + } + + return array('listofpaths'=>$listofpaths, 'listofnames'=>$listofnames, 'listofmimes'=>$mimetype); + } + + + /** + * Add new message on a ticket (private area). Can also send it be email if GETPOST('send_email', 'int') is set. + * + * @param User $user User for action + * @param string $action Action string + * @param int $private 1=Message is private. TODO Implement this. What does this means ? + * @return int + */ + public function newMessage($user, &$action, $private = 1) + { + global $mysoc, $conf, $langs; + + $error = 0; + + $object = new Ticket($this->db); + + $ret = $object->fetch('', '', GETPOST('track_id', 'alpha')); + + $object->socid = $object->fk_soc; + $object->fetch_thirdparty(); + + if ($ret < 0) { + $error++; + array_push($this->errors, $langs->trans("ErrorTicketIsNotValid")); + $action = ''; + } + + if (!GETPOST("message")) { + $error++; + array_push($this->errors, $langs->trans("ErrorFieldRequired", $langs->transnoentities("message"))); + $action = 'add_message'; + } + + if (!$error) { + $object->subject = GETPOST('subject', 'alphanohtml'); + $object->message = GETPOST("message", "none"); + $object->private = GETPOST("private_message", "alpha"); + + $send_email = GETPOST('send_email', 'int'); + + // Copy attached files (saved into $_SESSION) as linked files to ticket. Return array with final name used. + $resarray = $object->copyFilesForTicket(); + + $listofpaths = $resarray['listofpaths']; + $listofnames = $resarray['listofnames']; + $listofmimes = $resarray['listofmimes']; - $id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames); - if ($id <= 0) { - $error++; - $this->errors = $object->error; - $this->errors = $object->errors; - $action = 'add_message'; - } - - if (!$error && $id > 0) { - setEventMessages($langs->trans('TicketMessageSuccessfullyAdded'), null, 'mesgs'); - - //var_dump($_SESSION); var_dump($listofpaths);exit; - - /* + $id = $object->createTicketMessage($user, 0, $listofpaths, $listofmimes, $listofnames); + if ($id <= 0) { + $error++; + $this->errors = $object->error; + $this->errors = $object->errors; + $action = 'add_message'; + } + + if (!$error && $id > 0) { + setEventMessages($langs->trans('TicketMessageSuccessfullyAdded'), null, 'mesgs'); + + //var_dump($_SESSION); var_dump($listofpaths);exit; + + /* * Send emails to internal users (linked contacts) */ - if ($send_email > 0) { - // Retrieve internal contact datas - $internal_contacts = $object->getInfosTicketInternalContact(); + if ($send_email > 0) { + // Retrieve internal contact datas + $internal_contacts = $object->getInfosTicketInternalContact(); - $sendto = array(); - if (is_array($internal_contacts) && count($internal_contacts) > 0) { - // altairis: set default subject - $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; - $subject = GETPOST('subject', 'nohtml') ? GETPOST('subject', 'nohtml') : '['.$label_title.'- ticket #'.$object->track_id.'] '.$langs->trans('TicketNewMessage'); + $sendto = array(); + if (is_array($internal_contacts) && count($internal_contacts) > 0) { + // altairis: set default subject + $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; + $subject = GETPOST('subject', 'nohtml') ? GETPOST('subject', 'nohtml') : '['.$label_title.'- ticket #'.$object->track_id.'] '.$langs->trans('TicketNewMessage'); - $message_intro = $langs->trans('TicketNotificationEmailBody', "#".$object->id); - $message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE; + $message_intro = $langs->trans('TicketNotificationEmailBody', "#".$object->id); + $message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE; - $message = $langs->trans('TicketMessageMailIntroText'); - $message .= "\n\n"; - $message .= GETPOST('message', 'restricthtml'); + $message = $langs->trans('TicketMessageMailIntroText'); + $message .= "\n\n"; + $message .= GETPOST('message', 'restricthtml'); - // Coordonnées client - $message .= "\n\n"; - $message .= "==============================================\n"; - $message .= !empty($object->thirdparty->name) ? $langs->trans('Thirdparty')." : ".$object->thirdparty->name : ''; - $message .= !empty($object->thirdparty->town) ? "\n".$langs->trans('Town')." : ".$object->thirdparty->town : ''; - $message .= !empty($object->thirdparty->phone) ? "\n".$langs->trans('Phone')." : ".$object->thirdparty->phone : ''; + // Coordonnées client + $message .= "\n\n"; + $message .= "==============================================\n"; + $message .= !empty($object->thirdparty->name) ? $langs->trans('Thirdparty')." : ".$object->thirdparty->name : ''; + $message .= !empty($object->thirdparty->town) ? "\n".$langs->trans('Town')." : ".$object->thirdparty->town : ''; + $message .= !empty($object->thirdparty->phone) ? "\n".$langs->trans('Phone')." : ".$object->thirdparty->phone : ''; - // Build array to display recipient list - foreach ($internal_contacts as $key => $info_sendto) { - // altairis: avoid duplicate notifications - if ($info_sendto['id'] == $user->id) { - continue; - } + // Build array to display recipient list + foreach ($internal_contacts as $key => $info_sendto) { + // altairis: avoid duplicate notifications + if ($info_sendto['id'] == $user->id) { + continue; + } - if ($info_sendto['email'] != '') { - if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + if ($info_sendto['email'] != '') { + if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; - //Contact type - $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; - $message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient').' : '.$recipient."\n" : ''); - } - } - $message .= "\n"; - // URL ticket - $url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id; + //Contact type + $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; + $message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient').' : '.$recipient."\n" : ''); + } + } + $message .= "\n"; + // URL ticket + $url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id; - // altairis: make html link on url - $message .= "\n".$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.''.$object->track_id.''."\n"; + // altairis: make html link on url + $message .= "\n".$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.''.$object->track_id.''."\n"; - // Add global email address recipient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { - if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - } + // Add global email address recipient + if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { + if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + } - // altairis: dont try to send email if no recipient - if (!empty($sendto)) { - $this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames); - } - } + // altairis: dont try to send email if no recipient + if (!empty($sendto)) { + $this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames); + } + } - /* + /* * Send emails for externals users if not private (linked contacts) */ - if (empty($object->private)) { - // Retrieve email of all contacts (external) - $external_contacts = $object->getInfosTicketExternalContact(); + if (empty($object->private)) { + // Retrieve email of all contacts (external) + $external_contacts = $object->getInfosTicketExternalContact(); - // If no contact, get email from thirdparty - if (is_array($external_contacts) && count($external_contacts) === 0) { - if (!empty($object->fk_soc)) { - $object->fetch_thirdparty($object->fk_soc); - $array_company = array(array('firstname' => '', 'lastname' => $object->thirdparty->name, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id)); - $external_contacts = array_merge($external_contacts, $array_company); - } elseif (empty($object->fk_soc) && !empty($object->origin_email)) { - $array_external = array(array('firstname' => '', 'lastname' => $object->origin_email, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id)); - $external_contacts = array_merge($external_contacts, $array_external); - } - } + // If no contact, get email from thirdparty + if (is_array($external_contacts) && count($external_contacts) === 0) { + if (!empty($object->fk_soc)) { + $object->fetch_thirdparty($object->fk_soc); + $array_company = array(array('firstname' => '', 'lastname' => $object->thirdparty->name, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id)); + $external_contacts = array_merge($external_contacts, $array_company); + } elseif (empty($object->fk_soc) && !empty($object->origin_email)) { + $array_external = array(array('firstname' => '', 'lastname' => $object->origin_email, 'email' => $object->thirdparty->email, 'libelle' => $langs->transnoentities('Customer'), 'socid' => $object->thirdparty->id)); + $external_contacts = array_merge($external_contacts, $array_external); + } + } - $sendto = array(); - if (is_array($external_contacts) && count($external_contacts) > 0) { - // altairis: get default subject for email to external contacts - $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; - $subject = GETPOST('subject') ? GETPOST('subject') : '['.$label_title.'- ticket #'.$object->track_id.'] '.$langs->trans('TicketNewMessage'); + $sendto = array(); + if (is_array($external_contacts) && count($external_contacts) > 0) { + // altairis: get default subject for email to external contacts + $label_title = empty($conf->global->MAIN_APPLICATION_TITLE) ? $mysoc->name : $conf->global->MAIN_APPLICATION_TITLE; + $subject = GETPOST('subject') ? GETPOST('subject') : '['.$label_title.'- ticket #'.$object->track_id.'] '.$langs->trans('TicketNewMessage'); - $message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKET_MESSAGE_MAIL_INTRO; - $message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE; + $message_intro = GETPOST('mail_intro') ? GETPOST('mail_intro') : $conf->global->TICKET_MESSAGE_MAIL_INTRO; + $message_signature = GETPOST('mail_signature') ? GETPOST('mail_signature') : $conf->global->TICKET_MESSAGE_MAIL_SIGNATURE; - // We put intro after - $message = GETPOST('message'); - $message .= "\n\n"; + // We put intro after + $message = GETPOST('message'); + $message .= "\n\n"; - foreach ($external_contacts as $key => $info_sendto) { - // altairis: avoid duplicate emails to external contacts - if ($info_sendto['id'] == $user->contactid) { - continue; - } + foreach ($external_contacts as $key => $info_sendto) { + // altairis: avoid duplicate emails to external contacts + if ($info_sendto['id'] == $user->contactid) { + continue; + } - if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) { - if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; + if ($info_sendto['email'] != '' && $info_sendto['email'] != $object->origin_email) { + if (!empty($info_sendto['email'])) $sendto[] = trim($info_sendto['firstname']." ".$info_sendto['lastname'])." <".$info_sendto['email'].">"; - $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; - $message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient').' : '.$recipient."\n" : ''); - } - } + $recipient = dolGetFirstLastname($info_sendto['firstname'], $info_sendto['lastname'], '-1').' ('.strtolower($info_sendto['libelle']).')'; + $message .= (!empty($recipient) ? $langs->trans('TicketNotificationRecipient').' : '.$recipient."\n" : ''); + } + } - // If public interface is not enable, use link to internal page into mail - $url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? - (!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.$object->track_id; - $message .= "\n".$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.''.$object->track_id.''."\n"; + // If public interface is not enable, use link to internal page into mail + $url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? + (!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.$object->track_id; + $message .= "\n".$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.''.$object->track_id.''."\n"; - // Build final message - $message = $message_intro.$message; + // Build final message + $message = $message_intro.$message; - // Add signature - $message .= '
'.$message_signature; + // Add signature + $message .= '
'.$message_signature; - if (!empty($object->origin_email)) { - $sendto[] = $object->origin_email; - } + if (!empty($object->origin_email)) { + $sendto[] = $object->origin_email; + } - if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) { - $object->socid = $object->fk_soc; - $object->fetch_thirdparty(); - if (!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email; - } + if ($object->fk_soc > 0 && !in_array($object->origin_email, $sendto)) { + $object->socid = $object->fk_soc; + $object->fetch_thirdparty(); + if (!empty($object->thirdparty->email)) $sendto[] = $object->thirdparty->email; + } - // altairis: Add global email address reciepient - if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { - if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; - } + // altairis: Add global email address reciepient + if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { + if (!empty($conf->global->TICKET_NOTIFICATION_EMAIL_TO)) $sendto[] = $conf->global->TICKET_NOTIFICATION_EMAIL_TO; + } - // altairis: dont try to send email when no recipient - if (!empty($sendto)) { - $this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames); - } - } - } - } + // altairis: dont try to send email when no recipient + if (!empty($sendto)) { + $this->sendTicketMessageByEmail($subject, $message, '', $sendto, $listofpaths, $listofmimes, $listofnames); + } + } + } + } - // Set status to "answered" if not set yet, but only if internal user - if ($object->fk_statut < 3 && !$user->socid) - { - $object->setStatut(3); - } + // Set status to "answered" if not set yet, but only if internal user + if ($object->fk_statut < 3 && !$user->socid) + { + $object->setStatut(3); + } - return 1; - } else { - setEventMessages($object->error, $object->errors, 'errors'); - return -1; - } - } else { - setEventMessages($this->error, $this->errors, 'errors'); - return -1; - } - } + return 1; + } else { + setEventMessages($object->error, $object->errors, 'errors'); + return -1; + } + } else { + setEventMessages($this->error, $this->errors, 'errors'); + return -1; + } + } - /** - * Send ticket by email to linked contacts - * - * @param string $subject Email subject - * @param string $message Email message - * @param int $send_internal_cc Receive a copy on internal email ($conf->global->TICKET_NOTIFICATION_EMAIL_FROM) - * @param array $array_receiver Array of receiver. exemple array('name' => 'John Doe', 'email' => 'john@doe.com', etc...) + /** + * Send ticket by email to linked contacts + * + * @param string $subject Email subject + * @param string $message Email message + * @param int $send_internal_cc Receive a copy on internal email ($conf->global->TICKET_NOTIFICATION_EMAIL_FROM) + * @param array $array_receiver Array of receiver. exemple array('name' => 'John Doe', 'email' => 'john@doe.com', etc...) * @param array $filename_list List of files to attach (full path of filename on file system) * @param array $mimetype_list List of MIME type of attached files * @param array $mimefilename_list List of attached file name in message - * @return void - */ - public function sendTicketMessageByEmail($subject, $message, $send_internal_cc = 0, $array_receiver = array(), $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array()) - { - global $conf, $langs; + * @return void + */ + public function sendTicketMessageByEmail($subject, $message, $send_internal_cc = 0, $array_receiver = array(), $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array()) + { + global $conf, $langs; - if ($conf->global->TICKET_DISABLE_ALL_MAILS) { - dol_syslog(get_class($this).'::sendTicketMessageByEmail: Emails are disable into ticket setup by option TICKET_DISABLE_ALL_MAILS', LOG_WARNING); - return ''; - } + if ($conf->global->TICKET_DISABLE_ALL_MAILS) { + dol_syslog(get_class($this).'::sendTicketMessageByEmail: Emails are disable into ticket setup by option TICKET_DISABLE_ALL_MAILS', LOG_WARNING); + return ''; + } - $langs->load("mails"); + $langs->load("mails"); - include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - //$contactstatic = new Contact($this->db); + include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; + //$contactstatic = new Contact($this->db); - // If no receiver defined, load all ticket linked contacts - if (!is_array($array_receiver) || !count($array_receiver) > 0) { - $array_receiver = $this->getInfosTicketInternalContact(); - $array_receiver = array_merge($array_receiver, $this->getInfosTicketExternalContact()); - } + // If no receiver defined, load all ticket linked contacts + if (!is_array($array_receiver) || !count($array_receiver) > 0) { + $array_receiver = $this->getInfosTicketInternalContact(); + $array_receiver = array_merge($array_receiver, $this->getInfosTicketExternalContact()); + } - if ($send_internal_cc) { - $sendtocc = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM; - } + if ($send_internal_cc) { + $sendtocc = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM; + } - $from = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM; - if (is_array($array_receiver) && count($array_receiver) > 0) { - foreach ($array_receiver as $key => $receiver) - { - $deliveryreceipt = 0; - $filepath = $filename_list; - $filename = $mimefilename_list; - $mimetype = $mimetype_list; + $from = $conf->global->TICKET_NOTIFICATION_EMAIL_FROM; + if (is_array($array_receiver) && count($array_receiver) > 0) { + foreach ($array_receiver as $key => $receiver) + { + $deliveryreceipt = 0; + $filepath = $filename_list; + $filename = $mimefilename_list; + $mimetype = $mimetype_list; - $message_to_send = dol_nl2br($message); + $message_to_send = dol_nl2br($message); - // Envoi du mail - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; - $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; - } - include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + // Envoi du mail + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $old_MAIN_MAIL_AUTOCOPY_TO = $conf->global->MAIN_MAIL_AUTOCOPY_TO; + $conf->global->MAIN_MAIL_AUTOCOPY_TO = ''; + } + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $trackid = "tic".$this->id; - $mailfile = new CMailFile($subject, $receiver, $from, $message_to_send, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid); - if ($mailfile->error) { - setEventMessages($mailfile->error, null, 'errors'); - } else { - $result = $mailfile->sendfile(); - if ($result) { - setEventMessages($langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($receiver, 2)), null, 'mesgs'); - } else { - $langs->load("other"); - if ($mailfile->error) { - setEventMessages($langs->trans('ErrorFailedToSendMail', $from, $receiver), null, 'errors'); - dol_syslog($langs->trans('ErrorFailedToSendMail', $from, $receiver).' : '.$mailfile->error); - } else { - setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'errors'); - } - } - } - if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { - $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; - } - } - } else { - $langs->load("other"); - setEventMessages($langs->trans('ErrorMailRecipientIsEmptyForSendTicketMessage'), null, 'warnings'); - } - } + $mailfile = new CMailFile($subject, $receiver, $from, $message_to_send, $filepath, $mimetype, $filename, $sendtocc, '', $deliveryreceipt, -1, '', '', $trackid); + if ($mailfile->error) { + setEventMessages($mailfile->error, null, 'errors'); + } else { + $result = $mailfile->sendfile(); + if ($result) { + setEventMessages($langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($receiver, 2)), null, 'mesgs'); + } else { + $langs->load("other"); + if ($mailfile->error) { + setEventMessages($langs->trans('ErrorFailedToSendMail', $from, $receiver), null, 'errors'); + dol_syslog($langs->trans('ErrorFailedToSendMail', $from, $receiver).' : '.$mailfile->error); + } else { + setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'errors'); + } + } + } + if (!empty($conf->global->TICKET_DISABLE_MAIL_AUTOCOPY_TO)) { + $conf->global->MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO; + } + } + } else { + $langs->load("other"); + setEventMessages($langs->trans('ErrorMailRecipientIsEmptyForSendTicketMessage'), null, 'warnings'); + } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Load indicators for dashboard (this->nbtodo and this->nbtodolate) - * - * @param User $user Object user - * @param int $mode "opened" for askprice to close, "signed" for proposal to invoice - * @return int <0 if KO, >0 if OK - */ - public function load_board($user, $mode) - { - // phpcs:enable - global $conf, $user, $langs; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load indicators for dashboard (this->nbtodo and this->nbtodolate) + * + * @param User $user Object user + * @param int $mode "opened" for askprice to close, "signed" for proposal to invoice + * @return int <0 if KO, >0 if OK + */ + public function load_board($user, $mode) + { + // phpcs:enable + global $conf, $user, $langs; - $now = dol_now(); + $now = dol_now(); - $this->nbtodo = $this->nbtodolate = 0; - $clause = " WHERE"; + $this->nbtodo = $this->nbtodolate = 0; + $clause = " WHERE"; - $sql = "SELECT p.rowid, p.ref, p.datec as datec"; - $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; - if (!$user->rights->societe->client->voir && !$user->socid) - { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; - $sql .= " WHERE sc.fk_user = ".$user->id; - $clause = " AND"; - } - $sql .= $clause." p.entity IN (".getEntity('ticket').")"; - if ($mode == 'opened') $sql .= " AND p.fk_statut in (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")"; - if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid; + $sql = "SELECT p.rowid, p.ref, p.datec as datec"; + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; + if (!$user->rights->societe->client->voir && !$user->socid) + { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON p.fk_soc = sc.fk_soc"; + $sql .= " WHERE sc.fk_user = ".$user->id; + $clause = " AND"; + } + $sql .= $clause." p.entity IN (".getEntity('ticket').")"; + if ($mode == 'opened') $sql .= " AND p.fk_statut in (".Ticket::STATUS_CLOSED.", ".Ticket::STATUS_CANCELED.")"; + if ($user->socid) $sql .= " AND p.fk_soc = ".$user->socid; - $resql = $this->db->query($sql); - if ($resql) - { - $label = $labelShort = ''; - $status = ''; - if ($mode == 'opened') { - $status = 'openall'; - //$delay_warning = $conf->ticket->warning_delay; - $delay_warning = 0; - $label = $langs->trans("MenuListNonClosed"); - $labelShort = $langs->trans("MenuListNonClosed"); - } + $resql = $this->db->query($sql); + if ($resql) + { + $label = $labelShort = ''; + $status = ''; + if ($mode == 'opened') { + $status = 'openall'; + //$delay_warning = $conf->ticket->warning_delay; + $delay_warning = 0; + $label = $langs->trans("MenuListNonClosed"); + $labelShort = $langs->trans("MenuListNonClosed"); + } - $response = new WorkboardResponse(); - //$response->warning_delay = $delay_warning / 60 / 60 / 24; - $response->label = $label; - $response->labelShort = $labelShort; - $response->url = DOL_URL_ROOT.'/ticket/list.php?search_fk_statut[]='.$status; - $response->img = img_object('', "ticket"); + $response = new WorkboardResponse(); + //$response->warning_delay = $delay_warning / 60 / 60 / 24; + $response->label = $label; + $response->labelShort = $labelShort; + $response->url = DOL_URL_ROOT.'/ticket/list.php?search_fk_statut[]='.$status; + $response->img = img_object('', "ticket"); - // This assignment in condition is not a bug. It allows walking the results. - while ($obj = $this->db->fetch_object($resql)) - { - $response->nbtodo++; - if ($mode == 'opened') - { - $datelimit = $this->db->jdate($obj->datefin); - if ($datelimit < ($now - $delay_warning)) - { - //$response->nbtodolate++; - } - } - } - return $response; - } - else - { - $this->error = $this->db->lasterror(); - return -1; - } - } + // This assignment in condition is not a bug. It allows walking the results. + while ($obj = $this->db->fetch_object($resql)) + { + $response->nbtodo++; + if ($mode == 'opened') + { + $datelimit = $this->db->jdate($obj->datefin); + if ($datelimit < ($now - $delay_warning)) + { + //$response->nbtodolate++; + } + } + } + return $response; + } + else + { + $this->error = $this->db->lasterror(); + return -1; + } + } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - /** - * Load indicator this->nb of global stats widget - * - * @return int <0 if ko, >0 if ok - */ - public function load_state_board() - { - // phpcs:enable - global $conf, $user; + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps + /** + * Load indicator this->nb of global stats widget + * + * @return int <0 if ko, >0 if ok + */ + public function load_state_board() + { + // phpcs:enable + global $conf, $user; - $this->nb = array(); - $clause = "WHERE"; + $this->nb = array(); + $clause = "WHERE"; - $sql = "SELECT count(p.rowid) as nb"; - $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; - if (!$user->rights->societe->client->voir && !$user->socid) - { - $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; - $sql .= " WHERE sc.fk_user = ".$user->id; - $clause = "AND"; - } - $sql .= " ".$clause." p.entity IN (".getEntity('ticket').")"; + $sql = "SELECT count(p.rowid) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."ticket as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->socid) + { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON s.rowid = sc.fk_soc"; + $sql .= " WHERE sc.fk_user = ".$user->id; + $clause = "AND"; + } + $sql .= " ".$clause." p.entity IN (".getEntity('ticket').")"; - $resql = $this->db->query($sql); - if ($resql) - { - // This assignment in condition is not a bug. It allows walking the results. - while ($obj = $this->db->fetch_object($resql)) - { - $this->nb["ticket"] = $obj->nb; - } - $this->db->free($resql); - return 1; - } - else - { - dol_print_error($this->db); - $this->error = $this->db->lasterror(); - return -1; - } - } + $resql = $this->db->query($sql); + if ($resql) + { + // This assignment in condition is not a bug. It allows walking the results. + while ($obj = $this->db->fetch_object($resql)) + { + $this->nb["ticket"] = $obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error = $this->db->lasterror(); + return -1; + } + } } @@ -2911,117 +2911,117 @@ class TicketsLine public $rowid; /** - * @var int ID - */ - public $id; + * @var int ID + */ + public $id; - /** - * @var string $ref Ticket reference - */ - public $ref; + /** + * @var string $ref Ticket reference + */ + public $ref; - /** - * Hash to identify ticket - */ - public $track_id; + /** + * Hash to identify ticket + */ + public $track_id; - /** - * @var int Thirdparty ID - */ - public $fk_soc; + /** + * @var int Thirdparty ID + */ + public $fk_soc; - /** - * Project ID - */ - public $fk_project; + /** + * Project ID + */ + public $fk_project; - /** - * Person email who have create ticket - */ - public $origin_email; + /** + * Person email who have create ticket + */ + public $origin_email; - /** - * User id who have create ticket - */ - public $fk_user_create; + /** + * User id who have create ticket + */ + public $fk_user_create; - /** - * User id who have ticket assigned - */ - public $fk_user_assign; + /** + * User id who have ticket assigned + */ + public $fk_user_assign; - /** - * Ticket subject - */ - public $subject; + /** + * Ticket subject + */ + public $subject; - /** - * Ticket message - */ - public $message; + /** + * Ticket message + */ + public $message; - /** - * Ticket statut - */ - public $fk_statut; + /** + * Ticket statut + */ + public $fk_statut; - /** - * State resolution - */ - public $resolution; + /** + * State resolution + */ + public $resolution; - /** - * Progress in percent - */ - public $progress; + /** + * Progress in percent + */ + public $progress; - /** - * Duration for ticket - */ - public $timing; + /** + * Duration for ticket + */ + public $timing; - /** - * Type code - */ - public $type_code; + /** + * Type code + */ + public $type_code; - /** - * Category code - */ - public $category_code; + /** + * Category code + */ + public $category_code; - /** - * Severity code - */ - public $severity_code; + /** + * Severity code + */ + public $severity_code; - /** - * Type label - */ - public $type_label; + /** + * Type label + */ + public $type_label; - /** - * Category label - */ - public $category_label; + /** + * Category label + */ + public $category_label; - /** - * Severity label - */ - public $severity_label; + /** + * Severity label + */ + public $severity_label; - /** - * Creation date - */ - public $datec = ''; + /** + * Creation date + */ + public $datec = ''; - /** - * Read date - */ - public $date_read = ''; + /** + * Read date + */ + public $date_read = ''; - /** - * Close ticket date - */ - public $date_close = ''; + /** + * Close ticket date + */ + public $date_close = ''; } diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 65951e9f2de..3bdc6b5390c 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -145,6 +145,22 @@ if ($action == 'update' && !$cancel) } } +// update personal email +if ($action == 'setpersonal_email') +{ + $object->personal_email = GETPOST('personal_email'); + $result = $object->update($user); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); +} + +// update personal mobile +if ($action == 'setpersonal_mobile') +{ + $object->personal_mobile = GETPOST('personal_mobile'); + $result = $object->update($user); + if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); +} + /* * View @@ -197,6 +213,22 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco print ''.$object->login.''; print ''; + print ''; + print ''; + print $form->editfieldkey("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer); + print ''; + print $form->editfieldval("UserPersonalEmail", 'personal_email', $object->personal_email, $object, $user->rights->user->user->creer, 'email', ($object->personal_email != '' ? dol_print_email($object->personal_email) : '')); + print ''; + print ''; + + print ''; + print ''; + print $form->editfieldkey("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer); + print ''; + print $form->editfieldval("UserPersonalMobile", 'personal_mobile', $object->personal_mobile, $object, $user->rights->user->user->creer, 'string', ($object->personal_mobile != '' ? dol_print_phone($object->personal_mobile) : '')); + print ''; + print ''; + print ''; print '
'; diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index fb1da988ce4..46022d066f3 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2030 Thibault FOUCART * * 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 @@ -62,10 +63,11 @@ class Users extends DolibarrApi * @param int $limit Limit for list * @param int $page Page number * @param string $user_ids User ids filter field. Example: '1' or '1,2,3' {@pattern /^[0-9,]*$/i} + * @param int $category Use this param to filter list by category * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')" * @return array Array of User objects */ - public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $sqlfilters = '') + public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $user_ids = 0, $category = 0, $sqlfilters = '') { global $db, $conf; @@ -80,8 +82,18 @@ class Users extends DolibarrApi $sql = "SELECT t.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."user as t"; + if ($category > 0) { + $sql .= ", ".MAIN_DB_PREFIX."categorie_user as c"; + } $sql .= ' WHERE t.entity IN ('.getEntity('user').')'; if ($user_ids) $sql .= " AND t.rowid IN (".$user_ids.")"; + + // Select products of given category + if ($category > 0) { + $sql .= " AND c.fk_categorie = ".$db->escape($category); + $sql .= " AND c.fk_user = t.rowid "; + } + // Add sql filters if ($sqlfilters) { diff --git a/htdocs/website/index.php b/htdocs/website/index.php index b70079e9130..437ef5b498d 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -327,6 +327,8 @@ if ($cancel) $savbacktopage = $backtopage; $backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php +if ($sortfield) $backtopage.='&sortfield='.$sortfield; +if ($sortorder) $backtopage.='&sortorder='.$sortorder; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $backtopage = $savbacktopage; @@ -2131,7 +2133,7 @@ print '
'; // Add a margin under toolbar ? $style = ''; -if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource') $style = ' margin-bottom: 5px;'; +if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && ! GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;'; if (!GETPOST('hide_websitemenu')) @@ -2433,10 +2435,20 @@ if (!GETPOST('hide_websitemenu')) if ($action == 'createpagefromclone') { // Create an array for form $preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang); + $onlylang = array(); + if ($website->otherlang) { + foreach(explode(',', $website->otherlang) as $langkey) { + $onlylang[$langkey] = $langkey; + } + $textifempty = 1; + } else { + $onlylang['none'] = ''; + } + $textifempty = 1; $formquestion = array( array('type' => 'hidden', 'name' => 'sourcepageurl', 'value'=> $objectpage->pageurl), array('type' => 'checkbox', 'tdclass'=>'maxwidth200', 'name' => 'is_a_translation', 'label' => $langs->trans("PageIsANewTranslation"), 'value' => 0), - array('type' => 'other', 'name' => 'newlang', 'label' => $langs->trans("Language"), 'value' => $formadmin->select_language($preselectedlanguage, 'newlang', 0, null, 1, 0, 0, 'minwidth200', 0, 1)), + array('type' => 'other', 'name' => 'newlang', 'label' => $form->textwithpicto($langs->trans("Language"), $langs->trans("DefineListOfAltLanguagesInWebsiteProperties")), 'value' => $formadmin->select_language($preselectedlanguage, 'newlang', 0, null, $textifempty, 0, 0, 'minwidth200', 0, 1, 0, $onlylang, 1)), array('type' => 'other', 'name' => 'newwebsite', 'label' => $langs->trans("WebSite"), 'value' => $formwebsite->selectWebsite($object->id, 'newwebsite', 0)), array('type' => 'text', 'tdclass'=>'maxwidth200 fieldrequired', 'name' => 'newtitle', 'label'=> $langs->trans("WEBSITE_TITLE"), 'value'=> $langs->trans("CopyOf").' '.$objectpage->title), array('type' => 'text', 'tdclass'=>'maxwidth200', 'name' => 'newpageurl', 'label'=> $langs->trans("WEBSITE_PAGENAME"), 'value'=> ''), diff --git a/htdocs/website/samples/wrapper.php b/htdocs/website/samples/wrapper.php index 910b58f391f..84878a102f6 100644 --- a/htdocs/website/samples/wrapper.php +++ b/htdocs/website/samples/wrapper.php @@ -76,10 +76,10 @@ $original_file = str_replace("../", "/", $original_file); // Cache or not if (GETPOST("cache", 'none') || image_format_supported($original_file) >= 0) { - // Important: Following code is to avoid page request by browser and PHP CPU at - // each Dolibarr page access. - header('Cache-Control: max-age=3600, public, must-revalidate'); - header('Pragma: cache'); // This is to avoid having Pragma: no-cache + // Important: Following code is to avoid page request by browser and PHP CPU at + // each Dolibarr page access. + header('Cache-Control: max-age=3600, public, must-revalidate'); + header('Pragma: cache'); // This is to avoid having Pragma: no-cache } $refname = basename(dirname($original_file)."/"); @@ -99,107 +99,107 @@ if ($rss) { $website->fetch('', $websitekey); - $MAXNEWS = 20; - $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); + $MAXNEWS = 20; + $arrayofblogs = $websitepage->fetchAll($website->id, 'DESC', 'date_creation', $MAXNEWS, 0, $filters); $eventarray = array(); - foreach($arrayofblogs as $blog) { + foreach ($arrayofblogs as $blog) { $blog->fullpageurl = $website->virtualhost.'/'.$blog->pageurl.'.php'; $eventarray[] = $blog; } - require_once DOL_DOCUMENT_ROOT."/core/lib/xcal.lib.php"; - require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; - require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; + require_once DOL_DOCUMENT_ROOT."/core/lib/xcal.lib.php"; + require_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php"; + require_once DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"; - dol_syslog("build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); + dol_syslog("build_exportfile Build export file format=".$format.", type=".$type.", cachedelay=".$cachedelay.", filename=".$filename.", filters size=".count($filters), LOG_DEBUG); - // Clean parameters - if (!$filename) - { - $extension = 'rss'; - $filename = $format.'.'.$extension; - } + // Clean parameters + if (!$filename) + { + $extension = 'rss'; + $filename = $format.'.'.$extension; + } - // Create dir and define output file (definitive and temporary) - $result = dol_mkdir($dir_temp); - $outputfile = $dir_temp.'/'.$filename; + // Create dir and define output file (definitive and temporary) + $result = dol_mkdir($dir_temp); + $outputfile = $dir_temp.'/'.$filename; - $result = 0; + $result = 0; - $buildfile = true; + $buildfile = true; - if ($cachedelay) - { - $nowgmt = dol_now(); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) - { - dol_syslog("build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); - $buildfile = false; - } - } + if ($cachedelay) + { + $nowgmt = dol_now(); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + if (dol_filemtime($outputfile) > ($nowgmt - $cachedelay)) + { + dol_syslog("build_exportfile file ".$outputfile." is not older than now - cachedelay (".$nowgmt." - ".$cachedelay."). Build is canceled"); + $buildfile = false; + } + } - if ($buildfile) - { - $langs->load("other"); - $title = $desc = $langs->transnoentities('LatestBlogPosts'); + if ($buildfile) + { + $langs->load("other"); + $title = $desc = $langs->transnoentities('LatestBlogPosts'); - // Create temp file - $outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads - @chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK)); + // Create temp file + $outputfiletmp = tempnam($dir_temp, 'tmp'); // Temporary file (allow call of function by different threads + @chmod($outputfiletmp, octdec($conf->global->MAIN_UMASK)); - // Write file - $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'); + // Write file + $result = build_rssfile($format, $title, $desc, $eventarray, $outputfiletmp, '', $website->virtualhost.'/wrapper.php?rss=1'); - if ($result >= 0) - { - if (dol_move($outputfiletmp, $outputfile, 0, 1)) $result = 1; - else - { - $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; - dol_syslog("build_exportfile ".$error, LOG_ERR); - dol_delete_file($outputfiletmp, 0, 1); - print $error; - exit(-1); - } - } - else - { - dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); - dol_delete_file($outputfiletmp, 0, 1); - $langs->load("errors"); - print $langs->trans("ErrorFailToCreateFile", $outputfile); - exit(-1); - } - } + if ($result >= 0) + { + if (dol_move($outputfiletmp, $outputfile, 0, 1)) $result = 1; + else + { + $error = 'Failed to rename '.$outputfiletmp.' into '.$outputfile; + dol_syslog("build_exportfile ".$error, LOG_ERR); + dol_delete_file($outputfiletmp, 0, 1); + print $error; + exit(-1); + } + } + else + { + dol_syslog("build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); + dol_delete_file($outputfiletmp, 0, 1); + $langs->load("errors"); + print $langs->trans("ErrorFailToCreateFile", $outputfile); + exit(-1); + } + } - if ($result >= 0) - { - $attachment = false; - if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; - //$attachment = false; - $contenttype = 'application/rss+xml'; - if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; - //$contenttype='text/plain'; - $outputencoding = 'UTF-8'; + if ($result >= 0) + { + $attachment = false; + if (isset($_GET["attachment"])) $attachment = $_GET["attachment"]; + //$attachment = false; + $contenttype = 'application/rss+xml'; + if (isset($_GET["contenttype"])) $contenttype = $_GET["contenttype"]; + //$contenttype='text/plain'; + $outputencoding = 'UTF-8'; - if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); - if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); + if ($contenttype) header('Content-Type: '.$contenttype.($outputencoding ? '; charset='.$outputencoding : '')); + if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"'); - // Ajout directives pour resoudre bug IE - //header('Cache-Control: Public, must-revalidate'); - //header('Pragma: public'); - if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); - else header('Cache-Control: private, must-revalidate'); + // Ajout directives pour resoudre bug IE + //header('Cache-Control: Public, must-revalidate'); + //header('Pragma: public'); + if ($cachedelay) header('Cache-Control: max-age='.$cachedelay.', private, must-revalidate'); + else header('Cache-Control: private, must-revalidate'); - // Clean parameters - $outputfile = $dir_temp.'/'.$filename; - $result = readfile($outputfile); - if (!$result) print 'File '.$outputfile.' was empty.'; + // Clean parameters + $outputfile = $dir_temp.'/'.$filename; + $result = readfile($outputfile); + if (!$result) print 'File '.$outputfile.' was empty.'; - // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); - exit; - } + // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); + exit; + } } // Get logos elseif ($modulepart == "mycompany" && preg_match('/^\/?logos\//', $original_file))