From de5e6cf546bd0a1dd93d77b83d69e0ce076eb441 Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 28 Sep 2020 17:04:45 +0200 Subject: [PATCH 01/46] Add 2 new field typeObject and ObjectId to website --- .../install/mysql/migration/11.0.0-12.0.0.sql | 2 ++ .../install/mysql/tables/llx_website_page.sql | 4 ++- htdocs/website/class/websitepage.class.php | 19 ++++++++++++++ htdocs/website/index.php | 25 ++++++++++++++++++- 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 htdocs/install/mysql/migration/11.0.0-12.0.0.sql diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql new file mode 100644 index 00000000000..98413f39d82 --- /dev/null +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -0,0 +1,2 @@ +ALTER TABLE llx_website_page Add COLUMN fk_typeobject varchar(255); +ALTER TABLE llx_website_page Add COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index 840e12e0141..156aff0b5a6 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -38,5 +38,7 @@ CREATE TABLE llx_website_page fk_user_modif integer, date_creation datetime, tms timestamp, - import_key varchar(14) -- import key + import_key varchar(14), -- import key + fk_typeobject varchar(255), + fk_object varchar(255) ) ENGINE=innodb; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index abdb8d323eb..a0297e11693 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -102,6 +102,15 @@ class WebsitePage extends CommonObject const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; + /** + * @var string path type object + */ + public $fk_typeobject; + /** + * @var string path name object + */ + public $fk_object; + // BEGIN MODULEBUILDER PROPERTIES @@ -131,6 +140,8 @@ class WebsitePage extends CommonObject 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1), + 'fk_typeobject' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''), + 'fk_object' => array('type' => 'varchar(255)','label' => 'ObjectId', 'enabled'=>1, 'visible'=>1, 'position'=>47, 'searchall'=>0, 'help'=>'') ); // END MODULEBUILDER PROPERTIES @@ -197,6 +208,8 @@ class WebsitePage extends CommonObject $sql .= " t.tms as date_modification,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif"; + $sql .= " t.fk_typeobject,"; + $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level $sql .= ' WHERE 1 = 1'; @@ -244,6 +257,8 @@ class WebsitePage extends CommonObject $this->date_modification = $this->db->jdate($obj->date_modification); $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; + $this->fk_typeobject = $obj->fk_typeobject; + $this->fk_object = $obj->fk_object; } $this->db->free($resql); @@ -298,6 +313,8 @@ class WebsitePage extends CommonObject $sql .= " t.tms as date_modification,"; $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif"; + $sql .= " t.fk_typeobject,"; + $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; // Manage filter @@ -349,6 +366,8 @@ class WebsitePage extends CommonObject $record->date_modification = $this->db->jdate($obj->date_modification); $record->fk_user_creat = $obj->fk_user_creat; $record->fk_user_modif = $obj->fk_user_modif; + $record->fk_typeobject = $obj->fk_typeobject; + $record->fk_object = $obj->fk_object; //var_dump($record->id); $records[$record->id] = $record; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 72fd6d0b70e..0d6df4694b2 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -825,6 +825,12 @@ if ($action == 'addcontainer') if (!$error) { + if (GETPOSTISSET('WEBSITE_OBJECTCLASS')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); + } + if (GETPOSTISSET('WEBSITE_OBJECTID')){ + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); + } $pageid = $objectpage->create($user); if ($pageid <= 0) { $error++; @@ -1412,7 +1418,12 @@ if ($action == 'updatemeta') $objectpage->lang = GETPOST('WEBSITE_LANG', 'aZ09'); $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); - + if(GETPOSTISSET('WEBSITE_OBJECTCLASS')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'aZ09'); + } + if(GETPOSTISSET('WEBSITE_OBJECTID')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTID','aZ09'); + } $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; @@ -3119,6 +3130,18 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; print ''; + print ''; + print 'ObjectClass'; + print ''; + print ''; + print ''; + + print ''; + print 'ObjectID'; + print ''; + print ''; + print ''; + $fuser = new User($db); print ''; From bdb38da9d3370b4ab20fa532990ad7fdf577a01f Mon Sep 17 00:00:00 2001 From: Florian Date: Mon, 28 Sep 2020 18:17:23 +0200 Subject: [PATCH 02/46] Add 2 new field typeObject and ObjectId to website --- .../install/mysql/migration/11.0.0-12.0.0.sql | 3 +++ .../install/mysql/tables/llx_website_page.sql | 4 ++- htdocs/website/class/websitepage.class.php | 22 ++++++++++++++-- htdocs/website/index.php | 25 ++++++++++++++++++- 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 994e5d89495..23830014690 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -335,3 +335,6 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (72 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; + +ALTER TABLE llx_website_page Add COLUMN fk_typeobject varchar(255); +ALTER TABLE llx_website_page Add COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index bacbc8e802b..ae339cfd119 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -39,5 +39,7 @@ CREATE TABLE llx_website_page author_alias varchar(64), date_creation datetime, tms timestamp, - import_key varchar(14) -- import key + import_key varchar(14), -- import k + fk_typeobject varchar(255), + fk_object varchar(255) ) ENGINE=innodb; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index b5e29e04176..a3563418873 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -104,6 +104,14 @@ class WebsitePage extends CommonObject */ public $author_alias; + /** + * @var string path type object + */ + public $fk_typeobject; + /** + * @var string path name object + */ + public $fk_object; const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; @@ -161,6 +169,8 @@ class WebsitePage extends CommonObject 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>512), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1), + 'fk_typeobject' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''), + 'fk_object' => array('type' => 'varchar(255)','label' => 'ObjectId', 'enabled'=>1, 'visible'=>1, 'position'=>47, 'searchall'=>0, 'help'=>'') ); // END MODULEBUILDER PROPERTIES @@ -260,7 +270,9 @@ class WebsitePage extends CommonObject $sql .= " t.fk_user_creat,"; $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif,"; - $sql .= " t.import_key"; + $sql .= " t.import_key,"; + $sql .= " t.fk_typeobject,"; + $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level $sql .= ' WHERE 1 = 1'; @@ -319,6 +331,8 @@ class WebsitePage extends CommonObject $this->author_alias = $obj->author_alias; $this->fk_user_modif = $obj->fk_user_modif; $this->import_key = $obj->import_key; + $this->fk_typeobject = $obj->fk_typeobject; + $this->fk_object = $obj->fk_object; } $this->db->free($resql); @@ -374,7 +388,9 @@ class WebsitePage extends CommonObject $sql .= " t.fk_user_creat,"; $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif,"; - $sql .= " t.import_key"; + $sql .= " t.import_key,"; + $sql .= " t.fk_typeobject,"; + $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; // Manage filter @@ -443,6 +459,8 @@ class WebsitePage extends CommonObject $record->author_alias = $obj->author_alias; $record->fk_user_modif = $obj->fk_user_modif; $record->import_key = $obj->import_key; + $record->fk_typeobject = $obj->fk_typeobject; + $record->fk_object = $obj->fk_object; //var_dump($record->id); $records[$record->id] = $record; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index a36f33ee682..e62887407d6 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -981,6 +981,12 @@ if ($action == 'addcontainer') if (!$error) { + if (GETPOSTISSET('WEBSITE_OBJECTCLASS')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); + } + if (GETPOSTISSET('WEBSITE_OBJECTID')){ + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); + } $pageid = $objectpage->create($user); if ($pageid <= 0) { $error++; @@ -1657,7 +1663,12 @@ if ($action == 'updatemeta') $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); - + if(GETPOSTISSET('WEBSITE_OBJECTCLASS')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); + } + if(GETPOSTISSET('WEBSITE_OBJECTID')){ + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTID','aZ09'); + } $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; @@ -3578,6 +3589,18 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ""; } + print ''; + print 'ObjectClass'; + print ''; + print ''; + print ''; + + print ''; + print 'ObjectID'; + print ''; + print ''; + print ''; + $fuser = new User($db); From dfba9a06ad59391489db79f88d3da2c1037c7976 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 28 Sep 2020 20:39:02 +0200 Subject: [PATCH 03/46] NEW Field to link website page to an other object --- htdocs/install/mysql/migration/11.0.0-12.0.0.sql | 3 --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_website_page.sql | 4 ++-- htdocs/website/class/websitepage.class.php | 8 +++++--- htdocs/website/index.php | 12 ++++-------- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index 23830014690..994e5d89495 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -335,6 +335,3 @@ insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,note,active) values (72 insert into llx_c_tva(rowid,fk_pays,taux,recuperableonly,localtax1,localtax1_type,note,active) values (722, 72, '18','0', '0.9', '1', 'VAT Rate 18+0.9', 1); ALTER TABLE llx_expedition ADD COLUMN billed smallint DEFAULT 0; - -ALTER TABLE llx_website_page Add COLUMN fk_typeobject varchar(255); -ALTER TABLE llx_website_page Add COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index e76948808bb..e177d53d6cc 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -330,3 +330,6 @@ ALTER TABLE llx_bank ADD COLUMN origin_type varchar(64) NULL; ALTER TABLE llx_bank ADD COLUMN import_key varchar(14); ALTER TABLE llx_menu MODIFY COLUMN enabled text; + +ALTER TABLE llx_website_page ADD COLUMN fk_typeobject varchar(255); +ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index ae339cfd119..ec2d6f4c72b 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -39,7 +39,7 @@ CREATE TABLE llx_website_page author_alias varchar(64), date_creation datetime, tms timestamp, - import_key varchar(14), -- import k + import_key varchar(14), -- import key fk_typeobject varchar(255), - fk_object varchar(255) + fk_object varchar(255) ) ENGINE=innodb; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index a3563418873..aa256960f0f 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2020 Nicolas ZABOURI * * 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 @@ -104,12 +105,13 @@ class WebsitePage extends CommonObject */ public $author_alias; - /** - * @var string path type object + /** + * @var string path of external object */ public $fk_typeobject; + /** - * @var string path name object + * @var string id of external object */ public $fk_object; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ce3f41676a0..add9e07eff5 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1,5 +1,6 @@ + * Copyright (C) 2020 Nicolas ZABOURI * * 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 @@ -941,7 +942,8 @@ if ($action == 'addcontainer') $objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml')); $objectpage->htmlheader = GETPOST('htmlheader', 'none'); $objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml'); - + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); $substitutionarray = array(); $substitutionarray['__WEBSITE_CREATE_BY__'] = $user->getFullName($langs); @@ -981,12 +983,6 @@ if ($action == 'addcontainer') if (!$error) { - if (GETPOSTISSET('WEBSITE_OBJECTCLASS')){ - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); - } - if (GETPOSTISSET('WEBSITE_OBJECTID')){ - $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); - } $pageid = $objectpage->create($user); if ($pageid <= 0) { $error++; @@ -3592,7 +3588,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; print 'ObjectClass'; print ''; - print ''; + print ''; print ''; print ''; From 848ee9decf4370f4be63faabb2ba996ecf517f09 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 28 Sep 2020 20:49:51 +0200 Subject: [PATCH 04/46] FIX Stickler error --- htdocs/website/index.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index add9e07eff5..5de0f2c1007 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1659,12 +1659,9 @@ if ($action == 'updatemeta') $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); - if(GETPOSTISSET('WEBSITE_OBJECTCLASS')){ - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); - } - if(GETPOSTISSET('WEBSITE_OBJECTID')){ - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTID','aZ09'); - } + $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID','aZ09'); + $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; From e58d0d4af4eabba6f1197904035e551b00d0666a Mon Sep 17 00:00:00 2001 From: Nicolas Date: Mon, 28 Sep 2020 20:56:19 +0200 Subject: [PATCH 05/46] FIX Stickler error --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 5de0f2c1007..29dd6c44929 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1660,7 +1660,7 @@ if ($action == 'updatemeta') $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); - $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID','aZ09'); + $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID', 'aZ09'); $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); if ($newdatecreation) $objectpage->date_creation = $newdatecreation; From 2d4e2ee378f03c2668dfca2aeba0f282bd412746 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Tue, 29 Sep 2020 10:00:14 +0200 Subject: [PATCH 06/46] Use object field for list fields (project) --- htdocs/projet/class/project.class.php | 94 +++++++++++++++++---------- htdocs/projet/list.php | 70 ++++++++++++-------- 2 files changed, 102 insertions(+), 62 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 30a2a0c242b..54a8b56fe23 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -150,6 +150,66 @@ class Project extends CommonObject */ public $lines; + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), + 'fk_soc' =>array('type'=>'integer', 'label'=>'Fk soc', 'enabled'=>1, 'visible'=>0, 'position'=>15), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreationShort', 'enabled'=>1, 'visible'=>1, 'position'=>20), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>25), + 'dateo' =>array('type'=>'date', 'label'=>'DateStart', 'enabled'=>1, 'visible'=>1, 'position'=>30), + 'datee' =>array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>1, 'position'=>35), + 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>40, 'searchall'=>1), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>45), + 'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1), + 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>1), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'Fk user creat', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>60), + 'public' =>array('type'=>'integer', 'label'=>'Visibility', 'enabled'=>1, 'visible'=>1, 'position'=>65), + 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500), + 'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>1, 'visible'=>1, 'position'=>75), + 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>1, 'visible'=>1, 'position'=>80), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>85, 'searchall'=>1), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>90, 'searchall'=>1), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>95), + 'budget_amount' =>array('type'=>'double(24,8)', 'label'=>'Budget', 'enabled'=>1, 'visible'=>1, 'position'=>100), + 'date_close' =>array('type'=>'datetime', 'label'=>'Date close', 'enabled'=>1, 'visible'=>0, 'position'=>105), + 'fk_user_close' =>array('type'=>'integer', 'label'=>'Fk user close', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'OpportunityAmountShort', 'enabled'=>1, 'visible'=>1, 'position'=>115), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>120), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>0, 'position'=>125), + 'usage_bill_time' =>array('type'=>'integer', 'label'=>'UsageBillTimeShort', 'enabled'=>1, 'visible'=>1, 'position'=>130), + 'usage_opportunity' =>array('type'=>'integer', 'label'=>'UsageOpportunity', 'enabled'=>1, 'visible'=>1, 'position'=>135), + 'usage_task' =>array('type'=>'integer', 'label'=>'UsageTasks', 'enabled'=>1, 'visible'=>1, 'position'=>140), + 'usage_organize_event' =>array('type'=>'integer', 'label'=>'Usage organize event', 'enabled'=>1, 'visible'=>0, 'position'=>145), + ); + // END MODULEBUILDER PROPERTIES + /** * Draft status */ @@ -165,40 +225,6 @@ class Project extends CommonObject */ const STATUS_CLOSED = 2; - - public $fields = array( - 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'fk_soc' =>array('type'=>'integer', 'label'=>'Fk soc', 'enabled'=>1, 'visible'=>-1, 'position'=>15), - 'datec' =>array('type'=>'datetime', 'label'=>'Datec', 'enabled'=>1, 'visible'=>-1, 'position'=>20), - 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), - 'dateo' =>array('type'=>'date', 'label'=>'Dateo', 'enabled'=>1, 'visible'=>-1, 'position'=>30), - 'datee' =>array('type'=>'date', 'label'=>'Datee', 'enabled'=>1, 'visible'=>-1, 'position'=>35), - 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'showoncombobox'=>1, 'position'=>40), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>45), - 'title' =>array('type'=>'varchar(255)', 'label'=>'Title', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>50, 'showoncombobox'=>1), - 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'Fk user creat', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>60), - 'public' =>array('type'=>'integer', 'label'=>'Public', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Fk statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), - 'fk_opp_status' =>array('type'=>'integer', 'label'=>'Fk opp status', 'enabled'=>1, 'visible'=>-1, 'position'=>75), - 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'Opp percent', 'enabled'=>1, 'visible'=>-1, 'position'=>80), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>95), - 'budget_amount' =>array('type'=>'double(24,8)', 'label'=>'Budget amount', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'date_close' =>array('type'=>'datetime', 'label'=>'Date close', 'enabled'=>1, 'visible'=>-1, 'position'=>105), - 'fk_user_close' =>array('type'=>'integer', 'label'=>'Fk user close', 'enabled'=>1, 'visible'=>-1, 'position'=>110), - 'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'Opp amount', 'enabled'=>1, 'visible'=>-1, 'position'=>115), - 'email_msgid' => array('type'=>'varchar(255)', 'label'=>'EmailMsgID', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1, 'help'=>'EmailMsgIDDesc'), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>120), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>-1, 'position'=>125), - 'usage_bill_time' =>array('type'=>'integer', 'label'=>'Usage bill time', 'enabled'=>1, 'visible'=>-1, 'position'=>130), - 'usage_opportunity' =>array('type'=>'integer', 'label'=>'Usage opportunity', 'enabled'=>1, 'visible'=>-1, 'position'=>135), - 'usage_task' =>array('type'=>'integer', 'label'=>'Usage task', 'enabled'=>1, 'visible'=>-1, 'position'=>140), - 'usage_organize_event' =>array('type'=>'integer', 'label'=>'Usage organize event', 'enabled'=>1, 'visible'=>-1, 'position'=>145), - ); - - /** * Constructor * diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 8a7645941d5..40e247131b6 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -123,34 +123,48 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 'p.ref'=>"Ref", - 'p.title'=>"Label", - 's.nom'=>"ThirdPartyName", - "p.note_public"=>"NotePublic" -); -if (empty($user->socid)) $fieldstosearchall["p.note_private"] = "NotePrivate"; +$fieldstosearchall = array(); +foreach ($object->fields as $key => $val) +{ + if (empty($val['searchall'])) { + continue; + } + + // don't allow search in private notes for external users when doing "search in all" + if (!empty($user->socid) && $key == "note_private") { + continue; + } + + $fieldstosearchall['p.'.$key] = $val['label']; +} + +// Add none object fields for "search in all" +$fieldstosearchall['s.nom'] = "ThirdPartyName"; + +// Definition of fields for list +$arrayfields = array(); +foreach ($object->fields as $key => $val) +{ + // If $val['visible']==0, then we never show the field + if (empty($val['visible'])) { + continue; + } + + // visibility based on global settings + if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'fk_opp_status') continue; + if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'opp_percent') continue; + if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'opp_amount') continue; + if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'usage_opportunity') continue; + if(!empty($conf->global->PROJECT_HIDE_TASKS) && $key == 'usage_bill_time') continue; + if(!empty($conf->global->PROJECT_HIDE_TASKS) && $key == 'usage_task') continue; + + $arrayfields['p.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($val['visible'] < 0) ? 0 : 1), + 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), + 'position'=>$val['position']); +} -$arrayfields = array( - 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1, 'position'=>10), - 'p.title'=>array('label'=>$langs->trans("Label"), 'checked'=>1, 'position'=>11), - 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>(empty($conf->societe->enabled) ? 0 : 1), 'position'=>20), - 'commercial'=>array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0, 'css'=>'tdoverflowmax100', 'position'=>21), - 'p.dateo'=>array('label'=>$langs->trans("DateStart"), 'checked'=>1, 'position'=>100), - 'p.datee'=>array('label'=>$langs->trans("DateEnd"), 'checked'=>1, 'position'=>101), - 'p.public'=>array('label'=>$langs->trans("Visibility"), 'checked'=>1, 'position'=>102), - 'p.opp_amount'=>array('label'=>$langs->trans("OpportunityAmountShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>103), - 'p.fk_opp_status'=>array('label'=>$langs->trans("OpportunityStatusShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>104), - 'p.opp_percent'=>array('label'=>$langs->trans("OpportunityProbabilityShort"), 'checked'=>1, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>105), - 'opp_weighted_amount'=>array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>106), - 'p.budget_amount'=>array('label'=>$langs->trans("Budget"), 'checked'=>0, 'position'=>110), - 'p.usage_opportunity'=>array('label'=>$langs->trans("UsageOpportunity"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_USE_OPPORTUNITIES ? 1 : 0), 'position'=>115), - 'p.usage_task'=>array('label'=>$langs->trans("UsageTasks"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_HIDE_TASKS ? 0 : 1), 'position'=>116), - 'p.usage_bill_time'=>array('label'=>$langs->trans("UsageBillTimeShort"), 'checked'=>0, 'enabled'=>($conf->global->PROJECT_HIDE_TASKS ? 0 : 1), 'position'=>117), - 'p.datec'=>array('label'=>$langs->trans("DateCreationShort"), 'checked'=>0, 'position'=>500), - 'p.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), - 'p.fk_statut'=>array('label'=>$langs->trans("Status"), 'checked'=>1, 'position'=>1000), -); // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { @@ -160,7 +174,7 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); } } -$object->fields = dol_sort_array($object->fields, 'position'); + $arrayfields = dol_sort_array($arrayfields, 'position'); From c0a3aa2b5ba0a88e0ec5e84dfc50205aa16f4738 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Tue, 29 Sep 2020 12:00:54 +0200 Subject: [PATCH 07/46] add mising elements from last commit --- htdocs/projet/list.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 40e247131b6..07da8cba855 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -130,7 +130,7 @@ foreach ($object->fields as $key => $val) continue; } - // don't allow search in private notes for external users when doing "search in all" + // Don't allow search in private notes for external users when doing "search in all" if (!empty($user->socid) && $key == "note_private") { continue; } @@ -138,7 +138,7 @@ foreach ($object->fields as $key => $val) $fieldstosearchall['p.'.$key] = $val['label']; } -// Add none object fields for "search in all" +// Add none object fields to "search in all" $fieldstosearchall['s.nom'] = "ThirdPartyName"; // Definition of fields for list @@ -150,7 +150,7 @@ foreach ($object->fields as $key => $val) continue; } - // visibility based on global settings + // Visibility based on global settings if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'fk_opp_status') continue; if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'opp_percent') continue; if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'opp_amount') continue; @@ -165,6 +165,11 @@ foreach ($object->fields as $key => $val) 'position'=>$val['position']); } +// Add none object fields to fields for list +$arrayfields['s.nom'] = array('label'=>$langs->trans("ThirdParty"), 'checked'=>1, 'enabled'=>(empty($conf->societe->enabled) ? 0 : 1)); +$arrayfields['commercial'] = array('label'=>$langs->trans("SaleRepresentativesOfThirdParty"), 'checked'=>0); +$arrayfields['opp_weighted_amount'] = array('label'=>$langs->trans('OpportunityWeightedAmountShort'), 'checked'=>0, 'enabled'=>(empty($conf->global->PROJECT_USE_OPPORTUNITIES) ? 0 : 1), 'position'=>106); + // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { From c8e11f9eaee88ef504a3ea2fe7a6145de67e0b33 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Tue, 29 Sep 2020 14:59:16 +0200 Subject: [PATCH 08/46] Use object fileds on contact list --- htdocs/contact/class/contact.class.php | 81 ++++++++++++++-------- htdocs/contact/list.php | 95 +++++++++++++++----------- 2 files changed, 106 insertions(+), 70 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 0c2c3bf56ce..289a4a94495 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -60,6 +60,29 @@ class Contact extends CommonObject */ public $picto = 'contact'; + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'enabled' is a condition when the field must be managed. + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ // BEGIN MODULEBUILDER PROPERTIES /** @@ -67,40 +90,38 @@ class Contact extends CommonObject */ public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>15), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), - 'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>25), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>0, 'position'=>15), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>20), + 'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>25, 'searchall'=>1), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30, 'index'=>1), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), - 'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>-1, 'position'=>40), - 'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>-1, 'position'=>45, 'showoncombobox'=>1), - 'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>-1, 'position'=>50, 'showoncombobox'=>1), - 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55), - 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>-1, 'position'=>60), - 'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>-1, 'position'=>65), - 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>-1, 'position'=>70), - 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>3, 'position'=>40), + 'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'showoncombobox'=>1, 'searchall'=>1), + 'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1), + 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>3, 'position'=>55), + 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60), + 'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>1, 'position'=>65), + 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>0, 'position'=>70), + 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>0, 'position'=>75), 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'position'=>80), 'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>85), - 'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>-1, 'position'=>90), - 'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'Phone perso', 'enabled'=>1, 'visible'=>-1, 'position'=>95), - 'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'Phone mobile', 'enabled'=>1, 'visible'=>-1, 'position'=>100), - 'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>-1, 'position'=>105), - 'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>-1, 'position'=>110), - 'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>115), - 'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>170), - 'priv' =>array('type'=>'smallint(6)', 'label'=>'Private', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175), - 'fk_stcomm' =>array('type'=>'integer', 'label'=>'Fk stcommcontact', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220), - 'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255), - 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>185), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>190), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>195), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>200), - 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>-1, 'position'=>205), - 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>-1, 'position'=>210), - 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Statut', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>1000), + 'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>1, 'position'=>90, 'searchall'=>1), + 'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>1, 'position'=>95, 'searchall'=>1), + 'phone_mobile' =>array('type'=>'varchar(30)', 'label'=>'PhoneMobile', 'enabled'=>1, 'visible'=>1, 'position'=>100, 'searchall'=>1), + 'fax' =>array('type'=>'varchar(30)', 'label'=>'Fax', 'enabled'=>1, 'visible'=>1, 'position'=>105, 'searchall'=>1), + 'email' =>array('type'=>'varchar(255)', 'label'=>'Email', 'enabled'=>1, 'visible'=>1, 'position'=>110, 'searchall'=>1), + 'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>3, 'position'=>115), + 'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>3, 'position'=>170), + 'priv' =>array('type'=>'smallint(6)', 'label'=>'ContactVisibility', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>175), + 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>0, 'position'=>185), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>0, 'position'=>190), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>195, 'searchall'=>1), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'searchall'=>1), + 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>0, 'position'=>205), + 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>0, 'position'=>210), + 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>1000), ); public $civility_id; // In fact we store civility_code diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 1332bc5e100..e8493e59ba3 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -149,46 +149,60 @@ $extrafields->fetch_name_optionals_label($object->table_element); $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 'p.lastname'=>'Lastname', - 'p.firstname'=>'Firstname', - 'p.email'=>'EMail', - 's.nom'=>"ThirdParty", - 'p.phone'=>"Phone", - 'p.phone_perso'=>"PhonePerso", - 'p.phone_mobile'=>"PhoneMobile", - 'p.fax'=>"Fax", - 'p.note_public'=>"NotePublic", - 'p.note_private'=>"NotePrivate", -); +$fieldstosearchall = array(); +foreach ($object->fields as $key => $val) +{ + // don't allow search in private notes for external users when doing "search in all" + if (!empty($user->socid) && $key == "note_private") { + continue; + } + + if (empty($val['searchall'])) { + continue; + } + + $fieldstosearchall['p.'.$key] = $val['label']; +} + +// Add none object fields for "search in all" +if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { + $fieldstosearchall['s.nom'] = $fieldstosearchall['p.fk_soc']; + unset($fieldstosearchall['p.fk_soc']); +} // Definition of fields for list -$arrayfields = array( - 'p.rowid'=>array('label'=>"TechnicalID", 'position'=>1, 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0)), - 'p.lastname'=>array('label'=>"Lastname", 'position'=>2, 'checked'=>1), - 'p.firstname'=>array('label'=>"Firstname", 'position'=>3, 'checked'=>1), - 'p.poste'=>array('label'=>"PostOrFunction", 'position'=>10, 'checked'=>1), - 'p.town'=>array('label'=>"Town", 'position'=>20, 'checked'=>0), - 'p.zip'=>array('label'=>"Zip", 'position'=>21, 'checked'=>0), - 'country.code_iso'=>array('label'=>"Country", 'position'=>22, 'checked'=>0), - 'p.phone'=>array('label'=>"Phone", 'position'=>30, 'checked'=>1), - 'p.phone_perso'=>array('label'=>"PhonePerso", 'position'=>31, 'checked'=>0), - 'p.phone_mobile'=>array('label'=>"PhoneMobile", 'position'=>32, 'checked'=>1), - 'p.fax'=>array('label'=>"Fax", 'position'=>33, 'checked'=>0), - 'p.email'=>array('label'=>"EMail", 'position'=>40, 'checked'=>1), - 'p.no_email'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))), - 'p.thirdparty'=>array('label'=>"ThirdParty", 'position'=>50, 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)), - 'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200), - 'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500), - 'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), - 'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), - 'p.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), -); +$arrayfields = array(); +foreach ($object->fields as $key => $val) { + // If $val['visible']==0, then we never show the field + if (empty($val['visible'])) { + continue; + } + + // Visibility based on global settings + if ($key == 'rowid' && !empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) continue; + if ($key == 'no_email' && empty($conf->mailing->enabled)) continue; + + $arrayfields['p.'.$key] = array( + 'label'=>$val['label'], + 'checked'=>(($val['visible'] < 0) ? 0 : 1), + 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), + 'position'=>$val['position']); +} + +// Add none object fields to fields for list +$arrayfields['country.code_iso'] = array('label'=>"Country", 'position'=>22, 'checked'=>0); +if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { + $arrayfields['s.nom'] = $arrayfields['p.fk_soc']; + unset($arrayfields['p.fk_soc']); +} if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { $arrayfields['p.fk_prospectcontactlevel'] = array('label'=>"ProspectLevelShort", 'checked'=>1, 'position'=>210); $arrayfields['p.fk_stcommcontact'] = array('label'=>"StatusProsp", 'checked'=>1, 'position'=>215); } +// Special overrides for object files +$arrayfields['p.rowid']['checked'] = ($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0); + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { @@ -398,7 +412,7 @@ if (strlen($search_firstlast_only)) $sql .= natural_search(array('p.lastname', ' if ($search_id > 0) $sql .= natural_search("p.rowid", $search_id, 1); if ($search_lastname) $sql .= natural_search('p.lastname', $search_lastname); if ($search_firstname) $sql .= natural_search('p.firstname', $search_firstname); -if ($search_societe) $sql .= natural_search('s.nom', $search_societe); +if ($search_societe) $sql .= natural_search((empty($conf->global->SOCIETE_DISABLE_CONTACTS) ? 's.nom' : 'p.fk_soc'), $search_societe); if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')'; if (strlen($search_poste)) $sql .= natural_search('p.poste', $search_poste); if (strlen($search_phone_perso)) $sql .= natural_search('p.phone_perso', $search_phone_perso); @@ -725,7 +739,7 @@ if (!empty($conf->socialnetworks->enabled)) { } } } -if (!empty($arrayfields['p.thirdparty']['checked'])) +if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) { print ''; print ''; @@ -823,10 +837,11 @@ if (!empty($conf->socialnetworks->enabled)) { } } } -if (!empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder); -if (!empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) print_liste_field_titre($arrayfields['p.fk_prospectcontactlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectcontactlevel", "", $param, '', $sortfield, $sortorder, 'center '); -if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'], $_SERVER["PHP_SELF"], "p.fk_stcommcontact", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['p.fk_soc']['checked'])) print_liste_field_titre($arrayfields['p.fk_soc']['label'], $_SERVER["PHP_SELF"], "p.fk_soc", $begin, $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder); +if (!empty($arrayfields['p.priv']['checked'])) print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) print_liste_field_titre($arrayfields['p.fk_prospectcontactlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectcontactlevel", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'], $_SERVER["PHP_SELF"], "p.fk_stcommcontact", "", $param, '', $sortfield, $sortorder, 'center '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields @@ -987,7 +1002,7 @@ while ($i < min($num, $limit)) } } // Company - if (!empty($arrayfields['p.thirdparty']['checked'])) + if (!empty($arrayfields['p.fk_soc']['checked']) || !empty($arrayfields['s.nom']['checked'])) { print ''; if ($obj->socid) From ce8d240d8f871edaa41651d5796043fea73bed7e Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 29 Sep 2020 13:06:23 +0000 Subject: [PATCH 09/46] Fixing style errors. --- htdocs/contact/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index e8493e59ba3..af2fc2f7269 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -181,7 +181,7 @@ foreach ($object->fields as $key => $val) { // Visibility based on global settings if ($key == 'rowid' && !empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) continue; if ($key == 'no_email' && empty($conf->mailing->enabled)) continue; - + $arrayfields['p.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), From 9ed6092ed8379eb1deff429cbc840b888dd1a592 Mon Sep 17 00:00:00 2001 From: bomuux Date: Tue, 29 Sep 2020 19:56:22 +0200 Subject: [PATCH 10/46] Bug: ActionComm::ref_ext is not saved properly ActionComm::ref_ext is considered to be a timestamp in ActionComm::create(), (but not in ActionComm::create()). Correction to consider it a string. --- htdocs/comm/action/class/actioncomm.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c6fd2183459..97896448a3f 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -495,7 +495,7 @@ class ActionComm extends CommonObject $sql .= ((isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '') ? "'".$this->db->escape($this->durationp)."'" : "null").", "; // deprecated $sql .= (isset($this->type_id) ? $this->type_id : "null").","; $sql .= ($code ? ("'".$this->db->escape($code)."'") : "null").", "; - $sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", "; + $sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null").", "; $sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", "; $sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", "; $sql .= " '".$this->db->escape($this->note_private)."', "; From fc62ca57b5efae1713a0c19e1345950632157612 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 30 Sep 2020 06:37:48 +0200 Subject: [PATCH 11/46] Remove old code --- htdocs/accountancy/admin/defaultaccounts.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 84ea304a74d..3d03dc9c4b6 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -101,22 +101,6 @@ if ($conf->societe->enabled) { /* * Actions */ - -$accounting_mode = empty($conf->global->ACCOUNTING_MODE) ? 'RECETTES-DEPENSES' : $conf->global->ACCOUNTING_MODE; - -if (GETPOST('change_chart', 'alpha')) -{ - $chartofaccounts = GETPOST('chartofaccounts', 'int'); - - if (!empty($chartofaccounts)) { - if (!dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { - $error++; - } - } else { - $error++; - } -} - if ($action == 'update') { $error = 0; From ed26f077835da70c627e5644943af2dd0f279d6c Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 30 Sep 2020 06:46:23 +0200 Subject: [PATCH 12/46] FIX If salaries subledger account not defined, put only in the general account --- htdocs/accountancy/journal/bankjournal.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 4dd5df83152..7062c25b108 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -180,10 +180,10 @@ if ($result) { $account_supplier = (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER != "") ? $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER : 'NotDefined'); // NotDefined is a reserved word $account_customer = (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER != "") ? $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER : 'NotDefined'); // NotDefined is a reserved word $account_employee = (!empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) ? $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word - $account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word + $account_pay_vat = (!empty($conf->global->ACCOUNTING_VAT_PAY_ACCOUNT) ? $conf->global->ACCOUNTING_VAT_PAY_ACCOUNT : 'NotDefined'); // NotDefined is a reserved word + $account_pay_donation = (!empty($conf->global->DONATION_ACCOUNTINGACCOUNT) ? $conf->global->DONATION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word + $account_pay_subscription = (!empty($conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT) ? $conf->global->ADHERENT_SUBSCRIPTION_ACCOUNTINGACCOUNT : 'NotDefined'); // NotDefined is a reserved word + $account_transfer = (!empty($conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH) ? $conf->global->ACCOUNTING_ACCOUNT_TRANSFER_CASH : 'NotDefined'); // NotDefined is a reserved word $tabcompany = array(); $tabuser = array(); @@ -237,7 +237,7 @@ if ($result) { ); // Set accountancy code for user - $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : $account_employee); + $compta_user = (!empty($obj->accountancy_code) ? $obj->accountancy_code : ''); $tabuser[$obj->rowid] = array( 'id' => $obj->userid, From 6c46b2e8dea5d0826361ac352095088124498912 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Wed, 30 Sep 2020 11:45:29 +0200 Subject: [PATCH 13/46] Address feedback --- htdocs/contact/class/contact.class.php | 54 ++++++++++++++------------ htdocs/contact/list.php | 22 +++-------- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 289a4a94495..d05fd04673d 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -90,20 +90,20 @@ class Contact extends CommonObject */ public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>0, 'position'=>15), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>20), - 'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>25, 'searchall'=>1), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30, 'index'=>1), - 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>0, 'position'=>35), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>15), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), + 'fk_soc' =>array('type'=>'integer', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>1, 'position'=>25, 'searchall'=>1), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>30, 'index'=>1), + 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'Ref ext', 'enabled'=>1, 'visible'=>3, 'position'=>35), 'civility' =>array('type'=>'varchar(6)', 'label'=>'Civility', 'enabled'=>1, 'visible'=>3, 'position'=>40), 'lastname' =>array('type'=>'varchar(50)', 'label'=>'Lastname', 'enabled'=>1, 'visible'=>1, 'position'=>45, 'showoncombobox'=>1, 'searchall'=>1), 'firstname' =>array('type'=>'varchar(50)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1), - 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>3, 'position'=>55), + 'address' =>array('type'=>'varchar(255)', 'label'=>'Address', 'enabled'=>1, 'visible'=>-1, 'position'=>55), 'zip' =>array('type'=>'varchar(25)', 'label'=>'Zip', 'enabled'=>1, 'visible'=>1, 'position'=>60), 'town' =>array('type'=>'text', 'label'=>'Town', 'enabled'=>1, 'visible'=>1, 'position'=>65), - 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>0, 'position'=>70), - 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>0, 'position'=>75), - 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>-1, 'position'=>80), + 'fk_departement' =>array('type'=>'integer', 'label'=>'Fk departement', 'enabled'=>1, 'visible'=>3, 'position'=>70), + 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>3, 'position'=>75), + 'birthday' =>array('type'=>'date', 'label'=>'Birthday', 'enabled'=>1, 'visible'=>3, 'position'=>80), 'poste' =>array('type'=>'varchar(80)', 'label'=>'PostOrFunction', 'enabled'=>1, 'visible'=>-1, 'position'=>85), 'phone' =>array('type'=>'varchar(30)', 'label'=>'Phone', 'enabled'=>1, 'visible'=>1, 'position'=>90, 'searchall'=>1), 'phone_perso' =>array('type'=>'varchar(30)', 'label'=>'PhonePerso', 'enabled'=>1, 'visible'=>1, 'position'=>95, 'searchall'=>1), @@ -114,14 +114,14 @@ class Contact extends CommonObject 'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>3, 'position'=>170), 'priv' =>array('type'=>'smallint(6)', 'label'=>'ContactVisibility', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>175), 'no_email' =>array('type'=>'smallint(6)', 'label'=>'No_Email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>0, 'position'=>185), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>0, 'position'=>190), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>195, 'searchall'=>1), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>200, 'searchall'=>1), - 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>0, 'position'=>205), - 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>0, 'position'=>210), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>3, 'position'=>185), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>3, 'position'=>190), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>195, 'searchall'=>1), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>200, 'searchall'=>1), + 'default_lang' =>array('type'=>'varchar(6)', 'label'=>'Default lang', 'enabled'=>1, 'visible'=>3, 'position'=>205), + 'canvas' =>array('type'=>'varchar(32)', 'label'=>'Canvas', 'enabled'=>1, 'visible'=>3, 'position'=>210), 'statut' =>array('type'=>'tinyint(4)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>1000), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'position'=>1000), ); public $civility_id; // In fact we store civility_code @@ -249,16 +249,22 @@ class Contact extends CommonObject global $conf, $langs; $this->db = $db; - - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; - if (empty($conf->mailing->enabled)) $this->fields['no_email']['enabled'] = 0; - if (!empty($conf->global->SOCIETE_DISABLE_CONTACTS)) $this->fields['thirdparty']['enabled'] = 0; - if (empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { // Default behaviour - $this->field['fk_stcomm']['enabled'] = 0; - $this->field['fk_prospectlevel']['enabled'] = 0; - } $this->statut = 1; // By default, status is enabled + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0; + if (empty($conf->mailing->enabled)) $this->fields['no_email']['enabled'] = 0; + + // typical ['s.nom'] is used for third-parties + if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { + $this->fields['fk_soc']['enabled'] = 0; + $this->fields['fk_soc']['searchall'] = 0; + } + + if (empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { // Default behaviour + $this->field['fk_stcommcontact']['enabled'] = 0; + $this->field['fk_prospectcontactlevel']['enabled'] = 0; + } + // Unset fields that are disabled foreach ($this->fields as $key => $val) { diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index e8493e59ba3..a6130c3e47a 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -166,8 +166,7 @@ foreach ($object->fields as $key => $val) // Add none object fields for "search in all" if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - $fieldstosearchall['s.nom'] = $fieldstosearchall['p.fk_soc']; - unset($fieldstosearchall['p.fk_soc']); + $fieldstosearchall['s.nom'] = "ThirdParty"; } // Definition of fields for list @@ -178,10 +177,6 @@ foreach ($object->fields as $key => $val) { continue; } - // Visibility based on global settings - if ($key == 'rowid' && !empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) continue; - if ($key == 'no_email' && empty($conf->mailing->enabled)) continue; - $arrayfields['p.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), @@ -192,16 +187,8 @@ foreach ($object->fields as $key => $val) { // Add none object fields to fields for list $arrayfields['country.code_iso'] = array('label'=>"Country", 'position'=>22, 'checked'=>0); if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - $arrayfields['s.nom'] = $arrayfields['p.fk_soc']; - unset($arrayfields['p.fk_soc']); + $arrayfields['s.nom'] = array('label'=>"ThirdParty", 'position'=>25, 'checked'=>1); } -if (!empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { - $arrayfields['p.fk_prospectcontactlevel'] = array('label'=>"ProspectLevelShort", 'checked'=>1, 'position'=>210); - $arrayfields['p.fk_stcommcontact'] = array('label'=>"StatusProsp", 'checked'=>1, 'position'=>215); -} - -// Special overrides for object files -$arrayfields['p.rowid']['checked'] = ($conf->global->MAIN_SHOW_TECHNICAL_ID ? 1 : 0); if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { @@ -214,6 +201,7 @@ if (!empty($conf->socialnetworks->enabled)) { } } } + // Extra fields if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label']) > 0) { @@ -409,10 +397,10 @@ if (strlen($search_phone)) $sql .= natural_search(array('p.phone', 'p.p if (strlen($search_cti)) $sql .= natural_search(array('p.phone', 'p.phone_perso', 'p.phone_mobile'), $search_cti); if (strlen($search_firstlast_only)) $sql .= natural_search(array('p.lastname', 'p.firstname'), $search_firstlast_only); -if ($search_id > 0) $sql .= natural_search("p.rowid", $search_id, 1); +if ($search_id > 0) $sql .= natural_search('p.rowid', $search_id, 1); if ($search_lastname) $sql .= natural_search('p.lastname', $search_lastname); if ($search_firstname) $sql .= natural_search('p.firstname', $search_firstname); -if ($search_societe) $sql .= natural_search((empty($conf->global->SOCIETE_DISABLE_CONTACTS) ? 's.nom' : 'p.fk_soc'), $search_societe); +if ($search_societe) $sql .= natural_search(empty($conf->global->SOCIETE_DISABLE_CONTACTS) ? 's.nom' : 'p.fk_soc', $search_societe); if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')'; if (strlen($search_poste)) $sql .= natural_search('p.poste', $search_poste); if (strlen($search_phone_perso)) $sql .= natural_search('p.phone_perso', $search_phone_perso); From 3187c38ba32bce763d4292f687a4aaab2f21ddc3 Mon Sep 17 00:00:00 2001 From: davidNDU Date: Wed, 30 Sep 2020 14:37:47 +0300 Subject: [PATCH 14/46] Add object Methods with module builder, add/modify user rights and left side menu --- htdocs/modulebuilder/template/class/myobject.class.php | 6 ++++++ .../modules/mymodule/doc/pdf_standard_myobject.modules.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 8465f804d5c..18ca9b5ea20 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -116,6 +116,7 @@ class MyObject extends CommonObject 'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid'), 'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), + 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>1, 'visible'=>0, 'notnull'=>0, 'position'=>600), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled')), @@ -171,6 +172,11 @@ class MyObject extends CommonObject */ public $fk_user_modif; + /** + * @var string public $last_main_doc + */ + public $last_main_doc; + /** * @var string import_key */ diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php index f8fc8466349..694263e2ec5 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/pdf_standard_myobject.modules.php @@ -899,7 +899,7 @@ class pdf_standard_myobject extends ModelePDFMyObject pdf_pagehead($pdf, $outputlangs, $this->page_hauteur); // Show Draft Watermark - if ($object->statut == Facture::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK))) + if ($object->statut == $object::STATUS_DRAFT && (!empty($conf->global->FACTURE_DRAFT_WATERMARK))) { pdf_watermark($pdf, $outputlangs, $this->page_hauteur, $this->page_largeur, 'mm', $conf->global->FACTURE_DRAFT_WATERMARK); } @@ -959,7 +959,7 @@ class pdf_standard_myobject extends ModelePDFMyObject $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); $textref = $outputlangs->transnoentities("Ref")." : ".$outputlangs->convToOutputCharset($object->ref); - if ($object->statut == Facture::STATUS_DRAFT) + if ($object->statut == $object::STATUS_DRAFT) { $pdf->SetTextColor(128, 0, 0); $textref .= ' - '.$outputlangs->transnoentities("NotValidated"); From 6b539dfad0f15a4b3a35c0d0a3c7686ad9a68740 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 30 Sep 2020 13:53:27 +0200 Subject: [PATCH 15/46] fix remove php warning non-numeric value --- htdocs/product/stock/replenish.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 98b9f54b2ff..9ad848cf535 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -768,6 +768,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) } } + $stockwarehouse=0; if ($usevirtualstock) { // If option to increase/decrease is not on an object validation, virtual stock may differs from physical stock. @@ -793,8 +794,8 @@ while ($i < ($limit ? min($num, $limit) : $num)) $desiredstock = $objp->desiredstock; $alertstock = $objp->seuil_stock_alerte; - $desiredstockwarehouse = ($objp->desiredstockpse ? $objp->desiredstockpse : ''); - $alertstockwarehouse = ($objp->seuil_stock_alertepse ? $objp->seuil_stock_alertepse : ''); + $desiredstockwarehouse = ($objp->desiredstockpse ? $objp->desiredstockpse : 0); + $alertstockwarehouse = ($objp->seuil_stock_alertepse ? $objp->seuil_stock_alertepse : 0); $warning = ''; if ($alertstock && ($stock < $alertstock)) From 27c90abc0b79e85f5cd2abce637576e0053161b1 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Wed, 30 Sep 2020 14:54:24 +0200 Subject: [PATCH 16/46] address feedback --- htdocs/projet/class/project.class.php | 36 +++++++++++++++++++-------- htdocs/projet/list.php | 14 ++--------- 2 files changed, 28 insertions(+), 22 deletions(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 54a8b56fe23..a4a419a44ba 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -179,34 +179,34 @@ class Project extends CommonObject * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ public $fields=array( - 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), - 'fk_soc' =>array('type'=>'integer', 'label'=>'Fk soc', 'enabled'=>1, 'visible'=>0, 'position'=>15), + 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'fk_soc' =>array('type'=>'integer', 'label'=>'Fk soc', 'enabled'=>1, 'visible'=>3, 'position'=>15), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreationShort', 'enabled'=>1, 'visible'=>1, 'position'=>20), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModificationShort', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>25), 'dateo' =>array('type'=>'date', 'label'=>'DateStart', 'enabled'=>1, 'visible'=>1, 'position'=>30), 'datee' =>array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>1, 'position'=>35), 'ref' =>array('type'=>'varchar(50)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>40, 'searchall'=>1), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>45), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>45), 'title' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>50, 'showoncombobox'=>1, 'searchall'=>1), 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>1), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'Fk user creat', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>60), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'Fk user creat', 'enabled'=>1, 'visible'=>3, 'notnull'=>1, 'position'=>60), 'public' =>array('type'=>'integer', 'label'=>'Visibility', 'enabled'=>1, 'visible'=>1, 'position'=>65), 'fk_statut' =>array('type'=>'smallint(6)', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'position'=>500), 'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>1, 'visible'=>1, 'position'=>75), 'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>1, 'visible'=>1, 'position'=>80), 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>3, 'position'=>85, 'searchall'=>1), 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>3, 'position'=>90, 'searchall'=>1), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>95), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>3, 'position'=>95), 'budget_amount' =>array('type'=>'double(24,8)', 'label'=>'Budget', 'enabled'=>1, 'visible'=>1, 'position'=>100), - 'date_close' =>array('type'=>'datetime', 'label'=>'Date close', 'enabled'=>1, 'visible'=>0, 'position'=>105), - 'fk_user_close' =>array('type'=>'integer', 'label'=>'Fk user close', 'enabled'=>1, 'visible'=>0, 'position'=>110), + 'date_close' =>array('type'=>'datetime', 'label'=>'Date close', 'enabled'=>1, 'visible'=>3, 'position'=>105), + 'fk_user_close' =>array('type'=>'integer', 'label'=>'Fk user close', 'enabled'=>1, 'visible'=>3, 'position'=>110), 'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'OpportunityAmountShort', 'enabled'=>1, 'visible'=>1, 'position'=>115), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>0, 'position'=>120), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>0, 'position'=>125), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>3, 'position'=>120), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'Fk user modif', 'enabled'=>1, 'visible'=>3, 'position'=>125), 'usage_bill_time' =>array('type'=>'integer', 'label'=>'UsageBillTimeShort', 'enabled'=>1, 'visible'=>1, 'position'=>130), 'usage_opportunity' =>array('type'=>'integer', 'label'=>'UsageOpportunity', 'enabled'=>1, 'visible'=>1, 'position'=>135), 'usage_task' =>array('type'=>'integer', 'label'=>'UsageTasks', 'enabled'=>1, 'visible'=>1, 'position'=>140), - 'usage_organize_event' =>array('type'=>'integer', 'label'=>'Usage organize event', 'enabled'=>1, 'visible'=>0, 'position'=>145), + 'usage_organize_event' =>array('type'=>'integer', 'label'=>'Usage organize event', 'enabled'=>1, 'visible'=>3, 'position'=>145), ); // END MODULEBUILDER PROPERTIES @@ -236,6 +236,22 @@ class Project extends CommonObject $this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); $this->statuts_long = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); + + global $conf; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0; + + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + $this->fields['fk_opp_status']['enabled'] = 0; + $this->fields['opp_percent']['enabled'] = 0; + $this->fields['opp_amount']['enabled'] = 0; + $this->fields['usage_opportunity']['enabled'] = 0; + } + + if (empty($conf->global->PROJECT_HIDE_TASKS)) { + $this->fields['usage_bill_time']['visible'] = 0; + $this->fields['usage_task']['visible'] = 0; + } } /** diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 07da8cba855..40690ab1833 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -124,8 +124,7 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen // List of fields to search into when doing a "search in all" $fieldstosearchall = array(); -foreach ($object->fields as $key => $val) -{ +foreach ($object->fields as $key => $val) { if (empty($val['searchall'])) { continue; } @@ -143,21 +142,12 @@ $fieldstosearchall['s.nom'] = "ThirdPartyName"; // Definition of fields for list $arrayfields = array(); -foreach ($object->fields as $key => $val) -{ +foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (empty($val['visible'])) { continue; } - // Visibility based on global settings - if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'fk_opp_status') continue; - if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'opp_percent') continue; - if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'opp_amount') continue; - if(empty($conf->global->PROJECT_USE_OPPORTUNITIES) && $key == 'usage_opportunity') continue; - if(!empty($conf->global->PROJECT_HIDE_TASKS) && $key == 'usage_bill_time') continue; - if(!empty($conf->global->PROJECT_HIDE_TASKS) && $key == 'usage_task') continue; - $arrayfields['p.'.$key] = array( 'label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), From fd8e7fdfe31504523c81ac9d5beeab2545b899c6 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 30 Sep 2020 12:57:36 +0000 Subject: [PATCH 17/46] Fixing style errors. --- htdocs/projet/class/project.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index a4a419a44ba..cc7e57a89df 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -236,7 +236,7 @@ class Project extends CommonObject $this->statuts_short = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); $this->statuts_long = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); - + global $conf; if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) $this->fields['rowid']['visible'] = 0; From 259737f08218d11dd53ff30434911708e5d93154 Mon Sep 17 00:00:00 2001 From: lvessiller Date: Wed, 30 Sep 2020 15:09:45 +0200 Subject: [PATCH 18/46] FIX set paid on total discount of a product in cash desk --- htdocs/takepos/invoice.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 2b8b0f21921..e1afc524cb1 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -153,22 +153,23 @@ if ($action == 'valid' && $user->rights->facture->creer) $res = $invoice->validate($user); } - $remaintopay = $invoice->getRemainToPay(); - // Add the payment - if ($res >= 0 && $remaintopay > 0) { - $payment = new Paiement($db); - $payment->datepaye = $now; - $payment->fk_account = $bankaccount; - $payment->amounts[$invoice->id] = $amountofpayment; + if ($res >= 0) { + $remaintopay = $invoice->getRemainToPay(); + if ($remaintopay > 0) { + $payment = new Paiement($db); + $payment->datepaye = $now; + $payment->fk_account = $bankaccount; + $payment->amounts[$invoice->id] = $amountofpayment; - $payment->paiementid = $paiementid; - $payment->num_payment = $invoice->ref; + $payment->paiementid = $paiementid; + $payment->num_payment = $invoice->ref; - $payment->create($user); - $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + $payment->create($user); + $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded + } - $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded if ($remaintopay == 0) { dol_syslog("Invoice is paid, so we set it to status Paid"); $result = $invoice->set_paid($user); From 8ab627e76817f8074700e267a6c3af09ff3db5f5 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <1179011+defrance@users.noreply.github.com> Date: Wed, 30 Sep 2020 15:17:44 +0200 Subject: [PATCH 19/46] fix typo error --- htdocs/fichinter/class/fichinter.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index d0bc877d910..930c6e07978 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2020 Juanjo Menent * Copyright (C) 2015 Marcos García - * Copyright (C) 2015 Charlie Benke + * Copyright (C) 2015-2020 Charlene Benke * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018-2019 Frédéric France * @@ -810,7 +810,7 @@ class Fichinter extends CommonObject $result .= $linkend; global $action; - $hookmanager->initHooks(array('intervnetiondao')); + $hookmanager->initHooks(array('interventiondao')); $parameters = array('id'=>$this->id, 'getnomurl'=>$result); $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; From 9624a33e531dfa07dfd31c64c7e65ef98f4b623f Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 30 Sep 2020 15:27:16 +0200 Subject: [PATCH 20/46] FIX date and user cloture / closing display temporary fix while convert french to english term in dolibarr --- htdocs/core/lib/functions2.lib.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index b5a51032bdd..547f1be6620 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -383,19 +383,20 @@ function dol_print_object_info($object, $usetable = 0) } // User close - if (!empty($object->user_cloture)) + if (!empty($object->user_cloture) || !empty($object->user_closing)) { + if (isset($object->user_cloture) && !empty($object->user_cloture)) $object->user_closing = $object->user_cloture; if ($usetable) print ''; print $langs->trans("ClosedBy"); if ($usetable) print ''; else print ': '; - if (is_object($object->user_cloture)) + if (is_object($object->user_closing)) { - if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1, '', 0, 0, 0); + if ($object->user_closing->id) print $object->user_closing->getNomUrl(1, '', 0, 0, 0); else print $langs->trans("Unknown"); } else { $userstatic = new User($db); - $userstatic->fetch($object->user_cloture); + $userstatic->fetch($object->user_closing); if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); else print $langs->trans("Unknown"); } @@ -404,14 +405,15 @@ function dol_print_object_info($object, $usetable = 0) } // Date close - if (!empty($object->date_cloture)) + if (!empty($object->date_cloture) || !empty($object->date_closing)) { + if (isset($object->date_cloture) && !empty($object->date_cloture)) $object->date_closing = $object->date_cloture; if ($usetable) print ''; print $langs->trans("DateClosing"); if ($usetable) print ''; else print ': '; - print dol_print_date($object->date_cloture, 'dayhour'); - if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_cloture + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); + print dol_print_date($object->date_closing, 'dayhour'); + if ($deltadateforuser) print ' '.$langs->trans("CurrentHour").'   /   '.dol_print_date($object->date_closing + ($deltadateforuser * 3600), "dayhour").'  '.$langs->trans("ClientHour"); if ($usetable) print ''; else print '
'; } From e14c971b69d007bdb8a4dddbb0848dbbb7c942be Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 30 Sep 2020 13:29:20 +0000 Subject: [PATCH 21/46] Fixing style errors. --- htdocs/core/lib/functions2.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 547f1be6620..7cc14060aac 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -385,7 +385,7 @@ function dol_print_object_info($object, $usetable = 0) // User close if (!empty($object->user_cloture) || !empty($object->user_closing)) { - if (isset($object->user_cloture) && !empty($object->user_cloture)) $object->user_closing = $object->user_cloture; + if (isset($object->user_cloture) && !empty($object->user_cloture)) $object->user_closing = $object->user_cloture; if ($usetable) print ''; print $langs->trans("ClosedBy"); if ($usetable) print ''; @@ -407,7 +407,7 @@ function dol_print_object_info($object, $usetable = 0) // Date close if (!empty($object->date_cloture) || !empty($object->date_closing)) { - if (isset($object->date_cloture) && !empty($object->date_cloture)) $object->date_closing = $object->date_cloture; + if (isset($object->date_cloture) && !empty($object->date_cloture)) $object->date_closing = $object->date_cloture; if ($usetable) print ''; print $langs->trans("DateClosing"); if ($usetable) print ''; From 0355e03f52f85d49d0a791ffa726aec13ed33a9e Mon Sep 17 00:00:00 2001 From: Dushyant Singh <55306442+Dushyantsingh-ds@users.noreply.github.com> Date: Wed, 30 Sep 2020 22:22:27 -0700 Subject: [PATCH 22/46] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 19a767c8232..9930e592e54 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,8 @@ Other licenses apply for some included dependencies. See [COPYRIGHT](https://git If you have low technical skills and you're looking to install Dolibarr ERP/CRM in just a few clicks, you can use one of the packaged versions: -- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_(DoliWamp) -- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian +- [DoliWamp for Windows](https://wiki.dolibarr.org/index.php/Dolibarr_for_Windows_DoliWamp) +- [DoliDeb for Debian](https://wiki.dolibarr.org/index.php/Dolibarr_for_Ubuntu_or_Debian) - DoliRpm for Redhat, Fedora, OpenSuse, Mandriva or Mageia Releases can be downloaded from [official website](https://www.dolibarr.org/). From 3460a3486c390d9152ede314785216ed893bb82b Mon Sep 17 00:00:00 2001 From: Dushyant Singh <55306442+Dushyantsingh-ds@users.noreply.github.com> Date: Wed, 30 Sep 2020 22:24:21 -0700 Subject: [PATCH 23/46] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9930e592e54..648d5ef003d 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,8 @@ If you don't have time to install it yourself, you can try some commercial 'read ## UPGRADING Dolibarr supports upgrading usually wihtout the need for any (commercial) support (depending on if you use any commercial extensions) and supports upgrading all the way from any version after 2.8 without breakage. This is unique in the ERP ecosystem and a benefit our users highly appreciate! - -- At first make a backup of your Dolibarr files & than see https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr + +- At first make a backup of your Dolibarr files & than [see](https://wiki.dolibarr.org/index.php/Installation_-_Upgrade#Upgrade_Dolibarr) - Check that your installed PHP version is supported by the new version [see PHP support](./doc/phpmatrix.md). - Overwrite all old files from 'dolibarr' directory with files provided into the new version's package. - At first next access, Dolibarr will redirect you to the "install/" page to follow the upgrade process. From 0b35a0729010055a3621b373cf2cd2d1df5f4ff6 Mon Sep 17 00:00:00 2001 From: Ahmad Jamaly Rabib Date: Thu, 1 Oct 2020 11:52:56 +0600 Subject: [PATCH 24/46] NEW ADDED IMPORT TOOL FOR PROPOSAL MODULE Added proposal import functionality in import module --- htdocs/core/modules/modPropale.class.php | 169 +++++++++++++++++++++++ htdocs/imports/class/import.class.php | 3 + htdocs/langs/am_ET/propal.lang | 4 + htdocs/langs/de_DE/propal.lang | 4 + htdocs/langs/en_US/main.lang | 3 +- htdocs/langs/en_US/propal.lang | 5 + htdocs/langs/fr_FR/propal.lang | 4 + htdocs/langs/ja_JP/propal.lang | 4 + htdocs/langs/ko_KR/propal.lang | 4 + htdocs/langs/vi_VN/propal.lang | 4 + htdocs/langs/zh_CN/propal.lang | 4 + 11 files changed, 207 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 007e92e4277..4da02808251 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -5,6 +5,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2012 Juanjo Menent + * Copyright (C) 2020 Ahmad Jamaly Rabib * * 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 @@ -254,6 +255,174 @@ class modPropale extends DolibarrModules $this->export_sql_end[$r] .= ' WHERE c.fk_soc = s.rowid AND c.rowid = cd.fk_propal'; $this->export_sql_end[$r] .= ' AND c.entity IN ('.getEntity('propal').')'; if (!$user->rights->societe->client->voir) $this->export_sql_end[$r] .= ' AND sc.fk_user = '.$user->id; + + // Imports + //-------- + $r = 0; + + $r++; + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = 'Proposals'; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = ['c' => MAIN_DB_PREFIX . 'propal', 'extra' => MAIN_DB_PREFIX . 'propal_extrafields']; + $this->import_tables_creator_array[$r] = ['c'=>'fk_user_author']; // Fields to store import user id + $this->import_fields_array[$r] = [ + 'c.ref' => 'Document Ref*', + 'c.ref_client' => 'RefCustomer', + 'c.fk_soc' => 'ThirdPartyName*', + 'c.datec' => 'DateCreation', + 'c.datep' => 'DatePropal', + 'c.fin_validite' => 'DateEndPropal', + 'c.remise_percent' => 'GlobalDiscount', + 'c.total_ht' => 'TotalHT', + 'c.total' => 'TotalTTC', + 'c.fk_statut' => 'Status*', + 'c.note_public' => 'Note', + 'c.date_livraison' => 'DeliveryDate', + 'c.fk_user_valid' => 'ValidatedById' + ]; + if (! empty($conf->multicurrency->enabled)) { + $this->import_fields_array[$r]['c.multicurrency_code'] = 'Currency'; + $this->import_fields_array[$r]['c.multicurrency_tx'] = 'CurrencyRate'; + $this->import_fields_array[$r]['c.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->import_fields_array[$r]['c.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->import_fields_array[$r]['c.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } + // Add extra fields + $import_extrafield_sample = []; + $sql = "SELECT name, label, fieldrequired FROM " . MAIN_DB_PREFIX . "extrafields WHERE elementtype = 'propal' AND entity IN (0, " . $conf->entity . ")"; + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 'extra.' . $obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : ''); + $import_extrafield_sample[$fieldname] = $fieldlabel; + } + } + // End add extra fields + $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'propal']; + $this->import_regex_array[$r] = ['c.ref' => '[^ ]']; + $import_sample = [ + 'c.ref' => 'PROV0077', + 'c.ref_client' => 'Client1', + 'c.fk_soc' => 'MyBigCompany', + 'c.datec' => '2020-01-01', + 'c.datep' => '2020-01-01', + 'c.fin_validite' => '2020-01-01', + 'c.remise_percent' => '', + 'c.total_ht' => '0', + 'c.total' => '0', + 'c.fk_statut' => '1', + 'c.note_public' => '', + 'c.date_livraison' => '2020-01-01', + 'c.fk_user_valid' => '1', + 'c.multicurrency_code' => '', + 'c.multicurrency_tx' => '1', + 'c.multicurrency_total_ht' => '0', + 'c.multicurrency_total_tva' => '0', + 'c.multicurrency_total_ttc' => '0' + ]; + $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); + $this->import_updatekeys_array[$r] = ['c.ref'=>'Ref']; + $this->import_convertvalue_array[$r] = [ + 'c.fk_soc' => [ + 'rule' => 'fetchidfromref', + 'file' => '/societe/class/societe.class.php', + 'class' => 'Societe', + 'method' => 'fetch', + 'element' => 'ThirdParty' + ] + ]; + + //Import Proposal Lines + $r++; + $this->import_code[$r] = $this->rights_class.'line_'.$r; + $this->import_label[$r] = "ProposalLine"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = []; // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = [ + 'cd' => MAIN_DB_PREFIX . 'propaldet', + 'extra' => MAIN_DB_PREFIX . 'propaldet_extrafields' + ]; + $this->import_fields_array[$r] = [ + 'cd.fk_propal' => 'Document Ref*', + 'cd.fk_parent_line' => 'PrParentLine', + 'cd.fk_product' => 'IdProduct', + 'cd.label' => 'Label', + 'cd.description' => 'LineDescription', + 'cd.product_type' => 'TypeOfLineServiceOrProduct', + 'cd.tva_tx' => 'LineVATRate', + 'cd.qty' => 'LineQty', + 'cd.remise_percent' => 'Reduc. Percent', + 'cd.remise' => 'Reduc.', + 'cd.price' => 'Price', + 'cd.subprice' => 'Sub Price', + 'cd.total_ht' => 'LineTotalHT', + 'cd.total_tva' => 'LineTotalVAT', + 'cd.total_ttc' => 'LineTotalTTC', + 'cd.date_start' => 'Start Date', + 'cd.date_end' => 'End Date', + 'cd.buy_price_ht' => 'LineBuyPriceHT' + ]; + if (! empty($conf->multicurrency->enabled)) { + $this->import_fields_array[$r]['cd.multicurrency_code'] = 'Currency'; + $this->import_fields_array[$r]['cd.multicurrency_subprice'] = 'CurrencyRate'; + $this->import_fields_array[$r]['cd.multicurrency_total_ht'] = 'MulticurrencyAmountHT'; + $this->import_fields_array[$r]['cd.multicurrency_total_tva'] = 'MulticurrencyAmountVAT'; + $this->import_fields_array[$r]['cd.multicurrency_total_ttc'] = 'MulticurrencyAmountTTC'; + } + // Add extra fields + $import_extrafield_sample = []; + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'propaldet' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); + if ($resql) { + while ($obj = $this->db->fetch_object($resql)) { + $fieldname = 'extra.' . $obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel . ($obj->fieldrequired ? '*' : ''); + $import_extrafield_sample[$fieldname] = $fieldlabel; + } + } + // End add extra fields + $this->import_fieldshidden_array[$r] = ['extra.fk_object' => 'lastrowid-' . MAIN_DB_PREFIX . 'propaldet']; + $this->import_regex_array[$r] = ['cd.product_type' => '[0|1]$']; + $import_sample = [ + 'cd.fk_propal' => 'PROV(0001)', + 'cd.fk_parent_line' => '', + 'cd.fk_product' => '', + 'cd.label' => '', + 'cd.description' => 'Line description', + 'cd.product_type' => '1', + 'cd.tva_tx' => '0', + 'cd.qty' => '2', + 'cd.remise_percent' => '0', + 'cd.remise' => '0', + 'cd.price' => '', + 'cd.subprice' => '5000', + 'cd.total_ht' => '10000', + 'cd.total_tva' => '0', + 'cd.total_ttc' => '10100', + 'cd.date_start' => '', + 'cd.date_end' => '', + 'cd.buy_price_ht' => '7000', + 'cd.multicurrency_code' => 'JPY', + 'cd.multicurrency_tx' => '1', + 'cd.multicurrency_total_ht' => '10000', + 'cd.multicurrency_total_tva' => '0', + 'cd.multicurrency_total_ttc' => '10100' + ]; + $this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample); + $this->import_updatekeys_array[$r] = ['cd.fk_propal' => 'Quotation Id', 'cd.fk_product' => 'Product Id']; + $this->import_convertvalue_array[$r] = [ + 'cd.fk_propal' => [ + 'rule'=>'fetchidfromref', + 'file'=>'/comm/propal/class/propal.class.php', + 'class'=>'Propal', + 'method'=>'fetch' + ] + ]; } diff --git a/htdocs/imports/class/import.class.php b/htdocs/imports/class/import.class.php index 72d1eb16f66..f3e3d988c5b 100644 --- a/htdocs/imports/class/import.class.php +++ b/htdocs/imports/class/import.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Raphaël Doursenaud + * Copyright (C) 2020 Ahmad Jamaly Rabib * * 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 @@ -101,6 +102,8 @@ class Import // Defined if module is enabled $enabled = true; $part = strtolower(preg_replace('/^mod/i', '', $modulename)); + // Adds condition for propal module + if ($part === 'propale') $part = 'propal'; if (empty($conf->$part->enabled)) $enabled = false; if (empty($enabled)) continue; diff --git a/htdocs/langs/am_ET/propal.lang b/htdocs/langs/am_ET/propal.lang index 273996ab1b1..95085002f66 100644 --- a/htdocs/langs/am_ET/propal.lang +++ b/htdocs/langs/am_ET/propal.lang @@ -85,3 +85,7 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +IdProposal=Proposal ID +IdProduct=Product ID +PrParentLine=Proposal Parent Line +LineBuyPriceHT=Buy Price Amount net of tax for line diff --git a/htdocs/langs/de_DE/propal.lang b/htdocs/langs/de_DE/propal.lang index 78e3e09a746..0956cf4900f 100644 --- a/htdocs/langs/de_DE/propal.lang +++ b/htdocs/langs/de_DE/propal.lang @@ -85,3 +85,7 @@ ProposalCustomerSignature=Bei Beauftragung: Name in Klarschrift, Ort, Datum, Unt ProposalsStatisticsSuppliers=Statistik Lieferantenanfragen CaseFollowedBy=Fall gefolgt von SignedOnly=nur signiert +IdProposal=Angebots-ID +IdProduct=Produkt ID +PrParentLine=Übergeordnete Zeile des Vorschlags +LineBuyPriceHT=Kaufpreis Betrag abzüglich Steuern für Linie diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 0289b381b23..427a5a80d45 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -371,6 +371,7 @@ MulticurrencyPaymentAmount=Payment amount, original currency MulticurrencyAmountHT=Amount (excl. tax), original currency MulticurrencyAmountTTC=Amount (inc. of tax), original currency MulticurrencyAmountVAT=Amount tax, original currency +MulticurrencySubPrice=Amount sub price multi currency AmountLT1=Amount tax 2 AmountLT2=Amount tax 3 AmountLT1ES=Amount RE @@ -1094,4 +1095,4 @@ PublicVendorName=Public name of vendor DateOfBirth=Date of birth SecurityTokenHasExpiredSoActionHasBeenCanceledPleaseRetry=Security token has expired, so action has been canceled. Please try again. UpToDate=Up-to-date -OutOfDate=Out-of-date \ No newline at end of file +OutOfDate=Out-of-date diff --git a/htdocs/langs/en_US/propal.lang b/htdocs/langs/en_US/propal.lang index c68574d9ae2..557df2f840f 100644 --- a/htdocs/langs/en_US/propal.lang +++ b/htdocs/langs/en_US/propal.lang @@ -84,3 +84,8 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +IdProposal=Proposal ID +IdProduct=Product ID +PrParentLine=Proposal Parent Line +LineBuyPriceHT=Buy Price Amount net of tax for line + diff --git a/htdocs/langs/fr_FR/propal.lang b/htdocs/langs/fr_FR/propal.lang index 03981e2b17d..64199c5248d 100644 --- a/htdocs/langs/fr_FR/propal.lang +++ b/htdocs/langs/fr_FR/propal.lang @@ -98,3 +98,7 @@ ConfirmMassValidationQuestion = Voulez-vous confirmer la validation des devis br ConfirmMassSignatureQuestion = Voulez-vous confirmer la signature des devis ouvert selectionnés ? PropNoProductOrService = devis ne contient pas de produits ni de services PropsNoProductOrService = devis ne contiennent pas de produits ni de services +IdProposal=ID de proposition +IdProduct=ID produit +PrParentLine=Ligne parent de proposition +LineBuyPriceHT=Prix ​​d'achat Montant net de taxe pour la ligne diff --git a/htdocs/langs/ja_JP/propal.lang b/htdocs/langs/ja_JP/propal.lang index d2065e007a3..373ac4a2ce2 100644 --- a/htdocs/langs/ja_JP/propal.lang +++ b/htdocs/langs/ja_JP/propal.lang @@ -85,3 +85,7 @@ ProposalCustomerSignature=承諾書、会社印、日付、署名 ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +IdProposal=提案番号 +IdProduct=製品番号 +PrParentLine=提案親ライン +LineBuyPriceHT=購入価格ラインの税控除後の金額 diff --git a/htdocs/langs/ko_KR/propal.lang b/htdocs/langs/ko_KR/propal.lang index 93708eb0955..26a86464f91 100644 --- a/htdocs/langs/ko_KR/propal.lang +++ b/htdocs/langs/ko_KR/propal.lang @@ -85,3 +85,7 @@ ProposalCustomerSignature=Written acceptance, company stamp, date and signature ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +IdProposal=Proposal ID +IdProduct=Product ID +PrParentLine=Proposal Parent Line +LineBuyPriceHT=Buy Price Amount net of tax for line diff --git a/htdocs/langs/vi_VN/propal.lang b/htdocs/langs/vi_VN/propal.lang index 2a99f2a5577..a9e808d9f5a 100644 --- a/htdocs/langs/vi_VN/propal.lang +++ b/htdocs/langs/vi_VN/propal.lang @@ -85,3 +85,7 @@ ProposalCustomerSignature=Văn bản chấp nhận, dấu công ty, ngày và ch ProposalsStatisticsSuppliers=Thống kê đề xuất nhà cung cấp CaseFollowedBy=Theo bởi trường hợp SignedOnly=Signed only +IdProposal=ID đề xuất +IdProduct=ID sản phẩm +PrParentLine=Dòng mẹ đề xuất +LineBuyPriceHT=Giá mua Số lượng ròng của thuế cho dòng diff --git a/htdocs/langs/zh_CN/propal.lang b/htdocs/langs/zh_CN/propal.lang index 2c782854e14..79d10f5e2ba 100644 --- a/htdocs/langs/zh_CN/propal.lang +++ b/htdocs/langs/zh_CN/propal.lang @@ -85,3 +85,7 @@ ProposalCustomerSignature=书面接受,公司盖章,日期和签名 ProposalsStatisticsSuppliers=Vendor proposals statistics CaseFollowedBy=Case followed by SignedOnly=Signed only +IdProposal=提案编号 +IdProduct=产品编号 +PrParentLine=提案父行 +LineBuyPriceHT=购买价格扣除税额 From 91f0429bd29d08d14c84435d5b9327faf85d9816 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 09:34:10 +0200 Subject: [PATCH 25/46] Fix mention for france, only for FR country --- htdocs/core/modules/dons/html_cerfafr.modules.php | 6 +++--- htdocs/langs/en_US/admin.lang | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 657c24e615d..a4ff4e43a2d 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -205,7 +205,7 @@ class html_cerfafr extends ModeleDon $form = str_replace('__FrenchEligibility__', $frencheligibility, $form); $art200 = ''; - if (preg_match('/fr/i', $outputlangs->defaultlang)) { + if ($mysoc->country_code == 'FR') { if ($conf->global->DONATION_ART200 >= 1) { $art200 = '200 du CGI'; @@ -216,7 +216,7 @@ class html_cerfafr extends ModeleDon $form = str_replace('__ARTICLE200__', $art200, $form); $art238 = ''; - if (preg_match('/fr/i', $outputlangs->defaultlang)) { + if ($mysoc->country_code == 'FR') { if ($conf->global->DONATION_ART238 >= 1) { $art238 = '238 bis du CGI'; @@ -227,7 +227,7 @@ class html_cerfafr extends ModeleDon $form = str_replace('__ARTICLE238__', $art238, $form); $art978 = ''; - if (preg_match('/fr/i', $outputlangs->defaultlang)) { + if ($mysoc->country_code == 'FR') { if ($conf->global->DONATION_ART978 >= 1) { $art978 = '978 du CGI'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 241848a594a..9550e7a54fe 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -555,8 +555,6 @@ Module57Name=Payments by Direct Debit Module57Desc=Management of Direct Debit orders. It includes generation of SEPA file for European countries. Module58Name=ClickToDial Module58Desc=Integration of a ClickToDial system (Asterisk, ...) -Module59Name=Bookmark4u -Module59Desc=Add function to generate Bookmark4u account from a Dolibarr account Module60Name=Stickers Module60Desc=Management of stickers Module70Name=Interventions From 75ff2eb642f5b715001571139e6e30884e95eaa8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 09:39:18 +0200 Subject: [PATCH 26/46] Typo --- htdocs/langs/en_US/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 9550e7a54fe..1e64a5bfd04 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -71,7 +71,7 @@ DisableJavascriptNote=Note: For test or debug purpose. For optimization for blin UseSearchToSelectCompanyTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant COMPANY_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. UseSearchToSelectContactTooltip=Also if you have a large number of third parties (> 100 000), you can increase speed by setting constant CONTACT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string. DelaiedFullListToSelectCompany=Wait until a key is pressed before loading content of Third Parties combo list.
This may increase performance if you have a large number of third parties, but it is less convenient. -DelaiedFullListToSelectContact=Wait until a key is pressed before loading content of Contact combo list.
This may increase performance if you have a large number of contacts, but it is less convenient) +DelaiedFullListToSelectContact=Wait until a key is pressed before loading content of Contact combo list.
This may increase performance if you have a large number of contacts, but it is less convenient. NumberOfKeyToSearch=Number of characters to trigger search: %s NumberOfBytes=Number of Bytes SearchString=Search string From c16cd91d8e886b782408df6424e603b8db9fb250 Mon Sep 17 00:00:00 2001 From: John Botella Date: Thu, 1 Oct 2020 09:40:11 +0200 Subject: [PATCH 27/46] FIX default accountancy values and posted values --- htdocs/product/card.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index d0dc01bac33..ea1b2ef0e9f 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -78,6 +78,14 @@ $confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int'); $duration_value = GETPOST('duration_value', 'int'); $duration_unit = GETPOST('duration_unit', 'alpha'); + +$accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha'); +$accountancy_code_sell_intra = GETPOST('accountancy_code_sell_intra', 'alpha'); +$accountancy_code_sell_export = GETPOST('accountancy_code_sell_export', 'alpha'); +$accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha'); +$accountancy_code_buy_intra = GETPOST('accountancy_code_buy_intra', 'alpha'); +$accountancy_code_buy_export = GETPOST('accountancy_code_buy_export', 'alpha'); + if (!empty($user->socid)) $socid = $user->socid; $object = new Product($db); @@ -1323,6 +1331,14 @@ else } else // For external software { + + if (!empty($accountancy_code_sell)) { $object->accountancy_code_sell = $accountancy_code_sell; } + if (!empty($accountancy_code_sell_intra)) { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; } + if (!empty($accountancy_code_sell_export)) { $object->accountancy_code_sell_export = $accountancy_code_sell_export; } + if (!empty($accountancy_code_buy)) { $object->accountancy_code_buy = $accountancy_code_buy; } + if (!empty($accountancy_code_buy_intra)) { $object->accountancy_code_buy_intra = $accountancy_code_buy_intra; } + if (!empty($accountancy_code_buy_export)) { $object->accountancy_code_buy_export = $accountancy_code_buy_export; } + // Accountancy_code_sell print ''.$langs->trans("ProductAccountancySellCode").''; print ''; From e558dc3f275b95507298eb52d4778a50ef8ea639 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 1 Oct 2020 07:48:24 +0000 Subject: [PATCH 28/46] Fixing style errors. --- htdocs/product/card.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index ea1b2ef0e9f..8b4654ba921 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1331,7 +1331,6 @@ else } else // For external software { - if (!empty($accountancy_code_sell)) { $object->accountancy_code_sell = $accountancy_code_sell; } if (!empty($accountancy_code_sell_intra)) { $object->accountancy_code_sell_intra = $accountancy_code_sell_intra; } if (!empty($accountancy_code_sell_export)) { $object->accountancy_code_sell_export = $accountancy_code_sell_export; } From 9447eb28737d8c8ae6af71993b5459ae2f688d91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 09:50:09 +0200 Subject: [PATCH 29/46] Typo --- htdocs/langs/en_US/agenda.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/agenda.lang b/htdocs/langs/en_US/agenda.lang index aff922c4c23..4ab87aa8420 100644 --- a/htdocs/langs/en_US/agenda.lang +++ b/htdocs/langs/en_US/agenda.lang @@ -14,7 +14,7 @@ EventsNb=Number of events ListOfActions=List of events EventReports=Event reports Location=Location -ToUserOfGroup=Event assigned to any user in group +ToUserOfGroup=Event assigned to any user in the group EventOnFullDay=Event on all day(s) MenuToDoActions=All incomplete events MenuDoneActions=All terminated events From 7b3a7c9921c0d675a37d62eb71f7a85c43c88534 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 10:50:54 +0200 Subject: [PATCH 30/46] Add token on all url with action=delete --- htdocs/accountancy/admin/account.php | 4 ++-- htdocs/accountancy/admin/accountmodel.php | 4 ++-- htdocs/accountancy/admin/card.php | 4 ++-- htdocs/accountancy/admin/categories.php | 2 +- htdocs/accountancy/admin/fiscalyear_card.php | 4 ++-- htdocs/adherents/card.php | 2 +- htdocs/adherents/subscription/card.php | 4 ++-- htdocs/adherents/type.php | 2 +- htdocs/adherents/type_translation.php | 4 ++-- htdocs/admin/boxes.php | 2 +- htdocs/admin/const.php | 2 +- htdocs/admin/defaultvalues.php | 4 ++-- htdocs/admin/dict.php | 4 ++-- htdocs/admin/emailcollector_card.php | 4 ++-- htdocs/admin/expensereport_ik.php | 4 ++-- htdocs/admin/expensereport_rules.php | 4 ++-- htdocs/admin/mails_senderprofile_list.php | 2 +- htdocs/admin/mails_templates.php | 4 ++-- htdocs/admin/menus/index.php | 18 +++++++++--------- htdocs/admin/oauthlogintokens.php | 4 ++-- htdocs/admin/paymentbybanktransfer.php | 2 +- htdocs/admin/prelevement.php | 2 +- htdocs/admin/receiptprinter.php | 4 ++-- htdocs/admin/translation.php | 4 ++-- htdocs/admin/website.php | 4 ++-- htdocs/asset/card.php | 2 +- htdocs/asset/type.php | 2 +- htdocs/bom/bom_card.php | 2 +- htdocs/bom/tpl/objectline_view.tpl.php | 2 +- htdocs/bookmarks/card.php | 4 ++-- htdocs/bookmarks/list.php | 4 ++-- htdocs/categories/photos.php | 2 +- htdocs/categories/traduction.php | 2 +- htdocs/categories/viewcat.php | 2 +- htdocs/comm/action/card.php | 2 +- htdocs/comm/mailing/card.php | 2 +- htdocs/comm/mailing/cibles.php | 2 +- htdocs/comm/propal/card.php | 4 ++-- htdocs/commande/card.php | 2 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/bank/card.php | 4 ++-- htdocs/compta/bank/categ.php | 4 ++-- htdocs/compta/bank/various_payment/card.php | 2 +- htdocs/compta/deplacement/card.php | 2 +- htdocs/compta/facture/card.php | 6 +++--- htdocs/compta/facture/prelevement.php | 2 +- htdocs/compta/localtax/card.php | 2 +- htdocs/compta/paiement/cheque/card.php | 4 ++-- htdocs/compta/payment_sc/card.php | 2 +- htdocs/compta/sociales/card.php | 10 +++++----- htdocs/compta/tva/card.php | 2 +- .../default/tpl/contactcard_view.tpl.php | 2 +- htdocs/contact/card.php | 2 +- htdocs/contrat/card.php | 4 ++-- htdocs/core/class/commonobject.class.php | 4 ++-- htdocs/core/class/html.formfile.class.php | 6 +++--- .../core/modules/printing/printgcp.modules.php | 4 ++-- htdocs/core/tpl/admin_extrafields_view.tpl.php | 4 ++-- htdocs/core/tpl/bloc_comment.tpl.php | 4 ++-- htdocs/core/tpl/contacts.tpl.php | 6 +++--- htdocs/core/tpl/resource_view.tpl.php | 4 ++-- htdocs/cron/card.php | 2 +- htdocs/cron/list.php | 4 ++-- htdocs/don/card.php | 2 +- htdocs/don/payment/card.php | 2 +- htdocs/ecm/dir_add_card.php | 2 +- htdocs/ecm/dir_card.php | 2 +- htdocs/ecm/file_card.php | 2 +- htdocs/expedition/card.php | 4 ++-- htdocs/expensereport/card.php | 4 ++-- htdocs/expensereport/payment/card.php | 2 +- htdocs/exports/class/export.class.php | 2 +- htdocs/fichinter/card-rec.php | 4 ++-- htdocs/fichinter/card.php | 2 +- htdocs/fourn/commande/card.php | 2 +- htdocs/fourn/facture/card.php | 6 +++--- htdocs/fourn/paiement/card.php | 2 +- htdocs/ftp/index.php | 8 ++++---- htdocs/holiday/card.php | 2 +- htdocs/hrm/establishment/card.php | 2 +- htdocs/imports/import.php | 2 +- htdocs/langs/en_US/ticket.lang | 4 +--- htdocs/livraison/card.php | 4 ++-- htdocs/loan/card.php | 4 ++-- htdocs/loan/payment/card.php | 2 +- htdocs/main.inc.php | 2 +- htdocs/modulebuilder/index.php | 2 +- .../modulebuilder/template/myobject_card.php | 2 +- htdocs/mrp/mo_card.php | 2 +- htdocs/opensurvey/card.php | 2 +- htdocs/product/admin/dynamic_prices.php | 8 ++++---- htdocs/product/card.php | 2 +- htdocs/product/dynamic_price/editor.php | 2 +- htdocs/product/inventory/card.php | 2 +- htdocs/product/inventory/inventory.php | 2 +- htdocs/product/price.php | 8 ++++---- htdocs/product/stock/card.php | 18 ++++++++++++------ htdocs/product/stock/product.php | 2 +- htdocs/product/stock/productlot_card.php | 2 +- htdocs/product/traduction.php | 4 ++-- htdocs/projet/card.php | 2 +- htdocs/projet/tasks/contact.php | 2 +- htdocs/projet/tasks/task.php | 2 +- htdocs/projet/tasks/time.php | 2 +- htdocs/reception/card.php | 6 +++--- .../recruitmentcandidature_card.php | 2 +- .../recruitmentjobposition_candidature.php | 2 +- .../recruitmentjobposition_card.php | 2 +- htdocs/resource/card.php | 2 +- htdocs/resource/list.php | 4 ++-- htdocs/salaries/card.php | 2 +- .../canvas/company/tpl/card_view.tpl.php | 2 +- .../canvas/individual/tpl/card_view.tpl.php | 2 +- htdocs/societe/card.php | 2 +- htdocs/societe/notify/card.php | 2 +- htdocs/societe/paymentmodes.php | 8 ++++---- htdocs/societe/price.php | 2 +- htdocs/supplier_proposal/card.php | 2 +- htdocs/takepos/index.php | 4 ++-- htdocs/takepos/phone.php | 6 +++--- htdocs/ticket/card.php | 2 +- htdocs/user/card.php | 2 +- htdocs/user/group/card.php | 4 ++-- htdocs/user/notify/card.php | 2 +- htdocs/variants/card.php | 6 +++--- htdocs/variants/combinations.php | 2 +- htdocs/variants/list.php | 2 +- htdocs/website/websiteaccount_card.php | 2 +- htdocs/zapier/hook_card.php | 2 +- 129 files changed, 216 insertions(+), 212 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index de8fd9a8cd6..0ac79bcc3aa 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -481,11 +481,11 @@ if ($resql) // Action print ''; if ($user->rights->accounting->chartofaccount) { - print ''; + print ''; print img_edit(); print ''; print ' '; - print ''; + print ''; print img_delete(); print ''; } diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index be3b49e41c1..d3bd17d95a5 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -669,11 +669,11 @@ if ($id) print ""; // Modify link - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; else print ' '; // Delete link - if ($iserasable) print ''.img_delete().''; + if ($iserasable) print ''.img_delete().''; else print ' '; print "\n"; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 4ad131f5170..29ed90bb7be 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -372,13 +372,13 @@ if ($action == 'create') { print '
'; if (!empty($user->rights->accounting->chartofaccount)) { - print ''.$langs->trans('Modify').''; + print ''.$langs->trans('Modify').''; } else { print ''.$langs->trans('Modify').''; } if (!empty($user->rights->accounting->chartofaccount)) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 909d633c487..d605105f8e9 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -170,7 +170,7 @@ if ($action == 'display' || $action == 'delete') { print ''.length_accountg($cpt->account_number).''; print ''.$cpt->label.''; print ''; - print "rowid."'>"; + print ''; print $langs->trans("DeleteFromCat"); print img_picto($langs->trans("DeleteFromCat"), 'unlink'); print ""; diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 27ef1ea7bd1..a122d3acab5 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -305,9 +305,9 @@ if ($action == 'create') */ print ''; } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 0a32398f307..d0a67153209 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1694,7 +1694,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Delete if ($user->rights->adherent->supprimer) { - print '\n"; + print '\n"; } else { print '
'.$langs->trans("Delete")."
"; } diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 3fad8c9db14..a79355de768 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -345,7 +345,7 @@ if ($rowid && $action != 'edit') { if ($user->rights->adherent->cotisation->creer) { if (!$bankline->rappro) { - print '"; + print '"; } else { print '"; } @@ -353,7 +353,7 @@ if ($rowid && $action != 'edit') { // Delete if ($user->rights->adherent->cotisation->creer) { - print '\n"; + print '\n"; } print '
'; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 853e22bfbc9..ecd709bdd17 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -455,7 +455,7 @@ if ($rowid > 0) { // Delete if ($user->rights->adherent->configurer) { - print ''; + print ''; } print ""; diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index dcd4a7aa981..10c43dadbe3 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -201,7 +201,7 @@ if ($action == 'edit') { if (!empty($object->multilangs)) { foreach ($object->multilangs as $key => $value) { $s = picto_from_langcode($key); - print "
".($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"')."
"; + print '
'.($s ? $s.' ' : '').' '.$langs->trans('Language_'.$key).': '.img_delete('', 'class="valigntextbottom"')."
"; print '
'; print ''; @@ -228,7 +228,7 @@ if ($action == 'edit') { if (!empty($object->multilangs)) { foreach ($object->multilangs as $key => $value) { $s = picto_from_langcode($key); - print ($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"').''; + print ($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"').''; print '
'; print '
'; diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 2dbcfe00015..31723888e44 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -429,7 +429,7 @@ foreach ($boxactivated as $key => $box) print ($hasprevious ? ''.img_up().'' : ''); print ''; print '
'; print ''."\n"; diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 5a525cbe9ad..4aacdb3cfc2 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -299,7 +299,7 @@ if ($result) { print ''; } else { - print ''.img_delete().''; + print ''.img_delete().''; } print "\n"; diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 453f10bf837..17fa15af382 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -378,9 +378,9 @@ if ($result) print '"; // Modify link - if ($canbemodified) print ''; + if ($canbemodified) print ''; else print ''; // Delete link if ($iserasable) { print ''; } else print ''; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 1420cc0263e..eb9ffb52831 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -540,7 +540,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; print ''; print ''; } @@ -632,7 +632,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Delete print ''; print ''; $i++; diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index 3ff8ad0c4ce..f55e78d4105 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -166,8 +166,8 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) echo ''; echo ''; } else { - echo ''.img_edit().''; - if (!empty($range->ik->id)) echo ''.img_delete().''; + echo ''.img_edit().''; + if (!empty($range->ik->id)) echo ''.img_delete().''; // TODO add delete link } } diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 6d08355b815..e0012139154 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -305,8 +305,8 @@ foreach ($rules as $rule) echo ''; diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 101e57970c0..b7b0060c778 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -320,20 +320,20 @@ if ($conf->use_javascript_ajax) $titre = $langs->trans($menu['titre']); $entry = '
'; - print ''.img_delete().''; + print ''.img_delete().''; print '
'; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { - print ''.img_edit().''; + print ''.img_edit().''; print '   '; - print ''.img_delete().''; + print ''.img_delete().''; } else { print ''; print ''; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index b6d5df3644a..1ac1e0f4ad4 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1671,14 +1671,14 @@ if ($id) print "'.img_edit().''.img_edit().' '; - if ($user->admin) print ''.img_delete().''; + if ($user->admin) print ''.img_delete().''; //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin print ' '.$rulefilter['rulevalue'].''; - print ' '.img_delete().''; + print ' '.img_delete().''; print '
'; print ''.img_edit().''; - print ' '.img_delete().''; + print ' '.img_delete().''; print '
'; if ($object->id != $rule->id) { - echo ''.img_edit().' '; - echo ''.img_delete().''; + echo ''.img_edit().' '; + echo ''.img_delete().''; } else { echo ' '; echo ''.$langs->trans('Cancel').''; diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 9a1a696e034..16ae12ffcc5 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -587,7 +587,7 @@ while ($i < ($limit ? min($num, $limit) : $num)) if ($sortorder) $url .= '&page='.urlencode($sortorder); print ''.img_edit().''; //print '   '; - print ''.img_delete().'   '; + print ''.img_delete().'   '; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected = 0; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 610dd9c1ef2..7c79505158a 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -889,10 +889,10 @@ if ($resql) // Modify link / Delete link print ''; - if ($canbemodified) print ''.img_edit().''; + if ($canbemodified) print ''.img_edit().''; if ($iserasable) { - print ''.img_delete().''; + print ''.img_delete().''; //else print ''.img_delete().''; // Some dictionary can be edited by other profile than admin } print '
'; - $entry .= '   '.$titre.''; + $entry .= '   '.$titre.''; $entry .= ''; - $entry .= ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; - $entry .= ''.img_edit_add('default').' '; - $entry .= ''.img_delete('default').' '; + $entry .= ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; + $entry .= ''.img_edit_add('default').' '; + $entry .= ''.img_delete('default').' '; $entry .= '     '; - $entry .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; + $entry .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; $entry .= '
'; - $buttons = ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; - $buttons .= ''.img_edit_add('default').' '; - $buttons .= ''.img_delete('default').' '; + $buttons = ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; + $buttons .= ''.img_edit_add('default').' '; + $buttons .= ''.img_delete('default').' '; $buttons .= '     '; - $buttons .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; + $buttons .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; $data[] = array( 'rowid'=>$menu['rowid'], diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 0f12da3a02a..2d843a52577 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -148,7 +148,7 @@ if ($mode == 'setup' && $user->admin) // We pass this param list in to 'state' because we need it before and after the redirect. $shortscope = 'user,public_repo'; $urltorenew = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltodelete = $urlwithroot.'/core/modules/oauth/github_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltocheckperms = 'https://github.com/settings/applications/'; } elseif ($key[0] == 'OAUTH_GOOGLE_NAME') { @@ -161,7 +161,7 @@ if ($mode == 'setup' && $user->admin) } //$scope.=',gmail_full'; $urltorenew = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?shortscope='.$shortscope.'&state='.$shortscope.'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); - $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); + $urltodelete = $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/admin/oauthlogintokens.php'); $urltocheckperms = 'https://security.google.com/settings/security/permissions'; } elseif ($key[0] == 'OAUTH_STRIPE_TEST_NAME') { diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index d85f79257d0..718e64e6446 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -465,7 +465,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) print ''.dolGetFirstLastname($obj->firstname,$obj->lastname).''; $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); print ''.$label.''; - print 'rowid.'">'.img_delete().''; + print 'rowid.'">'.img_delete().''; print ''; $i++; } diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 1e1bee11ad4..50d01924364 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -472,7 +472,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) print ''.dolGetFirstLastname($obj->firstname,$obj->lastname).''; $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); print ''.$label.''; - print 'rowid.'">'.img_delete().''; + print 'rowid.'">'.img_delete().''; print ''; $i++; } diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 9b3563edd63..92b9ffbd8b4 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -340,11 +340,11 @@ if ($mode == 'config' && $user->admin) { print img_picto($langs->trans("Edit"), 'edit'); print ''; // delete icon - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; // test icon - print ''; + print ''; print img_picto($langs->trans("TestPrinter"), 'printer'); print ''; print ''; diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 17c4592f382..560530c9161 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -350,7 +350,7 @@ if ($mode == 'overwrite') } else { print ''.img_edit().''; print '   '; - print ''.img_delete().''; + print ''.img_delete().''; } print ''; @@ -514,7 +514,7 @@ if ($mode == 'searchkey') } print ''.img_edit().''; print ' '; - print ''.img_delete().''; + print ''.img_delete().''; print '  '; $htmltext = $langs->trans("OriginalValueWas", ''.$newlangfileonly->tab_translate[$key].''); print $form->textwithpicto('', $htmltext, 1, 'info'); diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index 83aeed6bd13..b8520ecc227 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -601,10 +601,10 @@ if ($id) print ""; // Modify link - print ''.img_edit().''; + print ''.img_edit().''; // Delete link - if ($iserasable) print ''.img_delete().''; + if ($iserasable) print ''.img_delete().''; else print ''.img_delete($langs->trans("DisableSiteFirst"), 'class="opacitymedium"').''; print "\n"; diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 3434b03da99..7ef3d9c011e 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -323,7 +323,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->asset->delete) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index 01418fde201..1045e9135ee 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -507,7 +507,7 @@ if ($rowid > 0) // Delete if ($user->rights->asset->write) { - print ''; + print ''; } print ""; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index cf452d6b8da..7daf29416c2 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -683,7 +683,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontodelete) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index e1e94dc2076..c5ee3870272 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -121,7 +121,7 @@ if ($this->status == 0 && ($object_rights->write) && $action != 'selectlines') { $coldisplay++; if (($line->fk_prev_id == null) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation - print 'id.'">'; + print 'id.'">'; print img_delete(); print ''; } diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index b6552dbd89c..93926e4ba92 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -311,13 +311,13 @@ if ($id > 0 && !preg_match('/^add/i', $action)) // Edit if ($user->rights->bookmark->creer && $action != 'edit') { - print " id."&action=edit\">".$langs->trans("Edit")."\n"; + print ''.$langs->trans("Edit").''."\n"; } // Remove if ($user->rights->bookmark->supprimer && $action != 'edit') { - print " id."&action=delete\">".$langs->trans("Delete")."\n"; + print ''.$langs->trans("Delete").''."\n"; } print ''; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 3b01efdeea8..7f70d74f5d9 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -241,11 +241,11 @@ while ($i < min($num, $limit)) print ''; if ($user->rights->bookmark->creer) { - print 'rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().""; + print 'rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().""; } if ($user->rights->bookmark->supprimer) { - print 'rowid.'">'.img_delete().''; + print 'rowid.'">'.img_delete().''; } else { print " "; } diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index e8b3da0a525..dc0a980a6f8 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -254,7 +254,7 @@ if ($object->id) } if ($user->rights->categorie->creer) { - print ''; + print ''; print img_delete().''; } if ($nbbyrow) print ''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index cf3db3444c7..f5755a697ca 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -301,7 +301,7 @@ if ($action == 'edit') { $s = picto_from_langcode($key); print ''; - print ''; + print ''; print ''; print ''; if (!empty($conf->global->CATEGORY_USE_OTHER_FIELD_IN_TRANSLATION)) diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 616c97f3bb9..30b706a4b3a 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -266,7 +266,7 @@ if ($user->rights->categorie->creer) if ($user->rights->categorie->supprimer) { - print "".$langs->trans("Delete").""; + print "".$langs->trans("Delete").""; } print ""; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 3818f459893..cb63813139d 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -2139,7 +2139,7 @@ if ($id > 0) if ($user->rights->agenda->allactions->delete || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 13037b58769..78b9dea4bc6 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1014,7 +1014,7 @@ if ($action == 'create') { print ''.$langs->trans("DeleteMailing").''; } else { - print ''.$langs->trans("DeleteMailing").''; + print ''.$langs->trans("DeleteMailing").''; } } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 813a195007b..ef2f3cc772e 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -665,7 +665,7 @@ if ($object->fetch($id) >= 0) if ($obj->statut == 0) // Not sent yet { if ($user->rights->mailing->creer && $allowaddtarget) { - print ''.img_delete($langs->trans("RemoveRecipient")).''; + print ''.img_delete($langs->trans("RemoveRecipient")).''; } } /*if ($obj->statut == -1) // Sent with error diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 2c6b7a9dca6..8febd8868e9 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2491,12 +2491,12 @@ if ($action == 'create') // Clone if ($usercancreate) { - print ''.$langs->trans("ToClone").''; + print ''.$langs->trans("ToClone").''; } // Delete if ($usercandelete) { - print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b3cb465d70d..5de377930d7 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2602,7 +2602,7 @@ if ($action == 'create' && $usercancreate) // Delete order if ($usercandelete) { if ($numshipping == 0) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 950d0c7d3c6..974ba750dd1 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1490,7 +1490,7 @@ if ($resql) } if ($user->rights->banque->modifier) { - print 'rowid.'&id='.$objp->bankid.'&page='.$page.'">'; + print 'rowid.'&id='.$objp->bankid.'&page='.$page.'">'; print img_delete('', 'class="marginleftonly"'); print ''; } diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 7d9e825ce08..bac2f974def 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -761,13 +761,13 @@ if ($action == 'create') if ($user->rights->banque->configurer) { - print 'id.'">'.$langs->trans("Modify").''; + print 'id.'">'.$langs->trans("Modify").''; } $canbedeleted = $object->can_be_deleted(); // Renvoi vrai si compte sans mouvements if ($user->rights->banque->configurer && $canbedeleted) { - print 'id.'">'.$langs->trans("Delete").''; + print 'id.'">'.$langs->trans("Delete").''; } print ''; diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 0f71134d08a..18b75bdea9b 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -135,8 +135,8 @@ if ($result) } else { print ""; print ''; } print ""; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 20eab8b349e..371dbaa65e2 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -550,7 +550,7 @@ if ($id) if ($alreadyaccounted) { print ''; } else { - print ''; + print ''; } } else { print ''; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 682981852d8..5b8b98135a1 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -521,7 +521,7 @@ if ($action == 'create') if ($user->rights->deplacement->supprimer) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 634a4a0e452..7b0d7fcf869 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3935,7 +3935,7 @@ if ($action == 'create') } } - if ($action == 'deletepaiement') + if ($action == 'deletepayment') { $payment_id = GETPOST('paiement_id'); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 'no', 1); @@ -4743,7 +4743,7 @@ if ($action == 'create') print ''; print ''; diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index cd7bbfd11c2..6353d394f20 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -280,7 +280,7 @@ if ($id) print "
\n"; if ($object->rappro == 0) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } else { print ''.$langs->trans("Delete").''; } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 24650ea343f..71cd900f915 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -734,12 +734,12 @@ print '
'; if ($user->socid == 0 && !empty($object->id) && $object->statut == 0 && $user->rights->banque->cheque) { - print ''.$langs->trans('Validate').''; + print ''.$langs->trans('Validate').''; } if ($user->socid == 0 && !empty($object->id) && $user->rights->banque->cheque) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } print '
'; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 2819e492f7b..0e71c83f6cb 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -311,7 +311,7 @@ if ($action == '') { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index bcdfe1f5238..c744bcc90e8 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -706,13 +706,13 @@ if ($id > 0) // Reopen if ($object->paye && $user->rights->tax->charges->creer) { - print ""; + print ''; } // Edit if ($object->paye == 0 && $user->rights->tax->charges->creer) { - print ""; + print ''; } // Emit payment @@ -724,19 +724,19 @@ if ($id > 0) // Classify 'paid' if ($object->paye == 0 && round($resteapayer) <= 0 && $user->rights->tax->charges->creer) { - print ""; + print ''; } // Clone if ($user->rights->tax->charges->creer) { - print ""; + print '"; } // Delete if ($user->rights->tax->charges->supprimer) { - print ""; + print ''; } print "
"; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 717b584fe44..010fd112646 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -379,7 +379,7 @@ if ($id) { if (!empty($user->rights->tax->charges->supprimer)) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php index bd0808aa8b5..43fd48e3ef0 100644 --- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php +++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php @@ -144,7 +144,7 @@ if (empty($user->socid)) { } if ($user->rights->societe->contact->supprimer) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } print '
'; diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 9f242b52666..e4e7ecaf5fb 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1526,7 +1526,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // Delete if ($user->rights->societe->contact->supprimer) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index adb117b7b8f..dd06d9fed4b 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1567,7 +1567,7 @@ if ($action == 'create') } if ($user->rights->contrat->creer && ($object->statut >= 0)) { - print ''; + print ''; print img_delete(); print ''; } @@ -2108,7 +2108,7 @@ if ($action == 'create') // - Droit de supprimer if (($user->rights->contrat->creer && $object->statut == $object::STATUS_DRAFT) || $user->rights->contrat->supprimer) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 46567edf369..3ea4bba4a7f 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7152,7 +7152,7 @@ abstract class CommonObject $return .= ''.img_picto($langs->trans("Resize"), 'resize', '').'   '; // Link to delete - $return .= ''; + $return .= ''; $return .= img_delete().''; } } @@ -7178,7 +7178,7 @@ abstract class CommonObject $return .= ''.img_picto($langs->trans("Resize"), 'resize', '').'   '; // Link to delete - $return .= ''; + $return .= ''; $return .= img_delete().''; } } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 2e06837563e..7264c83b152 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1337,7 +1337,7 @@ class FormFile if (!empty($conf->dol_use_jmobile)) $useajax = 0; if (empty($conf->use_javascript_ajax)) $useajax = 0; if (!empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax = 0; - print ''.img_delete().''; + print ''.img_delete().''; } print ""; @@ -1645,7 +1645,7 @@ class FormFile //if ($forcedownload) print '&attachment=1'; //print '&file='.urlencode($relativefile).'">'; //print img_view().'   '; - //if ($permissiontodelete) print ''.img_delete().''; + //if ($permissiontodelete) print ''.img_delete().''; //else print ' '; print "\n"; } @@ -1819,7 +1819,7 @@ class FormFile print ''; } - print ''."\n"; + print ''."\n"; print ""; } } else { diff --git a/htdocs/core/tpl/bloc_comment.tpl.php b/htdocs/core/tpl/bloc_comment.tpl.php index 02a32110779..edb675e45d6 100644 --- a/htdocs/core/tpl/bloc_comment.tpl.php +++ b/htdocs/core/tpl/bloc_comment.tpl.php @@ -125,12 +125,12 @@ if (!empty($object->comments)) } else { if ($fk_user == $user->id || $user->admin == 1) { - print ''; + print ''; print img_picto('', 'edit.png'); print ''; } if (($first && $fk_user == $user->id) || $user->admin == 1) { - print ''; + print ''; print img_picto('', 'delete.png'); print ''; } diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 7665c4e2211..1cb8b813001 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -298,9 +298,9 @@ foreach ($list as $entry) if ($permission) { $href = $_SERVER["PHP_SELF"]; - $href .= "?id=".$object->id; - $href .= "&action=deletecontact"; - $href .= "&lineid=".$entry->id; + $href .= '?id='.$object->id; + $href .= '&action=deletecontact&token='.newToken(); + $href .= '&lineid='.$entry->id; print "'; print ''; // Display lines extrafields @@ -2499,7 +2499,7 @@ if ($action == 'create') // Delete if ($user->rights->expedition->supprimer) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index addb13da745..34c33f5aaab 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2199,10 +2199,10 @@ if ($action == 'create') { print '"; diff --git a/htdocs/fichinter/card-rec.php b/htdocs/fichinter/card-rec.php index d297313675e..b8ff3714596 100644 --- a/htdocs/fichinter/card-rec.php +++ b/htdocs/fichinter/card-rec.php @@ -714,14 +714,14 @@ if ($action == 'create') { if ($user->rights->ficheinter->creer) { print ''; } if ($user->rights->ficheinter->supprimer) { print ''; } print ''; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 4034abad733..b6d7ab39336 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1697,7 +1697,7 @@ if ($action == 'create') // Delete if (($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer) || $user->rights->ficheinter->supprimer) { - print ''; } } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 4a26d3b4cb6..419d5c7a559 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2559,7 +2559,7 @@ if ($action == 'create') // Delete if (!empty($usercandelete) || ($object->statut == CommandeFournisseur::STATUS_DRAFT && !empty($usercancreate))) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } } diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 9470e408b70..b0f178c6fc4 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2345,7 +2345,7 @@ if ($action == 'create') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBill'), $langs->trans('ConfirmDeleteBill'), 'confirm_delete', '', 0, 1); } - if ($action == 'deletepaiement') + if ($action == 'deletepayment') { $payment_id = GETPOST('paiement_id'); $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&paiement_id='.$payment_id, $langs->trans('DeletePayment'), $langs->trans('ConfirmDeletePayment'), 'confirm_delete_paiement', '', 0, 1); @@ -2789,7 +2789,7 @@ if ($action == 'create') print ''; // Del button - print ''; // Action button print ''; diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index d97bc8f7f35..49841fe24b9 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -521,7 +521,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Delete (need delete permission, or if draft, just need create/modify permission) if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 49b29b7048b..add7de31b56 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -656,7 +656,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Delete (need delete permission, or if draft, just need create/modify permission) if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 2d714deeb2c..f5fa5a5ab78 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -371,7 +371,7 @@ if ($action != 'edit' && $user->rights->opensurvey->write) { } //Delete button - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } print ''; diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index bc9f1048b4b..aafc36ca256 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -178,8 +178,8 @@ if ($action != 'create_updater' && $action != 'edit_updater') print ''; print ''; print ''; - print ''; + print ''; print ''; } } else { @@ -270,7 +270,7 @@ if ($action != 'create_variable' && $action != 'edit_variable') print ''; print ''; print ''; + print 'id.'">'.img_delete().''; print ''; } } else { @@ -284,7 +284,7 @@ if ($action != 'create_variable' && $action != 'edit_variable') { //Action Buttons print ''; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index f86b94f314e..ce852876a3d 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2238,7 +2238,7 @@ if ($action != 'create' && $action != 'edit') { print ''.$langs->trans('Delete').''."\n"; } else { - print 'id.'">'.$langs->trans("Delete").''; + print 'id.'">'.$langs->trans("Delete").''; } } else { print ''.$langs->trans("Delete").''; diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php index c0bbf8388a2..b59319ad985 100644 --- a/htdocs/product/dynamic_price/editor.php +++ b/htdocs/product/dynamic_price/editor.php @@ -206,7 +206,7 @@ if ($eid == 0) { print '
'.$langs->trans('Delete').'
'."\n"; } else { - print ''; + print ''; } print ''; diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 3053cc45d71..f7dbc1f6410 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -425,7 +425,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Delete (need delete permission, or if draft, just need create/modify permission) if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 504f8419685..37f1cb9721a 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -512,7 +512,7 @@ if ($object->id > 0) print 'rowid).'">'; print ''; print ''; print ''; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index c73e43dc6f0..847292fa367 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -913,7 +913,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ if (($user->rights->produit->creer || $user->rights->service->creer)) { print ''; print img_edit().''; - print ''; + print ''; print img_delete().''; } else { print ' '; @@ -1064,7 +1064,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ { print ''; print img_edit().''; - print ''; + print ''; print img_delete().''; } else { print ' '; @@ -1591,7 +1591,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul print ''; diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 11aa5e860ae..81ae26390c9 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -485,13 +485,19 @@ if ($action == 'create') { if (empty($action)) { - if ($user->rights->stock->creer) - print "id."\">".$langs->trans("Modify").""; - else print "".$langs->trans("Modify").""; + if ($user->rights->stock->creer) { + print ''.$langs->trans("Modify").''; + } + else { + print ''.$langs->trans("Modify").''; + } - if ($user->rights->stock->supprimer) - print "id."\">".$langs->trans("Delete").""; - else print "".$langs->trans("Delete").""; + if ($user->rights->stock->supprimer) { + print ''.$langs->trans("Delete").''; + } + else { + print ''.$langs->trans("Delete").''; + } } } diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 54d57bf5d75..64c23814ec2 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -1006,7 +1006,7 @@ if (!$variants) { print ''; print ''; if (!empty($user->rights->produit->creer)) { - print ''; + print ''; } print ''; } diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index bdc68f5c3e5..dbedba85d99 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -371,7 +371,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->stock->supprimer) { - print ''."\n"; + print ''."\n"; } */ } diff --git a/htdocs/product/traduction.php b/htdocs/product/traduction.php index 502a15cd04e..c6a5d15a0b0 100644 --- a/htdocs/product/traduction.php +++ b/htdocs/product/traduction.php @@ -236,7 +236,7 @@ if ($action == 'edit') foreach ($object->multilangs as $key => $value) { $s = picto_from_langcode($key); - print "
".($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"')."
"; + print "
".($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"')."
"; print '
'; print '
'.($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', '').'
'.($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', '').'
'.$langs->trans('Label').''.$object->multilangs[$key]["label"].'
'.$langs->trans('Description').''.$object->multilangs[$key]["description"].'
".$objp->label."'; - print ''.img_edit().''; - print ''.img_delete().''; + print ''.img_edit().''; + print ''.img_delete().''; print '
'; if ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; } @@ -5286,7 +5286,7 @@ if ($action == 'create') { print ''.$langs->trans('Delete').''; } else { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } } else { print ''.$langs->trans('Delete').''; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 721c0b857ab..f69517c1037 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -752,7 +752,7 @@ if ($object->id > 0) print ''.$langs->trans("OrderWaiting").''; - print ''; + print ''; print img_delete(); print '
'; print ''.img_edit().''; // id= is included into $param if ($permissiontodelete) { - print '   '.img_delete().''; // id= is included into $param + print '   '.img_delete().''; // id= is included into $param } else { print ' '; } diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 4b707f0772f..0312aa061f8 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -140,7 +140,7 @@ class printing_printgcp extends PrintingDriver 'info'=>$access, 'type'=>'info', 'renew'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?state=userinfo_email,userinfo_profile,cloud_print&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), - 'delete'=>($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp') : '') + 'delete'=>($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE) ? $urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp') : '') ); if ($token_ok) { $expiredat = ''; @@ -166,7 +166,7 @@ class printing_printgcp extends PrintingDriver /* if ($storage->hasAccessToken($this->OAUTH_SERVICENAME_GOOGLE)) { $this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink'); - $this->conf[] = array('varname'=>'DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'delete'); + $this->conf[] = array('varname'=>'DELETE_TOKEN', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?action=delete&token='.newToken().'&backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'delete'); } else { $this->conf[] = array('varname'=>'PRINTGCP_AUTHLINK', 'link'=>$urlwithroot.'/core/modules/oauth/google_oauthcallback.php?backtourl='.urlencode(DOL_URL_ROOT.'/printing/admin/printing.php?mode=setup&driver=printgcp'), 'type'=>'authlink'); }*/ diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 8b92f4e183c..fb542f9037e 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -112,8 +112,8 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel } print ''.img_edit().''; - print '  '.img_delete().''.img_edit().''; + print '  '.img_delete().'
"; print ""; diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index ed54b4a2d00..9bc8447a796 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -73,11 +73,11 @@ if ((array) $linked_resources && count($linked_resources) > 0) print ''; print ''; diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 80c3602f5d9..df529b598ec 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -726,7 +726,7 @@ if (($action == "create") || ($action == "edit")) if (!$user->rights->cron->delete) { print ''.$langs->trans("Delete").''; } else { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } print ''; diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index a41608e7e25..927c1d1014f 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -536,12 +536,12 @@ if ($num > 0) $backtourl = urlencode($_SERVER["PHP_SELF"].'?'.$param.($sortfield ? '&sortfield='.$sortfield : '').($sortorder ? '&sortorder='.$sortorder : '')); if ($user->rights->cron->create) { - print 'trans('Edit'))."\">".img_picto($langs->trans('Edit'), 'edit')."  "; } if ($user->rights->cron->delete) { - print 'trans('CronDelete'))."\">".img_picto($langs->trans('CronDelete'), 'delete', '', false, 0, 0, '', 'marginleftonly')."   "; } else { print "trans('NotEnoughPermissions'))."\">".img_picto($langs->trans('NotEnoughPermissions'), 'delete', '', false, 0, 0, '', 'marginleftonly')."   "; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 42e45c2cba0..95bebb3ef8d 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -817,7 +817,7 @@ if (!empty($id) && $action != 'edit') { if ($object->statut == -1 || $object->statut == 0) { - print '"; + print '"; } else { print '"; } diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index 4e4ce818556..26f540969ee 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -268,7 +268,7 @@ if (empty($action)) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index b4e3c76aef1..a84beb605cb 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -292,7 +292,7 @@ if (empty($action) || $action == 'delete_section') print '
'; if ($user->rights->ecm->setup) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index 27d08e9119f..be481aa09bd 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -457,7 +457,7 @@ if ($action != 'edit' && $action != 'delete') //{ if ($permtoadd) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 48c15f92aa2..40068e2e0a3 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -405,7 +405,7 @@ if ($action != 'edit') /* if ($user->rights->ecm->setup) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7d4a455d58b..86ec2ee5c38 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2360,7 +2360,7 @@ if ($action == 'create') print 'id.'">'.img_edit().''; print '
'; - print 'id.'">'.img_delete().''; + print 'id.'">'.img_delete().''; print ''; - print 'rowid.'">'; + print 'rowid.'">'; print img_edit(); print '   '; - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; diff --git a/htdocs/expensereport/payment/card.php b/htdocs/expensereport/payment/card.php index fd1453b8ae5..9bc50341973 100644 --- a/htdocs/expensereport/payment/card.php +++ b/htdocs/expensereport/payment/card.php @@ -293,7 +293,7 @@ if ($action == '') { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index a33437166ea..89ae2103476 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -845,7 +845,7 @@ class Export } // suppression de l'export print ''; - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; print "
'; if ($object->statut == FactureFournisseur::STATUS_VALIDATED && $object->paye == 0 && $user->socid == 0) { - print 'rowid.'">'; + print 'rowid.'">'; print img_delete(); print ''; } @@ -3178,7 +3178,7 @@ if ($action == 'create') { print ''; } else { - print ''; + print ''; } } print ''; diff --git a/htdocs/fourn/paiement/card.php b/htdocs/fourn/paiement/card.php index 9a7af329f50..ffe4c95bf51 100644 --- a/htdocs/fourn/paiement/card.php +++ b/htdocs/fourn/paiement/card.php @@ -345,7 +345,7 @@ if ($result > 0) { if ($allow_delete) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index cd76f74b278..7c0eab0f352 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -598,19 +598,19 @@ if (!function_exists('ftp_connect')) print ''; if ($is_directory) { - if ($file != '..') print ''.img_delete().''; + if ($file != '..') print ''.img_delete().''; else print ' '; } elseif ($is_link) { $newfile = $file; $newfile = preg_replace('/ ->.*/', '', $newfile); - print ''.img_delete().''; + print ''.img_delete().''; } else { - print ''.img_picto('', 'file').''; + print ''.img_picto('', 'file').''; print '   '; print ''; print '   '; - print ''.img_delete().''; + print ''.img_delete().''; print ''; print ''; } diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php index 3bacf8d6d6a..d9bbe6607bf 100644 --- a/htdocs/holiday/card.php +++ b/htdocs/holiday/card.php @@ -1470,7 +1470,7 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') } if ($candelete && ($object->statut == Holiday::STATUS_DRAFT || $object->statut == Holiday::STATUS_CANCELED || $object->statut == Holiday::STATUS_REFUSED)) // If draft or canceled or refused { - print ''.$langs->trans("DeleteCP").''; + print ''.$langs->trans("DeleteCP").''; } print ''; diff --git a/htdocs/hrm/establishment/card.php b/htdocs/hrm/establishment/card.php index 0b000f879c2..1f43878babf 100644 --- a/htdocs/hrm/establishment/card.php +++ b/htdocs/hrm/establishment/card.php @@ -426,7 +426,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index 8dee2ed0538..71fad9dee9b 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -639,7 +639,7 @@ if ($step == 3 && $datatoimport) // Affiche date fichier print ''.dol_print_date(dol_filemtime($dir.'/'.$file), 'dayhour').''.img_delete().''; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index e6f9e612a59..cf370fbdca0 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -31,10 +31,8 @@ TicketDictType=Ticket - Types TicketDictCategory=Ticket - Groupes TicketDictSeverity=Ticket - Severities TicketDictResolution=Ticket - Resolution -TicketTypeShortBUGSOFT=Dysfonctionnement logiciel -TicketTypeShortBUGHARD=Dysfonctionnement matériel -TicketTypeShortCOM=Commercial question +TicketTypeShortCOM=Commercial question TicketTypeShortHELP=Request for functionnal help TicketTypeShortISSUE=Issue, bug or problem TicketTypeShortREQUEST=Change or enhancement request diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 80594338ba1..2a1646a5d80 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -658,9 +658,9 @@ if ($action == 'create') // Create. Seems to no be used { if ($conf->expedition_bon->enabled) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } else { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } } diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 157bdbd53b8..1c4116b34c2 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -752,13 +752,13 @@ if ($id > 0) // Classify 'paid' if (($object->paid == 0 || $object->paid == 2) && round($staytopay) <= 0 && $user->rights->loan->write) { - print ''; + print ''; } // Delete if (($object->paid == 0 || $object->paid == 2) && $user->rights->loan->delete) { - print ''; + print ''; } print ""; diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 9b4da35e5d1..51aa3f85a92 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -281,7 +281,7 @@ if (empty($action) && !empty($user->rights->loan->delete)) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 6cdf59a078a..69f985db0b9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -373,7 +373,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl || defined('CSRFCHECK_WITH_TOKEN')) // Check validity of token, only if option MAIN_SECURITY_CSRF_WITH_TOKEN enabled or if constant CSRFCHECK_WITH_TOKEN is set { // Check all cases that need a token (all POST actions, all actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set, all sensitive GET actions) - if ($_SERVER['REQUEST_METHOD'] == 'POST' || ((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) || in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof'))) + if ($_SERVER['REQUEST_METHOD'] == 'POST' || ((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) || in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof', 'deletepayment'))) { if (!GETPOSTISSET('token')) { dol_syslog("--- Access to ".$_SERVER["PHP_SELF"]." refused by CSRFCHECK_WITH_TOKEN protection. Token not provided."); diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index fd9fe7fa798..49d097ffc8a 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -2713,7 +2713,7 @@ if ($module == 'initmodule') print ''; if ($propname != 'rowid') { - print ''.img_delete().''; + print ''.img_delete().''; } print ''.$entry->code.''.$entry->description.''.price($entry->value).'id.'">'.img_edit().'  '; - print 'id.'">'.img_delete().'id.'">'.img_edit().'  '; + print 'id.'">'.img_delete().'
'.$entry->update_interval.''.$entry->getLastUpdated().'id.'">'.img_edit().'  '; - print 'id.'">'.img_delete().'
'; - print ''.img_delete().''; + print ''.img_delete().''; print '
'; if ($candelete) { - print 'id.'&lineid='.$objp->rowid.'">'; + print 'id.'&lineid='.$objp->rowid.'">'; print img_delete(); print ''; } else print ' '; // Can not delete last price (it's current price) @@ -2148,7 +2148,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print img_edit('default', 0, 'style="vertical-align: middle;"'); print ''; print ' '; - print 'id.'&lineid='.$line->id.'">'; + print 'id.'&lineid='.$line->id.'">'; print img_delete('default', 'style="vertical-align: middle;"'); print ''; print ''.$line['seuil_stock_alerte'].''.$line['desiredstock'].''.img_delete().''.img_delete().'
'; @@ -272,7 +272,7 @@ if ($action == 'edit') foreach ($object->multilangs as $key => $value) { $s = picto_from_langcode($key); - print ($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"').''; + print ($s ? $s.' ' : '')." ".$langs->trans('Language_'.$key).": ".''.img_delete('', 'class="valigntextbottom"').''; print '
'; print '
'; diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index c1c59bcd3b7..db38e3c02d7 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1324,7 +1324,7 @@ if ($action == 'create' && $user->rights->projet->creer) { if ($userDelete > 0 || ($object->statut == 0 && $user->rights->projet->creer)) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 72e3a1bae32..313fec73721 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -518,7 +518,7 @@ if ($id > 0 || !empty($ref)) if ($user->rights->projet->creer) { print ' '; - print ''; + print ''; print img_picto($langs->trans('Unlink'), 'unlink'); print ''; } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 49e1a3e6866..096eb62d0d0 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -604,7 +604,7 @@ if ($id > 0 || !empty($ref)) { if (!$object->hasChildren() && !$object->hasTimeSpent()) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 4ded7e9d197..dfeb73bb3cc 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1462,7 +1462,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; print ' '; - print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; + print 'rowid.$param.((empty($id) || $tab == 'timespent') ? '&tab=timespent' : '').'">'; print img_delete('default', 'class="pictodelete paddingleft"'); print ''; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 0758e1456ce..d41ce8e6bf4 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1909,10 +1909,10 @@ if ($action == 'create') { // edit-delete buttons print '
'; print ''; // Display lines extrafields @@ -2035,7 +2035,7 @@ if ($action == 'create') if ($user->rights->reception->supprimer) { - print ''.$langs->trans("Delete").''; + print ''.$langs->trans("Delete").''; } } diff --git a/htdocs/recruitment/recruitmentcandidature_card.php b/htdocs/recruitment/recruitmentcandidature_card.php index 5e790c0b993..e25de998a36 100644 --- a/htdocs/recruitment/recruitmentcandidature_card.php +++ b/htdocs/recruitment/recruitmentcandidature_card.php @@ -543,7 +543,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Delete (need delete permission, or if draft, just need create/modify permission) if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/recruitment/recruitmentjobposition_candidature.php b/htdocs/recruitment/recruitmentjobposition_candidature.php index 219bb3469f6..a945df25bfc 100644 --- a/htdocs/recruitment/recruitmentjobposition_candidature.php +++ b/htdocs/recruitment/recruitmentjobposition_candidature.php @@ -520,7 +520,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Delete (need delete permission, or if draft, just need create/modify permission) if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/recruitment/recruitmentjobposition_card.php b/htdocs/recruitment/recruitmentjobposition_card.php index ee09413905d..d4a115962f2 100644 --- a/htdocs/recruitment/recruitmentjobposition_card.php +++ b/htdocs/recruitment/recruitmentjobposition_card.php @@ -544,7 +544,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Delete (need delete permission, or if draft, just need create/modify permission) if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index b1fec3058c0..e170b038e7a 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -369,7 +369,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) if ($user->rights->resource->delete) { print ''; } } diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index e2d10ffceef..a8a946e7578 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -269,11 +269,11 @@ if ($ret) include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; print ''; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 6a696aa4132..ec1184a77e6 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -484,7 +484,7 @@ if ($id) { if (!empty($user->rights->salaries->delete)) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/societe/canvas/company/tpl/card_view.tpl.php b/htdocs/societe/canvas/company/tpl/card_view.tpl.php index d7f06763034..6591e38e1cb 100644 --- a/htdocs/societe/canvas/company/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_view.tpl.php @@ -246,7 +246,7 @@ for ($i = 1; $i <= 4; $i++) { use_javascript_ajax) { ?> trans('Delete'); ?> - ">trans('Delete'); ?> + ">trans('Delete'); ?> diff --git a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php index 14c8822dc9e..a49dbcde698 100644 --- a/htdocs/societe/canvas/individual/tpl/card_view.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_view.tpl.php @@ -189,7 +189,7 @@ if ($this->control->tpl['action_delete']) echo $this->control->tpl['action_delet use_javascript_ajax) { ?> trans('Delete'); ?> - ">trans('Delete'); ?> + ">trans('Delete'); ?> diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 8104d40d201..9e6ad514da6 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2657,7 +2657,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { print ''.$langs->trans('Delete').''."\n"; } else { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } } } diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 18cc536d6b8..ba1ea5d54a5 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -339,7 +339,7 @@ if ($result > 0) if ($obj->type == 'email') print $langs->trans("Email"); if ($obj->type == 'sms') print $langs->trans("SMS"); print ''; - print ''; + print ''; print ''; $i++; } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index ed835dfd9a4..6adf32dd392 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1094,11 +1094,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''.$langs->trans("CreateCardOnStripe").''; } - print ''; + print ''; print img_picto($langs->trans("Modify"), 'edit'); print ''; print ' '; - print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& + print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& print img_picto($langs->trans("Delete"), 'delete'); print ''; } @@ -1248,7 +1248,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 1e884629791..1190b29aa3c 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1902,7 +1902,7 @@ if ($action == 'create') // Delete if (($object->statut == SupplierProposal::STATUS_DRAFT && $usercancreate) || $usercandelete) { - print ''; } } diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index bcc56ff0166..66212ab3203 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -432,7 +432,7 @@ function ChangeThirdparty(idcustomer) { function deleteline() { console.log("Delete line"); - $("#poslines").load("invoice.php?action=deleteline&place="+place+"&idline="+selectedline, function() { + $("#poslines").load("invoice.php?action=deleteline&token=&place="+place+"&idline="+selectedline, function() { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); ClearSearch(); @@ -499,7 +499,7 @@ function New() { if (r == true) { // Reload section with invoice lines - $("#poslines").load("invoice.php?action=delete&place=" + place, function () { + $("#poslines").load("invoice.php?action=delete&token=&place=" + place, function () { //$('#poslines').scrollTop($('#poslines')[0].scrollHeight); }); ClearSearch(); diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 119752014a1..14ca718740b 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -250,7 +250,7 @@ function SetQty(place, selectedline, qty){ if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { ?> if (qty==0){ - $("#phonediv2").load("auto_order.php?mobilepage=invoice&action=deleteline&place="+place+"&idline="+selectedline, function() { + $("#phonediv2").load("auto_order.php?mobilepage=invoice&action=deleteline&token=&place="+place+"&idline="+selectedline, function() { }); } else{ @@ -262,7 +262,7 @@ function SetQty(place, selectedline, qty){ else { ?> if (qty==0){ - $("#phonediv2").load("invoice.php?mobilepage=invoice&action=deleteline&place="+place+"&idline="+selectedline, function() { + $("#phonediv2").load("invoice.php?mobilepage=invoice&action=deleteline&token=&place="+place+"&idline="+selectedline, function() { }); } else{ @@ -271,7 +271,7 @@ function SetQty(place, selectedline, qty){ } + ?> LoadCats(); } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 03e9fe52781..1719013bdf5 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1265,7 +1265,7 @@ elseif (empty($action) || $action == 'view' || $action == 'addlink' || $action = // Delete ticket if ($user->rights->ticket->delete && !$user->socid) { - print ''; + print ''; } } print ''."\n"; diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 96b9d55af6a..f989e231f60 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1898,7 +1898,7 @@ if ($action == 'create' || $action == 'adduserldap') { if ($user->admin || !$object->admin) // If user edited is admin, delete is possible on for an admin { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index febdf3373fe..e8ffbd7c1f7 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -385,12 +385,12 @@ else { if ($caneditperms) { - print ''.$langs->trans("Modify").''; + print ''.$langs->trans("Modify").''; } if ($candisableperms) { - print ''.$langs->trans("DeleteGroup").''; + print ''.$langs->trans("DeleteGroup").''; } print "\n"; diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index bc07dc0270d..ca90e7f60e9 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -313,7 +313,7 @@ if ($result > 0) if ($obj->type == 'email') print $langs->trans("Email"); if ($obj->type == 'sms') print $langs->trans("SMS"); print ''; - print ''; + print ''; print ''; $i++; } diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index 13b7408fc93..c1bbc6fe6e2 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -219,8 +219,8 @@ if ($action == 'edit') { @@ -263,7 +263,7 @@ if ($action == 'edit') { '.$prodstatic->getLibStatut(2, 1).''; print ''; print ''; print ''; print '
'; - print 'id.'">'.img_edit().''; + print 'id.'">'.img_edit().''; print ''; - print 'id.'">'.img_delete().''; + print 'id.'">'.img_delete().''; print ''; - print ''; + print ''; print img_edit(); print ''; print ' '; - print ''; + print ''; print img_delete('', 'class="marginleftonly"'); print ''; print ' '.img_delete().''.img_delete().'
'; if ($user->rights->societe->creer) { - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; } @@ -1492,7 +1492,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print img_picto($langs->trans("Modify"), 'edit'); print ''; - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; } diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 8fb17a59e3f..4a709fb9009 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -593,7 +593,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print img_edit('default', 0, 'style="vertical-align: middle;"'); print ''; print ' '; - print 'id.'&lineid='.$line->id.'">'; + print 'id.'&lineid='.$line->id.'">'; print img_delete('default', 'style="vertical-align: middle;"'); print ''; print ''.img_delete().''.img_delete().'
value) ?> - + '; print 'id.'">'.img_edit().''; - print 'id.'">'.img_delete().''; + print 'id.'">'.img_delete().''; print ''; if ($productCombinations || $massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined diff --git a/htdocs/variants/list.php b/htdocs/variants/list.php index 971533bdd25..7973553f6d0 100644 --- a/htdocs/variants/list.php +++ b/htdocs/variants/list.php @@ -126,7 +126,7 @@ foreach ($variants as $key => $attribute) { print ''.$attribute->countChildProducts().''; print ''.img_edit().''; - print ''.img_delete().''; + print ''.img_delete().''; print ''; if ($key > 0) { diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index c1057935e31..403128a0f8b 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -331,7 +331,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->website->delete) { - print ''."\n"; + print ''."\n"; } } print ''."\n"; diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php index efb02395e7b..721b40ebfd9 100644 --- a/htdocs/zapier/hook_card.php +++ b/htdocs/zapier/hook_card.php @@ -353,7 +353,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea */ if ($user->rights->mymodule->delete) { - print ''.$langs->trans('Delete').''."\n"; + print ''.$langs->trans('Delete').''."\n"; } else { print ''.$langs->trans('Delete').''."\n"; } From c1bb03e56d869887287a8842a67fe31f52c56e89 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 10:58:43 +0200 Subject: [PATCH 31/46] Doc --- ChangeLog | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9e0b301edde..62f28b9bd6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,16 +13,17 @@ WARNING: Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: * Properties ->contactid has been renamed into ->contact_id -* Property $paiementid in API api_supplier_invoices has been renamed into into $payment_mode_id (english) +* Property $paiementid in API 'api_supplier_invoices.php' has been renamed into into $payment_mode_id (english) * The deprecated subsitution key __SIGNATURE__ has been removed. Replace with __USER_SIGNATURE__ if you used the old syntax in your email templates. * The hidden option HOLIDAY_MORE_PUBLIC_HOLIDAYS has been removed. Use instead the dictionary table if you need to define custom days of holiday. -* Property num_paiement has been renamed num_payment everywhere for better code consistency. -* If you build a class that implement CommonObject to use the incoterm properties or method (->fk_incoterm, ->label_incoterm, ->location_incoterm), - you must now also include declaration of the Trait CommonIncoterm in your class. All incoterm functions were moved into this Trait. -* The GETPOST(..., 'alpha') has now the same behaviour than GETPOST(..., 'alphanohtml'); - +* Property 'num_paiement' has been renamed 'num_payment' everywhere for better code consistency. +* If you build a class that implement CommonObject to use the incoterm properties or methods (->fk_incoterm, ->label_incoterm, ->location_incoterm), + you must now also include declaration of the Trait 'CommonIncoterm' in your class. All incoterm functions were moved into this Trait. +* The GETPOST(..., 'alpha') has now the same behaviour than GETPOST(..., 'alphanohtml') so no html will be allowed. Use GETPOST(..., 'restricthtml') to accept HTML. +* If you have links in your code with '&action=delete' as a parameter, you must also add '&token='.newToken() as another parameter to avoid CSRF protection errors. + ***** ChangeLog for 12.0.3 compared to 12.0.2 ***** FIX: 10.0 - when the mime file name is different from the filesystem name, the attachment name should be the mime filename From 298e94e574f7fccf08c47b487037b2bc08c867f4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 11:16:43 +0200 Subject: [PATCH 32/46] Typo --- htdocs/langs/en_US/receiptprinter.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang index 83a003f388d..284c4fa61fa 100644 --- a/htdocs/langs/en_US/receiptprinter.lang +++ b/htdocs/langs/en_US/receiptprinter.lang @@ -54,7 +54,7 @@ DOL_DOUBLE_WIDTH=Double width size DOL_DEFAULT_HEIGHT_WIDTH=Default height and width size DOL_UNDERLINE=Enable underline DOL_UNDERLINE_DISABLED=Disable underline -DOL_BEEP=Beed sound +DOL_BEEP=Beep sound DOL_PRINT_TEXT=Print text DateInvoiceWithTime=Invoice date and time YearInvoice=Invoice year From 676d70d86dc71aa9b878b8b6c437eafafaff2086 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 1 Oct 2020 12:14:50 +0200 Subject: [PATCH 33/46] FIX stripe for connect mode --- htdocs/public/stripe/ipn.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 4291cb6f834..16160e94200 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Frédéric France +/* Copyright (C) 2018-2020 Thibault FOUCART + * Copyright (C) 2018 Frédéric France * * 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 @@ -115,7 +115,7 @@ if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled { $sql = "SELECT entity"; $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql .= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'"; + $sql .= " WHERE service = '".$db->escape($service)."' and tokenstring LIKE '%".$db->escape($event->account)."%'"; dol_syslog(get_class($db)."::fetch", LOG_DEBUG); $result = $db->query($sql); @@ -134,8 +134,6 @@ if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled $key = 1; } $ret = $mc->switchEntity($key); - if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; - if (!$res) die("Include of main fails"); } // list of action From 3f78d8fe258f43d3e4716663f86d8b291b78e9b4 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 1 Oct 2020 12:19:12 +0200 Subject: [PATCH 34/46] Update stripe.class.php --- htdocs/stripe/class/stripe.class.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index a72e5291f58..2ac8193a71e 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -90,15 +90,12 @@ class Stripe extends CommonObject global $conf; $sql = "SELECT tokenstring"; - $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql .= " WHERE entity = ".$conf->entity; - $sql .= " AND service = '".$mode."'"; + $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token WHERE"; + if (empty($fk_soc)) $sql .= " entity = ".$conf->entity. " AND"; + $sql .= " service = '".$mode."'"; if ($fk_soc > 0) { $sql .= " AND fk_soc = ".$fk_soc; } - else { - $sql .= " AND fk_soc IS NULL"; - } $sql .= " AND fk_user IS NULL AND fk_adherent IS NULL"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); From 4e16db1e5f71dfe1f2ca416f222ed24a2b5dea83 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Thu, 1 Oct 2020 12:22:53 +0200 Subject: [PATCH 35/46] Update paymentmodes.php --- htdocs/societe/paymentmodes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index b29a3073c85..5894c3245a9 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1329,7 +1329,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } // List of Stripe payment modes - if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && $object->fournisseur && !empty($stripesupplieracc)) + if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && !empty($stripesupplieracc)) { print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc ? ' (Stripe connection with StripeConnect account '.$stripesupplieracc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, 'stripe-s'); $balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc)); From a890b2d7ad3464187f042cd5bdb8f793c272bc2e Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 1 Oct 2020 12:31:00 +0200 Subject: [PATCH 36/46] handle fk_origin for stock movement for users the core way --- htdocs/product/stock/class/mouvementstock.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 534b9300158..0252e6a17ce 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -1002,6 +1002,10 @@ class MouvementStock extends CommonObject require_once DOL_DOCUMENT_ROOT.'/mrp/class/mo.class.php'; $origin = new Mo($this->db); break; + case 'user': + require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; + $origin = new User($this->db); + break; default: if ($origintype) From c89f8b323b256e4c12fe6063c8f92c9d6394c073 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 1 Oct 2020 15:18:19 +0200 Subject: [PATCH 37/46] Rename fk_typeobject to type_object --- htdocs/install/mysql/migration/12.0.0-13.0.0.sql | 2 +- htdocs/install/mysql/tables/llx_website_page.sql | 2 +- htdocs/website/class/websitepage.class.php | 12 ++++++------ htdocs/website/index.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql index e177d53d6cc..cae368aea21 100644 --- a/htdocs/install/mysql/migration/12.0.0-13.0.0.sql +++ b/htdocs/install/mysql/migration/12.0.0-13.0.0.sql @@ -331,5 +331,5 @@ ALTER TABLE llx_bank ADD COLUMN import_key varchar(14); ALTER TABLE llx_menu MODIFY COLUMN enabled text; -ALTER TABLE llx_website_page ADD COLUMN fk_typeobject varchar(255); +ALTER TABLE llx_website_page ADD COLUMN object_type varchar(255); ALTER TABLE llx_website_page ADD COLUMN fk_object varchar(255); diff --git a/htdocs/install/mysql/tables/llx_website_page.sql b/htdocs/install/mysql/tables/llx_website_page.sql index ec2d6f4c72b..e2bec4a8a24 100644 --- a/htdocs/install/mysql/tables/llx_website_page.sql +++ b/htdocs/install/mysql/tables/llx_website_page.sql @@ -40,6 +40,6 @@ CREATE TABLE llx_website_page date_creation datetime, tms timestamp, import_key varchar(14), -- import key - fk_typeobject varchar(255), + object_type varchar(255), fk_object varchar(255) ) ENGINE=innodb; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index aa256960f0f..8e9584a86ac 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -108,7 +108,7 @@ class WebsitePage extends CommonObject /** * @var string path of external object */ - public $fk_typeobject; + public $object_type; /** * @var string id of external object @@ -171,7 +171,7 @@ class WebsitePage extends CommonObject 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>512), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1), - 'fk_typeobject' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''), + 'object_type' => array('type' => 'varchar(255)','label' => 'ObjectType', 'enabled'=>1, 'visible'=>1, 'position'=>46, 'searchall'=>0, 'help'=>''), 'fk_object' => array('type' => 'varchar(255)','label' => 'ObjectId', 'enabled'=>1, 'visible'=>1, 'position'=>47, 'searchall'=>0, 'help'=>'') ); // END MODULEBUILDER PROPERTIES @@ -273,7 +273,7 @@ class WebsitePage extends CommonObject $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif,"; $sql .= " t.import_key,"; - $sql .= " t.fk_typeobject,"; + $sql .= " t.object_type,"; $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level @@ -333,7 +333,7 @@ class WebsitePage extends CommonObject $this->author_alias = $obj->author_alias; $this->fk_user_modif = $obj->fk_user_modif; $this->import_key = $obj->import_key; - $this->fk_typeobject = $obj->fk_typeobject; + $this->object_type = $obj->object_type; $this->fk_object = $obj->fk_object; } $this->db->free($resql); @@ -391,7 +391,7 @@ class WebsitePage extends CommonObject $sql .= " t.author_alias,"; $sql .= " t.fk_user_modif,"; $sql .= " t.import_key,"; - $sql .= " t.fk_typeobject,"; + $sql .= " t.object_type,"; $sql .= " t.fk_object"; $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; @@ -461,7 +461,7 @@ class WebsitePage extends CommonObject $record->author_alias = $obj->author_alias; $record->fk_user_modif = $obj->fk_user_modif; $record->import_key = $obj->import_key; - $record->fk_typeobject = $obj->fk_typeobject; + $record->object_type = $obj->object_type; $record->fk_object = $obj->fk_object; //var_dump($record->id); $records[$record->id] = $record; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 29dd6c44929..db859573707 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -942,7 +942,7 @@ if ($action == 'addcontainer') $objectpage->keywords = str_replace(array('<', '>'), '', GETPOST('WEBSITE_KEYWORDS', 'alphanohtml')); $objectpage->htmlheader = GETPOST('htmlheader', 'none'); $objectpage->author_alias = GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml'); - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS'); + $objectpage->object_type = GETPOST('WEBSITE_OBJECTCLASS'); $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID'); $substitutionarray = array(); $substitutionarray['__WEBSITE_CREATE_BY__'] = $user->getFullName($langs); @@ -1659,7 +1659,7 @@ if ($action == 'updatemeta') $objectpage->htmlheader = trim(GETPOST('htmlheader', 'none')); $objectpage->fk_page = (GETPOST('pageidfortranslation', 'int') > 0 ? GETPOST('pageidfortranslation', 'int') : 0); $objectpage->author_alias = trim(GETPOST('WEBSITE_AUTHORALIAS', 'alphanohtml')); - $objectpage->fk_typeobject = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); + $objectpage->object_type = GETPOST('WEBSITE_OBJECTCLASS', 'alpha'); $objectpage->fk_object = GETPOST('WEBSITE_OBJECTID', 'aZ09'); $newdatecreation = dol_mktime(GETPOST('datecreationhour', 'int'), GETPOST('datecreationmin', 'int'), GETPOST('datecreationsec', 'int'), GETPOST('datecreationmonth', 'int'), GETPOST('datecreationday', 'int'), GETPOST('datecreationyear', 'int')); From b258a848e29dc91c2e57aa7a82895bb41a50d56c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 16:21:07 +0200 Subject: [PATCH 38/46] NEW Can enable/disable users in bulk actions --- htdocs/core/actions_massactions.inc.php | 2 +- .../modulebuilder/template/myobject_list.php | 1 - htdocs/user/card.php | 1 + htdocs/user/list.php | 314 ++++++++++++++---- 4 files changed, 249 insertions(+), 69 deletions(-) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 98e936a2d7a..2bdae583429 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -3,7 +3,7 @@ * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent * Copyright (C) 2019 Ferran Marcet - * Copyright (C) 2019 Frédéric France + * Copyright (C) 2019 Frédéric France * * 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 diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 3fc5032bced..e79128e1657 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -379,7 +379,6 @@ print ''; print ''; print ''; -//print ''; print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/mymodule/myobject_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); diff --git a/htdocs/user/card.php b/htdocs/user/card.php index f989e231f60..95a60804cfb 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -117,6 +117,7 @@ $hookmanager->initHooks(array('usercard', 'globalcard')); /** * Actions */ + $parameters = array('id' => $id, 'socid' => $socid, 'group' => $group, 'caneditgroup' => $caneditgroup); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 406401bdf38..d5d928f7c79 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -38,7 +38,15 @@ if (!$user->rights->user->user->lire && !$user->admin) { // Load translation files required by page $langs->loadLangs(array('users', 'companies', 'hrm')); +$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) +$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? +$confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation +$cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button +$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'userlist'; // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') // Security check (for external users) $socid = 0; @@ -54,25 +62,33 @@ $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); -if (empty($page) || $page == -1) { $page = 0; } +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (!$sortfield) $sortfield = "u.login"; -if (!$sortorder) $sortorder = "ASC"; - -// Define value to know what current user can do on users -$canadduser = (!empty($user->admin) || $user->rights->user->user->creer); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new User($db); -$hookmanager->initHooks(array('userlist')); $extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('userlist')); -// fetch optionals attributes and labels +// Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); + $search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +if (!$sortfield) $sortfield = "u.login"; +if (!$sortorder) $sortorder = "ASC"; + +// Initialize array of search criterias +$search_all = GETPOST('search_all', 'alphanohtml') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'); +$search = array(); +foreach ($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); +} + $userstatic = new User($db); $companystatic = new Societe($db); $form = new Form($db); @@ -115,8 +131,16 @@ if (is_array($extrafields->attributes[$object->table_element]['label']) && count { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) - $arrayfields["ef.".$key] = array('label'=>$extrafields->attributes[$object->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key])); + if (!empty($extrafields->attributes[$object->table_element]['list'][$key])) { + $arrayfields["ef.".$key] = array( + 'label'=>$extrafields->attributes[$object->table_element]['label'][$key], + 'checked'=>(($extrafields->attributes[$object->table_element]['list'][$key] < 0) ? 0 : 1), + 'position'=>$extrafields->attributes[$object->table_element]['pos'][$key], + 'enabled'=>(abs($extrafields->attributes[$object->table_element]['list'][$key]) != 3 && $extrafields->attributes[$object->table_element]['perms'][$key]), + 'langfile'=>$extrafields->attributes[$object->table_element]['langfile'][$key], + 'help'=>$extrafields->attributes[$object->table_element]['help'][$key] + ); + } } } $object->fields = dol_sort_array($object->fields, 'position'); @@ -144,6 +168,20 @@ $catid = GETPOST('catid', 'int'); if ($search_statut == '') $search_statut = '1'; if ($mode == 'employee' && !GETPOSTISSET('search_employee')) $search_employee = 1; +// Define value to know what current user can do on users +$permissiontoadd = (!empty($user->admin) || $user->rights->user->user->creer); +$canreaduser = (!empty($user->admin) || $user->rights->user->user->lire); +$canedituser = (!empty($user->admin) || $user->rights->user->user->creer); +$candisableuser = (!empty($user->admin) || $user->rights->user->user->supprimer); +$canreadgroup = $canreaduser; +$caneditgroup = $canedituser; +if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) +{ + $canreadgroup = (!empty($user->admin) || $user->rights->user->group_advance->read); + $caneditgroup = (!empty($user->admin) || $user->rights->user->group_advance->write); +} + +$error = 0; /* @@ -154,7 +192,7 @@ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createbills') { $massaction = ''; } $parameters = array(); -$reshook = $hookmanager->executeHooks('doActions', $parameters); // Note that $action and $object may have been modified by some hooks +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -184,6 +222,72 @@ if (empty($reshook)) $search_array_options = array(); $search_categ = 0; } + + // Mass actions + $objectclass = 'User'; + $objectlabel = 'User'; + $uploaddir = $conf->user->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + + // Disable or Enable records + if (!$error && ($massaction == 'disable' || $massaction == 'reactivate') && $permissiontoadd) + { + $objecttmp = new User($db); + + if (!$error) + { + $db->begin(); + + $nbok = 0; + foreach ($toselect as $toselectid) + { + if ($toselectid == $user->id) { + setEventMessages($langs->trans($massaction == 0 ? 'CantDisableYourself' : 'CanEnableYourself'), null, 'errors'); + $error++; + break; + } + + $result = $objecttmp->fetch($toselectid); + if ($result > 0) { + if ($objecttmp->admin) { + setEventMessages($langs->trans($massaction == 0 ? 'CantDisableAnAdminUserWithMassActions' : 'CantEnableAnAdminUserWithMassActions', $objecttmp->login), null, 'errors'); + $error++; + break; + } + + $result = $objecttmp->setstatus($massaction == 'disable' ? 0 : 1); + if ($result == 0) { + // Nothing is done + } elseif ($result < 0) { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } else $nbok++; + } else { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } + + if (!$error && !empty($conf->file->main_limit_users)) { + $nb = $object->getNbOfUsers("active"); + if ($nb >= $conf->file->main_limit_users) { + $error++; + setEventMessages($langs->trans("YourQuotaOfUsersIsReached"), null, 'errors'); + } + } + + if (!$error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } else { + $db->rollback(); + } + } + } } @@ -191,7 +295,11 @@ if (empty($reshook)) * View */ -$htmlother = new FormOther($db); +$formother = new FormOther($db); + +//$help_url="EN:Module_MyObject|FR:Module_MyObject_FR|ES:Módulo_MyObject"; +$help_url = ''; +$text = $langs->trans("ListOfUsers"); $user2 = new User($db); @@ -203,11 +311,13 @@ $sql .= " u2.rowid as id2, u2.login as login2, u2.firstname as firstname2, u2.la $sql .= " s.nom as name, s.canvas"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : ''); + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key.', ' : ''); } // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); $sql .= $hookmanager->resPrint; $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (u.rowid = ef.fk_object)"; @@ -246,29 +356,41 @@ if ($search_categ == -2) $sql .= " AND cu.fk_categorie IS NULL"; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = 0; -$result = $db->query($sql); -if ($result) +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $nbtotalofrecords = $db->num_rows($result); + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 + { + $page = 0; + $offset = 0; + } +} +// if total of record found is smaller than limit, no need to do paging and to restart another select with limits set. +if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) +{ + $num = $nbtotalofrecords; +} else { + if ($limit) $sql .= $db->plimit($limit + 1, $offset); + + $resql = $db->query($sql); + if (!$resql) + { + dol_print_error($db); + exit; + } + + $num = $db->num_rows($resql); } -$sql .= $db->plimit($limit + 1, $offset); - -$result = $db->query($sql); -if (!$result) -{ - dol_print_error($db); - exit; -} - -$num = $db->num_rows($result); - -if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $sall) +// Direct jump if only one record found +if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) { $obj = $db->fetch_object($resql); $id = $obj->rowid; @@ -276,7 +398,10 @@ if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $ exit; } -llxHeader('', $langs->trans("ListOfUsers")); +// Output page +// -------------------------------------------------------------------- + +llxHeader('', $langs->trans("ListOfUsers"), $help_url); $param = ''; if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); @@ -299,11 +424,14 @@ if ($search_categ > 0) $param .= "&search_categ=".urlencode($search_categ); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; -$text = $langs->trans("ListOfUsers"); +// List of mass actions available +$arrayofmassactions = array(); +if ($permissiontoadd) $arrayofmassactions['disable'] = $langs->trans("DisableUser"); +if ($permissiontoadd) $arrayofmassactions['reactivate'] = $langs->trans("Reactivate"); +//if ($permissiontodelete) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); -$url = DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu='; -if (!empty($socid)) $url .= '&socid='.$socid; -$newcardbutton = dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $canadduser); +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array(); +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); print '
'."\n"; if ($optioncss != '') print ''; @@ -314,12 +442,24 @@ print ''; print ''; print ''; +$url = DOL_URL_ROOT.'/user/card.php?action=create'.($mode == 'employee' ? '&employee=1' : '').'&leftmenu='; +if (!empty($socid)) $url .= '&socid='.$socid; + +$newcardbutton = dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); + $param = array('morecss'=>'btnTitleSelected'); $morehtmlright .= dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $param); $param = array('morecss'=>'marginleftonly'); $morehtmlright .= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $param); -print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, "", $num, $nbtotalofrecords, 'user', 0, $morehtmlright.' '.$newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, $morehtmlright.' '.$newcardbutton, '', $limit, 0, 0, 1); + +// Add code for pre mass action (confirmation or email presend form) +$topicmail = "SendUserRef"; +$modelmail = "user"; +$objecttmp = new User($db); +$trackid = 'use'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if (!empty($catid)) { @@ -330,29 +470,32 @@ if (!empty($catid)) print "
"; } -if ($sall) +if ($search_all) { foreach ($fieldstosearchall as $key => $val) $fieldstosearchall[$key] = $langs->trans($val); - print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; + print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'; } $moreforfilter = ''; +/*$moreforfilter.='
'; + $moreforfilter.= $langs->trans('MyFilter') . ': '; + $moreforfilter.= '
';*/ // Filter on categories if (!empty($conf->categorie->enabled)) { $moreforfilter .= '
'; $moreforfilter .= $langs->trans('Categories').': '; - $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1); + $moreforfilter .= $formother->select_categories(Categorie::TYPE_USER, $search_categ, 'search_categ', 1); $moreforfilter .= '
'; } $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; else $moreforfilter = $hookmanager->resPrint; -if ($moreforfilter) +if (!empty($moreforfilter)) { print '
'; print $moreforfilter; @@ -360,14 +503,14 @@ if ($moreforfilter) } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; -print '
'; -print '
'."\n"; - -// Search bar +// Fields title search +// -------------------------------------------------------------------- print ''; if (!empty($arrayfields['u.login']['checked'])) { @@ -433,7 +576,7 @@ if (!empty($arrayfields['u.datepreviouslogin']['checked'])) include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); -$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['u.datec']['checked'])) { @@ -456,11 +599,10 @@ if (!empty($arrayfields['u.statut']['checked'])) } // Action column print ''; - -print "\n"; +print ''."\n"; print ''; @@ -481,21 +623,38 @@ if (!empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_ti include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['u.datec']['checked'])) print_liste_field_titre("DateCreationShort", $_SERVER["PHP_SELF"], "u.datec", "", $param, '', $sortfield, $sortorder, 'center nowrap '); if (!empty($arrayfields['u.tms']['checked'])) print_liste_field_titre("DateModificationShort", $_SERVER["PHP_SELF"], "u.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); if (!empty($arrayfields['u.statut']['checked'])) print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "u.statut", "", $param, '', $sortfield, $sortorder, 'center '); -print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); -print "\n"; +// Action column +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +print ''."\n"; +// Detect if we need a fetch on each output line +$needToFetchEachLine = 0; +if (is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) +{ + foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) + { + if (preg_match('/\$object/', $val)) $needToFetchEachLine++; // There is at least one compute field that use $object + } +} + +// Loop on record +// -------------------------------------------------------------------- $i = 0; $totalarray = array(); -while ($i < min($num, $limit)) +while ($i < ($limit ? min($num, $limit) : $num)) { - $obj = $db->fetch_object($result); + $obj = $db->fetch_object($resql); + if (empty($obj)) break; // Should not happen + + // Store properties in $object + $object->setVarsFromFetchObj($obj); $userstatic->id = $obj->rowid; $userstatic->admin = $obj->admin; @@ -512,7 +671,7 @@ while ($i < min($num, $limit)) $li = $userstatic->getNomUrl(-1, '', 0, 0, 24, 1, 'login', '', 1); - print ""; + print ''; if (!empty($arrayfields['u.login']['checked'])) { print ''; + print ''; if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['u.firstname']['checked'])) { - print ''; + print ''; if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['u.gender']['checked'])) @@ -645,8 +804,8 @@ while ($i < min($num, $limit)) // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['u.datec']['checked'])) @@ -672,23 +831,44 @@ while ($i < min($num, $limit)) if (!$i) $totalarray['nbfield']++; } // Action column - print ''; + print ''; if (!$i) $totalarray['nbfield']++; - print "\n"; + print ''."\n"; $i++; } +// Show total line +include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + +// If no record found +if ($num == 0) +{ + $colspan = 1; + foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } + print ''; +} + + +$db->free($resql); + $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); -$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; -print "
'; -$searchpicto = $form->showFilterAndCheckAddButtons(0); +$searchpicto = $form->showFilterButtons(); print $searchpicto; print '
'; @@ -529,12 +688,12 @@ while ($i < min($num, $limit)) } if (!empty($arrayfields['u.lastname']['checked'])) { - print ''.$obj->lastname.''.$obj->lastname.''.$obj->firstname.''.$obj->firstname.''; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected = 0; + if (in_array($object->id, $arrayofselected)) $selected = 1; + print ''; + } + print '
'.$langs->trans("NoRecordFound").'
"; -print '
'; -print "\n"; +print '
'."\n"; +print ''."\n"; + +print ''."\n"; -$db->free($result); // End of page llxFooter(); From 8bfc2bed3eb214668dcdbcc04ad8299fdbcbf6d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 16:27:17 +0200 Subject: [PATCH 39/46] Fix navigation into user list --- htdocs/user/list.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/list.php b/htdocs/user/list.php index d5d928f7c79..0bed08c3c31 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -447,10 +447,10 @@ if (!empty($socid)) $url .= '&socid='.$socid; $newcardbutton = dolGetButtonTitle($langs->trans('NewUser'), '', 'fa fa-plus-circle', $url, '', $permissiontoadd); -$param = array('morecss'=>'btnTitleSelected'); -$morehtmlright .= dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $param); -$param = array('morecss'=>'marginleftonly'); -$morehtmlright .= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $param); +$moreparam = array('morecss'=>'btnTitleSelected'); +$morehtmlright .= dolGetButtonTitle($langs->trans("List"), '', 'fa fa-list paddingleft imgforviewmode', DOL_URL_ROOT.'/user/list.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam); +$moreparam = array('morecss'=>'marginleftonly'); +$morehtmlright .= dolGetButtonTitle($langs->trans("HierarchicView"), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/user/hierarchy.php'.(($search_statut != '' && $search_statut >= 0) ? '?search_statut='.$search_statut : ''), '', 1, $moreparam); print_barre_liste($text, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'user', 0, $morehtmlright.' '.$newcardbutton, '', $limit, 0, 0, 1); From 2f89d526eb49b16d03138414ca4ef5789259d273 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 16:43:56 +0200 Subject: [PATCH 40/46] Avoid to get a random result. --- htdocs/stripe/class/stripe.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 2ac8193a71e..e50f48aad69 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -90,11 +90,13 @@ class Stripe extends CommonObject global $conf; $sql = "SELECT tokenstring"; - $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token WHERE"; + $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token"; + $sql .= " WHERE service = '".$this->db->escape($mode)."'"; if (empty($fk_soc)) $sql .= " entity = ".$conf->entity. " AND"; - $sql .= " service = '".$mode."'"; if ($fk_soc > 0) { $sql .= " AND fk_soc = ".$fk_soc; + } else { + $sql .= " AND fk_soc IS NULL"; } $sql .= " AND fk_user IS NULL AND fk_adherent IS NULL"; From a2efdee8656066355a436a575c8f2ad6ec3341ad Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 16:49:27 +0200 Subject: [PATCH 41/46] Fix after regression of #14886 --- htdocs/stripe/class/stripe.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index e50f48aad69..392607ad89e 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -83,16 +83,17 @@ class Stripe extends CommonObject * * @param string $mode 'StripeTest' or 'StripeLive' * @param int $fk_soc Id of thirdparty + * @param int $entity Id of entity * @return string Stripe account 'acc_....' or '' if no OAuth token found */ - public function getStripeAccount($mode = 'StripeTest', $fk_soc = 0) + public function getStripeAccount($mode = 'StripeTest', $fk_soc = 0, $entity = 1) { global $conf; $sql = "SELECT tokenstring"; $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token"; $sql .= " WHERE service = '".$this->db->escape($mode)."'"; - if (empty($fk_soc)) $sql .= " entity = ".$conf->entity. " AND"; + $sql .= " AND entity = ".((int) $entity); if ($fk_soc > 0) { $sql .= " AND fk_soc = ".$fk_soc; } else { From f5f2ea57e35eac728b309c648798d00cfdd9568f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 16:57:49 +0200 Subject: [PATCH 42/46] Fix compatibility --- htdocs/stripe/class/stripe.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 392607ad89e..83b3905de43 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -83,13 +83,15 @@ class Stripe extends CommonObject * * @param string $mode 'StripeTest' or 'StripeLive' * @param int $fk_soc Id of thirdparty - * @param int $entity Id of entity + * @param int $entity Id of entity (-1 = current environment) * @return string Stripe account 'acc_....' or '' if no OAuth token found */ - public function getStripeAccount($mode = 'StripeTest', $fk_soc = 0, $entity = 1) + public function getStripeAccount($mode = 'StripeTest', $fk_soc = 0, $entity = -1) { global $conf; + if ($entity < 0) $entity = $conf->entity; + $sql = "SELECT tokenstring"; $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token"; $sql .= " WHERE service = '".$this->db->escape($mode)."'"; From 58de8c9149d91dc21de35aca2d6386c14cc3b73d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 17:04:24 +0200 Subject: [PATCH 43/46] Close #14885 Merge manualy the PR to solve a conflict. --- htdocs/fourn/class/fournisseur.facture.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 156f2a9a1df..23f0cc1f3ea 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -34,7 +34,7 @@ * \brief File of class to manage suppliers invoices */ -include_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commoninvoice.class.php'; require_once DOL_DOCUMENT_ROOT.'/multicurrency/class/multicurrency.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -765,7 +765,7 @@ class FactureFournisseur extends CommonInvoice $sql .= ', f.localtax1_tx, f.localtax2_tx, f.localtax1_type, f.localtax2_type, f.total_localtax1, f.total_localtax2, f.fk_facture_fourn '; $sql .= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql .= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; - $sql .= ', f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc'; + $sql .= ', fk_code_ventilation, f.fk_multicurrency, f.multicurrency_code, f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, f.multicurrency_total_ttc'; $sql .= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql .= ' WHERE fk_facture_fourn='.$this->id; @@ -825,6 +825,10 @@ class FactureFournisseur extends CommonInvoice $line->rang = $obj->rang; $line->fk_unit = $obj->fk_unit; + // Accountancy + $line->code_ventilation = $obj->fk_code_ventilation; + $line->fk_accounting_account = $obj->fk_code_ventilation; + // Multicurrency $line->fk_multicurrency = $obj->fk_multicurrency; $line->multicurrency_code = $obj->multicurrency_code; From 2f5a2d0e281e1d192609418bcb77ca3d4bd31448 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 1 Oct 2020 17:42:04 +0200 Subject: [PATCH 44/46] fix CSRF not provided --- htdocs/core/filemanagerdol/browser/default/frmupload.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/filemanagerdol/browser/default/frmupload.php b/htdocs/core/filemanagerdol/browser/default/frmupload.php index 08c76f374e4..e0f0f03e430 100644 --- a/htdocs/core/filemanagerdol/browser/default/frmupload.php +++ b/htdocs/core/filemanagerdol/browser/default/frmupload.php @@ -122,6 +122,7 @@ window.onload = function()
+
From ece8037f426c420f43bd23616d859b6322ee7d61 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 18:08:46 +0200 Subject: [PATCH 45/46] The button "Invoice orders" switch to page with lines autoselected. --- htdocs/comm/card.php | 2 +- htdocs/commande/customer.php | 2 +- htdocs/commande/list.php | 12 +++++++++++- htdocs/core/class/html.form.class.php | 18 ++++++++---------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 8df97d1031f..6f1a40b2fb0 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1283,7 +1283,7 @@ if ($object->id > 0) { if ($object->client != 0 && $object->client != 2) { - if (!empty($orders2invoice) && $orders2invoice > 0) print ''; + if (!empty($orders2invoice) && $orders2invoice > 0) print ''; else print ''; } else print ''; } diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index f78d6ce2e84..f2f806cc7af 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -164,7 +164,7 @@ if ($resql) $result = ''; $link = $linkend = ''; - $link = ''; + $link = ''; $linkend = ''; $name = $obj->name; $result .= ($link.img_object($langs->trans("ShowCompany").': '.$name, 'company').$linkend); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1acd515a49a..82fde75966b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -624,6 +624,16 @@ if ($resql) $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + if (GETPOST('autoselectall', 'int')) { + $selectedfields .= ''; + } + print '
'; print ''."\n"; @@ -1092,7 +1102,7 @@ if ($resql) { if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) { - print ' '; + print ' '; print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').''; } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e00d544ed22..7bf559240d9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -647,7 +647,7 @@ class Form $disabled = 0; $ret = '
'; - $ret .= ''; // Complete list with data from external modules. THe module can use $_SERVER['PHP_SELF'] to know on which page we are, or use the $parameters['currentcontext'] completed by executeHooks. $parameters = array(); @@ -7552,8 +7552,8 @@ class Form global $conf, $langs; $out = ''; - $id = uniqid(); - if (!empty($conf->use_javascript_ajax)) $out .= '
'; + + if (!empty($conf->use_javascript_ajax)) $out .= '
'; $out .= ''; + $(".' . $cssclass.'").change(function() { + $(this).closest("tr").toggleClass("highlight", this.checked); + }); + }); + '; return $out; } From d912908aef1744e68a06e289e01ac01f3d8e4a22 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 1 Oct 2020 19:05:20 +0200 Subject: [PATCH 46/46] NEW Can build vendor invoice from vendor orders --- htdocs/comm/card.php | 4 +- htdocs/commande/list.php | 4 +- htdocs/core/actions_massactions.inc.php | 4 +- htdocs/fourn/card.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 5 +- htdocs/fourn/commande/list.php | 214 +++++++++++------- 6 files changed, 145 insertions(+), 88 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 6f1a40b2fb0..79278fef056 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -777,8 +777,6 @@ if ($object->id > 0) print '
'; print ''; print ''; } @@ -1283,7 +1281,7 @@ if ($object->id > 0) { if ($object->client != 0 && $object->client != 2) { - if (!empty($orders2invoice) && $orders2invoice > 0) print ''; + if (!empty($orders2invoice) && $orders2invoice > 0) print ''; else print ''; } else print ''; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 82fde75966b..ad422a8b930 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1102,7 +1102,7 @@ if ($resql) { if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) { - print ' '; + print ' '; print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').''; } } @@ -1299,7 +1299,7 @@ if ($resql) } // Action column - print '
'; print ''; - //if($num2 > 0) print ''; - //else print ''; print '
'.$langs->trans("LastCustomerOrders", ($num <= $MAXLIST ? "" : $MAXLIST)).''.$langs->trans("AllOrders").''.$num.''.img_picto($langs->trans("Statistics"), 'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; + print ''; if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined { $selected = 0; diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 2bdae583429..c2f0a314445 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -615,7 +615,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders $cmd->fetch_optionals(); $objecttmp->socid = $cmd->socid; - $objecttmp->type = Facture::TYPE_STANDARD; + $objecttmp->type = $objecttmp::TYPE_STANDARD; $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; $objecttmp->fk_project = $cmd->fk_project; @@ -742,7 +742,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders 'HT', 0, $product_type, - $ii, + $lines[$i]->rang, $lines[$i]->special_code, $objecttmp->origin, $lines[$i]->rowid, diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 8488abeee30..1de6d30b681 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -798,7 +798,7 @@ if ($object->id > 0) if ($object->status == 1) { // Company is open - print ''; + print ''; } else { print ''; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 23f0cc1f3ea..0c0e32a2055 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1601,9 +1601,10 @@ class FactureFournisseur extends CommonInvoice * @param double $pu_ht_devise Amount in currency * @param string $ref_supplier Supplier ref * @param string $special_code Special code + * @param int $fk_parent_line Parent line id * @return int >0 if OK, <0 if KO */ - public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '', $special_code = '') + public function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = '', $price_base_type = 'HT', $type = 0, $rang = -1, $notrigger = false, $array_options = 0, $fk_unit = null, $origin_id = 0, $pu_ht_devise = 0, $ref_supplier = '', $special_code = '', $fk_parent_line = 0) { global $langs, $mysoc, $conf; @@ -1777,7 +1778,7 @@ class FactureFournisseur extends CommonInvoice $this->line->info_bits = $info_bits; $this->line->special_code = ((string) $special_code != '' ? $special_code : $this->special_code); - $this->line->fk_parent_line = $this->fk_parent_line; + $this->line->fk_parent_line = $fk_parent_line; $this->line->origin = $this->origin; $this->line->origin_id = $origin_id; $this->line->fk_unit = $fk_unit; diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 6be60c04249..48613e67d43 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -130,6 +131,9 @@ $fieldstosearchall = array( 'cf.ref_supplier'=>'RefSupplierOrder', 'pd.description'=>'Description', 's.nom'=>"ThirdParty", + 's.name_alias'=>"AliasNameShort", + 's.zip'=>"Zip", + 's.town'=>"Town", 'cf.note_public'=>'NotePublic', ); if (empty($user->socid)) $fieldstosearchall["cf.note_private"] = "NotePrivate"; @@ -180,7 +184,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; } -if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; } +if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createsupplierbills') { $massaction = ''; } $parameters = array('socid'=>$socid); $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks @@ -244,7 +248,7 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; // TODO Move this into mass action include - if ($massaction == 'confirm_createbills') + if ($massaction == 'confirm_createsupplierbills') { $orders = GETPOST('toselect', 'array'); $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); @@ -258,34 +262,36 @@ if (empty($reshook)) $db->begin(); foreach ($orders as $id_order) { - $cmd = new Commande($db); + $cmd = new CommandeFournisseur($db); if ($cmd->fetch($id_order) <= 0) continue; - $object = new Facture($db); - if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. + $objecttmp = new FactureFournisseur($db); + if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. else { - $object->socid = $cmd->socid; - $object->type = Facture::TYPE_STANDARD; - $object->cond_reglement_id = $cmd->cond_reglement_id; - $object->mode_reglement_id = $cmd->mode_reglement_id; - $object->fk_project = $cmd->fk_project; + $objecttmp->socid = $cmd->socid; + $objecttmp->type = $objecttmp::TYPE_STANDARD; + $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; + $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; + $objecttmp->fk_project = $cmd->fk_project; + $objecttmp->multicurrency_code = $cmd->multicurrency_code; + if (empty($createbills_onebythird)) $objecttmp->ref_client = $cmd->ref_client; - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($datefacture)) { - $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); + $datefacture = dol_now(); } - $object->date = $datefacture; - $object->origin = 'commande'; - $object->origin_id = $id_order; + $objecttmp->date = $datefacture; + $objecttmp->origin = 'order_supplier'; + $objecttmp->origin_id = $id_order; - $res = $object->create($user); + $res = $objecttmp->create($user); if ($res > 0) $nb_bills_created++; } - if ($object->id > 0) + if ($objecttmp->id > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; $sql .= "fk_source"; @@ -294,9 +300,9 @@ if (empty($reshook)) $sql .= ", targettype"; $sql .= ") VALUES ("; $sql .= $id_order; - $sql .= ", '".$db->escape($object->origin)."'"; - $sql .= ", ".$object->id; - $sql .= ", '".$db->escape($object->element)."'"; + $sql .= ", '".$db->escape($objecttmp->origin)."'"; + $sql .= ", ".$objecttmp->id; + $sql .= ", '".$db->escape($objecttmp->element)."'"; $sql .= ")"; if (!$db->query($sql)) @@ -323,7 +329,7 @@ if (empty($reshook)) { // Negative line, we create a discount line $discount = new DiscountAbsolute($db); - $discount->fk_soc = $object->socid; + $discount->fk_soc = $objecttmp->socid; $discount->amount_ht = abs($lines[$i]->total_ht); $discount->amount_tva = abs($lines[$i]->total_tva); $discount->amount_ttc = abs($lines[$i]->total_ttc); @@ -333,7 +339,7 @@ if (empty($reshook)) $discountid = $discount->create($user); if ($discountid > 0) { - $result = $object->insert_discount($discountid); + $result = $objecttmp->insert_discount($discountid); //$result=$discount->link_to_invoice($lineid,$id); } else { setEventMessages($discount->error, $discount->errors, 'errors'); @@ -358,32 +364,31 @@ if (empty($reshook)) { $fk_parent_line = 0; } - $result = $object->addline( + $result = $objecttmp->addline( $desc, $lines[$i]->subprice, - $lines[$i]->qty, $lines[$i]->tva_tx, $lines[$i]->localtax1_tx, $lines[$i]->localtax2_tx, - $lines[$i]->fk_product, + $lines[$i]->qty, + $lines[$i]->fk_product, $lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, - 'HT', - 0, - $product_type, - $ii, - $lines[$i]->special_code, - $object->origin, - $lines[$i]->rowid, - $fk_parent_line, - $lines[$i]->fk_fournprice, - $lines[$i]->pa_ht, - $lines[$i]->label - ); + 'HT', + $product_type, + $lines[$i]->rang, + false, + $lines[$i]->array_options, + $lines[$i]->fk_unit, + $objecttmp->origin_id, + $lines[$i]->pa_ht, + $lines[$i]->ref_supplier, + $lines[$i]->special_code, + $fk_parent_line + ); if ($result > 0) { $lineid = $result; @@ -404,8 +409,8 @@ if (empty($reshook)) $cmd->classifyBilled($user); // TODO Move this in workflow like done for customer orders - if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object; - else $TFact[$object->id] = $object; + if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $objecttmp; + else $TFact[$objecttmp->id] = $objecttmp; } // Build doc with all invoices @@ -415,38 +420,67 @@ if (empty($reshook)) if (!$error && $validate_invoices) { $massaction = $action = 'builddoc'; - foreach ($TAllFact as &$object) + foreach ($TAllFact as &$objecttmp) { - $object->validate($user); + $objecttmp->validate($user); if ($result <= 0) { $error++; - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); break; } - $id = $object->id; // For builddoc action + $id = $objecttmp->id; // For builddoc action // Fac builddoc $donotredirect = 1; - $upload_dir = $conf->facture->dir_output; - $permissiontoadd = $user->rights->facture->creer; - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + $upload_dir = $conf->fournisseur->facture->dir_output; + $permissiontoadd = $user->rights->fournisseur->facture->creer; + //include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } - $massaction = $action = 'confirm_createbills'; + $massaction = $action = 'confirm_createsupplierbills'; } if (!$error) { $db->commit(); setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); + + // Make a redirect to avoid to bill twice if we make a refresh or back + $param = ''; + 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); + if ($socid > 0) $param .= '&socid='.urlencode($socid); + 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); + if ($search_deliveryday) $param .= '&search_deliveryday='.urlencode($search_deliveryday); + if ($search_deliverymonth) $param .= '&search_deliverymonth='.urlencode($search_deliverymonth); + if ($search_deliveryyear) $param .= '&search_deliveryyear='.urlencode($search_deliveryyear); + if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); + if ($search_company) $param .= '&search_company='.urlencode($search_company); + if ($search_ref_customer) $param .= '&search_ref_customer='.urlencode($search_ref_customer); + if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); + if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); + if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht); + if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat); + if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc); + if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref); + if ($show_files) $param .= '&show_files='.urlencode($show_files); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($billed != '') $param .= '&billed='.urlencode($billed); + + header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); + exit; } else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; $_GET["originid"] = $_POST["originid"]; - setEventMessages($object->error, $object->errors, 'errors'); + setEventMessages("Error", null, 'errors'); $error++; } } @@ -566,6 +600,7 @@ $sql .= $hookmanager->resPrint; $sql .= $db->order($sortfield, $sortorder); +// Count total nb of records $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -579,6 +614,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) } $sql .= $db->plimit($limit + 1, $offset); +//print $sql; $resql = $db->query($sql); if ($resql) @@ -607,23 +643,24 @@ if ($resql) llxHeader('', $title, $help_url); $param = ''; - if ($socid > 0) $param .= '&socid='.$socid; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - if ($sall) $param .= "&search_all=".$sall; - if ($search_orderday) $param .= '&search_orderday='.$search_orderday; - if ($search_ordermonth) $param .= '&search_ordermonth='.$search_ordermonth; - if ($search_orderyear) $param .= '&search_orderyear='.$search_orderyear; - if ($search_deliveryday) $param .= '&search_deliveryday='.$search_deliveryday; - if ($search_deliverymonth) $param .= '&search_deliverymonth='.$search_deliverymonth; - if ($search_deliveryyear) $param .= '&search_deliveryyear='.$search_deliveryyear; - if ($search_ref) $param .= '&search_ref='.$search_ref; - if ($search_company) $param .= '&search_company='.$search_company; - if ($search_user > 0) $param .= '&search_user='.$search_user; - if ($search_request_author) $param .= '&search_request_author='.$search_request_author; - if ($search_sale > 0) $param .= '&search_sale='.$search_sale; - if ($search_total_ht != '') $param .= '&search_total_ht='.$search_total_ht; - if ($search_total_ttc != '') $param .= "&search_total_ttc=".$search_total_ttc; + 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); + if ($socid > 0) $param .= '&socid='.urlencode($socid); + if ($sall) $param .= "&search_all=".urlencode($sall); + 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); + if ($search_deliveryday) $param .= '&search_deliveryday='.urlencode($search_deliveryday); + if ($search_deliverymonth) $param .= '&search_deliverymonth='.urlencode($search_deliverymonth); + if ($search_deliveryyear) $param .= '&search_deliveryyear='.urlencode($search_deliveryyear); + if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); + if ($search_company) $param .= '&search_company='.urlencode($search_company); + if ($search_user > 0) $param .= '&search_user='.urlencode($search_user); + if ($search_request_author) $param .= '&search_request_author='.urlencode($search_request_author); + if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale); + if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht); + if ($search_total_ttc != '') $param .= "&search_total_ttc=".urlencode($search_total_ttc); if ($search_multicurrency_code != '') $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code); if ($search_multicurrency_tx != '') $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx); if ($search_multicurrency_montant_ht != '') $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht); @@ -644,7 +681,7 @@ if ($resql) 'builddoc'=>$langs->trans("PDFMerge"), 'presend'=>$langs->trans("SendByMail"), ); - //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); + if ($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier"); if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['predelete'] = ''.$langs->trans("Delete"); if (in_array($massaction, array('presend', 'predelete', 'createbills'))) $arrayofmassactions = array(); $massactionbutton = $form->selectMassAction('', $arrayofmassactions); @@ -653,15 +690,16 @@ if ($resql) if (!empty($socid)) $url .= '&socid='.$socid; $newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $user->rights->fournisseur->commande->creer); - // Fields title search - print ''; + // Lines of title fields + print ''; if ($optioncss != '') print ''; print ''; print ''; print ''; - print ''; print ''; print ''; + print ''; + print ''; print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit, 0, 0, 1); @@ -674,11 +712,11 @@ if ($resql) if ($massaction == 'createbills') { //var_dump($_REQUEST); - print ''; + print ''; - print ''; + print '
'; print ''; - print ''; print '
'; + print ''; print $langs->trans('DateInvoice'); print ''; @@ -760,7 +798,17 @@ if ($resql) $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields - if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + + if (GETPOST('autoselectall', 'int')) { + $selectedfields .= ''; + } print '
'; print ''."\n"; @@ -933,6 +981,7 @@ if ($resql) print "\n"; + // Fields title print ''; if (!empty($arrayfields['cf.ref']['checked'])) print_liste_field_titre($arrayfields['cf.ref']['label'], $_SERVER["PHP_SELF"], "cf.ref", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['cf.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['cf.ref_supplier']['label'], $_SERVER["PHP_SELF"], "cf.ref_supplier", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax100imp '); @@ -983,6 +1032,12 @@ if ($resql) { $obj = $db->fetch_object($resql); + $notshippable = 0; + $warning = 0; + $text_info = ''; + $text_warning = ''; + $nbprod = 0; + $objectstatic->id = $obj->rowid; $objectstatic->ref = $obj->ref; $objectstatic->ref_supplier = $obj->ref_supplier; @@ -1220,22 +1275,25 @@ if ($resql) if (!$i) $totalarray['nbfield']++; print "\n"; + + $total += $obj->total_ht; + $subtotal += $obj->total_ht; $i++; } // Show total line include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php'; + $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; - print "
\n"; - print '
'; - print "\n"; + print '
'."\n"; + print ''; - $db->free($resql); + print ''."\n"; $hidegeneratedfilelistifempty = 1; if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;