From a733628e10b1259610f26312834d69022c7b71a9 Mon Sep 17 00:00:00 2001 From: Erik van Berkum Date: Tue, 31 Aug 2021 08:13:15 +0900 Subject: [PATCH 001/154] Fix: select products in BOM, when adding new item the $conf->product->limit_size blocks loading all --- htdocs/bom/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 210ab695ec8..52cea154c0f 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -100,9 +100,9 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $statustoshow = -1; if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, 0, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { - $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, 0, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } echo ''; From cda25b711542d13eeef178748b7ea1f40735f9b5 Mon Sep 17 00:00:00 2001 From: Erik van Berkum Date: Fri, 3 Sep 2021 10:41:33 +0900 Subject: [PATCH 002/154] Previous commit was not a bug --- htdocs/bom/tpl/objectline_create.tpl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index 52cea154c0f..210ab695ec8 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -100,9 +100,9 @@ if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) { $statustoshow = -1; if (!empty($conf->global->ENTREPOT_EXTRA_STATUS)) { // hide products in closed warehouse, but show products for internal transfer - $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, 0, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } else { - $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, 0, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); + $form->select_produits(GETPOST('idprod', 'int'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } echo ''; From 940f77fb61a06f5789242be8b6c5ca35bd705c01 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 5 Sep 2021 12:15:11 +0200 Subject: [PATCH 003/154] fix entity knowledgerecord --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 6b192c4a83e..632317958c5 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -102,7 +102,8 @@ class KnowledgeRecord extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1), 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -119,6 +120,7 @@ class KnowledgeRecord extends CommonObject ); public $rowid; public $ref; + public $entity; public $date_creation; public $tms; public $last_main_doc; From 3ea23d75fec8990e51b638544e36ec0f2c42e2fd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 5 Sep 2021 10:17:23 +0000 Subject: [PATCH 004/154] Fixing style errors. --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 632317958c5..4c718589d7c 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -103,7 +103,7 @@ class KnowledgeRecord extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1), 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), @@ -120,7 +120,7 @@ class KnowledgeRecord extends CommonObject ); public $rowid; public $ref; - public $entity; + public $entity; public $date_creation; public $tms; public $last_main_doc; From 9d89e48d154276396e0dcd1c217cfa59577ac7df Mon Sep 17 00:00:00 2001 From: Julien Gainza Date: Mon, 6 Sep 2021 15:55:33 +0200 Subject: [PATCH 005/154] Fix : Add extrafields on API "get events list" --- htdocs/comm/action/class/api_agendaevents.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index d9feb4472b6..bf35ed95be0 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -171,6 +171,7 @@ class AgendaEvents extends DolibarrApi $obj = $db->fetch_object($result); $actioncomm_static = new ActionComm($db); if ($actioncomm_static->fetch($obj->rowid)) { + $actioncomm_static->fetch_optionals(); $obj_ret[] = $this->_cleanObjectDatas($actioncomm_static); } $i++; From a39f469a503de75d5404d1e4faf7a9e8d0f952d9 Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 7 Sep 2021 22:31:09 +1100 Subject: [PATCH 006/154] Only check takepos configuration if a terminal is choosen, to prevent error message --- htdocs/takepos/index.php | 51 +++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 1ddab39dcbe..61edb446963 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -978,36 +978,39 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { query($sql); -$paiementsModes = array(); -if ($resql) { - while ($obj = $db->fetch_object($resql)) { - $paycode = $obj->code; - if ($paycode == 'LIQ') { - $paycode = 'CASH'; - } - if ($paycode == 'CHQ') { - $paycode = 'CHEQUE'; - } + $resql = $db->query( $sql ); + $paiementsModes = array(); + if ( $resql ) { + while ( $obj = $db->fetch_object( $resql ) ) { + $paycode = $obj->code; + if ( $paycode == 'LIQ' ) { + $paycode = 'CASH'; + } + if ( $paycode == 'CHQ' ) { + $paycode = 'CHEQUE'; + } - $constantforkey = "CASHDESK_ID_BANKACCOUNT_".$paycode.$_SESSION["takeposterminal"]; - //var_dump($constantforkey.' '.$conf->global->$constantforkey); - if (!empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) { - array_push($paiementsModes, $obj); + $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"]; + //var_dump($constantforkey.' '.$conf->global->$constantforkey); + if ( ! empty( $conf->global->$constantforkey ) && $conf->global->$constantforkey > 0 ) { + array_push( $paiementsModes, $obj ); + } } } + + if ( empty( $paiementsModes ) ) { + $langs->load( 'errors' ); + setEventMessages( $langs->trans( "ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv( "TakePOS" ) ), null, 'errors' ); + setEventMessages( $langs->trans( "ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"] ), null, 'errors' ); + } } -if (empty($paiementsModes)) { - $langs->load('errors'); - setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors'); - setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors'); -} if (count($maincategories) == 0) { if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) { $tmpcategory = new Categorie($db); From 807b4bf93e8b9662a4c393ba62191895087915ea Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 7 Sep 2021 22:42:17 +1100 Subject: [PATCH 007/154] Fix cash payment in some cases. Make pay requests language independant and rely on payment method code. --- htdocs/takepos/invoice.php | 6 ++---- htdocs/takepos/pay.php | 15 +++------------ 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 0c00fcdd938..4130ac5c3cb 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -188,11 +188,9 @@ if ($action == 'valid' && $user->rights->facture->creer) { if (!empty($conf->global->TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT)) { $bankaccount = GETPOST('accountid', 'int'); } else { - if ($pay == "cash") { + if ($pay == 'LIQ') { $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility - } elseif ($pay == "card") { - $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takeposterminal"]}; // For backward compatibility - } elseif ($pay == "cheque") { + } elseif ($pay == "CHQ") { $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility } else { $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index ba8ac8f82f7..6e22f27f7ff 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -316,23 +316,20 @@ print ''; + print ''; } else { print ''; } @@ -345,23 +342,20 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; @@ -375,23 +369,20 @@ print ''; + print ''; } else { $button = array_pop($action_buttons); print ''; From c8af143468460be7a252412a89b5ac282fd1d429 Mon Sep 17 00:00:00 2001 From: Laurent Dinclaux Date: Tue, 7 Sep 2021 23:27:31 +1100 Subject: [PATCH 008/154] Fix coding standards --- htdocs/takepos/index.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 61edb446963..415281af65d 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -978,36 +978,36 @@ if (empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { query( $sql ); + $resql = $db->query($sql); $paiementsModes = array(); - if ( $resql ) { - while ( $obj = $db->fetch_object( $resql ) ) { + if ($resql) { + while ( $obj = $db->fetch_object($resql) ) { $paycode = $obj->code; - if ( $paycode == 'LIQ' ) { + if ($paycode == 'LIQ') { $paycode = 'CASH'; } - if ( $paycode == 'CHQ' ) { + if ($paycode == 'CHQ') { $paycode = 'CHEQUE'; } $constantforkey = "CASHDESK_ID_BANKACCOUNT_" . $paycode . $_SESSION["takeposterminal"]; //var_dump($constantforkey.' '.$conf->global->$constantforkey); - if ( ! empty( $conf->global->$constantforkey ) && $conf->global->$constantforkey > 0 ) { - array_push( $paiementsModes, $obj ); + if ( ! empty($conf->global->$constantforkey) && $conf->global->$constantforkey > 0) { + array_push($paiementsModes, $obj); } } } - if ( empty( $paiementsModes ) ) { - $langs->load( 'errors' ); - setEventMessages( $langs->trans( "ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv( "TakePOS" ) ), null, 'errors' ); - setEventMessages( $langs->trans( "ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"] ), null, 'errors' ); + if (empty($paiementsModes)) { + $langs->load('errors'); + setEventMessages($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("TakePOS")), null, 'errors'); + setEventMessages($langs->trans("ProblemIsInSetupOfTerminal", $_SESSION["takeposterminal"]), null, 'errors'); } } From 2fe85f2a86a2c6002608e816c25ee6d35fca21da Mon Sep 17 00:00:00 2001 From: lainwir3d Date: Sun, 12 Sep 2021 15:47:56 +0400 Subject: [PATCH 009/154] CLOSE #18689 REST API module: add api key generate / modify right. --- htdocs/core/ajax/security.php | 2 +- htdocs/core/modules/modApi.class.php | 14 ++++++++------ htdocs/user/card.php | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index 066e5b7812d..0056120c6bd 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -53,7 +53,7 @@ top_httphead(); // Registering the location of boxes if (isset($_GET['action']) && !empty($_GET['action'])) { - if ($_GET['action'] == 'getrandompassword' && $user->admin) { + if ($_GET['action'] == 'getrandompassword' && ($user->admin || $user->rights->api->apikey->generate)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $generic = $_GET['generic'] ? true : false; echo getRandomPassword($generic); diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index ffd274c7096..60145c73e1d 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -134,16 +134,18 @@ class modApi extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module + $this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled) + $r = 0; // Add here list of permission defined by an id, a label, a boolean and two constant strings. // Example: - // $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) - // $this->rights[$r][1] = 'Permision label'; // Permission label - // $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - // $this->rights[$r][4] = 'level1'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $this->rights[$r][5] = 'level2'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) - // $r++; + $this->rights[$r][0] = $this->numero + $r; // Permission id (must not be already used) + $this->rights[$r][1] = 'Générer / modifier la clé API des utilisateurs'; // Permission label + $this->rights[$r][3] = 0; // Permission by default for new user (0/1) + $this->rights[$r][4] = 'apikey'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $this->rights[$r][5] = 'generate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2) + $r++; // Main menu entries diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8d03d1d1cfb..f12060e9f50 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1805,7 +1805,7 @@ if ($action == 'create' || $action == 'adduserldap') { print ''."\n"; // API key - if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin)) { + if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->rights->api->apikey->generate)) { print ''.$langs->trans("ApiKey").''; print ''; if (!empty($object->api_key)) { @@ -2328,7 +2328,7 @@ if ($action == 'create' || $action == 'adduserldap') { print "\n"; // API key - if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin)) { + if (!empty($conf->api->enabled) && ($user->id == $id || $user->admin || $user->rights->api->apikey->generate)) { print ''.$langs->trans("ApiKey").''; print ''; print ''; From e424df644718e86f4730f37763af059902d3494d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 12 Sep 2021 12:15:33 +0000 Subject: [PATCH 010/154] Fixing style errors. --- htdocs/core/modules/modApi.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index 60145c73e1d..254e3f86983 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -135,7 +135,7 @@ class modApi extends DolibarrModules // Permissions $this->rights = array(); // Permission array used by this module $this->rights_admin_allowed = 1; // Admin is always granted of permission (even when module is disabled) - + $r = 0; // Add here list of permission defined by an id, a label, a boolean and two constant strings. From 4762fd9c2e7bff8cdef7536c6c11693fc0e09353 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 13 Sep 2021 11:22:55 +0200 Subject: [PATCH 011/154] Close #18678 : Implemention of tags/categories KM --- htdocs/categories/class/categorie.class.php | 10 ++++-- htdocs/core/actions_addupdatedelete.inc.php | 9 +++++ .../modules/modKnowledgeManagement.class.php | 13 +++++++ .../install/mysql/migration/14.0.0-15.0.0.sql | 14 ++++++++ .../llx_categorie_ knowledgemanagement.sql | 21 +++++++++++ .../llx_categorie_knowledgemanagement.sql | 20 +++++++++++ .../class/knowledgerecord.class.php | 25 +++++++++++++ .../knowledgerecord_card.php | 35 +++++++++++++++++++ 8 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql create mode 100644 htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index ba5515149d4..d5c135279bf 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -58,6 +58,7 @@ class Categorie extends CommonObject const TYPE_ACTIONCOMM = 'actioncomm'; const TYPE_WEBSITE_PAGE = 'website_page'; const TYPE_TICKET = 'ticket'; + const TYPE_KNOWLEDGEMANAGEMENT = 'knowledgemanagement'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -81,7 +82,8 @@ class Categorie extends CommonObject 'warehouse' => 9, 'actioncomm' => 10, 'website_page' => 11, - 'ticket' => 12 + 'ticket' => 12, + 'knowledgemanagement' => 13 ); /** @@ -102,7 +104,8 @@ class Categorie extends CommonObject 9 => 'warehouse', 10 => 'actioncomm', 11 => 'website_page', - 12 => 'ticket' + 12 => 'ticket', + 13 => 'knowledgemanagement' ); /** @@ -146,7 +149,8 @@ class Categorie extends CommonObject 'warehouse'=> 'Entrepot', 'actioncomm' => 'ActionComm', 'website_page' => 'WebsitePage', - 'ticket' => 'Ticket' + 'ticket' => 'Ticket', + 'knowledgemanagement' => 'KnowledgeRecord' ); /** diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 1154252a348..8364c139bae 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -131,6 +131,10 @@ if ($action == 'add' && !empty($permissiontoadd)) { $result = $object->create($user); if ($result > 0) { // Creation OK + if ($conf->categorie->enabled) { + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + } $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation header("Location: ".$urltogo); @@ -229,6 +233,11 @@ if ($action == 'update' && !empty($permissiontoadd)) { } } } + + if ($conf->categorie->enabled) { + $categories = GETPOST('categories', 'array'); + $object->setCategories($categories); + } } // Fill array 'array_options' with data from add form diff --git a/htdocs/core/modules/modKnowledgeManagement.class.php b/htdocs/core/modules/modKnowledgeManagement.class.php index c3be87963c8..afd20a94a04 100644 --- a/htdocs/core/modules/modKnowledgeManagement.class.php +++ b/htdocs/core/modules/modKnowledgeManagement.class.php @@ -362,6 +362,19 @@ class modKnowledgeManagement extends DolibarrModules // 0=Menu for internal users, 1=external users, 2=both 'user'=>2 ); + $this->menu[$r++] = array( + 'fk_menu' => 'fk_mainmenu=ticket,fk_leftmenu=knowledgemanagement_knowledgerecord', + 'type' => 'left', + 'titre' => 'Categories', + 'mainmenu' => 'ticket', + 'url' => '/categories/index.php?type=13', + 'langs' => 'knowledgemanagement', + 'position' => 112, + 'enabled' => '$conf->knowledgemanagement->enabled', + 'perms' => '$user->rights->knowledgemanagement->knowledgerecord->read', + 'target' => '', + 'user' => 0 + ); /* END MODULEBUILDER LEFTMENU KNOWLEDGERECORD */ diff --git a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql index fb37c2f94d2..73a52a98220 100644 --- a/htdocs/install/mysql/migration/14.0.0-15.0.0.sql +++ b/htdocs/install/mysql/migration/14.0.0-15.0.0.sql @@ -84,3 +84,17 @@ DELETE FROM llx_menu WHERE type = 'top' AND module = 'cashdesk' AND mainmenu = ' INSERT INTO llx_c_action_trigger (code, label, description, elementtype, rang) values ('MEMBER_EXCLUDE', 'Member excluded', 'Executed when a member is excluded', 'member', 27); + +CREATE TABLE llx_categorie_knowledgemanagement +( + fk_categorie integer NOT NULL, + fk_knowledgemanagement integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; + +ALTER TABLE llx_categorie_knowledgemanagement ADD PRIMARY KEY pk_categorie_knowledgemanagement (fk_categorie, fk_knowledgemanagement); +ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_knowledgemanagement (fk_knowledgemanagement); + +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement (rowid); diff --git a/htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql new file mode 100644 index 00000000000..47769643bd5 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql @@ -0,0 +1,21 @@ +-- Copyright (C) 2021 EOXIA +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +ALTER TABLE llx_categorie_knowledgemanagement ADD PRIMARY KEY pk_categorie_knowledgemanagement (fk_categorie, fk_knowledgemanagement); +ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_categorie (fk_categorie); +ALTER TABLE llx_categorie_knowledgemanagement ADD INDEX idx_categorie_knowledgemanagement_fk_knowledgemanagement (fk_knowledgemanagement); + +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_categorie_rowid FOREIGN KEY (fk_categorie) REFERENCES llx_categorie (rowid); +ALTER TABLE llx_categorie_knowledgemanagement ADD CONSTRAINT fk_categorie_knowledgemanagement_knowledgemanagement_rowid FOREIGN KEY (fk_knowledgemanagement) REFERENCES llx_knowledgemanagement (rowid); diff --git a/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql new file mode 100644 index 00000000000..9489cca9652 --- /dev/null +++ b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.sql @@ -0,0 +1,20 @@ +-- Copyright (C) 2021 EOXIA +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see https://www.gnu.org/licenses/. + +create table llx_categorie_knowledgemanagement + fk_categorie integer NOT NULL, + fk_knowledgemanagement integer NOT NULL, + import_key varchar(14) +)ENGINE=innodb; diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index df8044c8fc9..6394e22952c 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -456,6 +456,15 @@ class KnowledgeRecord extends CommonObject */ public function delete(User $user, $notrigger = false) { + $error = 0; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_member WHERE fk_member = ".((int) $this->rowid); + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) { + $error++; + $this->error .= $this->db->lasterror(); + $errorflag = -1; + } return $this->deleteCommon($user, $notrigger); //return $this->deleteCommon($user, $notrigger, 1); } @@ -1036,6 +1045,22 @@ class KnowledgeRecord extends CommonObject return $error; } + + /** + * Sets object to supplied categories. + * + * Deletes object from existing categories not supplied. + * Adds it to non existing supplied categories. + * Existing categories are left untouch. + * + * @param int[]|int $categories Category or categories IDs + * @return void + */ + public function setCategories($categories) + { + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + return parent::setCategoriesCommon($categories, Categorie::TYPE_KNOWLEDGEMANAGEMENT); + } } diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 08092696cab..45c821fe9f8 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -31,6 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/class/knowledgerecord.class.php'; require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_knowledgerecord.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "ticket", "other")); @@ -191,7 +192,16 @@ if ($action == 'create') { // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + if ($conf->categorie->enabled) { + $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); + if (count($cate_arbo)) { + // Categories + print ''.$langs->trans("Categories").''; + print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print ""; + } + } // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; @@ -229,6 +239,24 @@ if (($id || $ref) && $action == 'edit') { // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; + if ($conf->categorie->enabled) { + $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); + + if (count($cate_arbo)) { + // Categories + print ''.$langs->trans("Categories").''; + $c = new Categorie($db); + $cats = $c->containing($object->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT); + $arrayselected = array(); + if (is_array($cats)) { + foreach ($cats as $cat) { + $arrayselected[] = $cat->id; + } + } + print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); + print ""; + } + } // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; @@ -335,6 +363,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea //unset($object->fields['fk_soc']); // Hide field already shown in banner include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; + // Categories + if ($conf->categorie->enabled) { + print ''.$langs->trans("Categories").''; + print $form->showCategories($object->id, Categorie::TYPE_KNOWLEDGEMANAGEMENT, 1); + print ""; + } + // Other attributes. Fields from hook formObjectOptions and Extrafields. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; From 35ca516ef6cbee280a7316c71b95fa4adbca5a6a Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 13 Sep 2021 11:24:43 +0200 Subject: [PATCH 012/154] update knowledgerecord_card --- htdocs/knowledgemanagement/knowledgerecord_card.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/knowledgemanagement/knowledgerecord_card.php b/htdocs/knowledgemanagement/knowledgerecord_card.php index 45c821fe9f8..4b35e3be1c3 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_card.php +++ b/htdocs/knowledgemanagement/knowledgerecord_card.php @@ -192,6 +192,7 @@ if ($action == 'create') { // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; + if ($conf->categorie->enabled) { $cate_arbo = $form->select_all_categories(Categorie::TYPE_KNOWLEDGEMANAGEMENT, '', 'parent', 64, 0, 1); From 977fa996816ffad463b635cc8e7897d119cfbd11 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Mon, 13 Sep 2021 11:39:08 +0200 Subject: [PATCH 013/154] update knowledgemanagement.key name --- ...gemanagement.sql => llx_categorie_knowledgemanagement.key.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename htdocs/install/mysql/tables/{llx_categorie_ knowledgemanagement.sql => llx_categorie_knowledgemanagement.key.sql} (100%) diff --git a/htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql b/htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.key.sql similarity index 100% rename from htdocs/install/mysql/tables/llx_categorie_ knowledgemanagement.sql rename to htdocs/install/mysql/tables/llx_categorie_knowledgemanagement.key.sql From 65c4a2189860f8176955db309531fa75aea55e4c Mon Sep 17 00:00:00 2001 From: Julien Gainza Date: Mon, 13 Sep 2021 16:35:13 +0200 Subject: [PATCH 014/154] FIX move fetch_optionnal into $ac_static->fetch() --- htdocs/comm/action/class/actioncomm.class.php | 1 + htdocs/comm/action/class/api_agendaevents.class.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9e562173b04..a6252ecebe3 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -763,6 +763,7 @@ class ActionComm extends CommonObject $this->elementid = $obj->elementid; $this->elementtype = $obj->elementtype; + $this->fetch_optionals(); $this->fetchResources(); } $this->db->free($resql); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index bf35ed95be0..d9feb4472b6 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -171,7 +171,6 @@ class AgendaEvents extends DolibarrApi $obj = $db->fetch_object($result); $actioncomm_static = new ActionComm($db); if ($actioncomm_static->fetch($obj->rowid)) { - $actioncomm_static->fetch_optionals(); $obj_ret[] = $this->_cleanObjectDatas($actioncomm_static); } $i++; From 0ad8dc28389b65aa4884b79dd04fdc38e4f57e37 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Mon, 13 Sep 2021 19:01:25 +0200 Subject: [PATCH 015/154] Update knowledgerecord.class.php --- htdocs/knowledgemanagement/class/knowledgerecord.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 4c718589d7c..72ae3c17a5f 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -102,8 +102,8 @@ class KnowledgeRecord extends CommonObject public $fields=array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'visible'=>5, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), - 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>20, 'index'=>1), + 'question' => array('type'=>'text', 'label'=>'Question', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'lang' => array('type'=>'varchar(6)', 'label'=>'Language', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1), 'answer' => array('type'=>'html', 'label'=>'Solution', 'enabled'=>'1', 'position'=>50, 'notnull'=>0, 'visible'=>3, 'csslist'=>'tdoverflow300', 'copytoclipboard'=>1), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), From fe241cc71f474a340ddcc65fa6c733e6c31f3dbf Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 13 Sep 2021 21:12:39 +0200 Subject: [PATCH 016/154] FIX Accountancy - Format Quadra export - Missing line type C (act account) --- .../class/accountancyexport.class.php | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 9749cd91d4d..66ddd704b1b 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -516,14 +516,19 @@ class AccountancyExport } /** - * Export format : Quadratus + * Export format : Quadratus (Format ASCII) + * Format since 2015 compatible QuadraCOMPTA + * Last review for this format : 2021/09/13 Alexandre Spangaro (aspangaro@open-dsi.fr) + * + * Help : https://docplayer.fr/20769649-Fichier-d-entree-ascii-dans-quadracompta.html + * In QuadraCompta | Use menu : "Outils" > "Suivi des dossiers" > "Import ASCII(Compta)" * * @param array $TData data * @return void */ public function exportQuadratus(&$TData) { - global $conf; + global $conf, $db; $end_line = "\r\n"; @@ -536,6 +541,40 @@ class AccountancyExport $code_compta = $data->subledger_account; } + $Tab = array(); + + if (!empty($data->subledger_account)){ + $Tab['type_ligne'] = 'C'; + $Tab['num_compte'] = str_pad(self::trunc($data->subledger_account, 8), 8); + $Tab['lib_compte'] = str_pad(self::trunc($data->subledger_label, 30), 30); + $Tab['filler'] = str_repeat(' ', 59); + + if ($data->doc_type == 'customer_invoice') { + $Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, 8), 8); + } elseif ($data->doc_type == 'supplier_invoice') { + $Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, 8), 8); + } else { + $Tab['coll_compte'] = str_pad(' ', 8); + } + + $Tab['filler2'] = str_repeat(' ', 110); + $Tab['Maj'] = 2; // Maj partielle (clé alpha, intitulé, adresse, collectif, RIB) + + if ($data->doc_type == 'customer_invoice') { + $Tab['type_compte'] = 'C'; + } elseif ($data->doc_type == 'supplier_invoice') { + $Tab['coll_compte'] = 'F'; + } else { + $Tab['coll_compte'] = 'G'; + } + + $Tab['filler3'] = str_repeat(' ', 235); + + $Tab['end_line'] = $end_line; + + print implode($Tab); + } + $Tab = array(); $Tab['type_ligne'] = 'M'; $Tab['num_compte'] = str_pad(self::trunc($code_compta, 8), 8); From 6368ba9a6e1d66abd2eb98a1038569f268049bf5 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 13 Sep 2021 19:21:53 +0000 Subject: [PATCH 017/154] Fixing style errors. --- htdocs/accountancy/class/accountancyexport.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 60dbd67f201..ec1325046cb 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -543,7 +543,7 @@ class AccountancyExport $Tab = array(); - if (!empty($data->subledger_account)){ + if (!empty($data->subledger_account)) { $Tab['type_ligne'] = 'C'; $Tab['num_compte'] = str_pad(self::trunc($data->subledger_account, 8), 8); $Tab['lib_compte'] = str_pad(self::trunc($data->subledger_label, 30), 30); From 42543ba005c8ab3395390c811a94a27f8a5c49c8 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 13 Sep 2021 21:29:31 +0200 Subject: [PATCH 018/154] Add alpha key --- htdocs/accountancy/class/accountancyexport.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 60dbd67f201..07b641d8864 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -547,18 +547,22 @@ class AccountancyExport $Tab['type_ligne'] = 'C'; $Tab['num_compte'] = str_pad(self::trunc($data->subledger_account, 8), 8); $Tab['lib_compte'] = str_pad(self::trunc($data->subledger_label, 30), 30); - $Tab['filler'] = str_repeat(' ', 59); if ($data->doc_type == 'customer_invoice') { + $Tab['lib_alpha'] = strtoupper(str_pad('C'.self::trunc($data->subledger_label, 6), 6)); + $Tab['filler'] = str_repeat(' ', 52); $Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, 8), 8); } elseif ($data->doc_type == 'supplier_invoice') { + $Tab['lib_alpha'] = strtoupper(str_pad('F'.self::trunc($data->subledger_label, 6), 6)); + $Tab['filler'] = str_repeat(' ', 52); $Tab['coll_compte'] = str_pad(self::trunc($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, 8), 8); } else { + $Tab['filler'] = str_repeat(' ', 59); $Tab['coll_compte'] = str_pad(' ', 8); } $Tab['filler2'] = str_repeat(' ', 110); - $Tab['Maj'] = 2; // Maj partielle (clé alpha, intitulé, adresse, collectif, RIB) + $Tab['Maj'] = 2; // Partial update (alpha key, label, address, collectif, RIB) if ($data->doc_type == 'customer_invoice') { $Tab['type_compte'] = 'C'; From d7126e8d2425e89c5f5c30c2ba955b5be64b793e Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Tue, 14 Sep 2021 01:49:24 +0200 Subject: [PATCH 019/154] Update list.php $search_account and $search_paymenttype are not saved when sorting by any field --- htdocs/compta/paiement/list.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index d1a94f5e690..75ff876ddc7 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -321,6 +321,12 @@ if ($search_company) { if ($search_amount != '') { $param .= '&search_amount='.urlencode($search_amount); } +if ($search_paymenttype) { + $param .= '&search_paymenttype='.urlencode($search_paymenttype); +} +if ($search_account) { + $param .= '&search_account='.urlencode($search_account); +} if ($search_payment_num) { $param .= '&search_payment_num='.urlencode($search_payment_num); } From 0763846805408b76bcc60a4a3e456fd2795adb75 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Tue, 14 Sep 2021 02:15:22 +0200 Subject: [PATCH 020/154] Bug: #18670 date, account and payment type are lost when sorting by any field Filtereds $date, $search_account and $search_paymenttype are not saved when sorting by any field --- htdocs/compta/paiement/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 5f2d4d9a2cd..e21d704889d 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -277,6 +277,11 @@ $param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); $param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); +$param .= ($search_paymenttype ? "&search_paymenttype=".urlencode($search_paymenttype) : ""); +$param .= ($search_account ? "&search_account=".urlencode($search_account) : ""); +$param .= ($day ? "&day=".urlencode($day) : ""); +$param .= ($month ? "&month=".urlencode($month) : ""); +$param .= ($year ? "&year=".urlencode($year) : ""); $param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From e1203d115add9debedc30fc8c16996f6773199e2 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Tue, 14 Sep 2021 02:22:30 +0200 Subject: [PATCH 021/154] Update list.php --- htdocs/compta/paiement/list.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index e21d704889d..756c80e5777 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -277,11 +277,11 @@ $param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); $param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); -$param .= ($search_paymenttype ? "&search_paymenttype=".urlencode($search_paymenttype) : ""); -$param .= ($search_account ? "&search_account=".urlencode($search_account) : ""); -$param .= ($day ? "&day=".urlencode($day) : ""); -$param .= ($month ? "&month=".urlencode($month) : ""); -$param .= ($year ? "&year=".urlencode($year) : ""); +$param .= ($search_paymenttype ? "&search_paymenttype=".urlencode($search_paymenttype) : ''); +$param .= ($search_account ? "&search_account=".urlencode($search_account) : ''); +$param .= ($day ? "&day=".urlencode($day) : ''); +$param .= ($month ? "&month=".urlencode($month) : ''); +$param .= ($year ? "&year=".urlencode($year) : ''); $param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); From cb37c42b5e186f11a3166c7ce168d3ea13fb456f Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 14 Sep 2021 04:50:05 +0200 Subject: [PATCH 022/154] NEW Customer invoice template list - Add input date from/to --- .../compta/facture/invoicetemplate_list.php | 136 ++++++++++++------ 1 file changed, 93 insertions(+), 43 deletions(-) diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 660c7d7c4e4..e5c7fdafd0c 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -74,12 +74,22 @@ $search_montant_vat = GETPOST('search_montant_vat'); $search_montant_ttc = GETPOST('search_montant_ttc'); $search_payment_mode = GETPOST('search_payment_mode'); $search_payment_term = GETPOST('search_payment_term'); -$search_day = GETPOST('search_day', 'int'); -$search_year = GETPOST('search_year', 'int'); -$search_month = GETPOST('search_month', 'int'); -$search_day_date_when = GETPOST('search_day_date_when', 'int'); -$search_year_date_when = GETPOST('search_year_date_when', 'int'); -$search_month_date_when = GETPOST('search_month_date_when', 'int'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver +$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); +$search_date_when_startday = GETPOST('search_date_when_startday', 'int'); +$search_date_when_startmonth = GETPOST('search_date_when_startmonth', 'int'); +$search_date_when_startyear = GETPOST('search_date_when_startyear', 'int'); +$search_date_when_endday = GETPOST('search_date_when_endday', 'int'); +$search_date_when_endmonth = GETPOST('search_date_when_endmonth', 'int'); +$search_date_when_endyear = GETPOST('search_date_when_endyear', 'int'); +$search_date_when_start = dol_mktime(0, 0, 0, $search_date_when_startmonth, $search_date_when_startday, $search_date_when_startyear); // Use tzserver +$search_date_when_end = dol_mktime(23, 59, 59, $search_date_when_endmonth, $search_date_when_endday, $search_date_when_endyear); $search_recurring = GETPOST('search_recurring', 'int'); $search_frequency = GETPOST('search_frequency', 'alpha'); $search_unit_frequency = GETPOST('search_unit_frequency', 'alpha'); @@ -206,12 +216,22 @@ if (empty($reshook)) { $search_montant_ttc = ''; $search_payment_mode = ''; $search_payment_term = ''; - $search_day = ''; - $search_year = ''; - $search_month = ''; - $search_day_date_when = ''; - $search_year_date_when = ''; - $search_month_date_when = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_date_when_startday = ''; + $search_date_when_startmonth = ''; + $search_date_when_startyear = ''; + $search_date_when_endday = ''; + $search_date_when_endmonth = ''; + $search_date_when_endyear = ''; + $search_date_when_start = ''; + $search_date_when_end = ''; $search_recurring = ''; $search_frequency = ''; $search_unit_frequency = ''; @@ -326,8 +346,18 @@ if ($search_status != '' && $search_status >= -1) { $sql .= ' AND suspended = 1'; } } -$sql .= dolSqlDateFilter('f.date_last_gen', $search_day, $search_month, $search_year); -$sql .= dolSqlDateFilter('f.date_when', $search_day_date_when, $search_month_date_when, $search_year_date_when); +if ($search_date_start) { + $sql .= " AND f.date_last_gen >= '".$db->idate($search_date_start)."'"; +} +if ($search_date_end) { + $sql .= " AND f.date_last_gen <= '".$db->idate($search_date_end)."'"; +} +if ($search_date_when_start) { + $sql .= " AND f.date_when >= '".$db->idate($search_date_when_start)."'"; +} +if ($search_date_when_end) { + $sql .= " AND f.date_when <= '".$db->idate($search_date_when_end)."'"; +} $sql .= $db->order($sortfield, $sortorder); @@ -357,23 +387,41 @@ if ($resql) { if ($socid > 0) { $param .= '&socid='.urlencode($socid); } - if ($search_day) { - $param .= '&search_day='.urlencode($search_day); + if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); } - if ($search_month) { - $param .= '&search_month='.urlencode($search_month); + if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); } - if ($search_year) { - $param .= '&search_year='.urlencode($search_year); + if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); } - if ($search_day_date_when) { - $param .= '&search_day_date_when='.urlencode($search_day_date_when); + if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); } - if ($search_month_date_when) { - $param .= '&search_month_date_when='.urlencode($search_month_date_when); + if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); } - if ($search_year_date_when) { - $param .= '&search_year_date_when='.urlencode($search_year_date_when); + if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); + } + if ($search_date_when_startday) { + $param .= '&search_date_when_startday='.urlencode($search_date_when_startday); + } + if ($search_date_when_startmonth) { + $param .= '&search_date_when_startmonth='.urlencode($search_date_when_startmonth); + } + if ($search_date_when_startyear) { + $param .= '&search_date_when_startyear='.urlencode($search_date_when_startyear); + } + if ($search_date_when_endday) { + $param .= '&search_date_when_endday='.urlencode($search_date_when_endday); + } + if ($search_date_when_endmonth) { + $param .= '&search_date_when_endmonth='.urlencode($search_date_when_endmonth); + } + if ($search_date_when_endyear) { + $param .= '&search_date_when_endyear='.urlencode($search_date_when_endyear); } if ($search_ref) { $param .= '&search_ref='.urlencode($search_ref); @@ -453,7 +501,7 @@ if ($resql) { print ''; print ''; } - // Thirpdarty + // Thirdparty if (!empty($arrayfields['s.nom']['checked'])) { print ''; } @@ -489,19 +537,19 @@ if ($resql) { } if (!empty($arrayfields['recurring']['checked'])) { // Recurring or not - print ''; + print ''; print $form->selectyesno('search_recurring', $search_recurring, 1, false, 1); print ''; } if (!empty($arrayfields['f.frequency']['checked'])) { // Recurring or not - print ''; + print ''; print ''; print ''; } if (!empty($arrayfields['f.unit_frequency']['checked'])) { // Frequency unit - print ''; + print ''; print ''; print ''; } @@ -512,22 +560,24 @@ if ($resql) { } // Date invoice if (!empty($arrayfields['f.date_last_gen']['checked'])) { - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year ? $search_year : -1, 'search_year', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + print ''; + print '
'; + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // Date next generation if (!empty($arrayfields['f.date_when']['checked'])) { - print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($search_year_date_when ? $search_year_date_when : -1, 'search_year_date_when', 1, 20, 5, 0, 0, '', 'widthauto valignmiddle'); + print ''; + print '
'; + print $form->selectDate($search_date_when_start ? $search_date_when_start : -1, 'search_date_when_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_when_end ? $search_date_when_end : -1, 'search_date_when_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; print ''; } // Extra fields @@ -559,7 +609,7 @@ if ($resql) { } // Status if (!empty($arrayfields['status']['checked'])) { - print ''; + print ''; $liststatus = array( 0=>$langs->trans("Draft"), 1=>$langs->trans("Active"), From c967c5c6d4bf95575eb3ea9c3e746bb74d53b14f Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Tue, 14 Sep 2021 08:46:07 +0200 Subject: [PATCH 023/154] fix cancel redirects on product,warehouse cards --- htdocs/product/card.php | 2 +- htdocs/product/stock/card.php | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b4625d5602d..23fc0077c97 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -201,7 +201,7 @@ if ($reshook < 0) { } if (empty($reshook)) { - $backurlforlist = DOL_URL_ROOT.'/product/list.php'; + $backurlforlist = DOL_URL_ROOT.'/product/list.php?type='.$type; if (empty($backtopage) || ($cancel && empty($id))) { if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { diff --git a/htdocs/product/stock/card.php b/htdocs/product/stock/card.php index 2ffaf43ea90..fc394d6203a 100644 --- a/htdocs/product/stock/card.php +++ b/htdocs/product/stock/card.php @@ -104,6 +104,29 @@ if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); } if (empty($reshook)) { + $backurlforlist = DOL_URL_ROOT.'/product/stock/list.php'; + + if (empty($backtopage) || ($cancel && empty($id))) { + if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) { + if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { + $backtopage = $backurlforlist; + } else { + $backtopage = DOL_URL_ROOT.'/product/stock/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__'); + } + } + } + + if ($cancel) { + if (!empty($backtopageforcancel)) { + header("Location: ".$backtopageforcancel); + exit; + } elseif (!empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + $action = ''; + } + // Ajout entrepot if ($action == 'add' && $user->rights->stock->creer) { $object->ref = (string) GETPOST("ref", "alpha"); From 6a1588e92526427a3b091dfa048a43d4d3c553b1 Mon Sep 17 00:00:00 2001 From: Vincent Dieltiens Date: Tue, 14 Sep 2021 21:37:39 +0200 Subject: [PATCH 024/154] FIX https://github.com/Dolibarr/dolibarr/issues/18717 --- htdocs/product/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/card.php b/htdocs/product/card.php index b4625d5602d..fade4271e98 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -481,7 +481,7 @@ if (empty($reshook)) { $object->setCategories($categories); if (!empty($backtopage)) { - $backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation + $backtopage = preg_replace('/__ID__/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation if (preg_match('/\?/', $backtopage)) { $backtopage .= '&socid='.$object->id; // Old method } From 7a637104b26a5b985011fdd7f0cbe5dd9f1fb53b Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Wed, 15 Sep 2021 11:29:12 +0200 Subject: [PATCH 025/154] Fix: Not filter by company when it is an external user --- htdocs/compta/paiement/list.php | 11 +++++------ htdocs/fourn/paiement/list.php | 6 ++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index cfcdead5fed..20f69401fd6 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -6,7 +6,7 @@ * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent * Copyright (C) 2017 Alexandre Spangaro - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018-2021 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2020 Tobias Sekan * @@ -31,11 +31,6 @@ */ require '../../main.inc.php'; - -// Security check -if ($user->socid) $socid = $user->socid; -$result = restrictedArea($user, 'facture', $facid, ''); - require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -58,6 +53,10 @@ $day = GETPOST('day', 'int'); $month = GETPOST('month', 'int'); $year = GETPOST('year', 'int'); +// Security check +if ($user->socid) $socid = $user->socid; +$result = restrictedArea($user, 'facture', $facid, ''); + $search_ref = GETPOST("search_ref", "alpha"); $search_company = GETPOST("search_company", 'alpha'); $search_paymenttype = GETPOST("search_paymenttype"); diff --git a/htdocs/fourn/paiement/list.php b/htdocs/fourn/paiement/list.php index f61d1795cba..13adc9d1ffc 100644 --- a/htdocs/fourn/paiement/list.php +++ b/htdocs/fourn/paiement/list.php @@ -35,8 +35,7 @@ require '../../main.inc.php'; -// Security check -if ($user->socid) $socid = $user->socid; + // doesn't work :-( // restrictedArea($user, 'fournisseur'); @@ -64,6 +63,9 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : ' $socid = GETPOST('socid', 'int'); +// Security check +if ($user->socid) $socid = $user->socid; + $search_ref = GETPOST('search_ref', 'alpha'); $search_day = GETPOST('search_day', 'int'); $search_month = GETPOST('search_month', 'int'); From b26e9be36fda9a0b9cd28d42179e95e06db60d6e Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Wed, 15 Sep 2021 15:36:57 +0200 Subject: [PATCH 026/154] Close #18677 : new show articles of KM --- htdocs/core/ajax/fetchKnowledgeRecord.php | 80 +++++++++++++++++++++ htdocs/core/class/html.formticket.class.php | 59 +++++++++++++++ htdocs/langs/en_US/ticket.lang | 3 +- htdocs/langs/fr_FR/ticket.lang | 1 + 4 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 htdocs/core/ajax/fetchKnowledgeRecord.php diff --git a/htdocs/core/ajax/fetchKnowledgeRecord.php b/htdocs/core/ajax/fetchKnowledgeRecord.php new file mode 100644 index 00000000000..a1f8ae6a1e9 --- /dev/null +++ b/htdocs/core/ajax/fetchKnowledgeRecord.php @@ -0,0 +1,80 @@ +. + */ + +/** + * \file /htdocs/core/ajax/fetchKnowledgeRecord.php + * \brief File to make Ajax action on Knowledge Management + */ + +if (!defined('NOTOKENRENEWAL')) { + define('NOTOKENRENEWAL', '1'); // Disables token renewal +} +if (!defined('NOREQUIREMENU')) { + define('NOREQUIREMENU', '1'); +} +if (!defined('NOREQUIREHTML')) { + define('NOREQUIREHTML', '1'); +} +if (!defined('NOREQUIREAJAX')) { + define('NOREQUIREAJAX', '1'); +} +if (!defined('NOREQUIRESOC')) { + define('NOREQUIRESOC', '1'); +} + +include '../../main.inc.php'; + +$action = GETPOST('action', 'aZ09'); +$idticketgroup = GETPOST('idticketgroup', 'aZ09'); +$idticketgroup = GETPOST('idticketgroup', 'aZ09'); +$lang = GETPOST('lang', 'aZ09'); + +/* + * Actions + */ + +// None + + +/* + * View + */ + +if ($action == "getKnowledgeRecord") { + $response = ''; + $sql = "SELECT kr.rowid, kr.ref, kr.question, kr.answer,l.url,ctc.code"; + $sql .= " FROM ".MAIN_DB_PREFIX."links as l"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."knowledgemanagement_knowledgerecord as kr ON kr.rowid = l.objectid"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_ticket_category as ctc ON ctc.rowid = kr.fk_c_ticket_category"; + $sql .= " WHERE ctc.code = '".$db->escape($idticketgroup)."'"; + $sql .= " AND ctc.active = 1 AND ctc.public = 1 AND (kr.lang = '".$db->escape($lang)."' OR kr.lang = 0)"; + $sql .= " AND kr.status = 1"; + $resql = $db->query($sql); + if ($resql) { + $num = $db->num_rows($resql); + $i = 0; + $response = array(); + while ($i < $num) { + $obj = $db->fetch_object($resql); + $response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$obj->url); + $i++; + } + } else { + dol_print_error($db); + } + $response =json_encode($response); + echo $response; +} diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index d486805cf46..496778525d1 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -243,6 +243,65 @@ class FormTicket } } + if ($conf->knowledgemanagement->enabled) { + // KM Articles + print ''; + print ' + '."\n"; + } + // MESSAGE $msg = GETPOSTISSET('message') ? GETPOST('message', 'restricthtml') : ''; print ''; diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 6243e98fdc9..cad00ad21f9 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -318,4 +318,5 @@ BoxNoTicketLastXDays=No new tickets the last %s days BoxNumberOfTicketByDay=Number of new tickets by day BoxNewTicketVSClose=Number of today's new tickets versus today's closed tickets TicketCreatedToday=Ticket created today -TicketClosedToday=Ticket closed today \ No newline at end of file +TicketClosedToday=Ticket closed today +KMFoundForTicketGroup=We found topics and FAQs that may answers your question, thanks to check them before submitting the ticket diff --git a/htdocs/langs/fr_FR/ticket.lang b/htdocs/langs/fr_FR/ticket.lang index b166e963caf..4b777ff33ca 100644 --- a/htdocs/langs/fr_FR/ticket.lang +++ b/htdocs/langs/fr_FR/ticket.lang @@ -319,3 +319,4 @@ BoxNumberOfTicketByDay=Nombre de nouveaux tickets par jour BoxNewTicketVSClose=Nombre de nouveaux tickets aujourd’hui par rapport aux tickets fermés aujourd’hui TicketCreatedToday=Ticket créé aujourd'hui TicketClosedToday=Ticket fermé aujourd'hui +KMFoundForTicketGroup=Nous avons trouvé des sujets et des FAQ susceptibles de répondre à votre question, merci de les vérifier avant de soumettre le ticket From 2c73c19bd5340f61a1b160f44964b094d7ad1a1c Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Wed, 15 Sep 2021 18:26:32 +0200 Subject: [PATCH 027/154] fix ldap passw bug with activedirectory Fix to avoid LDAP Error: 53 (Unwilling to perform) on Samba4 AD --- htdocs/core/class/ldap.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 0e8fd3ee7b4..eb4f200f5fd 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -486,6 +486,7 @@ class Ldap // For better compatibility with Samba4 AD if ($this->serverType == "activedirectory") { unset($info['cn']); // To avoid error : Operation not allowed on RDN (Code 67) + $info['unicodePwd'] = mb_convert_encoding("\"".$info['unicodePwd']."\"", "UTF-16LE", "UTF-8"); // To avoid error : LDAP Error: 53 (Unwilling to perform) } $result = @ldap_modify($this->connection, $dn, $info); From ed37f9fb7a602ff97babc8f45ea32c7497b9c4ea Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Thu, 16 Sep 2021 06:40:43 +0200 Subject: [PATCH 028/154] FIX Accountancy - Some correction on export name --- htdocs/accountancy/class/accountancyexport.class.php | 4 ++-- htdocs/langs/en_US/accountancy.lang | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 1f987f61602..ace7f236212 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -119,8 +119,8 @@ class AccountancyExport self::$EXPORT_TYPE_CHARLEMAGNE => $langs->trans('Modelcsv_charlemagne'), self::$EXPORT_TYPE_LDCOMPTA => $langs->trans('Modelcsv_LDCompta'), self::$EXPORT_TYPE_LDCOMPTA10 => $langs->trans('Modelcsv_LDCompta10'), - self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinum_v3'), - self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinum_v5'), + self::$EXPORT_TYPE_GESTIMUMV3 => $langs->trans('Modelcsv_Gestinumv3'), + self::$EXPORT_TYPE_GESTIMUMV5 => $langs->trans('Modelcsv_Gestinumv5'), self::$EXPORT_TYPE_FEC => $langs->trans('Modelcsv_FEC'), self::$EXPORT_TYPE_FEC2 => $langs->trans('Modelcsv_FEC2'), ); diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 771f0a83e7b..fc4b86a2cdb 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -343,7 +343,7 @@ Modelcsv_ciel=Export for Sage50, Ciel Compta or Compta Evo. (Format XIMPORT) Modelcsv_quadratus=Export for Quadratus QuadraCompta Modelcsv_ebp=Export for EBP Modelcsv_cogilog=Export for Cogilog -Modelcsv_agiris=Export for Agiris +Modelcsv_agiris=Export for Agiris Isacompta Modelcsv_LDCompta=Export for LD Compta (v9) (Test) Modelcsv_LDCompta10=Export for LD Compta (v10 & higher) Modelcsv_openconcerto=Export for OpenConcerto (Test) @@ -351,9 +351,10 @@ Modelcsv_configurable=Export CSV Configurable Modelcsv_FEC=Export FEC Modelcsv_FEC2=Export FEC (With dates generation writing / document reversed) Modelcsv_Sage50_Swiss=Export for Sage 50 Switzerland -Modelcsv_winfic=Export Winfic - eWinfic - WinSis Compta +Modelcsv_winfic=Export for Winfic - eWinfic - WinSis Compta Modelcsv_Gestinumv3=Export for Gestinum (v3) -Modelcsv_Gestinumv5Export for Gestinum (v5) +Modelcsv_Gestinumv5=Export for Gestinum (v5) +Modelcsv_charlemagne=Export for Aplim Charlemagne ChartofaccountsId=Chart of accounts Id ## Tools - Init accounting account on product / service From 8c1b3efc47aaa8a329e346af434057ddebe740d1 Mon Sep 17 00:00:00 2001 From: antonin_tdj <50403308+ibuiv@users.noreply.github.com> Date: Thu, 16 Sep 2021 09:31:00 +0200 Subject: [PATCH 029/154] Avoir Error 19 Constraint Violation (in case of password unchanged) --- htdocs/core/class/ldap.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index eb4f200f5fd..6f12c9ff4ab 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -486,7 +486,11 @@ class Ldap // For better compatibility with Samba4 AD if ($this->serverType == "activedirectory") { unset($info['cn']); // To avoid error : Operation not allowed on RDN (Code 67) - $info['unicodePwd'] = mb_convert_encoding("\"".$info['unicodePwd']."\"", "UTF-16LE", "UTF-8"); // To avoid error : LDAP Error: 53 (Unwilling to perform) + + // To avoid error : LDAP Error: 53 (Unwilling to perform) + if(isset($info['unicodePwd'])){ + $info['unicodePwd'] = mb_convert_encoding("\"".$info['unicodePwd']."\"", "UTF-16LE", "UTF-8"); + } } $result = @ldap_modify($this->connection, $dn, $info); From 9d3b680259122aa020858e3bbcc2dd4e43b3d297 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 16 Sep 2021 07:31:23 +0000 Subject: [PATCH 030/154] Fixing style errors. --- htdocs/core/class/ldap.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/ldap.class.php b/htdocs/core/class/ldap.class.php index 6f12c9ff4ab..e2ce33cc45f 100644 --- a/htdocs/core/class/ldap.class.php +++ b/htdocs/core/class/ldap.class.php @@ -486,10 +486,10 @@ class Ldap // For better compatibility with Samba4 AD if ($this->serverType == "activedirectory") { unset($info['cn']); // To avoid error : Operation not allowed on RDN (Code 67) - + // To avoid error : LDAP Error: 53 (Unwilling to perform) - if(isset($info['unicodePwd'])){ - $info['unicodePwd'] = mb_convert_encoding("\"".$info['unicodePwd']."\"", "UTF-16LE", "UTF-8"); + if (isset($info['unicodePwd'])) { + $info['unicodePwd'] = mb_convert_encoding("\"".$info['unicodePwd']."\"", "UTF-16LE", "UTF-8"); } } $result = @ldap_modify($this->connection, $dn, $info); From fd1d4d90734a7063eb94694ad907f25159728244 Mon Sep 17 00:00:00 2001 From: Christian Foellmann Date: Thu, 16 Sep 2021 11:33:42 +0200 Subject: [PATCH 031/154] add missing css classes to buttons --- htdocs/admin/external_rss.php | 5 ++--- htdocs/admin/mails_templates.php | 2 +- htdocs/compta/bank/bankentries_list.php | 2 +- htdocs/compta/facture/card.php | 2 +- htdocs/core/boxes/box_task.php | 2 +- htdocs/core/customreports.php | 4 ++-- htdocs/mrp/mo_production.php | 4 ++-- htdocs/projet/tasks/time.php | 3 ++- htdocs/user/card.php | 2 +- htdocs/user/group/card.php | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 26ba4d40f58..85cd419d9ee 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -252,9 +252,8 @@ if ($resql) { print ''; print "".$langs->trans("RSS")." ".($i + 1).""; print ''; - print ''; - print "   "; - print ''; + print ''; + print ''; print ''; print ''; print ''."\n"; diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 25a33717c46..848b1879702 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -935,7 +935,7 @@ if ($resql) { print ''; print ''; print ''; - print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index e5e264a12f5..dda6eec132c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -889,7 +889,7 @@ if ($resql) { print ''; }*/ print ''; - print '
'; + print '
'; print ''; print ''; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 99bf843f50b..cbf2d8952b6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -4673,7 +4673,7 @@ if ($action == 'create') { print ''; print $formother->select_revenue_stamp('', 'revenuestamp_type', $mysoc->country_code); print ' → '; - print ' '; + print ' '; print ''; print " '; + $response[] = array('title'=>$obj->question,'ref'=>$obj->url,'answer'=>$obj->answer,'url'=>$urltoprint); + } $i++; } } else { diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 496778525d1..a4774898018 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -258,7 +258,7 @@ class FormTicket if (idgroupticket != "") { $.ajax({ url: \''.DOL_URL_ROOT.'/core/ajax/fetchKnowledgeRecord.php\', - data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\'}, + data: { action: \'getKnowledgeRecord\', idticketgroup: idgroupticket, token: \''.newToken().'\', lang:\''.$langs->defaultlang.'\', popupurl:false}, type: \'GET\', success: function(response) { var urllist = \'\'; @@ -266,7 +266,7 @@ class FormTicket response = JSON.parse(response) for (key in response) { console.log(response[key]) - urllist += "
  • " + response[key].title + ": " + \'"+response[key].url+"
  • "; + urllist += "
  • " + response[key].title + ": " +response[key].url+"
  • "; } if (urllist != "") { console.log(urllist) From 3091448d1adcc1bba4af2bafa7f2a81afa7d1bc7 Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 16 Sep 2021 15:40:25 +0200 Subject: [PATCH 033/154] Expose bank account holder, label and number Useful for automated texts on invoices to have those values available as well. --- htdocs/core/class/commondocgenerator.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index aa8cb7a1301..4fc966459a4 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -399,6 +399,9 @@ abstract class CommonDocGenerator $array_key.'_bank_iban'=>$bank_account->iban, $array_key.'_bank_bic'=>$bank_account->bic, + $array_key.'_bank_label'=>$bank_account->label, + $array_key.'_bank_number'=>$bank_account->number, + $array_key.'_bank_proprio'=>$bank_account->proprio, $array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs), $array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)), From b9e637a2b2fbff9598c67386f3fda89c5c4b269e Mon Sep 17 00:00:00 2001 From: Florian Date: Thu, 16 Sep 2021 15:52:19 +0200 Subject: [PATCH 034/154] Expose bank account holder, label and number NEW Expose bank account holder, label and number --- htdocs/core/class/commondocgenerator.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 18920da3bc2..3f75ee30d02 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -447,6 +447,9 @@ abstract class CommonDocGenerator $array_key.'_bank_iban'=>$bank_account->iban, $array_key.'_bank_bic'=>$bank_account->bic, + $array_key.'_bank_label'=>$bank_account->label, + $array_key.'_bank_number'=>$bank_account->number, + $array_key.'_bank_proprio'=>$bank_account->proprio, $array_key.'_total_ht_locale'=>price($object->total_ht, 0, $outputlangs), $array_key.'_total_vat_locale'=>(!empty($object->total_vat) ?price($object->total_vat, 0, $outputlangs) : price($object->total_tva, 0, $outputlangs)), From 424ddcb218aabcf55370590f9ba963f754af1362 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Sep 2021 16:33:51 +0200 Subject: [PATCH 035/154] Fix page of payment --- htdocs/public/payment/newpayment.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 702c910ea01..d7bf9b3d565 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1834,7 +1834,8 @@ if ($source == 'organizedeventregistration') { // Debitor print ''.$langs->trans("Attendee"); print ''; - print $thirdparty->name; + print $attendee->email; + print ($thirdparty->name ? ' ('.$thirdparty->name.')' : ''); print ''; print ''."\n"; From 820a007731ef86c1e2b67bef8f1f180bea628e89 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 16 Sep 2021 17:10:06 +0200 Subject: [PATCH 036/154] NEW: add MRP into Object Linked Box --- htdocs/core/class/commonobject.class.php | 7 ++ htdocs/core/class/html.form.class.php | 9 ++- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 82 ++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 htdocs/mrp/tpl/linkedobjectblock.tpl.php diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 462a3bd5c44..c3d43cae61c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3741,6 +3741,7 @@ abstract class CommonObject } $sql .= ' ORDER BY '.$orderby; + print $sql; dol_syslog(get_class($this)."::fetchObjectLink", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { @@ -3845,8 +3846,14 @@ abstract class CommonObject $classfile = 'conferenceorbooth'; $classname = 'ConferenceOrBooth'; $module = 'eventorganization'; + } elseif ($objecttype == 'mo') { + $classpath = 'mrp/class'; + $classfile = 'mo'; + $classname = 'Mo'; + $module = 'mrp'; } + // Here $module, $classfile and $classname are set if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { if ($loadalsoobjects) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5813c45047a..d6762069e57 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -7891,12 +7891,16 @@ class Form $tplpath = 'eventorganization'; } elseif ($objecttype == 'conferenceorboothattendee') { $tplpath = 'eventorganization'; + } elseif ($objecttype == 'mo') { + $tplpath = 'mrp'; + if (empty($conf->mrp->enabled)) { + continue; // Do not show if module disabled + } } global $linkedObjectBlock; $linkedObjectBlock = $objects; - // Output template part (modules that overwrite templates must declare this into descriptor) $dirtpls = array_merge($conf->modules_parts['tpl'], array('/'.$tplpath.'/tpl')); foreach ($dirtpls as $reldir) { @@ -7982,7 +7986,8 @@ class Form 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled, 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('supplier_proposal').')'), 'order_supplier'=>array('enabled'=>$conf->supplier_order->enabled, 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('commande_fournisseur').')'), 'invoice_supplier'=>array('enabled'=>$conf->supplier_invoice->enabled, 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('facture_fourn').')'), - 'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')') + 'ticket'=>array('enabled'=>$conf->ticket->enabled, 'perms'=>1, 'label'=>'LinkToTicket', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.track_id, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."ticket as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('ticket').')'), + 'mo'=>array('enabled'=>$conf->mrp->enabled, 'perms'=>1, 'label'=>'LinkToMO', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.rowid, '0' as total_ht FROM ".MAIN_DB_PREFIX."societe as s INNER JOIN ".MAIN_DB_PREFIX."mrp_mo as t ON t.fk_soc = s.rowid WHERE t.fk_soc IN (".$this->db->sanitize($listofidcompanytoscan).') AND t.entity IN ('.getEntity('mo').')') ); } diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php new file mode 100644 index 00000000000..fcba37105d3 --- /dev/null +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,82 @@ + + * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2014 Marcos García + * Copyright (C) 2013-2020 Charlene BENKE + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +// Protection to avoid direct call of template +if (empty($conf) || !is_object($conf)) { + print "Error, template page can't be called as URL"; + exit; +} + +print "\n"; + +global $user, $db; +global $noMoreLinkedObjectBlockAfter; + +$langs = $GLOBALS['langs']; +$linkedObjectBlock = $GLOBALS['linkedObjectBlock']; + +// Load translation files required by the page +$langs->load("bom"); + +$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1); + +$total = 0; +$ilink = 0; +foreach ($linkedObjectBlock as $key => $objectlink) { + $ilink++; + $product_static = new Product($db); + $trclass = 'oddeven'; + if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) { + $trclass .= ' liste_sub_total'; + } + echo ''; + echo ''.$langs->trans("Bom"); + if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { + print ' '; + echo ''.$objectlink->getNomUrl(1).''; + + echo ''; + $result = $product_static->fetch($objectlink->fk_product); + if ($result < 0) { + setEventMessage($product_static->error, 'errors'); + } elseif ($result > 0) { + $product_static->getNomUrl(1); + } + print ''; + echo ''.dol_print_date($objectlink->date_creation, 'day').''; + echo ''; + if ($user->rights->commande->lire) { + $total = $total + $objectlink->total_ht; + echo price($objectlink->total_ht); + } + echo ''; + echo ''.$objectlink->getLibStatut(3).''; + echo ''; + // For now, shipments must stay linked to order, so link is not deletable + if ($object->element != 'shipping') { + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + } + echo ''; + echo "\n"; +} + +echo "\n"; From 06b6ada0609ced0962fbc0a16f6aa9684b0f98c6 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 16 Sep 2021 17:13:03 +0200 Subject: [PATCH 037/154] fix trad --- htdocs/mrp/mo_card.php | 2 +- htdocs/mrp/tpl/linkedobjectblock.tpl.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index fc8cab806c7..c8383301799 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -199,7 +199,7 @@ $form = new Form($db); $formfile = new FormFile($db); $formproject = new FormProjets($db); -$title = $langs->trans('Mo')." - ".$langs->trans("Card"); +$title = $langs->trans('ManufacturingOrder')." - ".$langs->trans("Card"); llxHeader('', $title, ''); diff --git a/htdocs/mrp/tpl/linkedobjectblock.tpl.php b/htdocs/mrp/tpl/linkedobjectblock.tpl.php index fcba37105d3..4f26d4c36dd 100644 --- a/htdocs/mrp/tpl/linkedobjectblock.tpl.php +++ b/htdocs/mrp/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { $trclass .= ' liste_sub_total'; } echo ''; - echo ''.$langs->trans("Bom"); + echo ''.$langs->trans("ManufacturingOrder"); if (!empty($showImportButton) && $conf->global->MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES) { print ' Date: Thu, 16 Sep 2021 17:13:34 +0200 Subject: [PATCH 038/154] remove debug --- htdocs/core/class/commonobject.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c3d43cae61c..45076e522a3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3741,7 +3741,6 @@ abstract class CommonObject } $sql .= ' ORDER BY '.$orderby; - print $sql; dol_syslog(get_class($this)."::fetchObjectLink", LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { From 67c468025df9c96b4d78626a593058e2142bbf12 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 16 Sep 2021 17:22:22 +0200 Subject: [PATCH 039/154] add trans --- htdocs/langs/en_US/main.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1756176cc4d..6c3061a192f 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -804,6 +804,7 @@ LinkToSupplierInvoice=Link to vendor invoice LinkToContract=Link to contract LinkToIntervention=Link to intervention LinkToTicket=Link to ticket +LinkToMo=Link to Mo CreateDraft=Create draft SetToDraft=Back to draft ClickToEdit=Click to edit @@ -1153,4 +1154,4 @@ ConfirmMassLeaveApprovalQuestion=Are you sure you want to approve the %s selecte ConfirmMassLeaveApproval=Mass leave approval confirmation RecordAproved=Record approved RecordsApproved=%s Record(s) approved -Properties=Properties \ No newline at end of file +Properties=Properties From 88cd8fface58a2f95cc6c4f6e41320b04879acb4 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Thu, 16 Sep 2021 17:53:47 +0200 Subject: [PATCH 040/154] FIX: task time: can't filter by user with pgsql + show error message --- htdocs/projet/tasks/time.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 2a4b1d6aeee..7baac31a51a 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -1058,7 +1058,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($search_note) $sql .= natural_search('t.note', $search_note); if ($search_task_ref) $sql .= natural_search('pt.ref', $search_task_ref); if ($search_task_label) $sql .= natural_search('pt.label', $search_task_label); - if ($search_user > 0) $sql .= natural_search('t.fk_user', $search_user); + if ($search_user > 0) $sql .= ' AND t.fk_user = ' . intval($search_user); if ($search_valuebilled == '1') $sql .= ' AND t.invoice_id > 0'; if ($search_valuebilled == '0') $sql .= ' AND (t.invoice_id = 0 OR t.invoice_id IS NULL)'; $sql .= dolSqlDateFilter('t.task_datehour', $search_day, $search_month, $search_year); @@ -1069,6 +1069,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); + + if (! $resql) { + dol_print_error($db); + exit; + } + $nbtotalofrecords = $db->num_rows($resql); if (($page * $limit) > $nbtotalofrecords) // if total of record found is smaller than page * limit, goto and load page 0 { From bfe305dc47456851fefc744a15d5dc994f1822ec Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 16 Sep 2021 17:46:47 +0200 Subject: [PATCH 041/154] Debug event organization module --- .../conferenceorbooth_list.php | 21 +++-- .../eventorganization/attendee_register.php | 86 +++++++++++++------ 2 files changed, 74 insertions(+), 33 deletions(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index c46798b05b5..5f6e2820591 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -55,6 +55,7 @@ $optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' $id = GETPOST('id', 'int'); $projectid = GETPOST('projectid', 'int'); +$projectref = GETPOST('ref'); // Load variable for pagination $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -152,12 +153,12 @@ if (!$permissiontoread) accessforbidden(); * Actions */ -if (preg_match('/^set/', $action) && $projectid > 0 && !empty($user->rights->eventorganization->write)) { +if (preg_match('/^set/', $action) && ($projectid > 0 || $projectref) && !empty($user->rights->eventorganization->write)) { $project = new Project($db); //If "set" fields keys is in projects fields $project_attr=preg_replace('/^set/', '', $action); if (array_key_exists($project_attr, $project->fields)) { - $result = $project->fetch($projectid); + $result = $project->fetch($projectid, $projectref); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); } else { @@ -234,11 +235,13 @@ $now = dol_now(); $help_url = ''; $title = $langs->trans('ListOfConferencesOrBooths'); -if ($projectid > 0) { +if ($projectid > 0 || $projectref) { $project = new Project($db); - $result = $project->fetch($projectid); + $result = $project->fetch($projectid, $projectref); if ($result < 0) { setEventMessages(null, $project->errors, 'errors'); + } else { + $projectid = $project->id; } $result = $project->fetch_thirdparty(); if ($result < 0) { @@ -430,8 +433,8 @@ if ($projectid > 0) { print $form->textwithpicto($langs->trans("SuggestOrVoteForConfOrBooth"), $langs->trans("EvntOrgRegistrationHelpMessage")); //print ''; print ''; - $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.$project->id; - $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.$project->id, 'md5'); + $linksuggest = $dolibarr_main_url_root.'/public/project/index.php?id='.((int) $project->id); + $encodedsecurekey = dol_hash($conf->global->EVENTORGANIZATION_SECUREKEY.'conferenceorbooth'.((int) $project->id), 'md5'); $linksuggest .= '&securekey='.urlencode($encodedsecurekey); //print ''; // TODO Replace this with mass delete action if ($user->rights->accounting->mouvements->supprimer_tous) { print ''; } diff --git a/htdocs/accountancy/bookkeeping/listbysubaccount.php b/htdocs/accountancy/bookkeeping/listbysubaccount.php index 5e83c729fb1..101a8897bb5 100644 --- a/htdocs/accountancy/bookkeeping/listbysubaccount.php +++ b/htdocs/accountancy/bookkeeping/listbysubaccount.php @@ -915,7 +915,7 @@ while ($i < min($num, $limit)) { } if (empty($line->date_validation)) { if ($user->rights->accounting->mouvements->supprimer) { - print ''.img_delete().''; + print ''.img_delete().''; } } print ''; @@ -968,7 +968,7 @@ print ''; // TODO Replace this with mass delete action if ($user->rights->accounting->mouvements->supprimer_tous) { print ''; } diff --git a/htdocs/adherents/admin/member.php b/htdocs/adherents/admin/member.php index 018498c2457..0ff0919652d 100644 --- a/htdocs/adherents/admin/member.php +++ b/htdocs/adherents/admin/member.php @@ -404,13 +404,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -419,7 +419,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->MEMBER_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 4b81e065d3f..ca1ad342d8a 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1979,10 +1979,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $isinspip = $mailmanspip->is_in_spip($object); if ($isinspip == 1) { - print ''.$langs->trans("DeleteIntoSpip").''."\n"; + print ''.$langs->trans("DeleteIntoSpip").''."\n"; } if ($isinspip == 0) { - print ''.$langs->trans("AddIntoSpip").''."\n"; + print ''.$langs->trans("AddIntoSpip").''."\n"; } } diff --git a/htdocs/adherents/tpl/linkedobjectblock.tpl.php b/htdocs/adherents/tpl/linkedobjectblock.tpl.php index 0414bf20a14..7aa2f39a3ff 100644 --- a/htdocs/adherents/tpl/linkedobjectblock.tpl.php +++ b/htdocs/adherents/tpl/linkedobjectblock.tpl.php @@ -45,7 +45,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } echo ''; echo ''; - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; echo ''; } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index d689b2df8af..5567e741272 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -282,9 +282,9 @@ while ($i <= $MAXAGENDA) { print ajax_constantonoff('AGENDA_EXT_ACTIVEBYDEFAULT' . $key); } else { if (empty($conf->global->{$default})) { - print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; } else { - print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; } } print ''; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 463df5475f9..252008fb877 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -260,7 +260,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if (in_array($name, $def)) { print ''."\n"; if ($conf->global->ACTION_EVENT_ADDON_PDF != "$name") { - print 'scandir.'&label='.urlencode($module->name).'&type=action">'; + print 'scandir.'&label='.urlencode($module->name).'&type=action">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; } else { @@ -269,7 +269,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -324,9 +324,9 @@ print ' '."\n"; print ''."\n"; //print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; + print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; } print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 2b2da673202..ac968778ffc 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -181,7 +181,7 @@ if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { $langs->load("errors"); print img_warning($langs->trans("WarningAvailableOnlyForHTTPSServers"), '', 'valignmiddle size15x').' '; } - print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; + print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; print ''."\n"; print ''."\n"; @@ -190,9 +190,9 @@ if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { print ''."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) { - print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; + print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; } else { - print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; + print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; } print ''."\n"; @@ -229,7 +229,7 @@ if (empty($conf->cron->enabled)) { $langs->load("cron"); print ''.$langs->trans("JobXMustBeEnabled", $langs->transnoentitiesnoconv("sendEmailsReminder")).''; } else { - print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; + print ''.img_picto($langs->trans('Enabled'), 'switch_on').''; } } } diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index a9463be9937..4e79d3ee276 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -354,13 +354,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 0aae15eef3e..35cf6b3e8a4 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -362,13 +362,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index c4e697bfe00..2e4226e89d5 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -423,8 +423,8 @@ foreach ($boxactivated as $key => $box) { $hasprevious = ($key != 0); print ''.($key + 1).''; print ''; - print ($hasnext ? ''.img_down().' ' : ''); - print ($hasprevious ? ''.img_up().'' : ''); + print ($hasnext ? ''.img_down().' ' : ''); + print ($hasprevious ? ''.img_up().'' : ''); print ''; print ''; print ''.img_delete().''; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index d57292e3562..23d7020e370 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -424,13 +424,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -439,7 +439,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->COMMANDE_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index b5e0c3ae28b..7854924c090 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -353,13 +353,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -368,7 +368,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->CONTRACT_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index 4fa7b2b79c7..68a18aa0f6a 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -357,13 +357,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 52badf366ca..44df7f74189 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -93,9 +93,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('ECM_AUTO_TREE_ENABLED'); } else { if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } elseif (!empty($conf->global->USER_MAIL_REQUIRED)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index 9c088aec61c..36ba50818c6 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -580,13 +580,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 32f82f5dad5..777767a823e 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -353,13 +353,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -368,7 +368,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->EXPEDITION_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 1553f6887f8..70bbc6f2b07 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -358,13 +358,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index bf4e2ea9eb6..a9f1e97ffab 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -501,13 +501,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 4d9304472d5..cdc3d139515 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -419,13 +419,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 81db1cbe58d..00d82f68035 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -359,13 +359,13 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/knowledgemanagement.php b/htdocs/admin/knowledgemanagement.php index 477f38fa663..b886e6faf39 100644 --- a/htdocs/admin/knowledgemanagement.php +++ b/htdocs/admin/knowledgemanagement.php @@ -533,13 +533,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 7cd3c095955..333fcb2bd6b 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -359,13 +359,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -374,7 +374,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->MRP_MO_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 4d170aa5fbd..04e1488fedc 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -298,7 +298,7 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ''; @@ -306,7 +306,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index f9c183b5c7d..2e266f833ea 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -312,7 +312,7 @@ foreach ($dirmodels as $reldir) if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"),'switch_on'); print ''; print ''; @@ -320,7 +320,7 @@ foreach ($dirmodels as $reldir) else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').''; print ""; } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index dcd91df0dbc..88df6b0da05 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -402,13 +402,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 6367b80c150..c364911ab51 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -363,13 +363,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index 5f8cc66eb1e..477691cf6ef 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -111,9 +111,9 @@ if (function_exists("imagecreatefrompng")) { print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA'); } else { if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } } else { @@ -130,9 +130,9 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS'); } else { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ""; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index e45a01d9ed1..d8d6a883d88 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -565,13 +565,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index a888a248d11..ec5a3e087cf 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -375,7 +375,7 @@ foreach ($dirmodels as $reldir) { //if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF != "$name") //{ // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'; + print 'scandir).'&label='.urlencode($module->name).'&type=invoice_supplier">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; /*} @@ -386,7 +386,7 @@ foreach ($dirmodels as $reldir) { print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index cfa6c878a74..0efa365a33f 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -381,7 +381,7 @@ foreach ($dirmodels as $reldir) { if (in_array($name, $def)) { print ''."\n"; if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF != "$name") { - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'; + print 'scandir).'&label='.urlencode($module->name).'&type=order_supplier">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; } else { @@ -390,7 +390,7 @@ foreach ($dirmodels as $reldir) { print ""; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 980ebe10fff..1585b66b1e1 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -380,18 +380,18 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''."\n"; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } // Defaut - print ""; + print ''; if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { diff --git a/htdocs/admin/ticket.php b/htdocs/admin/ticket.php index c3778861ddf..03fd647dd29 100644 --- a/htdocs/admin/ticket.php +++ b/htdocs/admin/ticket.php @@ -400,13 +400,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index da3a1913d64..391a456439c 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -147,9 +147,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('USER_MAIL_REQUIRED'); } else { if (empty($conf->global->USER_MAIL_REQUIRED)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; @@ -256,13 +256,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index b73d3ce4f22..9846389f87a 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -188,13 +188,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/workflow.php b/htdocs/admin/workflow.php index 1b6fa5bebe7..ada5a6e0b3b 100644 --- a/htdocs/admin/workflow.php +++ b/htdocs/admin/workflow.php @@ -250,11 +250,11 @@ foreach ($workflowcodes as $key => $params) { print ajax_constantonoff($key); } else { if (!empty($conf->global->$key)) { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/workstation.php b/htdocs/admin/workstation.php index f14393e2588..76556fb4d68 100755 --- a/htdocs/admin/workstation.php +++ b/htdocs/admin/workstation.php @@ -423,13 +423,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/bom/tpl/linkedobjectblock.tpl.php b/htdocs/bom/tpl/linkedobjectblock.tpl.php index fcba37105d3..946563f7b81 100644 --- a/htdocs/bom/tpl/linkedobjectblock.tpl.php +++ b/htdocs/bom/tpl/linkedobjectblock.tpl.php @@ -73,7 +73,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'shipping') { - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; } echo ''; echo "\n"; diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index bddeb9a771a..02e6892b571 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -101,9 +101,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('CATEGORIE_RECURSIV_ADD'); } else { if (empty($conf->global->CATEGORIE_RECURSIV_ADD)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 23c1a459c74..829effed6a2 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -68,7 +68,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } print ''; print ''.$objectlink->getLibStatut(3).''; - print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; } if (count($linkedObjectBlock) > 1) { diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index a0641c4c493..211702059cb 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -64,7 +64,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo ''; // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'shipping') { - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; } echo ''; echo "\n"; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 47523447205..bcfece64157 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -93,7 +93,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { print $objectlink->getLibStatut(3); } print ''; - print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + print ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; print "\n"; } if (count($linkedObjectBlock) > 1) { diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php index 935f6b03948..7c9683c8b8c 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php @@ -57,7 +57,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> global->BILL_ADD_PAYMENT_VALIDATION)) if ($action == '') { if ($user->rights->tax->charges->supprimer) { if (!$disable_delete) { - print ''.$langs->trans('Delete').''; + print ''.$langs->trans('Delete').''; } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 9764f679959..363af314113 100755 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -767,7 +767,7 @@ if ($id) { } if (!empty($user->rights->tax->charges->supprimer) && empty($totalpaye)) { - print ''; + print ''; } else { print ''; } diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index 310e2bd00b9..8715a8ce4cc 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -62,7 +62,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo price($totalcontrat); } ?> getLibStatut(7); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { } print ''; echo ''.$objectlink->getLibStatut(3).''; - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; echo ''; } diff --git a/htdocs/expensereport/tpl/linkedobjectblock.tpl.php b/htdocs/expensereport/tpl/linkedobjectblock.tpl.php index 31c5526903b..e3fc511a024 100644 --- a/htdocs/expensereport/tpl/linkedobjectblock.tpl.php +++ b/htdocs/expensereport/tpl/linkedobjectblock.tpl.php @@ -47,7 +47,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { datev, 'day'); ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { echo $objectlink->getLibStatut(3); } ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> gl 'activate', 'add', 'addrights', 'addtimespent', 'doprev', 'donext', 'dvprev', 'dvnext', 'install', - 'reopen', - 'setpricelevel', 'set_paid', - 'update' + 'reopen' ); $sensitiveget = false; if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { $sensitiveget = true; } - if (preg_match('/^(classify|close|confirm_|delete|disable|enable|remove_|setremise)/', GETPOST('action', 'aZ09'))) { + if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|update)/', GETPOST('action', 'aZ09'))) { $sensitiveget = true; } diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 939b084fe41..588773ef50c 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -155,9 +155,9 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARGIN_RATES'); } else { if (empty($conf->global->DISPLAY_MARGIN_RATES)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; @@ -172,9 +172,9 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARK_RATES'); } else { if (empty($conf->global->DISPLAY_MARK_RATES)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index 5aaae9f93eb..e5ccb0c3966 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -125,9 +125,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); } else { if (empty($conf->global->MODULEBUILDER_USE_ABOUT)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 9007eab60cc..6d7497b7780 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -598,13 +598,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php index 67aac8c0e98..3c6442bd454 100644 --- a/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php +++ b/htdocs/modulebuilder/template/core/tpl/linkedobjectblock_myobject.tpl.php @@ -50,7 +50,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { date, 'day'); ?> getLibStatut(7); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { echo ''; // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'shipping') { - echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; + echo ''.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').''; } echo ''; echo "\n"; diff --git a/htdocs/multicurrency/multicurrency_rate.php b/htdocs/multicurrency/multicurrency_rate.php index 35b7544ccbc..d0be7666a95 100644 --- a/htdocs/multicurrency/multicurrency_rate.php +++ b/htdocs/multicurrency/multicurrency_rate.php @@ -526,8 +526,8 @@ if ($resql) { if (in_array($obj->rowid, $arrayofselected)) { $selected = 1; } - print 'rowid.'">'.img_picto('edit', 'edit').''; - print 'rowid.'">'.img_picto('delete', 'delete').''; + print 'rowid.'">'.img_picto('edit', 'edit').''; + print 'rowid.'">'.img_picto('delete', 'delete').''; print ''; } print ''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index fa75a20277f..199f2a04f03 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -448,13 +448,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/product/stock/massstockmove.php b/htdocs/product/stock/massstockmove.php index da8ef2e5b37..af6d6c08740 100644 --- a/htdocs/product/stock/massstockmove.php +++ b/htdocs/product/stock/massstockmove.php @@ -632,7 +632,7 @@ foreach ($listofdata as $key => $val) { print ''; } print ''.$val['qty'].''; - print ''.img_delete($langs->trans("Remove")).''; + print ''.img_delete($langs->trans("Remove")).''; print ''; } } diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index eaea44dd22b..0ce2a38a471 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -564,13 +564,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -704,13 +704,13 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) { // Active if (in_array($name, $def)) { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ""; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/reception/tpl/linkedobjectblock.tpl.php b/htdocs/reception/tpl/linkedobjectblock.tpl.php index 39a5a24347d..41ebc02747f 100644 --- a/htdocs/reception/tpl/linkedobjectblock.tpl.php +++ b/htdocs/reception/tpl/linkedobjectblock.tpl.php @@ -69,7 +69,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { // For now, receptions must stay linked to order, so link is not deletable if ($object->element != 'order_supplier') { ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index 6da39445f7f..6b6dd050820 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -459,13 +459,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index 2bcddf58964..b2189954bf4 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -457,13 +457,13 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index b9b2046fd90..8b4975a5592 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -560,7 +560,7 @@ foreach ($dirsociete as $dirroot) { print "\n"; //if ($conf->global->COMPANY_ADDON_PDF != "$name") //{ - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; //} diff --git a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php index c33c3b2ebac..d0fce33ed22 100644 --- a/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/supplier_proposal/tpl/linkedobjectblock.tpl.php @@ -53,7 +53,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) { echo price($objectlink->total_ht); } ?> getLibStatut(3); ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> $objectlink) { // For now, shipments must stay linked to order, so link is not deletable if ($object->element != 'shipping') { ?> - ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> + ">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?> diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 36b9ce7566c..4fb9c51644f 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -384,7 +384,7 @@ if ($action == 'create') { } if ($candisableperms) { - print ''.$langs->trans("DeleteGroup").''; + print ''.$langs->trans("DeleteGroup").''; } print "\n"; diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index e2c419b0543..46506163c1f 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -332,7 +332,7 @@ if ($object->id > 0) { if (in_array($obj->id, $permsgroupbyentity[$entity])) { // Own permission by group if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes">'; //print img_edit_remove($langs->trans("Remove")); print img_picto($langs->trans("Remove"), 'switch_on'); print ''; @@ -343,7 +343,7 @@ if ($object->id > 0) { } else { // Do not own permission if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes">'; //print img_edit_add($langs->trans("Add")); print img_picto($langs->trans("Add"), 'switch_off'); print ''; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 391682b2d6d..7c7fe868b2f 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -279,9 +279,9 @@ print ''.$langs->trans("Module").''; if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) { if ($caneditperms) { print ''; - print ''.$langs->trans("All").""; + print ''.$langs->trans("All").""; print ' / '; - print ''.$langs->trans("None").""; + print ''.$langs->trans("None").""; print ''; } print ' '; @@ -359,9 +359,9 @@ if ($result) { if (($caneditperms && empty($objMod->rights_admin_allowed)) || empty($object->admin)) { if ($caneditperms) { print ''; - print 'module.'&confirm=yes&token='.newToken().'">'.$langs->trans("All").""; + print 'module.'&confirm=yes">'.$langs->trans("All").""; print ' / '; - print 'module.'&confirm=yes&token='.newToken().'">'.$langs->trans("None").""; + print 'module.'&confirm=yes">'.$langs->trans("None").""; print ''; } print ' '; @@ -399,7 +399,7 @@ if ($result) { print ''; } elseif (in_array($obj->id, $permsuser)) { // Permission granted by user if ($caneditperms) { - print 'id.'&confirm=yes&token='.newToken().'">'; + print 'id.'&confirm=yes">'; //print img_edit_remove($langs->trans("Remove")); print img_picto($langs->trans("Remove"), 'switch_on'); print ''; diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index c29fc519258..a3ad036ca9a 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -888,7 +888,7 @@ if (!empty($id) || !empty($ref)) { print ''.$prodstatic->getLibStatut(2, 0).''; print ''.$prodstatic->getLibStatut(2, 1).''; print ''; - print 'id.'">'.img_edit().''; + print 'id.'">'.img_edit().''; print 'id.'">'.img_delete().''; print ''; print ''; From 4d563651fab4c55ef82ef0ff3aef37999c15531d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 14:49:11 +0200 Subject: [PATCH 110/154] Add a mode MAIN_SECURITY_CSRF_WITH_TOKEN = 2 --- htdocs/main.inc.php | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index a40135adc27..433c168b7f2 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -460,22 +460,25 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) { //dol_syslog("aaaa - ".defined('NOCSRFCHECK')." - ".$dolibarr_nocsrfcheck." - ".$conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN." - ".$_SERVER['REQUEST_METHOD']." - ".GETPOST('token', 'alpha')); // Check validity of token, only if option MAIN_SECURITY_CSRF_WITH_TOKEN enabled or if constant CSRFCHECK_WITH_TOKEN is set into page -if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->global->MAIN_SECURITY_CSRF_WITH_TOKEN)) || defined('CSRFCHECK_WITH_TOKEN')) { +if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) || defined('CSRFCHECK_WITH_TOKEN')) { // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) - $arrayofactiontoforcetokencheck = array( - 'activate', 'add', 'addrights', 'addtimespent', - 'doprev', 'donext', 'dvprev', 'dvnext', - 'install', - 'reopen' - ); $sensitiveget = false; - if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { + if (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { $sensitiveget = true; + } else { + $arrayofactiontoforcetokencheck = array( + 'activate', 'add', 'addrights', 'addtimespent', + 'doprev', 'donext', 'dvprev', 'dvnext', + 'install', + 'reopen' + ); + if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { + $sensitiveget = true; + } + if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|update)/', GETPOST('action', 'aZ09'))) { + $sensitiveget = true; + } } - if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|update)/', GETPOST('action', 'aZ09'))) { - $sensitiveget = true; - } - // Check a token is provided for all cases that need a mandatory token // (all POST actions + all login, actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set + all sensitive GET actions) if ( From 074e8b2031c4340ad42b871c773a82f56e5492ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 14:53:09 +0200 Subject: [PATCH 111/154] Update doc to prepare MAIN_SECURITY_CSRF_WITH_TOKEN to 2 by default --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index d27749eb203..61f4a392db8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -54,7 +54,7 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us * $dolibarr_main_prod must be set to 1 into conf.php * $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value) * $dolibarr_main_force_https must be set to something else than 0. -* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be set to 1 soon by default) +* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 2 into backoffice menu Home - Setup - Other (this protection should be set to 2 soon by default) * The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools) * ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). From bf9f007c98f4526e4b2ba070bc914d72fb98facf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 14:53:09 +0200 Subject: [PATCH 112/154] Fix MAIN_SECURITY_CSRF_WITH_TOKEN = 2 --- SECURITY.md | 2 +- htdocs/main.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SECURITY.md b/SECURITY.md index d27749eb203..61f4a392db8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -54,7 +54,7 @@ ONLY vulnerabilities discovered, when the following setup on test platform is us * $dolibarr_main_prod must be set to 1 into conf.php * $dolibarr_nocsrfcheck must be kept to the value 0 into conf.php (this is the default value) * $dolibarr_main_force_https must be set to something else than 0. -* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 1 into backoffice menu Home - Setup - Other (this protection should be set to 1 soon by default) +* The constant MAIN_SECURITY_CSRF_WITH_TOKEN must be set to 2 into backoffice menu Home - Setup - Other (this protection should be set to 2 soon by default) * The module DebugBar and ModuleBuilder must NOT be enabled (by default, these modules are not enabled. They are developer tools) * ONLY security reports on modules provided by default and with the "stable" status are valid (troubles into "experimental", "developement" or external modules are not valid vulnerabilities). * The root of web server must link to htdocs and the documents directory must be outside of the web server root (this is the default when using the default installer but may differs with external installer). diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 433c168b7f2..8070a1b3526 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -463,7 +463,7 @@ if (!defined('NOTOKENRENEWAL') && !defined('NOSESSION')) { if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN')) || defined('CSRFCHECK_WITH_TOKEN')) { // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $sensitiveget = false; - if (getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { + if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { $sensitiveget = true; } else { $arrayofactiontoforcetokencheck = array( From 5631e8cc152c4849e5a3a4717be6fb3372ef27fd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 15:01:57 +0200 Subject: [PATCH 113/154] css --- htdocs/admin/translation.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 8b5c05b7bda..2327abd549e 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -463,6 +463,8 @@ if ($mode == 'searchkey') { } print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); + $massactionbutton = ''; + print ''; print ''; @@ -499,7 +501,7 @@ if ($mode == 'searchkey') { //} print ''; // Action column - print ''; + print ''; $searchpicto = $form->showFilterAndCheckAddButtons(!empty($massactionbutton) ? 1 : 0, 'checkforselect', 1); print $searchpicto; print ''; From 1d597e8a726289c07022e26457c34862ebb2d2cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 18:03:38 +0200 Subject: [PATCH 114/154] Fix add unset* action as sensible GET actions --- htdocs/admin/agenda_other.php | 2 +- htdocs/admin/agenda_reminder.php | 4 ++-- htdocs/admin/bank.php | 8 ++++---- htdocs/admin/barcode.php | 4 ++-- htdocs/admin/bom.php | 4 ++-- htdocs/admin/commande.php | 14 ++++++------- htdocs/admin/contract.php | 2 +- htdocs/admin/defaultvalues.php | 4 ++-- htdocs/admin/delivery.php | 4 ++-- htdocs/admin/expedition.php | 2 +- htdocs/admin/expensereport.php | 4 ++-- htdocs/admin/facture.php | 2 +- htdocs/admin/fichinter.php | 4 ++-- htdocs/admin/holiday.php | 20 +++++++++---------- htdocs/admin/ldap.php | 2 +- htdocs/admin/ldap_contacts.php | 2 +- htdocs/admin/ldap_groups.php | 2 +- htdocs/admin/ldap_members.php | 2 +- htdocs/admin/ldap_members_types.php | 2 +- htdocs/admin/ldap_users.php | 2 +- htdocs/admin/modules.php | 2 +- htdocs/admin/mrp.php | 4 ++-- htdocs/admin/paymentbybanktransfer.php | 4 ++-- htdocs/admin/prelevement.php | 2 +- htdocs/admin/propal.php | 8 ++++---- htdocs/admin/reception_setup.php | 4 ++-- htdocs/admin/security.php | 2 +- htdocs/admin/spip.php | 2 +- htdocs/admin/stock.php | 2 +- htdocs/admin/supplier_invoice.php | 6 +++--- htdocs/admin/supplier_order.php | 8 ++++---- htdocs/admin/supplier_payment.php | 6 +++--- htdocs/admin/supplier_proposal.php | 8 ++++---- htdocs/admin/user.php | 6 +++--- htdocs/admin/usergroup.php | 2 +- htdocs/bom/bom_card.php | 2 +- htdocs/comm/mailing/card.php | 10 +++++----- htdocs/contact/card.php | 2 +- htdocs/contact/list.php | 2 +- .../modules/printing/printgcp.modules.php | 2 +- .../modules/printing/printipp.modules.php | 2 +- .../product_batch/mod_lot_advanced.php | 4 ++-- .../modules/product_batch/mod_sn_advanced.php | 4 ++-- htdocs/don/admin/donation.php | 6 +++--- htdocs/install/step2.php | 2 +- htdocs/main.inc.php | 4 +++- htdocs/margin/admin/margin.php | 4 ++-- htdocs/modulebuilder/template/admin/setup.php | 4 ++-- htdocs/printing/admin/printing.php | 8 ++++---- htdocs/product/admin/product.php | 8 ++++---- htdocs/product/admin/product_lot.php | 4 ++-- htdocs/projet/admin/project.php | 8 ++++---- htdocs/recruitment/admin/setup.php | 4 ++-- .../recruitment/admin/setup_candidatures.php | 4 ++-- htdocs/societe/admin/societe.php | 6 +++--- htdocs/societe/list.php | 2 +- htdocs/takepos/admin/setup.php | 2 +- 57 files changed, 126 insertions(+), 124 deletions(-) diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 252008fb877..8060398574c 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -278,7 +278,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if ($conf->global->ACTION_EVENT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index ac968778ffc..1d8cd8f723c 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -174,7 +174,7 @@ if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { $langs->load("errors"); print img_warning($langs->trans("WarningAvailableOnlyForHTTPSServers"), '', 'valignmiddle size15x').' '; } - print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; + print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; print ''."\n"; } else { if (!isHTTPS()) { @@ -221,7 +221,7 @@ if (empty($conf->cron->enabled)) { print ''.$langs->trans("WarningModuleNotActive", $langs->transnoentitiesnoconv("Module2300Name")).''; } else { if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { - print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; + print ''.img_picto($langs->trans('Disabled'), 'switch_off').''; } else { // Get the max frequency of reminder if ($job->id > 0) { diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 4e79d3ee276..6580db4e8f3 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -258,7 +258,7 @@ while ($i < $nbofbank) { print img_picto($langs->trans("Activated"), 'on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'off'); print ''; } @@ -369,7 +369,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->BANKADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -428,13 +428,13 @@ print ""; // Active if ($conf->global->BANK_COLORIZE_MOVEMENT) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print ''."\n"; - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index b0eb36d81ac..de05203f5f6 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -374,11 +374,11 @@ if ($conf->product->enabled) { print ''.$modBarCode->getExample($langs)."\n"; if ($conf->global->BARCODE_PRODUCT_ADDON_NUM == "$file") { - print ''; + print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 35cf6b3e8a4..a36c3698306 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->BOM_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -377,7 +377,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->BOM_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 23d7020e370..1e977fb48df 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -299,7 +299,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->COMMANDE_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -655,10 +655,10 @@ print ''.$langs->trans("ShippableOrderIconInList").''; print ' '; print ''; if (!empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { - print ''; + print ''; print img_picto($langs->trans("Activated"),'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"),'switch_off'); } print ''; @@ -676,9 +676,9 @@ if ($conf->banque->enabled) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ORDER'); } else { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; @@ -696,9 +696,9 @@ if ($conf->stock->enabled) { print ajax_constantonoff('WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER'); } else { if (empty($conf->global->WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 7854924c090..1c6a0ec0458 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -230,7 +230,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->CONTRACT_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index e74a8df069c..026a4315c83 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -206,12 +206,12 @@ $param = '&mode='.$mode; $enabledisablehtml = $langs->trans("EnableDefaultValues").' '; if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { // Button off, click to enable - $enabledisablehtml .= ''; + $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; } else { // Button on, click to disable - $enabledisablehtml .= ''; + $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); $enabledisablehtml .= ''; } diff --git a/htdocs/admin/delivery.php b/htdocs/admin/delivery.php index 68a18aa0f6a..8e60b02a5bf 100644 --- a/htdocs/admin/delivery.php +++ b/htdocs/admin/delivery.php @@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->DELIVERY_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -372,7 +372,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->DELIVERY_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 777767a823e..2d4736cc49d 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -229,7 +229,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->EXPEDITION_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir).'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index 70bbc6f2b07..f7c9a84c5d1 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -238,7 +238,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->EXPENSEREPORT_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -373,7 +373,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->EXPENSEREPORT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index a9f1e97ffab..ae269492ddf 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -516,7 +516,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FACTURE_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').''; } print ''; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index cdc3d139515..4369bb9a2a7 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -294,7 +294,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FICHEINTER_ADDON == $classname) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -434,7 +434,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->FICHEINTER_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index 00d82f68035..55d19a7ea6c 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -230,7 +230,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->HOLIDAY_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -374,7 +374,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { if ($conf->global->HOLIDAY_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -466,9 +466,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY', array(), null, 0); } else { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_MONDAY)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print ""; @@ -482,9 +482,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY', array(), null, 0); } else { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_FRIDAY)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print ""; @@ -498,9 +498,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY', array(), null, 0, 0, 0, 2, 0, 1); } else { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SATURDAY)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print ""; @@ -514,9 +514,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY', array(), null, 0, 0, 0, 2, 0, 1); } else { if (!empty($conf->global->MAIN_NON_WORKING_DAYS_INCLUDE_SUNDAY)) { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } } print ""; diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index 1a274f8cec1..737aa7e1940 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -131,7 +131,7 @@ if (!function_exists("ldap_connect")) { $form = new Form($db); -print '
    '; +print ''; print ''; print dol_get_fiche_head($head, 'ldap', $langs->trans("LDAPSetup"), -1); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index d68726c5125..b51843e1509 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -145,7 +145,7 @@ print dol_get_fiche_head($head, 'contacts', $langs->trans("LDAPSetup"), -1); print $langs->trans("LDAPDescContact").'
    '; print '
    '; -print ''; +print ''; print ''; print ''; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 91fba4e3519..14718303f67 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -120,7 +120,7 @@ print $langs->trans("LDAPDescGroups").'
    '; print '
    '; -print ''; +print ''; print ''; print '
    '; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 3fb65f730c6..44ed5f5dc25 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -184,7 +184,7 @@ if (!function_exists("ldap_connect")) { setEventMessages($langs->trans("LDAPFunctionsNotAvailableOnPHP"), null, 'errors'); } -print ''; +print ''; print ''; print dol_get_fiche_head($head, 'members', $langs->trans("LDAPSetup"), -1); diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 777bc80c6e1..a812f98a5e7 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -112,7 +112,7 @@ print $langs->trans("LDAPDescMembersTypes").'
    '; print '
    '; -print ''; +print ''; print ''; $form = new Form($db); diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index ab6c0f52121..dbdd61b9913 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -173,7 +173,7 @@ if (!function_exists("ldap_connect")) { } -print ''; +print ''; print ''; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index ccf12d5a104..253ee32e581 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -878,7 +878,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { } } $codeenabledisable .= ''."\n"; - $codeenabledisable .= 'global->MRP_MO_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -374,7 +374,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->MRP_MO_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/paymentbybanktransfer.php b/htdocs/admin/paymentbybanktransfer.php index 04e1488fedc..ba7690bb6e3 100644 --- a/htdocs/admin/paymentbybanktransfer.php +++ b/htdocs/admin/paymentbybanktransfer.php @@ -144,7 +144,7 @@ $linkback = ''; -print ''; +print ''; print ''; print '
    '; @@ -318,7 +318,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index 2e266f833ea..90a75626e7c 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -332,7 +332,7 @@ foreach ($dirmodels as $reldir) } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').''; } print ''; diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 88df6b0da05..22ce045a7ab 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -278,7 +278,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROPALE_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -417,7 +417,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROPALE_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -658,11 +658,11 @@ if ($conf->banque->enabled) { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index c364911ab51..218cc1ef853 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -235,7 +235,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->RECEPTION_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -378,7 +378,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->RECEPTION_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index a86ca272b85..b3204d594e0 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -260,7 +260,7 @@ foreach ($arrayhandler as $key => $module) { //print img_picto('', 'tick'); print img_picto($langs->trans("Enabled"), 'switch_on'); } else { - print ''; + print ''; //print $langs->trans("Activate"); print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 8f267e9eb1c..92dba301854 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -149,7 +149,7 @@ if (!empty($conf->global->ADHERENT_USE_SPIP)) { } else { print dol_get_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); - $link = ''; + $link = ''; //$link.=$langs->trans("Activate"); $link .= img_picto($langs->trans("Disabled"), 'switch_off'); $link .= ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index d8d6a883d88..2f357b2d5fc 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -580,7 +580,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->STOCK_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index ec5a3e087cf..40fe58f68d6 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -256,7 +256,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->INVOICE_SUPPLIER_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -395,9 +395,9 @@ foreach ($dirmodels as $reldir) { if ($conf->global->INVOICE_SUPPLIER_ADDON_PDF == "$name") { //print img_picto($langs->trans("Default"),'on'); // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 0efa365a33f..00b5fbfdb8e 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -269,7 +269,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->COMMANDE_SUPPLIER_ADDON_NUMBER == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -399,7 +399,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->COMMANDE_SUPPLIER_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=order_supplier" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -472,11 +472,11 @@ if ($conf->banque->enabled) { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER)) { - print ''.img_picto($langs->trans("Disabled"),'switch_off').''; + print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"),'switch_on').''; + print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } } print ''; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 15210f89360..ce2c9f0f872 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -372,7 +372,7 @@ foreach ($dirmodels as $reldir) { print ""; } else { print '"; } @@ -381,9 +381,9 @@ foreach ($dirmodels as $reldir) { if ($conf->global->SUPPLIER_PAYMENT_ADDON_PDF == "$name") { //print img_picto($langs->trans("Default"),'on'); // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all - print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir).'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 1585b66b1e1..6e3f190aeb6 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -257,7 +257,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->SUPPLIER_PROPOSAL_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -395,7 +395,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -503,9 +503,9 @@ if ($conf->banque->enabled) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL'); } else { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL)) { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; + print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; } } print ''; diff --git a/htdocs/admin/user.php b/htdocs/admin/user.php index 391a456439c..85ab0f0e9a8 100644 --- a/htdocs/admin/user.php +++ b/htdocs/admin/user.php @@ -165,9 +165,9 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('USER_HIDE_INACTIVE_IN_COMBOBOX'); } else { if (empty($conf->global->USER_HIDE_INACTIVE_IN_COMBOBOX)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; @@ -271,7 +271,7 @@ foreach ($dirmodels as $reldir) { if (getDolGlobalString('USER_ADDON_PDF_ODT') == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/usergroup.php b/htdocs/admin/usergroup.php index 9846389f87a..3319ab994a6 100644 --- a/htdocs/admin/usergroup.php +++ b/htdocs/admin/usergroup.php @@ -203,7 +203,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->USERGROUP_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index f24cf3f80d3..ec7ee47c6be 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -596,7 +596,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Modify if ($object->status == $object::STATUS_DRAFT) { if ($permissiontoadd) { - print ''.$langs->trans("Modify").''."\n"; + print ''.$langs->trans("Modify").''."\n"; } else { print ''.$langs->trans('Modify').''."\n"; } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 0a28346a130..dbfbc84b69f 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -952,18 +952,18 @@ if ($action == 'create') { print "\n\n
    \n"; if (($object->statut == 1) && ($user->rights->mailing->valider || $object->fk_user_valid == $user->id)) { - print ''.$langs->trans("SetToDraft").''; + print ''.$langs->trans("SetToDraft").''; } if (($object->statut == 0 || $object->statut == 1 || $object->statut == 2) && $user->rights->mailing->creer) { if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { - print ''.$langs->trans("EditWithEditor").''; + print ''.$langs->trans("EditWithEditor").''; } else { - print ''.$langs->trans("EditWithTextEditor").''; + print ''.$langs->trans("EditWithTextEditor").''; } if (!empty($conf->use_javascript_ajax)) { - print ''.$langs->trans("EditHTMLSource").''; + print ''.$langs->trans("EditHTMLSource").''; } } @@ -972,7 +972,7 @@ if ($action == 'create') { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("TestMailing").''; } else { - print ''.$langs->trans("TestMailing").''; + print ''.$langs->trans("TestMailing").''; } if ($object->statut == 0) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 1941d7e31d6..835e7f0cafb 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -1371,7 +1371,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $titlealt = $val['label']; } if ($object->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print '
    '; diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 26624b1bf10..bae32e8b3b1 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -1216,7 +1216,7 @@ while ($i < min($num, $limit)) { $titlealt = $val['label']; } if ($obj->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print ''; diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index ec53b523336..226ed6c43cd 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -237,7 +237,7 @@ class printing_printgcp extends PrintingDriver if ($conf->global->PRINTING_GCP_DEFAULT == $printer_det['id']) { $html .= img_picto($langs->trans("Default"), 'on'); } else { - $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; + $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; } $html .= ''; $html .= ''."\n"; diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 0d824d2c7c0..f290b2b4e90 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -233,7 +233,7 @@ class printing_printipp extends PrintingDriver if ($conf->global->PRINTIPP_URI_DEFAULT == $value) { $html .= img_picto($langs->trans("Default"), 'on'); } else { - $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; + $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; } $html .= ''; $html .= ''."\n"; diff --git a/htdocs/core/modules/product_batch/mod_lot_advanced.php b/htdocs/core/modules/product_batch/mod_lot_advanced.php index 0e920483508..d44a261a16b 100644 --- a/htdocs/core/modules/product_batch/mod_lot_advanced.php +++ b/htdocs/core/modules/product_batch/mod_lot_advanced.php @@ -87,9 +87,9 @@ class mod_lot_advanced extends ModeleNumRefBatch // Option to enable custom masks per product $texte .= ''; diff --git a/htdocs/core/modules/product_batch/mod_sn_advanced.php b/htdocs/core/modules/product_batch/mod_sn_advanced.php index ca24a67c781..5e8fde199c1 100644 --- a/htdocs/core/modules/product_batch/mod_sn_advanced.php +++ b/htdocs/core/modules/product_batch/mod_sn_advanced.php @@ -87,9 +87,9 @@ class mod_sn_advanced extends ModeleNumRefBatch // Option to enable custom masks per product $texte .= ''; diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index d8b06285be4..c56effea73a 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -251,12 +251,12 @@ if (is_resource($handle)) { print ''; } else { print "'; } } else { print ""; } @@ -267,7 +267,7 @@ if (is_resource($handle)) { print ''; } else { print "'; } diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index f95cb218561..1835c87f759 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -141,7 +141,7 @@ if ($action == "set") { $requestnb = 0; // To disable some code, so you can call step2 with url like - // http://localhost/dolibarrnew/install/step2.php?action=set&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements + // http://localhost/dolibarrnew/install/step2.php?action=set&token='.newToken().'&createtables=0&createkeys=0&createfunctions=0&createdata=llx_20_c_departements $createtables = isset($_GET['createtables']) ?GETPOST('createtables') : 1; $createkeys = isset($_GET['createkeys']) ?GETPOST('createkeys') : 1; $createfunctions = isset($_GET['createfunctions']) ?GETPOST('createfunction') : 1; diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8070a1b3526..bea9500bd0f 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -464,8 +464,10 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( // Array of action code where CSRFCHECK with token will be forced (so token must be provided on url request) $sensitiveget = false; if ((GETPOSTISSET('massaction') || GETPOST('action', 'aZ09')) && getDolGlobalInt('MAIN_SECURITY_CSRF_WITH_TOKEN') == 2) { + // All GET actions and mass actions are processed as sensitive. $sensitiveget = true; } else { + // Only GET actions coded with a &token into url are processed as sensitive. $arrayofactiontoforcetokencheck = array( 'activate', 'add', 'addrights', 'addtimespent', 'doprev', 'donext', 'dvprev', 'dvnext', @@ -475,7 +477,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && getDolGlobalInt( if (in_array(GETPOST('action', 'aZ09'), $arrayofactiontoforcetokencheck)) { $sensitiveget = true; } - if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|update)/', GETPOST('action', 'aZ09'))) { + if (preg_match('/^(classify|close|confirm|del|disable|enable|remove|set|unset|update)/', GETPOST('action', 'aZ09'))) { $sensitiveget = true; } } diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 588773ef50c..30c85197337 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -189,9 +189,9 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('ForceBuyingPriceIfNull'); } else { if (empty($conf->global->ForceBuyingPriceIfNull)) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } print ''; diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 6d7497b7780..d0d4a404dcf 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -614,9 +614,9 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($conf->global->$constforvar == $name) { //print img_picto($langs->trans("Default"), 'on'); // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print 'scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 2b86efa507c..a0849f082e8 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -274,13 +274,13 @@ if ($mode == 'config' && $user->admin) { print ajax_constantonoff($printer->active); } else { if (empty($conf->global->{$printer->conf})) { - print ''.img_picto($langs->trans("Disabled"), 'off').''; + print ''.img_picto($langs->trans("Disabled"), 'off').''; } else { - print ''.img_picto($langs->trans("Enabled"), 'on').''; + print ''.img_picto($langs->trans("Enabled"), 'on').''; } } - print ''; - print ''; + print ''; + print ''; print ''."\n"; } diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 199f2a04f03..4f6094e1787 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -346,7 +346,7 @@ foreach ($dirproduct as $dirroot) { } print ''; @@ -762,10 +762,10 @@ if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) { if ($conf->global->$const) { print img_picto($langs->trans("Active"), 'tick'); print ''; diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index 3f4fd636de4..24f515fa0bc 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -161,7 +161,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) { if ($conf->global->PRODUCTBATCH_LOT_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } @@ -253,7 +253,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL < 2) { if ($conf->global->PRODUCTBATCH_SN_ADDON == $file) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } diff --git a/htdocs/projet/admin/project.php b/htdocs/projet/admin/project.php index 0ce2a38a471..adef0826992 100644 --- a/htdocs/projet/admin/project.php +++ b/htdocs/projet/admin/project.php @@ -347,7 +347,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROJECT_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -443,7 +443,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) { if ($conf->global->PROJECT_TASK_ADDON == 'mod_'.$classname) { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -579,7 +579,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROJECT_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -719,7 +719,7 @@ if (empty($conf->global->PROJECT_HIDE_TASKS)) { if ($conf->global->PROJECT_TASK_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/recruitment/admin/setup.php b/htdocs/recruitment/admin/setup.php index 6b6dd050820..3f71b0397a1 100644 --- a/htdocs/recruitment/admin/setup.php +++ b/htdocs/recruitment/admin/setup.php @@ -475,9 +475,9 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($conf->global->$constforvar == $name) { //print img_picto($langs->trans("Default"), 'on'); // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print 'scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/recruitment/admin/setup_candidatures.php b/htdocs/recruitment/admin/setup_candidatures.php index b2189954bf4..9c30f0d1ccf 100644 --- a/htdocs/recruitment/admin/setup_candidatures.php +++ b/htdocs/recruitment/admin/setup_candidatures.php @@ -473,9 +473,9 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) { if ($conf->global->$constforvar == $name) { //print img_picto($langs->trans("Default"), 'on'); // Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset - print 'scandir.'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; + print 'scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } else { - print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 8b4975a5592..29f8d0b175d 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -391,7 +391,7 @@ foreach ($arrayofmodules as $file => $modCodeTiers) { $disabled = (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false); print ''; } else { - print ''; } @@ -576,7 +576,7 @@ foreach ($dirsociete as $dirroot) { print ""; } else { print '"; } } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index ca4793c2c60..bc786a540d6 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1639,7 +1639,7 @@ while ($i < min($num, $limit)) { $titlealt = $val['label']; } if ($obj->stcomm_id != $val['id']) { - print ''.img_action($titlealt, $val['code'], $val['picto']).''; + print ''.img_action($titlealt, $val['code'], $val['picto']).''; } } print ''; diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index e75321e263b..db3b28d0948 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -196,7 +196,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->TAKEPOS_REF_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); } else { - print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; } From a747c71cf58482e51752280611a5f0d8677364af Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 19:19:28 +0200 Subject: [PATCH 115/154] css --- htdocs/core/tpl/objectline_view.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index b50ca83c6f6..248059ba531 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -164,7 +164,7 @@ if (($line->info_bits & 2) == 2) { // Show date range if ($line->element == 'facturedetrec') { if ($line->date_start_fill || $line->date_end_fill) { - print '

    '; + print '
    '; } if ($line->date_start_fill) { print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); From 14c8bdce1a8f03419a958a8508268941df710c10 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 19:25:38 +0200 Subject: [PATCH 116/154] Better desciption of option --- htdocs/core/tpl/objectline_view.tpl.php | 4 ++-- htdocs/langs/en_US/admin.lang | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 248059ba531..ad27dae210c 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -164,7 +164,7 @@ if (($line->info_bits & 2) == 2) { // Show date range if ($line->element == 'facturedetrec') { if ($line->date_start_fill || $line->date_end_fill) { - print '
    '; + print '
    '; } if ($line->date_start_fill) { print ''.$langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill); @@ -180,7 +180,7 @@ if (($line->info_bits & 2) == 2) { } } else { if ($line->date_start || $line->date_end) { - print '
    '.get_date_range($line->date_start, $line->date_end, $format).'
    '; + print '
    '.get_date_range($line->date_start, $line->date_end, $format).'
    '; } //print get_date_range($line->date_start, $line->date_end, $format); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 26edb7f0518..a73f06e1201 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1626,8 +1626,7 @@ ProductSetup=Products module setup ServiceSetup=Services module setup ProductServiceSetup=Products and Services modules setup NumberOfProductShowInSelect=Maximum number of products to show in combo select lists (0=no limit) -ViewProductDescInFormAbility=Display product descriptions in forms (otherwise shown in a tooltip popup) -DoNotAddProductDescAtAddLines=Do not add product description (from product card) on submit add lines on forms +ViewProductDescInFormAbility=Display product descriptions in lines of items (otherwise show description in a tooltip popup) OnProductSelectAddProductDesc=How to use the description of the products when adding a product as a line of a document AutoFillFormFieldBeforeSubmit=Auto fill the description input field with the description of product DoNotAutofillButAutoConcat=Do not autofill the input field with description of product. Description of the product will be concatenated to the entered description automatically. From ee362a42bd5098a00c155521ff8a96202c1011ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:06:09 +0200 Subject: [PATCH 117/154] css --- htdocs/bom/class/bom.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 19938a049a9..b57aaf158fd 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -98,7 +98,7 @@ class BOM extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'noteditable'=>1, 'visible'=>4, 'position'=>10, 'notnull'=>1, 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of BOM", 'showoncombobox'=>'1',), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'notnull'=>1, 'searchall'=>1, 'showoncombobox'=>'2', 'autofocusoncreate'=>1, 'css'=>'maxwidth300', 'csslist'=>'tdoverflowmax200'), - 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth150', 'csslist'=>'minwidth150 center'), + 'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>1, 'position'=>33, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing', 1=>'Disassemble'), 'css'=>'minwidth175', 'csslist'=>'minwidth175 center'), //'bomtype' => array('type'=>'integer', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>32, 'notnull'=>1, 'default'=>'0', 'arrayofkeyval'=>array(0=>'Manufacturing')), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php:1:(finished IS NULL or finished <> 0)', 'label'=>'Product', 'picto'=>'product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), 'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>-1, 'position'=>60, 'notnull'=>-1,), From 3dc32140479a74253276ecdeae3bc6361d2a2e0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:13:27 +0200 Subject: [PATCH 118/154] CSS --- htdocs/expedition/list.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 50a59e0d2e4..27340df146c 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -402,16 +402,16 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } if ($sall) { - $param .= "&sall=".urlencode($sall); + $param .= "&sall=".urlencode($sall); } if ($search_ref_exp) { - $param .= "&search_ref_exp=".urlencode($search_ref_exp); + $param .= "&search_ref_exp=".urlencode($search_ref_exp); } if ($search_ref_liv) { - $param .= "&search_ref_liv=".urlencode($search_ref_liv); + $param .= "&search_ref_liv=".urlencode($search_ref_liv); } if ($search_ref_customer) { - $param .= "&search_ref_customer=".urlencode($search_ref_customer); + $param .= "&search_ref_customer=".urlencode($search_ref_customer); } if ($search_user > 0) { $param .= '&search_user='.urlencode($search_user); @@ -420,10 +420,10 @@ if ($search_sale > 0) { $param .= '&search_sale='.urlencode($search_sale); } if ($search_company) { - $param .= "&search_company=".urlencode($search_company); + $param .= "&search_company=".urlencode($search_company); } if ($search_tracking) { - $param .= "&search_tracking=".urlencode($search_tracking); + $param .= "&search_tracking=".urlencode($search_tracking); } if ($search_town) { $param .= '&search_town='.urlencode($search_town); @@ -768,7 +768,7 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['e.ref']['checked'])) { - print "
    \n"; if (!$i) { @@ -788,7 +788,7 @@ while ($i < min($num, $limit)) { // Third party if (!empty($arrayfields['s.nom']['checked'])) { - print ''; if (!$i) { From 6af9f3b142247f5e1f07c7dae13aabc2039b10cf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:18:30 +0200 Subject: [PATCH 119/154] Fix css --- htdocs/expedition/list.php | 4 ++-- htdocs/reception/list.php | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 27340df146c..3660b8a5cbe 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -806,7 +806,7 @@ while ($i < min($num, $limit)) { } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; if (!$i) { @@ -815,7 +815,7 @@ while ($i < min($num, $limit)) { } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; + print '\n"; if (!$i) { $totalarray['nbfield']++; } diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 5b4bdf6bb6f..d14d2159ea3 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -573,43 +573,43 @@ if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } if ($sall) { - $param .= "&sall=".urlencode($sall); + $param .= "&sall=".urlencode($sall); } if ($search_ref_rcp) { - $param .= "&search_ref_rcp=".urlencode($search_ref_rcp); + $param .= "&search_ref_rcp=".urlencode($search_ref_rcp); } if ($search_ref_liv) { - $param .= "&search_ref_liv=".urlencode($search_ref_liv); + $param .= "&search_ref_liv=".urlencode($search_ref_liv); } if ($search_company) { - $param .= "&search_company=".urlencode($search_company); + $param .= "&search_company=".urlencode($search_company); } if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); + $param .= '&optioncss='.urlencode($optioncss); } if ($search_billed != '' && $search_billed >= 0) { - $param .= "&search_billed=".urlencode($search_billed); + $param .= "&search_billed=".urlencode($search_billed); } if ($search_town) { - $param .= "&search_town=".urlencode($search_town); + $param .= "&search_town=".urlencode($search_town); } if ($search_zip) { - $param .= "&search_zip=".urlencode($search_zip); + $param .= "&search_zip=".urlencode($search_zip); } if ($search_state) { - $param .= "&search_state=".urlencode($search_state); + $param .= "&search_state=".urlencode($search_state); } if ($search_status != '') { - $param .= "&search_status=".urlencode($search_status); + $param .= "&search_status=".urlencode($search_status); } if ($search_country) { - $param .= "&search_country=".urlencode($search_country); + $param .= "&search_country=".urlencode($search_country); } if ($search_type_thirdparty) { - $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); + $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); } if ($search_ref_supplier) { - $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); + $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); } // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -885,7 +885,7 @@ while ($i < min($num, $limit)) { // Ref if (!empty($arrayfields['e.ref']['checked'])) { - print "'; if (!$i) { @@ -928,7 +928,7 @@ while ($i < min($num, $limit)) { } // Zip if (!empty($arrayfields['s.zip']['checked'])) { - print ''; if (!$i) { From 25971e373ddaaff83988463da3d990c68cbbf635 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:20:12 +0200 Subject: [PATCH 120/154] Fix css --- htdocs/reception/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index d14d2159ea3..207e04428bc 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -900,7 +900,7 @@ while ($i < min($num, $limit)) { // Ref customer if (!empty($arrayfields['e.ref_supplier']['checked'])) { - print '\n"; if (!$i) { From b5a27b4c15eec694ab5eecdef53b2de5ebbcec19 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 19 Sep 2021 21:27:01 +0200 Subject: [PATCH 121/154] css --- htdocs/reception/list.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index 207e04428bc..624748ded8f 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -898,9 +898,9 @@ while ($i < min($num, $limit)) { } } - // Ref customer + // Ref supplier if (!empty($arrayfields['e.ref_supplier']['checked'])) { - print '\n"; if (!$i) { @@ -919,8 +919,8 @@ while ($i < min($num, $limit)) { } // Town if (!empty($arrayfields['s.town']['checked'])) { - print ''; if (!$i) { $totalarray['nbfield']++; @@ -929,7 +929,7 @@ while ($i < min($num, $limit)) { // Zip if (!empty($arrayfields['s.zip']['checked'])) { print ''; if (!$i) { $totalarray['nbfield']++; @@ -937,7 +937,7 @@ while ($i < min($num, $limit)) { } // State if (!empty($arrayfields['state.nom']['checked'])) { - print "\n"; + print "\n"; if (!$i) { $totalarray['nbfield']++; } @@ -946,7 +946,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['country.code_iso']['checked'])) { print ''; if (!$i) { $totalarray['nbfield']++; From 77e493755f14931f1f9b5b30471414a9bf6aefd8 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Sun, 19 Sep 2021 22:26:49 +0200 Subject: [PATCH 122/154] Fix: #18760 bad rights admin if advanced perms Insufficient rights to view a group's card for admin users if advanced permissions are used --- htdocs/main.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1d975f5ab5a..b7b1462ad36 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1039,6 +1039,16 @@ if (!defined('NOLOGIN')) { $user->rights->user->user->supprimer = 1; $user->rights->user->self->creer = 1; $user->rights->user->self->password = 1; + + //Required if advanced permissions are used with MAIN_USE_ADVANCED_PERMS + $user->rights->user->user_advance->readperms = 1; + $user->rights->user->user_advance->write = 1; + $user->rights->user->self_advance->readperms = 1; + $user->rights->user->self_advance->writeperms = 1; + $user->rights->user->group_advance->read = 1; + $user->rights->user->group_advance->readperms = 1; + $user->rights->user->group_advance->write = 1; + $user->rights->user->group_advance->delete = 1; } /* From 1ea2182bf7522238076b56c2567bba06a6d6b77b Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 19 Sep 2021 20:32:07 +0000 Subject: [PATCH 123/154] Fixing style errors. --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index b7b1462ad36..1af8595b780 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1039,7 +1039,7 @@ if (!defined('NOLOGIN')) { $user->rights->user->user->supprimer = 1; $user->rights->user->self->creer = 1; $user->rights->user->self->password = 1; - + //Required if advanced permissions are used with MAIN_USE_ADVANCED_PERMS $user->rights->user->user_advance->readperms = 1; $user->rights->user->user_advance->write = 1; From ce56f52a30cab429caa4eadc63a4cfee47f9a63b Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Mon, 20 Sep 2021 03:28:30 +0200 Subject: [PATCH 124/154] FIX #18698 Supplier invoice list - "alert" checkbox not working --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- htdocs/fourn/facture/list.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index fd393445187..4bca77809cb 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2440,7 +2440,7 @@ class FactureFournisseur extends CommonInvoice if ($facturestatic->hasDelay()) { $response->nbtodolate++; - $response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills'; + $response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?search_option=late&mainmenu=billing&leftmenu=suppliers_bills'; } } $this->db->free($resql); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 0d34a3790df..ac64a9af82e 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -119,7 +119,7 @@ $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); $search_categ_sup = trim(GETPOST("search_categ_sup", 'int')); -$option = GETPOST('option'); +$option = GETPOST('search_option'); if ($option == 'late') { $search_status = '1'; } @@ -803,7 +803,7 @@ if ($resql) { $param .= '&show_files='.urlencode($show_files); } if ($option) { - $param .= "&option=".urlencode($option); + $param .= "&search_option=".urlencode($option); } if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); @@ -1428,9 +1428,9 @@ if ($resql) { // Date limit if (!empty($arrayfields['f.date_lim_reglement']['checked'])) { - print ''; if (!$i) { From 360e3290b56f6412066739ad27fd6f3b284088fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 04:20:20 +0200 Subject: [PATCH 125/154] typo --- htdocs/core/modules/modFacture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 2fadb5d86ae..ef341c83e89 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -142,7 +142,7 @@ class modFacture extends DolibarrModules 'objectname'=>'Facture', 'method'=>'sendEmailsRemindersOnInvoiceDueDate', 'parameters'=>"10,all,EmailTemplateCode", - 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days = today. First param is the offset n of days, second parameter is "all" or a payment mode code, last paramater is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority).', + 'comment'=>'Send an emails when the unpaid invoices reach a due date + n days = today. First param is the offset n of days, second parameter is "all" or a payment mode code, last parameter is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority).', 'frequency'=>1, 'unitfrequency'=>3600 * 24, 'priority'=>50, From 9b4e4b0ba57e3c332b2d1f4c1911c89e2e5a269a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 04:20:21 +0200 Subject: [PATCH 126/154] typo From 5397e2d9c3ee220a1e7e8fe81ad1f1a589c62595 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 11:30:33 +0200 Subject: [PATCH 127/154] Clean sql --- htdocs/ecm/class/ecmdirectory.class.php | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 3c7af135922..54b1e6b6bb8 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -144,7 +144,6 @@ class EcmDirectory extends CommonObject // Clean parameters $this->label = dol_sanitizeFileName(trim($this->label)); - $this->fk_parent = trim($this->fk_parent); $this->description = trim($this->description); $this->date_c = $now; $this->fk_user_c = $user->id; @@ -155,7 +154,7 @@ class EcmDirectory extends CommonObject // Check if same directory does not exists with this name $relativepath = $this->label; - if ($this->fk_parent) { + if ($this->fk_parent > 0) { $parent = new EcmDirectory($this->db); $parent->fetch($this->fk_parent); $relativepath = $parent->getRelativePath().$relativepath; @@ -194,11 +193,11 @@ class EcmDirectory extends CommonObject $sql .= ") VALUES ("; $sql .= " '".$this->db->escape($this->label)."',"; $sql .= " '".$this->db->escape($conf->entity)."',"; - $sql .= " '".$this->db->escape($this->fk_parent)."',"; + $sql .= " ".($this->fk_parent > 0 ? ((int) $this->fk_parent) : "null").","; $sql .= " '".$this->db->escape($this->description)."',"; $sql .= " ".((int) $this->cachenbofdoc).","; $sql .= " '".$this->db->idate($this->date_c)."',"; - $sql .= " '".$this->db->escape($this->fk_user_c)."'"; + $sql .= " ".($this->fk_user_c > 0 ? ((int) $this->fk_user_c) : "null").","; $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); @@ -249,20 +248,19 @@ class EcmDirectory extends CommonObject // Clean parameters $this->label = trim($this->label); - $this->fk_parent = trim($this->fk_parent); $this->description = trim($this->description); - - // Check parameters - // Put here code to add control on parameters values + if ($this->fk_parent <= 0) { + $this->fk_parent = 0; + } $this->db->begin(); // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."ecm_directories SET"; - $sql .= " label='".$this->db->escape($this->label)."',"; - $sql .= " fk_parent='".$this->db->escape($this->fk_parent)."',"; - $sql .= " description='".$this->db->escape($this->description)."'"; - $sql .= " WHERE rowid=".((int) $this->id); + $sql .= " label = '".$this->db->escape($this->label)."',"; + $sql .= " fk_parent = ".($this->fk_parent > 0 ? ((int) $this->fk_parent) : "null").","; + $sql .= " description = '".$this->db->escape($this->description)."'"; + $sql .= " WHERE rowid = ".((int) $this->id); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); From 0453a27bda7740fb65a1a7cf8e93c2386b2d8f68 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Mon, 20 Sep 2021 12:24:44 +0200 Subject: [PATCH 128/154] Update main.inc.php --- htdocs/main.inc.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 1af8595b780..9bcf6238b36 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1041,14 +1041,16 @@ if (!defined('NOLOGIN')) { $user->rights->user->self->password = 1; //Required if advanced permissions are used with MAIN_USE_ADVANCED_PERMS - $user->rights->user->user_advance->readperms = 1; - $user->rights->user->user_advance->write = 1; - $user->rights->user->self_advance->readperms = 1; - $user->rights->user->self_advance->writeperms = 1; - $user->rights->user->group_advance->read = 1; - $user->rights->user->group_advance->readperms = 1; - $user->rights->user->group_advance->write = 1; - $user->rights->user->group_advance->delete = 1; + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { + $user->rights->user->user_advance->readperms = 1; + $user->rights->user->user_advance->write = 1; + $user->rights->user->self_advance->readperms = 1; + $user->rights->user->self_advance->writeperms = 1; + $user->rights->user->group_advance->read = 1; + $user->rights->user->group_advance->readperms = 1; + $user->rights->user->group_advance->write = 1; + $user->rights->user->group_advance->delete = 1; + } } /* From be2a95ca51f124b674104a9be8af793381d8025a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 13:01:53 +0200 Subject: [PATCH 129/154] Add language as_IN --- htdocs/langs/en_US/languages.lang | 1 + htdocs/societe/class/societe.class.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index e3b6bed94c8..ca962811831 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -6,6 +6,7 @@ Language_ar_MA=Arabic (Moroco) Language_ar_SA=Arabic Language_ar_TN=Arabic (Tunisia) Language_ar_IQ=Arabic (Iraq) +Language_as_IN=Assamese Language_az_AZ=Azerbaijani Language_bn_BD=Bengali Language_bn_IN=Bengali (India) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ff6e9474d34..e7597b311c2 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2581,7 +2581,7 @@ class Societe extends CommonObject $label .= ' ('.dol_escape_htmltag($this->name_alias).')'; } } - $label .= '
    '.$langs->trans('Email').': '.$this->email; + $label .= '
    '.img_picto('', 'email', 'class="pictofixedwidth"').$this->email; if (!empty($this->phone) || !empty($this->fax)) { $phonelist = array(); if ($this->phone) { @@ -2590,7 +2590,7 @@ class Societe extends CommonObject if ($this->fax) { $phonelist[] = dol_print_phone($this->fax, $this->country_code, $this->id, 0, '', ' ', 'fax'); } - $label .= '
    '.$langs->trans('Phone').': '.implode(' ', $phonelist); + $label .= '
    '.implode(' ', $phonelist); } if (!empty($this->address)) { $label .= '
    '.$langs->trans("Address").': '.dol_format_address($this, 1, ' ', $langs); // Address + country From 0eff2fa15b64882be38019bf6c492b8b08f70a03 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 13:20:54 +0200 Subject: [PATCH 130/154] FIX default language defined for IN country --- htdocs/core/class/html.formadmin.class.php | 12 ++++++++++++ htdocs/core/lib/functions.lib.php | 12 +++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 8e03f158a02..13619fe5aa3 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -73,6 +73,18 @@ class FormAdmin $langs_available = $langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly); + // If the language to select is not inside the list of available language and empty value is not available, we must find + // an alternative as the language code to pre-select (to avoid to have first element in list pre-selected). + if ($selected && !in_array($selected, $langs_available) && empty($showempty)) { + $tmparray = explode('_', $selected); + if (!empty($tmparray[1])) { + $selected = getLanguageCodeFromCountryCode($tmparray[1]); + } + if (empty($selected)) { + $selected = $langs->defaultlang; + } + } + $out = ''; $out .= ''; +print ''; +print ''; +print ''; print load_fiche_titre($langs->trans("CommentsOfVoters"), '', ''); @@ -391,7 +396,7 @@ $comments = $object->getComments(); if ($comments) { foreach ($comments as $comment) { if ($user->rights->opensurvey->write) { - print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', '', 0).' '; + print ' '.img_picto('', 'delete.png', '', false, 0, 0, '', '', 0).' '; } print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))."
    "; @@ -407,10 +412,7 @@ if ($object->allow_comments) { print $langs->trans("AddACommentForPoll").'
    '; print '
    '."\n"; print $langs->trans("Name").': '."\n"; - print '
    '."\n"; - if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide == "yes") { - print "".$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")).""; - } + print '
    '."\n"; } print ''; From 82f66f8b0a4cc1939d9710e3a5e38b7dbbe1f987 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 19:00:28 +0200 Subject: [PATCH 136/154] Better label of field --- htdocs/langs/en_US/products.lang | 1 + htdocs/mrp/mo_production.php | 39 ++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 10 deletions(-) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index ae199f4136b..b8f242652a1 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -397,6 +397,7 @@ ActionAvailableOnVariantProductOnly=Action only available on the variant of prod ProductsPricePerCustomer=Product prices per customers ProductSupplierExtraFields=Additional Attributes (Supplier Prices) DeleteLinkedProduct=Delete the child product linked to the combination +AmountUsedToUpdateWAP=Amount to use to update the Weighted Average Price PMPValue=Weighted average price PMPValueShort=WAP DefaultBOM=Default BOM diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 3dccebf9549..84dab109b91 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -38,7 +38,7 @@ dol_include_once('/bom/class/bom.class.php'); dol_include_once('/mrp/lib/mrp_mo.lib.php'); // Load translation files required by the page -$langs->loadLangs(array("mrp", "stocks", "other", "productbatch")); +$langs->loadLangs(array("mrp", "stocks", "other", "product", "productbatch")); // Get parameters $id = GETPOST('id', 'int'); @@ -691,6 +691,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $bom = new Bom($db); $res = $bom->fetch($object->fk_bom); if ($res > 0) { + $bom->calculateCosts(); $bomcost = $bom->unit_cost; } } @@ -818,6 +819,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } + $bomcost = price2num($bomcost, 'MU'); + $arrayoflines = $object->fetchLinesLinked('consumed', $line->id); $alreadyconsumed = 0; foreach ($arrayoflines as $line2) { @@ -1006,9 +1009,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
    '; if ($permissiontoupdatecost) { if (empty($bomcost)) { - print ''; + print ''; } else { - print ''; + print ''; } } print ''; @@ -1073,10 +1076,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $tmpproduct = new Product($db); $tmpproduct->fetch($line->fk_product); - if (empty($bomcost)) { - $bomcost = $tmpproduct->pmp; - } - $arrayoflines = $object->fetchLinesLinked('produced', $line->id); $alreadyproduced = 0; foreach ($arrayoflines as $line2) { @@ -1095,8 +1094,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; if ($permissiontoupdatecost) { + // Defined $manufacturingcost + $manufacturingcost = $bomcost; + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + } + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + } + print ''; } print ''; if ($permissiontoupdatecost) { + // Defined $manufacturingcost + $manufacturingcost = $bomcost; + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->cost_price, 'MU'); + } + if (empty($manufacturingcost)) { + $manufacturingcost = price2num($tmpproduct->pmp, 'MU'); + } + if ($tmpproduct->type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { - $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : price($bomcost)); + $preselected = (GETPOSTISSET('pricetoproduce-'.$line->id.'-'.$i) ? GETPOST('pricetoproduce-'.$line->id.'-'.$i) : price($manufacturingcost)); print ''; } else { - print ''; + print ''; } } print ''; From d1bfaa5256106d089c6823eea168a2a9b29d82e3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 19:02:04 +0200 Subject: [PATCH 137/154] Trans --- htdocs/langs/en_US/products.lang | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index b8f242652a1..294e2afbc03 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -75,6 +75,7 @@ SellingPriceTTC=Selling price (inc. tax) SellingMinPriceTTC=Minimum Selling price (inc. tax) CostPriceDescription=This price field (excl. tax) can be used to capture the average amount this product costs to your company. It may be any price you calculate yourself, for example, from the average buying price plus average production and distribution cost. CostPriceUsage=This value could be used for margin calculation. +ManufacturingPrice=Manufacturing price SoldAmount=Sold amount PurchasedAmount=Purchased amount NewPrice=New price From e3f3e01c2170bdd24f0a6a31a6dbd22074615f33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 20 Sep 2021 19:21:39 +0200 Subject: [PATCH 138/154] Fields on surveys on 2 columns --- htdocs/opensurvey/card.php | 35 +++++++++++++++++--------- htdocs/opensurvey/results.php | 46 ++++++++++++++++++++++++++++++----- 2 files changed, 63 insertions(+), 18 deletions(-) diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index bc63b319efd..c32b49ff1a1 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -222,20 +222,21 @@ dol_banner_tab($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage', $morehtm print '
    '; -print '
    '; +print '
    '; +print '
    '; print '
    '."\n"; - print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "
    '; if ($conf->global->PRODUCTBATCH_LOT_USE_PRODUCT_MASKS) { - $texte .= ''.img_picto($langs->trans("Enabled"), 'on').''; + $texte .= ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - $texte .= ''.img_picto($langs->trans("Disabled"), 'off').''; + $texte .= ''.img_picto($langs->trans("Disabled"), 'off').''; } $texte .= ' '.$langs->trans('CustomMasks')."\n"; $texte .= ''; if ($conf->global->PRODUCTBATCH_SN_USE_PRODUCT_MASKS) { - $texte .= ''.img_picto($langs->trans("Enabled"), 'on').''; + $texte .= ''.img_picto($langs->trans("Enabled"), 'on').''; } else { - $texte .= ''.img_picto($langs->trans("Disabled"), 'off').''; + $texte .= ''.img_picto($langs->trans("Disabled"), 'off').''; } $texte .= ' '.$langs->trans('CustomMasks')."\n"; $texte .= '\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').''; print '\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; print ''.img_picto('', 'setup').''.img_picto('', 'setup').''.img_picto('', 'setup').''.img_picto('', 'setup').'
    '; if (!$disabled) { - print ''; + print ''; } print img_picto($langs->trans("Disabled"), 'switch_off'); if (!$disabled) { @@ -463,7 +463,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PRODUCT_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; - print ''.$langs->trans("Disable").''; + print ''.$langs->trans("Disable").''; } else { print ' '; - print ''.$langs->trans("Activate").''; + print ''.$langs->trans("Activate").''; } print '
    '; if (!$disabled) { - print ''; + print ''; } print img_picto($langs->trans("Disabled"), 'switch_off'); if (!$disabled) { @@ -468,7 +468,7 @@ foreach ($arrayofmodules as $file => $modCodeCompta) { print img_picto($langs->trans("Activated"), 'switch_on'); print ''; + print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''."\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; + print ''; print $shipment->getNomUrl(1); print "'; + print ''; print $companystatic->getNomUrl(1); print ''; + print ''; print $obj->zip; print '".$obj->state_name."'.$obj->state_name.""; + print ''; print $reception->getNomUrl(1); $filename = dol_sanitizeFileName($reception->ref); $filedir = $conf->reception->dir_output.'/'.dol_sanitizeFileName($reception->ref); @@ -900,8 +900,8 @@ while ($i < min($num, $limit)) { // Ref customer if (!empty($arrayfields['e.ref_supplier']['checked'])) { - print ""; - print $obj->ref_supplier; + print '\n"; if (!$i) { $totalarray['nbfield']++; @@ -910,7 +910,7 @@ while ($i < min($num, $limit)) { // Third party if (!empty($arrayfields['s.nom']['checked'])) { - print ''; + print ''; print $companystatic->getNomUrl(1); print ''; + print ''; print $obj->zip; print 'ref_supplier).'">'; print dol_escape_htmltag($obj->ref_supplier); print "'; + print ''; print dol_escape_htmltag($obj->ref_supplier); print "'; - print $obj->town; + print ''; + print dol_escape_htmltag($obj->town); print ''; - print $obj->zip; + print dol_escape_htmltag($obj->zip); print '".$obj->state_name."".dol_escape_htmltag($obj->state_name)."'; $tmparray = getCountry($obj->fk_pays, 'all'); - print $tmparray['label']; + print dol_escape_htmltag($tmparray['label']); print ''.dol_print_date($datelimit, 'day'); + print ''.dol_print_date($datelimit, 'day'); if ($facturestatic->hasDelay()) { - print img_warning($langs->trans('Late')); + print img_warning($langs->trans('Alert').' - '.$langs->trans('Late')); } print ''.$langs->trans("Qty").''.$langs->trans("PMPValue").''.$form->textwithpicto($langs->trans("UnitCost"), $langs->trans("AmountUsedToUpdateWAP")).''.$langs->trans("UnitCost").''.$form->textwithpicto($langs->trans("ManufacturingPrice"), $langs->trans("AmountUsedToUpdateWAP")).''.$langs->trans("QtyAlreadyProduced").''.$line->qty.''; - print price($bomcost); + if ($manufacturingcost) { + print price($manufacturingcost); + } print ''; @@ -1188,11 +1198,20 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } print '
    '; // Type $type = ($object->format == "A") ? 'classic' : 'date'; -print ''; // Title print ''; // Description -print ''; // EMail //If linked user, then emails are going to be sent to users' email if (!$object->fk_user_creat) { - print ''; } // Receive an email with each vote -print ''; // Users can comment -print ''; // Users can see others vote -print ''; +print '
    '.$langs->trans("Type").''; +print '
    '.$langs->trans("Type").''; print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1); print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'
    '; $adresseadmin = $object->mail_admin; -print $langs->trans("Title").''; +print $langs->trans("Title").''; if ($action == 'edit') { print ''; } else { @@ -244,7 +245,7 @@ if ($action == 'edit') { print '
    '.$langs->trans("Description").''; +print '
    '.$langs->trans("Description").''; if ($action == 'edit') { $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); $doleditor->Create(0, ''); @@ -256,17 +257,17 @@ print '
    '.$langs->trans("EMail").''; + print '
    '.$langs->trans("EMail").''; if ($action == 'edit') { print ''; } else { - print dol_print_email($object->mail_admin, 0, 0, 1); + print dol_print_email($object->mail_admin, 0, 0, 1, 0, 1, 1); } print '
    '.$langs->trans('ToReceiveEMailForEachVote').''; +print '
    '.$langs->trans('ToReceiveEMailForEachVote').''; if ($action == 'edit') { print 'mailsonde ? 'checked="checked"' : '').'">'; } else { @@ -282,7 +283,7 @@ if ($action == 'edit') { print '
    '.$langs->trans('CanComment').''; +print '
    '.$langs->trans('CanComment').''; if ($action == 'edit') { print 'allow_comments ? 'checked="checked"' : '').'">'; } else { @@ -291,7 +292,7 @@ if ($action == 'edit') { print '
    '.$langs->trans('CanSeeOthersVote').''; +print '
    '.$langs->trans('CanSeeOthersVote').''; if ($action == 'edit') { print 'allow_spy ? 'checked="checked"' : '').'">'; } else { @@ -299,8 +300,16 @@ if ($action == 'edit') { } print '
    '; + +print ''; +print '
    '; +print '
    '; + +print ''; + // Expire date -print ''; // Author print ''; // Link -print ''; print '
    '.$langs->trans('ExpireDate').''; +print '
    '.$langs->trans('ExpireDate').''; if ($action == 'edit') { print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); } else { @@ -313,7 +322,7 @@ print '
    '; -print $langs->trans("Author").''; +print $langs->trans("Author").''; if ($object->fk_user_creat) { print $userstatic->getLoginUrl(1); } else { @@ -322,7 +331,7 @@ if ($object->fk_user_creat) { print '
    '.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').''; +print '
    '.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').''; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -338,8 +347,10 @@ if ($action != 'edit') { print '
    '; +print '
    '; print ''; +print '
    '; print dol_get_fiche_end(); diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index ff5198c006a..d03cbca69c5 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -455,20 +455,21 @@ dol_banner_tab($object, 'id', $linkback, 1, 'id_sondage', 'id_sondage', $morehtm print '
    '; -print '
    '; +print '
    '; +print '
    '; print ''; // Type $type = ($object->format == "A") ? 'classic' : 'date'; -print ''; // Title print ''; +// Description +print ''; + +// EMail +//If linked user, then emails are going to be sent to users' email +if (!$object->fk_user_creat) { + print ''; +} + +print '
    '.$langs->trans("Type").''; +print '
    '.$langs->trans("Type").''; print img_picto('', dol_buildpath('/opensurvey/img/'.($type == 'classic' ? 'chart-32.png' : 'calendar-32.png'), 1), 'width="16"', 1); print ' '.$langs->trans($type == 'classic' ? "TypeClassic" : "TypeDate").'
    '; $adresseadmin = $object->mail_admin; -print $langs->trans("Title").''; +print $langs->trans("Title").''; if ($action == 'edit') { print ''; } else { @@ -476,8 +477,39 @@ if ($action == 'edit') { } print '
    '.$langs->trans("Description").''; +if ($action == 'edit') { + $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); + $doleditor->Create(0, ''); +} else { + print (dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); +} +print '
    '.$langs->trans("EMail").''; + if ($action == 'edit') { + print ''; + } else { + print dol_print_email($object->mail_admin, 0, 0, 1, 0, 1, 1); + } + print '
    '; + +print '
    '; +print '
    '; +print '
    '; + +print ''; + + // Expire date -print ''; // Author print ''; // Link -print ''; print '
    '.$langs->trans('ExpireDate').''; +print '
    '.$langs->trans('ExpireDate').''; if ($action == 'edit') { print $form->selectDate($expiredate ? $expiredate : $object->date_fin, 'expire', 0, 0, 0, '', 1, 0); } else { @@ -490,7 +522,7 @@ print '
    '; -print $langs->trans("Author").''; +print $langs->trans("Author").''; if ($object->fk_user_creat) { print $userstatic->getLoginUrl(1); } else { @@ -499,7 +531,7 @@ if ($object->fk_user_creat) { print '
    '.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').''; +print '
    '.img_picto('', 'globe').' '.$langs->trans("UrlForSurvey", '').''; // Define $urlwithroot $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); @@ -521,8 +553,10 @@ if ($action != 'edit') { print '
    '; +print '
    '; print '
    '; +print '
    '; print dol_get_fiche_end(); From c40b22facd3cf4f3e69020755b7abf5cdf8b21a9 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Mon, 20 Sep 2021 19:41:13 +0200 Subject: [PATCH 139/154] Add turnover homepage box --- .../facture/class/facturestats.class.php | 28 +++ .../core/boxes/box_graph_invoices_peryear.php | 223 ++++++++++++++++++ htdocs/core/class/stats.class.php | 30 +++ 3 files changed, 281 insertions(+) create mode 100644 htdocs/core/boxes/box_graph_invoices_peryear.php diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 96c8e88b97e..39325c2cbbd 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -266,4 +266,32 @@ class FactureStats extends Stats return $this->_getAllByProduct($sql, $limit); } + /** + * Return the invoices amount by year for a number of past years + * + * @param int $numberYears Years to scan + * @param int $format 0=Label of abscissa is a translated text, 1=Label of abscissa is year, 2=Label of abscissa is last number of year + * @return array Array with amount by year + */ + public function getAmountByYear($numberYears, $format = 0) + { + global $user; + + $endYear = date('Y'); + $startYear = $endYear - $numberYears; + $sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")"; + $sql .= " FROM ".$this->from; + if (!$user->rights->societe->client->voir && !$this->socid) + { + $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + } + $sql .= $this->join; + $sql .= " WHERE f.datef BETWEEN '".$this->db->idate(dol_get_first_day($startYear))."' AND '".$this->db->idate(dol_get_last_day($endYear))."'"; + $sql .= " AND ".$this->where; + $sql .= " GROUP BY dm"; + $sql .= $this->db->order('dm', 'ASC'); + + $res = $this->_getAmountByYear($sql); + return $res; + } } diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php new file mode 100644 index 00000000000..3b3192a98ba --- /dev/null +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -0,0 +1,223 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/boxes/box_graph_invoices_peryear.php + * \ingroup factures + * \brief Box to show graph of invoices per year + */ +include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; + + +/** + * Class to manage the box to show last invoices + */ +class box_graph_invoices_peryear extends ModeleBoxes +{ + public $boxcode = "invoicesperyear"; + public $boximg = "object_bill"; + public $boxlabel = "BoxCustomersInvoicesPerYear"; + public $depends = array("facture"); + + /** + * @var DoliDB Database handler. + */ + public $db; + + public $info_box_head = array(); + public $info_box_contents = array(); + + + /** + * Constructor + * + * @param DoliDB $db Database handler + * @param string $param More parameters + */ + public function __construct($db, $param) + { + global $user; + + $this->db = $db; + + $this->hidden = !($user->rights->facture->lire); + } + + /** + * Load data into info_box_contents array to show array later. + * + * @param int $max Maximum number of records to load + * @return void + */ + public function loadBox($max = 5) + { + global $conf, $user, $langs; + + $this->max = $max; + + $refreshaction = 'refresh_'.$this->boxcode; + + //include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + //$facturestatic=new Facture($this->db); + + $startmonth = $conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1; + if (empty($conf->global->GRAPH_USE_FISCAL_YEAR)) $startmonth = 1; + + $text = $langs->trans("Turnover", $max); + $this->info_box_head = array( + 'text' => $text, + 'limit'=> dol_strlen($text), + 'graph'=> 1, + 'sublink'=>'', + 'subtext'=>$langs->trans("Filter"), + 'subpicto'=>'filter.png', + 'subclass'=>'linkobject boxfilter', + 'target'=>'none' // Set '' to get target="_blank" + ); + + $dir = ''; // We don't need a path because image file will not be saved into disk + $prefix = ''; + $socid = 0; + if ($user->socid) $socid = $user->socid; + if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user + + if ($user->rights->facture->lire) + { + $mesg = ''; + + $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; + $param_showtot = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_showtot'; + + include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; + $autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE')); + if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray)) + { + $endyear = GETPOST($param_year, 'int'); + $showtot = GETPOST($param_showtot, 'alpha'); + } else { + $tmparray = json_decode($_COOKIE['DOLUSERCOOKIE_box_'.$this->boxcode], true); + $endyear = $tmparray['year']; + $showtot = $tmparray['showtot']; + } + if (empty($showtot)) { $showtot = 1; } + $nowarray = dol_getdate(dol_now(), true); + if (empty($endyear)) $endyear = $nowarray['year']; + $numberyears = (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 5 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH); + $startyear = $endyear - $numberyears; + $endyear = + + $mode = 'customer'; + $WIDTH = (($showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320'; + $HEIGHT = '192'; + + $stats = new FactureStats($this->db, $socid, $mode, 0); + + // Build graphic amount of object. $data = array(array('Lib',val1,val2,val3),...) + $data2 = $stats->getAmountByYear($numberyears); + + $filenamenb = $dir."/".$prefix."invoicesamountyears-".$endyear.".png"; + // default value for customer mode + $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstats&file=invoicesamountyears-'.$endyear.'.png'; + if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=billstatssupplier&file=invoicessupplieramountyears-'.$endyear.'.png'; + + $px2 = new DolGraph(); + $mesg = $px2->isGraphKo(); + if (!$mesg) + { + $langs->load("bills"); + + $px2->SetData($data2); + unset($data2); + $i = $startyear; + $legend = array(); + while ($i <= $endyear) + { + if ($startmonth != 1) + { + $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); + } else { + $legend[] = $i; + } + $i++; + } + $px2->SetLegend([$langs->trans("AmountOfBillsHT")]); + $px2->SetMaxValue($px2->GetCeilMaxValue()); + $px2->SetWidth($WIDTH); + $px2->SetHeight($HEIGHT); + $px2->SetYLabel($langs->trans("AmountOfBillsHT")); + $px2->SetShading(3); + $px2->SetHorizTickIncrement(1); + $px2->SetCssPrefix("cssboxes"); + $px2->mode = 'depth'; + $px2->SetTitle($langs->trans("Turnover")); + + $px2->draw($filenamenb, $fileurlnb); + } + + if (empty($conf->use_javascript_ajax)) + { + $langs->load("errors"); + $mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs"); + } + + if (!$mesg) + { + $stringtoshow = ''; + $stringtoshow .= ''; + $stringtoshow .= '
    '; // hideobject is to start hidden + $stringtoshow .= '
    '; + $stringtoshow .= ''; + $stringtoshow .= ''; + $stringtoshow .= ''; + $stringtoshow .= ''; + $stringtoshow .= $langs->trans("Year").' '; + $stringtoshow .= ''; + $stringtoshow .= '
    '; + $stringtoshow .= '
    '; + $stringtoshow .= $px2->show(); + $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover center"', 'textnoformat'=>$stringtoshow); + } else { + $this->info_box_contents[0][0] = array('tr'=>'class="oddeven nohover"', 'td' => 'class="nohover left"', 'maxlength'=>500, 'text' => $mesg); + } + } else { + $this->info_box_contents[0][0] = array( + 'td' => 'class="nohover left"', + 'text' => ''.$langs->trans("ReadPermissionNotAllowed").'' + ); + } + } + + /** + * Method to show box + * + * @param array $head Array with properties of box title + * @param array $contents Array with properties of box lines + * @param int $nooutput No print, only return string + * @return string + */ + public function showBox($head = null, $contents = null, $nooutput = 0) + { + return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); + } +} diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index 4ac164b1d3a..6fd5db42253 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -617,4 +617,34 @@ abstract class Stats return $result; } + + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** + * Returns the summed amounts per year for a given number of past years ending now + * @param string $sql SQL + * @return array + */ + function _getAmountByYear($sql) + { + $result = array(); + $resql = $this->db->query($sql); + if ($resql) + { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) + { + $row = $this->db->fetch_row($resql); + $j = (int) $row[0]; + $result[] = [ + 0 => (int) $row[0], + 1 => (int) $row[1], + ]; + $i++; + } + $this->db->free($resql); + } + return $result; + } + } From d919ef9c4cf74b8049864034e0a2882bec041b19 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 20 Sep 2021 17:57:10 +0000 Subject: [PATCH 140/154] Fixing style errors. --- .../facture/class/facturestats.class.php | 3 +-- .../core/boxes/box_graph_invoices_peryear.php | 23 +++++++------------ htdocs/core/class/stats.class.php | 9 +++----- 3 files changed, 12 insertions(+), 23 deletions(-) diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 39325c2cbbd..1e6457104ea 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -281,8 +281,7 @@ class FactureStats extends Stats $startYear = $endYear - $numberYears; $sql = "SELECT date_format(datef,'%Y') as dm, SUM(f.".$this->field.")"; $sql .= " FROM ".$this->from; - if (!$user->rights->societe->client->voir && !$this->socid) - { + if (!$user->rights->societe->client->voir && !$this->socid) { $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; } $sql .= $this->join; diff --git a/htdocs/core/boxes/box_graph_invoices_peryear.php b/htdocs/core/boxes/box_graph_invoices_peryear.php index 3b3192a98ba..447ab9dfdfb 100644 --- a/htdocs/core/boxes/box_graph_invoices_peryear.php +++ b/htdocs/core/boxes/box_graph_invoices_peryear.php @@ -95,8 +95,7 @@ class box_graph_invoices_peryear extends ModeleBoxes if ($user->socid) $socid = $user->socid; if (!$user->rights->societe->client->voir || $socid) $prefix .= 'private-'.$user->id.'-'; // If user has no permission to see all, output dir is specific to user - if ($user->rights->facture->lire) - { + if ($user->rights->facture->lire) { $mesg = ''; $param_year = 'DOLUSERCOOKIE_box_'.$this->boxcode.'_year'; @@ -105,8 +104,7 @@ class box_graph_invoices_peryear extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; $autosetarray = preg_split("/[,;:]+/", GETPOST('DOL_AUTOSET_COOKIE')); - if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray)) - { + if (in_array('DOLUSERCOOKIE_box_'.$this->boxcode, $autosetarray)) { $endyear = GETPOST($param_year, 'int'); $showtot = GETPOST($param_showtot, 'alpha'); } else { @@ -119,7 +117,7 @@ class box_graph_invoices_peryear extends ModeleBoxes if (empty($endyear)) $endyear = $nowarray['year']; $numberyears = (empty($conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH) ? 5 : $conf->global->MAIN_NB_OF_YEAR_IN_WIDGET_GRAPH); $startyear = $endyear - $numberyears; - $endyear = + $endyear = $mode = 'customer'; $WIDTH = (($showtot) || !empty($conf->dol_optimize_smallscreen)) ? '256' : '320'; @@ -137,18 +135,15 @@ class box_graph_invoices_peryear extends ModeleBoxes $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); - if (!$mesg) - { + if (!$mesg) { $langs->load("bills"); $px2->SetData($data2); unset($data2); $i = $startyear; $legend = array(); - while ($i <= $endyear) - { - if ($startmonth != 1) - { + while ($i <= $endyear) { + if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); } else { $legend[] = $i; @@ -169,14 +164,12 @@ class box_graph_invoices_peryear extends ModeleBoxes $px2->draw($filenamenb, $fileurlnb); } - if (empty($conf->use_javascript_ajax)) - { + if (empty($conf->use_javascript_ajax)) { $langs->load("errors"); $mesg = $langs->trans("WarningFeatureDisabledWithDisplayOptimizedForBlindNoJs"); } - if (!$mesg) - { + if (!$mesg) { $stringtoshow = ''; $stringtoshow .= '