From d034acb3ecdf5c4e3a69337ca2d93b7271e13c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A9lina=20JOUM?= Date: Mon, 13 Feb 2023 12:13:02 +0100 Subject: [PATCH 01/33] add supplier --- htdocs/accountancy/class/accountancyexport.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 232df48761a..900da6890cf 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -1913,14 +1913,16 @@ class AccountancyExport //Calcul de la longueur des numéros de comptes $taille_numero = strlen(length_accountg($line->numero_compte)); - //Création du numéro de client générique + //Création du numéro de client et fournisseur générique $numero_cpt_client = '411'; + $numero_cpt_fourn = '401'; for ($i = 1; $i <= ($taille_numero - 3); $i++) { $numero_cpt_client .= '0'; + $numero_cpt_fourn .= '0'; } - //Création des comptes auxiliaire des clients - if (length_accountg($line->numero_compte) == $numero_cpt_client) { + //Création des comptes auxiliaire des clients et fournisseur + if (length_accountg($line->numero_compte) == $numero_cpt_client || length_accountg($line->numero_compte) == $numero_cpt_fourn) { $tab[] = rtrim(length_accounta($line->subledger_account), "0"); } else { $tab[] = length_accountg($line->numero_compte); From a8daf57f715b35fff40ea1365e2bfc4167cc239b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 14:03:34 +0100 Subject: [PATCH 02/33] doc --- htdocs/asset/class/asset.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index c01f4b967c4..5cf9e748d00 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -157,6 +157,11 @@ class Asset extends CommonObject public $status; public $user_cloture_id; + /** + * @var Asset object oldcopy + */ + public $oldcopy; + // /** // * @var string Field with ID of parent key if this object has a parent // */ From 7af9834a0c7b99ebc13794747afd5d3b1a76c8f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 21:28:20 +0100 Subject: [PATCH 03/33] enhance member tooltip --- htdocs/adherents/class/adherent.class.php | 4 ++++ htdocs/core/ajax/ajaxtooltip.php | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 6e77fd3fa95..b84d622094d 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2287,6 +2287,7 @@ class Adherent extends CommonObject global $conf, $langs; $datas = []; + $langs->loadLangs(['members', 'companies']); $nofetch = empty($params['nofetch']) ? false : true; if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { @@ -2303,6 +2304,9 @@ class Adherent extends CommonObject $datas['divopen'] = '
'; $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Member").' '.$this->getLibStatut(4); + if (!empty($this->morphy)) { + $datas['picto'] .= ' ' . $this->getmorphylib('', 1); + } if (!empty($this->ref)) { $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; } diff --git a/htdocs/core/ajax/ajaxtooltip.php b/htdocs/core/ajax/ajaxtooltip.php index 3933f03533b..8652908eced 100644 --- a/htdocs/core/ajax/ajaxtooltip.php +++ b/htdocs/core/ajax/ajaxtooltip.php @@ -118,7 +118,6 @@ if ($objecttype == 'facture' || $objecttype == 'invoice') { $module = 'contrat'; $myobject = 'contrat'; } elseif ($objecttype == 'member') { - $langs->load('members'); $classpath = 'adherents/class'; $module = 'adherent'; $myobject = 'adherent'; From e54020ea153b9dd8e49b13bebf68d36bb142a92c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 21:32:43 +0100 Subject: [PATCH 04/33] enhance membertype tooltip --- htdocs/adherents/class/adherent_type.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index a744ce71bdc..9534ed639ae 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -706,6 +706,9 @@ class AdherentType extends CommonObject if (isset($this->subscription)) { $datas['subscription'] = '
'.$langs->trans("SubscriptionRequired").': '.yn($this->subscription); } + if (isset($this->vote)) { + $datas['vote'] = '
'.$langs->trans("VoteAllowed").': '.yn($this->vote); + } return $datas; } From bd1d487c382a1d12f098145f07d264b8a33af0e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 21:40:48 +0100 Subject: [PATCH 05/33] enhance membertype tooltip --- htdocs/adherents/class/adherent_type.class.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 9534ed639ae..ebf0a6fdb7a 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -709,6 +709,15 @@ class AdherentType extends CommonObject if (isset($this->vote)) { $datas['vote'] = '
'.$langs->trans("VoteAllowed").': '.yn($this->vote); } + if (isset($this->duration)) { + $datas['duration'] = '
'.$langs->trans("Duration").': '.$this->duration_value; + if ($this->duration_value > 1) { + $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + } elseif ($this->duration_value > 0) { + $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); + } + $datas['duration'] .= " " . (!empty($this->duration_unit) && isset($dur[$this->duration_unit]) ? $langs->trans($dur[$this->duration_unit]) : ''); + } return $datas; } @@ -736,6 +745,7 @@ class AdherentType extends CommonObject 'id' => $this->id, 'objecttype' => $this->element, 'option' => $option, + 'nofetch' => 1, ]; if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { $classfortooltip = 'classforajaxtooltip'; From 364e8a554ab0489a6506caae8529351010db81fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 21:47:44 +0100 Subject: [PATCH 06/33] enhance membertype tooltip --- htdocs/adherents/class/adherent_type.class.php | 2 +- htdocs/adherents/type.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index ebf0a6fdb7a..eda018e6dca 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -712,7 +712,7 @@ class AdherentType extends CommonObject if (isset($this->duration)) { $datas['duration'] = '
'.$langs->trans("Duration").': '.$this->duration_value; if ($this->duration_value > 1) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); } elseif ($this->duration_value > 0) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c91915f7bdb..8b459e2c7b6 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -522,7 +522,7 @@ if ($rowid > 0) { print ''.$langs->trans("Duration").''.$object->duration_value.' '; if ($object->duration_value > 1) { - $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); + $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); } elseif ($object->duration_value > 0) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } From 3e91a4b1d142d48f47f911c5a471ecdf5a8232c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 22:51:46 +0100 Subject: [PATCH 07/33] enhance membertype tooltip --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index c6cc2acc722..985bd288e30 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2740,7 +2740,7 @@ class FactureFournisseur extends CommonInvoice $alreadypaid = $this->alreadypaid; } - $$datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid); + $datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid); } if ($moretitle) { $datas['picto'] .= ' - '.$moretitle; From b9243376afb35086d1282f73570f9e86a4a7fc58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 23:29:10 +0100 Subject: [PATCH 08/33] enhance shipping tooltip --- htdocs/expedition/class/expedition.class.php | 47 ++++++++++++++++--- .../fourn/class/fournisseur.facture.class.php | 2 +- htdocs/holiday/class/holiday.class.php | 2 +- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index dd6dfee55b1..812547ed317 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1784,6 +1784,30 @@ class Expedition extends CommonObject } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('shipping'); + $nofetch = empty($params['nofetch']) ? false : true; + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Shipment").''; + if (isset($this->statut)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + $datas['refcustomer'] = '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); + + return $datas; + } + /** * Return clicable link of object (with eventually picto) * @@ -1800,9 +1824,20 @@ class Expedition extends CommonObject global $langs, $conf, $hookmanager; $result = ''; - $label = ''.$langs->trans("Shipment").''; - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + 'nofetch' => 1, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); + } + $label = implode($this->getTooltipContentArray($params)); $url = DOL_URL_ROOT.'/expedition/card.php?id='.$this->id; @@ -1827,8 +1862,8 @@ class Expedition extends CommonObject $label = $langs->trans("Shipment"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.'"'; } $linkstart = 'picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= $this->ref; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 985bd288e30..c6cc2acc722 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2740,7 +2740,7 @@ class FactureFournisseur extends CommonInvoice $alreadypaid = $this->alreadypaid; } - $datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid); + $$datas['picto'] .= ' '.$this->getLibStatut(5, $alreadypaid); } if ($moretitle) { $datas['picto'] .= ' - '.$moretitle; diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index e3a605a09aa..1b857f2a640 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1317,7 +1317,7 @@ class Holiday extends CommonObject if (isset($this->statut)) { $datas['picto'] .= ' '.$this->getLibStatut(5); } - $datas['label'] = '
'.$langs->trans('Ref').': '.$this->ref; + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; return $datas; } From adc7d1fae2f079f1f44fdd4b9cc53cf635c46348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 13 Feb 2023 23:42:08 +0100 Subject: [PATCH 09/33] enhance shipping tooltip --- htdocs/expedition/class/expedition.class.php | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 812547ed317..0592b5cfdcf 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -90,6 +90,15 @@ class Expedition extends CommonObject */ public $fields = array(); + /** + * @var int ID of user author + */ + public $user_author_id; + + /** + * @var int ID of user author + */ + public $fk_user_author; public $socid; @@ -175,8 +184,35 @@ class Expedition extends CommonObject public $meths; public $listmeths; // List of carriers + /** + * @var int ID of order + */ + public $commande_id; + + /** + * @var Commande order + */ + public $commande; + + /** + * @var ExpeditionLigne[] array of shipping lines + */ public $lines = array(); + // Multicurrency + /** + * @var int Currency ID + */ + public $fk_multicurrency; + + /** + * @var string multicurrency code + */ + public $multicurrency_code; + public $multicurrency_tx; + public $multicurrency_total_ht; + public $multicurrency_total_tva; + public $multicurrency_total_ttc; /** * Draft status @@ -565,6 +601,7 @@ class Expedition extends CommonObject $this->ref_ext = $obj->ref_ext; $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; + $this->fk_user_author = $obj->fk_user_author; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_valid = $this->db->jdate($obj->date_valid); $this->date = $this->db->jdate($obj->date_expedition); // TODO deprecated From 67ada4bc9c67e0fe72894400065d848b597eb4ef Mon Sep 17 00:00:00 2001 From: HYWZ Date: Tue, 14 Feb 2023 10:46:13 +0300 Subject: [PATCH 10/33] add on common doc generator user attributs Add attributs : * myuser_birth * myuser_dateemployment * myuser_dateemploymentend * myuser_gender --- htdocs/core/class/commondocgenerator.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 33d5e5a97c6..1cd9eb9f05b 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -145,7 +145,11 @@ abstract class CommonDocGenerator 'myuser_email'=>$user->email, 'myuser_logo'=>$logotouse, 'myuser_job'=>$user->job, - 'myuser_web'=>'' // url not exist in $user object + 'myuser_web'=>'' // url not exist in $user object, + 'myuser_birth'=>dol_print_date($user->birth, 'day', 'tzuser'), + 'myuser_dateemployment'=>dol_print_date($user->dateemployment, 'day', 'tzuser'), + 'myuser_dateemploymentend'=>dol_print_date($user->dateemploymentend, 'day', 'tzuser'), + 'myuser_gender'=>$user->gender, ); // Retrieve extrafields if (is_array($user->array_options) && count($user->array_options)) { From 8deecaff98e5b3a1372cb86c590434de59fc4ddd Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 14 Feb 2023 07:48:26 +0000 Subject: [PATCH 11/33] Fixing style errors. --- htdocs/core/class/commondocgenerator.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 1cd9eb9f05b..86ac881ec13 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -147,9 +147,9 @@ abstract class CommonDocGenerator 'myuser_job'=>$user->job, 'myuser_web'=>'' // url not exist in $user object, 'myuser_birth'=>dol_print_date($user->birth, 'day', 'tzuser'), - 'myuser_dateemployment'=>dol_print_date($user->dateemployment, 'day', 'tzuser'), - 'myuser_dateemploymentend'=>dol_print_date($user->dateemploymentend, 'day', 'tzuser'), - 'myuser_gender'=>$user->gender, + 'myuser_dateemployment'=>dol_print_date($user->dateemployment, 'day', 'tzuser'), + 'myuser_dateemploymentend'=>dol_print_date($user->dateemploymentend, 'day', 'tzuser'), + 'myuser_gender'=>$user->gender, ); // Retrieve extrafields if (is_array($user->array_options) && count($user->array_options)) { From 98976231c6f27deee9b5227b441fedb83f0935ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Feb 2023 14:23:12 +0100 Subject: [PATCH 12/33] Use recent model by default --- htdocs/core/modules/modCommande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index d7b9d6da1ed..4fae3b1e0c9 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -79,7 +79,7 @@ class modCommande extends DolibarrModules $this->const[$r][0] = "COMMANDE_ADDON_PDF"; $this->const[$r][1] = "chaine"; - $this->const[$r][2] = "einstein"; + $this->const[$r][2] = "eratosthene"; $this->const[$r][3] = 'Name of PDF model of order'; $this->const[$r][4] = 0; From 6745860cac8cc01d263f847c835808af529c48c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Feb 2023 20:24:07 +0100 Subject: [PATCH 13/33] clean code --- htdocs/societe/class/societe.class.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e180d9ab13e..37d383e69a7 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2716,25 +2716,28 @@ class Societe extends CommonObject if (!empty($this->code_client) && ($this->client == 1 || $this->client == 3)) { $datas['customercode'] = '
'.$langs->trans('CustomerCode').': '.$this->code_client; } + if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) { + $langs->load('compta'); + $datas['accountancycustomercode'] = '
'.$langs->trans('CustomerAccountancyCode').': '.($this->code_compta ? $this->code_compta : $this->code_compta_client); + } + // show categories for this record only in ajax to not overload lists + if (!$nofetch && isModEnabled('categorie') && $this->client) { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $form = new Form($this->db); + $datas['categories_customer'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1, 1); + } if (!empty($this->code_fournisseur) && $this->fournisseur) { $datas['suppliercode'] = '
'.$langs->trans('SupplierCode').': '.$this->code_fournisseur; } - if (isModEnabled('accounting') && ($this->client == 1 || $this->client == 3)) { - $datas['accountancycustomercode'] = '
'.$langs->trans('CustomerAccountancyCode').': '.($this->code_compta ? $this->code_compta : $this->code_compta_client); - } if (isModEnabled('accounting') && $this->fournisseur) { + $langs->load('compta'); $datas['accountancysuppliercode'] = '
'.$langs->trans('SupplierAccountancyCode').': '.$this->code_compta_fournisseur; } // show categories for this record only in ajax to not overload lists - if (isModEnabled('categorie') && !$nofetch) { + if (!$nofetch && isModEnabled('categorie') && $this->fournisseur) { require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; $form = new Form($this->db); - if ($this->client) { - $datas['categories_customer'] = '
' . $form->showCategories($this->id, Categorie::TYPE_CUSTOMER, 1); - } - if ($this->fournisseur) { - $datas['categories_supplier'] = '
' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1); - } + $datas['categories_supplier'] = '
' . $form->showCategories($this->id, Categorie::TYPE_SUPPLIER, 1, 1); } $datas['divclose'] = '
'; From f0a7deb3f78af076ce8d6fb50fee9f5577f962ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Feb 2023 20:39:23 +0100 Subject: [PATCH 14/33] doc --- htdocs/societe/class/societe.class.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e180d9ab13e..cf8fd42c6d8 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -615,10 +615,11 @@ class Societe extends CommonObject /** * Duplicate of code_compta_client (for backward compatibility) * @var string + * @deprecated + * @see $code_compta_client */ public $code_compta; - /** * Accounting code for customer * @var string @@ -637,14 +638,12 @@ class Societe extends CommonObject */ public $accountancy_code_supplier; - /** * Accounting code for product (for level 3 of suggestion of prouct accounting account) * @var string */ public $code_compta_product; - /** * @var string * @deprecated Note is split in public and private notes From 7e307b9e19d6f9dc18195621adba4927b5fa07b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Feb 2023 20:48:53 +0100 Subject: [PATCH 15/33] colspan --- htdocs/hrm/skill_card.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/hrm/skill_card.php b/htdocs/hrm/skill_card.php index 9c5de6bf7f5..d5b62b26151 100644 --- a/htdocs/hrm/skill_card.php +++ b/htdocs/hrm/skill_card.php @@ -4,6 +4,7 @@ * Copyright (C) 2021 Greg Rastklan * Copyright (C) 2021 Jean-Pascal BOUDET * Copyright (C) 2021 Grégory BLEMAND + * Copyright (C) 2023 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -774,16 +775,16 @@ if ($action != "create" && $action != "edit") { // LINE EDITION | SUPPRESSION print ''; - print ''; - print ''; + + // print ''; // add pencil //@todo change to proper call dol_ //print 'id, 1) . '">'; // add trash //@todo change to proper call dol_ //print 'id,1) .'">'; - //print ''; + // print ''; // Fields from hook @@ -807,7 +808,7 @@ if ($action != "create" && $action != "edit") { // If no record found if ($num == 0) { - $colspan = 1; + $colspan = 2; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { $colspan++; From bd5dc3dbcc7bbf94f405de31c386fa181a5cdc2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Feb 2023 21:00:34 +0100 Subject: [PATCH 16/33] add ajaxtooltip on expensereport --- .../class/expensereport.class.php | 76 ++++++++++++++----- 1 file changed, 55 insertions(+), 21 deletions(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index a3c726ef521..9e60ac4b8c7 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1693,6 +1693,44 @@ class ExpenseReport extends CommonObject } } + /** + * getTooltipContentArray + * + * @param array $params ex option, infologin + * @since v18 + * @return array + */ + public function getTooltipContentArray($params) + { + global $conf, $langs; + + $langs->load('expensereport'); + $nofetch = empty($params['nofetch']) ? false : true; + $moretitle = $params['moretitle'] ?? ''; + $datas = []; + $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").''; + if (isset($this->status)) { + $datas['picto'] .= ' '.$this->getLibStatut(5); + } + if ($moretitle) { + $datas['picto'] .= ' - '.$moretitle; + } + if (!empty($this->ref)) { + $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref; + } + if (!empty($this->total_ht)) { + $datas['total_ht'] = '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $datas['total_tva'] = '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $datas['total_ttc'] = '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + + return $datas; + } + /** * Return clicable name (with picto eventually) * @@ -1717,25 +1755,21 @@ class ExpenseReport extends CommonObject return $url; } - $label = img_picto('', $this->picto).' '.$langs->trans("ExpenseReport").''; - if (isset($this->status)) { - $label .= ' '.$this->getLibStatut(5); - } - if (!empty($this->ref)) { - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - } - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - if ($moretitle) { - $label .= ' - '.$moretitle; + $params = [ + 'id' => $this->id, + 'objecttype' => $this->element, + 'option' => $option, + 'moretitle' => $moretitle, + 'nofetch' => 1, + ]; + $classfortooltip = 'classfortooltip'; + $dataparams = ''; + if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) { + $classfortooltip = 'classforajaxtooltip'; + $dataparams = ' data-params='.json_encode($params); + // $label = $langs->trans('Loading'); } + $label = implode($this->getTooltipContentArray($params)); if ($option != 'nolink') { // Add param to save lastsearch_values or not @@ -1759,8 +1793,8 @@ class ExpenseReport extends CommonObject $label = $langs->trans("ShowExpenseReport"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose .= ' class="classfortooltip"'; + $linkclose .= $dataparams.' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="'.$classfortooltip.'"'; } $linkstart = 'picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + $result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { $result .= ($max ? dol_trunc($ref, $max) : $ref); From ae4857113538d51ccd63e73be26752375fcbe426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 14 Feb 2023 22:56:12 +0100 Subject: [PATCH 17/33] use user->hasRight --- htdocs/comm/card.php | 20 ++++----- htdocs/comm/index.php | 4 +- htdocs/comm/propal/card.php | 2 +- htdocs/comm/propal/class/propal.class.php | 2 +- htdocs/comm/propal/contact.php | 6 +-- htdocs/comm/propal/index.php | 2 +- htdocs/comm/prospect/index.php | 4 +- htdocs/commande/class/commande.class.php | 2 +- htdocs/commande/contact.php | 6 +-- htdocs/compta/facture/card-rec.php | 42 +++++++++---------- htdocs/compta/facture/card.php | 12 +++--- htdocs/compta/facture/contact.php | 6 +-- htdocs/compta/facture/prelevement.php | 12 +++--- htdocs/compta/recap-compta.php | 2 +- htdocs/contact/consumption.php | 8 ++-- htdocs/contrat/card.php | 30 ++++++------- htdocs/contrat/class/contrat.class.php | 2 +- htdocs/contrat/contact.php | 6 +-- htdocs/contrat/index.php | 2 +- htdocs/core/ajax/loadinplace.php | 2 +- htdocs/core/ajax/row.php | 8 ++-- htdocs/core/boxes/box_services_contracts.php | 2 +- htdocs/core/lib/product.lib.php | 10 ++--- .../doc/doc_generic_project_odt.modules.php | 10 ++--- .../project/doc/pdf_beluga.modules.php | 10 ++--- htdocs/expedition/shipment.php | 22 +++++----- htdocs/fichinter/card.php | 2 +- htdocs/product/card.php | 6 +-- htdocs/projet/card.php | 8 ++-- htdocs/projet/tasks/time.php | 2 +- htdocs/societe/consumption.php | 8 ++-- htdocs/societe/paymentmodes.php | 16 +++---- .../class/supplier_proposal.class.php | 2 +- htdocs/takepos/invoice.php | 5 +-- 34 files changed, 141 insertions(+), 142 deletions(-) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 46343919cb6..8c4a5197b77 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -699,7 +699,7 @@ if ($object->id > 0) { $boxstat .= ''; $boxstat .= ''; if ($object->thirdparty->client) { $thirdTypeArray['customer'] = $langs->trans("customer"); - if (isModEnabled("propal") && $user->rights->propal->lire) { + if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) { $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); } - if (isModEnabled('commande') && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); } - if (isModEnabled('facture') && $user->rights->facture->lire) { + if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { $elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices'); } - if (isModEnabled('contrat') && $user->rights->contrat->lire) { + if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) { $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts'); } } diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 54779bb692d..10fe45ced69 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -214,7 +214,7 @@ if (empty($reshook)) { } // Add contract - if ($action == 'add' && $user->rights->contrat->creer) { + if ($action == 'add' && $user->hasRight('contrat', 'creer')) { // Check if (empty($datecontrat)) { $error++; @@ -408,9 +408,9 @@ if (empty($reshook)) { $action = 'create'; } } - } elseif ($action == 'classin' && $user->rights->contrat->creer) { + } elseif ($action == 'classin' && $user->hasRight('contrat', 'creer')) { $object->setProject(GETPOST('projectid')); - } elseif ($action == 'addline' && $user->rights->contrat->creer) { + } elseif ($action == 'addline' && $user->hasRight('contrat', 'creer')) { // Add a new line // Set if we used free entry or predefined product $predef = ''; @@ -682,7 +682,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - } elseif ($action == 'updateline' && $user->rights->contrat->creer && !GETPOST('cancel', 'alpha')) { + } elseif ($action == 'updateline' && $user->hasRight('contrat', 'creer') && !GETPOST('cancel', 'alpha')) { $error = 0; $predef = ''; @@ -795,7 +795,7 @@ if (empty($reshook)) { } else { $db->rollback(); } - } elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer) { + } elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) { $result = $object->deleteline(GETPOST('lineid', 'int'), $user); if ($result >= 0) { @@ -804,7 +804,7 @@ if (empty($reshook)) { } else { setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) { + } elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) { $result = $object->validate($user); if ($result > 0) { @@ -830,18 +830,18 @@ if (empty($reshook)) { } else { setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'reopen' && $user->rights->contrat->creer) { + } elseif ($action == 'reopen' && $user->hasRight('contrat', 'creer')) { $result = $object->reopen($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) { + } elseif ($action == 'confirm_close' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) { // Close all lines $result = $object->closeAll($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer) { + } elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) { $date_start = dol_mktime(12, 0, 0, GETPOST('d_startmonth'), GETPOST('d_startday'), GETPOST('d_startyear')); $date_end = dol_mktime(12, 0, 0, GETPOST('d_endmonth'), GETPOST('d_endday'), GETPOST('d_endyear')); $comment = GETPOST('comment', 'alpha'); @@ -857,7 +857,7 @@ if (empty($reshook)) { } else { setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) { + } elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->hasRight('contrat', 'creer')) { if (GETPOST('newcid') > 0) { $contractline = new ContratLigne($db); $result = $contractline->fetch(GETPOSTINT('lineid')); @@ -995,7 +995,7 @@ if (empty($reshook)) { include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; - if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->contrat->creer) { + if (!empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->hasRight('contrat', 'creer')) { if ($action == 'addcontact') { $contactid = (GETPOST('userid') ? GETPOST('userid') : GETPOST('contactid')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); @@ -1351,7 +1351,7 @@ if ($action == 'create') { // Contract - if (!empty($object->brouillon) && $user->rights->contrat->creer) { + if (!empty($object->brouillon) && $user->hasRight('contrat', 'creer')) { print ''; print ''; print ''; @@ -1448,7 +1448,7 @@ if ($action == 'create') { print ''; - if (!empty($object->brouillon) && $user->rights->contrat->creer) { + if (!empty($object->brouillon) && $user->hasRight('contrat', 'creer')) { print ''; } @@ -1826,7 +1826,7 @@ if ($action == 'create') { /* * Confirmation to delete service line of contract */ - if ($action == 'deleteline' && !$_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) { + if ($action == 'deleteline' && !$_REQUEST["cancel"] && $user->hasRight('contrat', 'creer') && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&lineid=".GETPOST('rowid'), $langs->trans("DeleteContractLine"), $langs->trans("ConfirmDeleteContractLine"), "confirm_deleteline", '', 0, 1); if ($ret == 'html') { print '
'; - if (isModEnabled("propal") && $user->rights->propal->lire) { + if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) { // Box proposals $tmp = $object->getOutstandingProposals(); $outstandingOpened = $tmp['opened']; @@ -720,7 +720,7 @@ if ($object->id > 0) { } } - if (isModEnabled('commande') && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { // Box commandes $tmp = $object->getOutstandingOrders(); $outstandingOpened = $tmp['opened']; @@ -741,7 +741,7 @@ if ($object->id > 0) { } } - if (isModEnabled('facture') && $user->rights->facture->lire) { + if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { // Box factures $tmp = $object->getOutstandingBills('customer', 0); $outstandingOpened = $tmp['opened']; @@ -820,7 +820,7 @@ if ($object->id > 0) { /* * Latest proposals */ - if (isModEnabled("propal") && $user->rights->propal->lire) { + if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) { $langs->load("propal"); $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht"; @@ -915,7 +915,7 @@ if ($object->id > 0) { /* * Latest orders */ - if (isModEnabled('commande') && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { $param =""; $sql = "SELECT s.nom, s.rowid"; @@ -1124,7 +1124,7 @@ if ($object->id > 0) { /* * Latest contracts */ - if (isModEnabled('contrat') && $user->rights->contrat->lire) { + if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) { $sql = "SELECT s.nom, s.rowid, c.rowid as id, c.ref as ref, c.statut as contract_status, c.datec as dc, c.date_contrat as dcon, c.ref_customer as refcus, c.ref_supplier as refsup, c.entity,"; $sql .= " c.last_main_doc, c.model_pdf"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c"; @@ -1318,7 +1318,7 @@ if ($object->id > 0) { /* * Latest invoices templates */ - if (isModEnabled('facture') && $user->rights->facture->lire) { + if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { $sql = 'SELECT f.rowid as id, f.titre as ref'; $sql .= ', f.total_ht'; $sql .= ', f.total_tva'; @@ -1413,7 +1413,7 @@ if ($object->id > 0) { /* * Latest invoices */ - if (isModEnabled('facture') && $user->rights->facture->lire) { + if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { $sql = 'SELECT f.rowid as facid, f.ref, f.type'; $sql .= ', f.total_ht'; $sql .= ', f.total_tva'; @@ -1557,12 +1557,12 @@ if ($object->id > 0) { print ''; } - if (isModEnabled("propal") && $user->rights->propal->creer && $object->status == 1) { + if (isModEnabled("propal") && $user->hasRight('propal', 'creer') && $object->status == 1) { $langs->load("propal"); print ''; } - if (isModEnabled('commande') && $user->rights->commande->creer && $object->status == 1) { + if (isModEnabled('commande') && $user->hasRight('commande', 'creer') && $object->status == 1) { $langs->load("orders"); print ''; } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 5d71683a311..8987d4ed25f 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -321,7 +321,7 @@ if (isModEnabled('supplier_proposal') && $user->hasRight("supplier_proposal", "l * Draft sales orders */ -if (isModEnabled('commande') && $user->rights->commande->lire) { +if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.total_tva, c.total_ttc, c.fk_statut as status"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; @@ -1008,7 +1008,7 @@ if (isModEnabled("propal") && $user->hasRight("propal", "lire")) { /* * Opened (validated) order */ -if (isModEnabled('commande') && $user->rights->commande->lire) { +if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { $sql = "SELECT c.rowid as commandeid, c.total_ttc, c.total_ht, c.total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; $sql .= ", s.rowid as socid, s.nom as name, s.name_alias"; $sql .= ", s.code_client, s.code_compta, s.client"; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3f74c4a860f..662a187d1c3 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -789,7 +789,7 @@ if (empty($reshook)) { } } } elseif ($action == 'import_lines_from_object' - && $user->rights->propal->creer + && $user->hasRight('propal', 'creer') && $object->statut == Propal::STATUS_DRAFT ) { // add lines from objectlinked diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 3a48230de40..da9082da8bc 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3795,7 +3795,7 @@ class Propal extends CommonObject } $linkclose = ''; - if (empty($notooltip) && $user->rights->propal->lire) { + if (empty($notooltip) && $user->hasRight('propal', 'lire')) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Proposal"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 45f2d175f9a..0c616ca2579 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -76,7 +76,7 @@ $usercancreate = $user->hasRight("propal", "creer"); * Add a new contact */ -if ($action == 'addcontact' && $user->rights->propal->creer) { +if ($action == 'addcontact' && $user->hasRight('propal', 'creer')) { if ($object->id > 0) { $contactid = (GETPOST('userid', 'int') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); @@ -94,12 +94,12 @@ if ($action == 'addcontact' && $user->rights->propal->creer) { setEventMessages($object->error, $object->errors, 'errors'); } } -} elseif ($action == 'swapstatut' && $user->rights->propal->creer) { +} elseif ($action == 'swapstatut' && $user->hasRight('propal', 'creer')) { // Toggle the status of a contact if ($object->id > 0) { $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } -} elseif ($action == 'deletecontact' && $user->rights->propal->creer) { +} elseif ($action == 'deletecontact' && $user->hasRight('propal', 'creer')) { // Deletes a contact $result = $object->delete_contact($lineid); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index 4a6d9ec63ed..ef5c295bd72 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -227,7 +227,7 @@ if ($resql) { /* * Open (validated) proposals */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) { $sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, s.email, s.code_compta"; $sql .= ", p.rowid as propalid, p.entity, p.total_ttc, p.total_ht, p.ref, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 19bde7072ad..13932d7da0c 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -119,7 +119,7 @@ if ($resql) { /* * Liste des propal brouillons */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) { $sql = "SELECT p.rowid, p.ref, p.price, s.nom as sname"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; @@ -177,7 +177,7 @@ if (isModEnabled('agenda')) { /* * Dernieres propales ouvertes */ -if (isModEnabled("propal") && $user->rights->propal->lire) { +if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) { $sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas,"; $sql .= " p.rowid as propalid, p.total_ttc, p.ref, p.datep as dp, c.label as statut, c.id as statutid"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5b111f67e6c..38e3accc1fb 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3820,7 +3820,7 @@ class Commande extends CommonOrder $label = implode($this->getTooltipContentArray($params)); $linkclose = ''; - if (empty($notooltip) && $user->rights->commande->lire) { + if (empty($notooltip) && $user->hasRight('commande', 'lire')) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("Order"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index a6202d5d3bf..a5fc715eb38 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -56,7 +56,7 @@ $object = new Commande($db); * Ajout d'un nouveau contact */ -if ($action == 'addcontact' && $user->rights->commande->creer) { +if ($action == 'addcontact' && $user->hasRight('commande', 'creer')) { $result = $object->fetch($id); if ($result > 0 && $id > 0) { @@ -76,14 +76,14 @@ if ($action == 'addcontact' && $user->rights->commande->creer) { setEventMessages($object->error, $object->errors, 'errors'); } } -} elseif ($action == 'swapstatut' && $user->rights->commande->creer) { +} elseif ($action == 'swapstatut' && $user->hasRight('commande', 'creer')) { // bascule du statut d'un contact if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } else { dol_print_error($db); } -} elseif ($action == 'deletecontact' && $user->rights->commande->creer) { +} elseif ($action == 'deletecontact' && $user->hasRight('commande', 'creer')) { // Efface un contact $object->fetch($id); $result = $object->delete_contact(GETPOST("lineid", 'int')); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index e29c5ca1bb3..1af465a806c 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -281,15 +281,15 @@ if (empty($reshook)) { // Update field // Set condition - if ($action == 'setconditions' && $user->rights->facture->creer) { + if ($action == 'setconditions' && $user->hasRight('facture', 'creer')) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); - } elseif ($action == 'setmode' && $user->rights->facture->creer) { + } elseif ($action == 'setmode' && $user->hasRight('facture', 'creer')) { // Set mode $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); - } elseif ($action == 'classin' && $user->rights->facture->creer) { + } elseif ($action == 'classin' && $user->hasRight('facture', 'creer')) { // Set project $object->setProject(GETPOST('projectid', 'int')); - } elseif ($action == 'setref' && $user->rights->facture->creer) { + } elseif ($action == 'setref' && $user->hasRight('facture', 'creer')) { // Set bank account //var_dump(GETPOST('ref', 'alpha'));exit; $result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY'); @@ -306,31 +306,31 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - } elseif ($action == 'setbankaccount' && $user->rights->facture->creer) { + } elseif ($action == 'setbankaccount' && $user->hasRight('facture', 'creer')) { // Set bank account $result = $object->setBankAccount(GETPOST('fk_account', 'int')); - } elseif ($action == 'setfrequency' && $user->rights->facture->creer) { + } elseif ($action == 'setfrequency' && $user->hasRight('facture', 'creer')) { // Set frequency and unit frequency $object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha')); - } elseif ($action == 'setdate_when' && $user->rights->facture->creer) { + } elseif ($action == 'setdate_when' && $user->hasRight('facture', 'creer')) { // Set next date of execution $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')); if (!empty($date)) { $object->setNextDate($date); } - } elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) { + } elseif ($action == 'setnb_gen_max' && $user->hasRight('facture', 'creer')) { // Set max period $object->setMaxPeriod(GETPOST('nb_gen_max', 'int')); - } elseif ($action == 'setauto_validate' && $user->rights->facture->creer) { + } elseif ($action == 'setauto_validate' && $user->hasRight('facture', 'creer')) { // Set auto validate $object->setAutoValidate(GETPOST('auto_validate', 'int')); - } elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer) { + } elseif ($action == 'setgenerate_pdf' && $user->hasRight('facture', 'creer')) { // Set generate pdf $object->setGeneratepdf(GETPOST('generate_pdf', 'int')); - } elseif ($action == 'setmodelpdf' && $user->rights->facture->creer) { + } elseif ($action == 'setmodelpdf' && $user->hasRight('facture', 'creer')) { // Set model pdf $object->setModelpdf(GETPOST('modelpdf', 'alpha')); - } elseif ($action == 'disable' && $user->rights->facture->creer) { + } elseif ($action == 'disable' && $user->hasRight('facture', 'creer')) { // Set status disabled $db->begin(); @@ -347,7 +347,7 @@ if (empty($reshook)) { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } elseif ($action == 'enable' && $user->rights->facture->creer) { + } elseif ($action == 'enable' && $user->hasRight('facture', 'creer')) { // Set status enabled $db->begin(); @@ -373,7 +373,7 @@ if (empty($reshook)) { } // Delete line - if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->facture->creer) { + if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->hasRight('facture', 'creer')) { $object->fetch($id); $object->fetch_thirdparty(); @@ -417,7 +417,7 @@ if (empty($reshook)) { } // Add a new line - if ($action == 'addline' && $user->rights->facture->creer) { + if ($action == 'addline' && $user->hasRight('facture', 'creer')) { $langs->load('errors'); $error = 0; @@ -1288,7 +1288,7 @@ if ($action == 'create') { print ''; - if ($action != 'editconditions' && $user->rights->facture->creer) { + if ($action != 'editconditions' && $user->hasRight('facture', 'creer')) { print ''; } print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'">'.img_edit($langs->trans('SetConditions'), 1).'
'; @@ -1309,7 +1309,7 @@ if ($action == 'create') { print ''; - if ($action != 'editmode' && $user->rights->facture->creer) { + if ($action != 'editmode' && $user->hasRight('facture', 'creer')) { print ''; } print '
'; print $langs->trans('PaymentMode'); print 'id.'">'.img_edit($langs->trans('SetMode'), 1).'
'; @@ -1418,7 +1418,7 @@ if ($action == 'create') { print ''; } print '
'; print $langs->trans('BankAccount'); print ''; - if (($action != 'editbankaccount') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) { + if (($action != 'editbankaccount') && $user->hasRight('facture', 'creer') && $object->statut == FactureRec::STATUS_DRAFT) { print 'id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; @@ -1436,7 +1436,7 @@ if ($action == 'create') { print ''; } print '
'; print $langs->trans('Model'); print ''; - if (($action != 'editmodelpdf') && $user->rights->facture->creer && $object->statut == FactureRec::STATUS_DRAFT) { + if (($action != 'editmodelpdf') && $user->hasRight('facture', 'creer') && $object->statut == FactureRec::STATUS_DRAFT) { print 'id.'">'.img_edit($langs->trans('SetModel'), 1).'
'; @@ -1482,7 +1482,7 @@ if ($action == 'create') { print ''; - if ($action != 'editfrequency' && $user->rights->facture->creer) { + if ($action != 'editfrequency' && $user->hasRight('facture', 'creer')) { print ''; } print '
'; print $langs->trans('Frequency'); print 'id.'">'.img_edit($langs->trans('Edit'), 1).'
'; @@ -1639,7 +1639,7 @@ if ($action == 'create') { } // Form to add new line - if ($object->statut == $object::STATUS_DRAFT && $user->rights->facture->creer && $action != 'valid' && $action != 'editline') { + if ($object->statut == $object::STATUS_DRAFT && $user->hasRight('facture', 'creer') && $action != 'valid' && $action != 'editline') { if ($action != 'editline') { // Add free products/services diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 3ce88a4a588..220a27436ce 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -391,7 +391,7 @@ if (empty($reshook)) { if ($result < 0) { dol_print_error($db, $object->error); } - } elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer) { + } elseif ($action == 'setretainedwarrantyconditions' && $user->hasRight('facture', 'creer')) { $object->fetch($id); $object->retained_warranty_fk_cond_reglement = 0; // To clean property $result = $object->setRetainedWarrantyPaymentTerms(GETPOST('retained_warranty_fk_cond_reglement', 'int')); @@ -411,13 +411,13 @@ if (empty($reshook)) { if ($result < 0) { dol_print_error($db, $object->error); } - } elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer) { + } elseif ($action == 'setretainedwarranty' && $user->hasRight('facture', 'creer')) { $object->fetch($id); $result = $object->setRetainedWarranty(GETPOST('retained_warranty', 'float')); if ($result < 0) { dol_print_error($db, $object->error); } - } elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer) { + } elseif ($action == 'setretainedwarrantydatelimit' && $user->hasRight('facture', 'creer')) { $object->fetch($id); $result = $object->setRetainedWarrantyDateLimit(GETPOST('retained_warranty_date_limit', 'float')); if ($result < 0) { @@ -4684,7 +4684,7 @@ if ($action == 'create') { print ''; - if ($action != 'editretainedwarranty' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) { + if ($action != 'editretainedwarranty' && $user->hasRight('facture', 'creer') && $object->statut == Facture::STATUS_DRAFT) { print ''; } @@ -4707,7 +4707,7 @@ if ($action == 'create') { print '
'; print $langs->trans('RetainedWarranty'); print 'id.'">'.img_edit($langs->trans('setretainedwarranty'), 1).'
'; - if ($action != 'editretainedwarrantypaymentterms' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) { + if ($action != 'editretainedwarrantypaymentterms' && $user->hasRight('facture', 'creer') && $object->statut == Facture::STATUS_DRAFT) { print ''; } @@ -4742,7 +4742,7 @@ if ($action == 'create') { print '
'; print $langs->trans('PaymentConditionsShortRetainedWarranty'); print 'id.'">'.img_edit($langs->trans('setPaymentConditionsShortRetainedWarranty'), 1).'
'; - if ($action != 'editretainedwarrantydatelimit' && $user->rights->facture->creer && $object->statut == Facture::STATUS_DRAFT) { + if ($action != 'editretainedwarrantydatelimit' && $user->hasRight('facture', 'creer') && $object->statut == Facture::STATUS_DRAFT) { print ''; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 2548284f97f..38d51f7b8b8 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -65,7 +65,7 @@ $usercancreate = $user->hasRight("facture", "creer"); * Add a new contact */ -if ($action == 'addcontact' && $user->rights->facture->creer) { +if ($action == 'addcontact' && $user->hasRight('facture', 'creer')) { if ($result > 0 && $id > 0) { $contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int')); $typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type')); @@ -83,10 +83,10 @@ if ($action == 'addcontact' && $user->rights->facture->creer) { setEventMessages($object->error, $object->errors, 'errors'); } } -} elseif ($action == 'swapstatut' && $user->rights->facture->creer) { +} elseif ($action == 'swapstatut' && $user->hasRight('facture', 'creer')) { // Toggle the status of a contact $result = $object->swapContactStatus(GETPOST('ligne', 'int')); -} elseif ($action == 'deletecontact' && $user->rights->facture->creer) { +} elseif ($action == 'deletecontact' && $user->hasRight('facture', 'creer')) { // Deletes a contact $result = $object->delete_contact($lineid); diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 790dc9e26ca..8af2972e1a0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -483,7 +483,7 @@ if ($object->id > 0) { print '
'; print $langs->trans('RetainedWarrantyDateLimit'); print 'id.'">'.img_edit($langs->trans('setretainedwarrantyDateLimit'), 1).'
'; - if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->rights->facture->creer) { + if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editinvoicedate' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) { print ''; } print '
'; print $langs->trans('DateInvoice'); print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).'
'; @@ -506,7 +506,7 @@ if ($object->id > 0) { print ''; - if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->rights->facture->creer) { + if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editconditions' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) { print ''; } print '
'; print $langs->trans('PaymentConditionsShort'); print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetConditions'), 1).'
'; @@ -527,7 +527,7 @@ if ($object->id > 0) { print ''; - if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->rights->facture->creer) { + if ($object->type != $object::TYPE_CREDIT_NOTE && $action != 'editpaymentterm' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) { print ''; } print '
'; print $langs->trans('DateMaxPayment'); print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetDate'), 1).'
'; @@ -556,7 +556,7 @@ if ($object->id > 0) { print ''; - if ($action != 'editmode' && !empty($object->brouillon) && $user->rights->facture->creer) { + if ($action != 'editmode' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) { print ''; } print '
'; print $langs->trans('PaymentMode'); print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetMode'), 1).'
'; @@ -577,7 +577,7 @@ if ($object->id > 0) { print ''; } print '
'; print $langs->trans('BankAccount'); print ''; - if (($action != 'editbankaccount') && $user->rights->commande->creer && !empty($object->brouillon)) { + if (($action != 'editbankaccount') && $user->hasRight('commande', 'creer') && !empty($object->brouillon)) { print 'id.'&type='.urlencode($type).'">'.img_edit($langs->trans('SetBankAccount'), 1).'
'; @@ -662,7 +662,7 @@ if ($object->id > 0) { print ''; - if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->rights->facture->creer) { + if ($action != 'editrevenuestamp' && !empty($object->brouillon) && $user->hasRight('facture', 'creer')) { print ''; } print '
'; print $langs->trans('RevenueStamp'); print 'id.'">'.img_edit($langs->trans('SetRevenuStamp'), 1).'
'; diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index b8986a449ce..0808e5a7aab 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -117,7 +117,7 @@ if ($id > 0) { dol_banner_tab($object, 'socid', '', ($user->socid ? 0 : 1), 'rowid', 'nom', '', '', 0, '', '', 1); print dol_get_fiche_end(); - if (isModEnabled('facture') && $user->rights->facture->lire) { + if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { // Invoice list print load_fiche_titre($langs->trans("CustomerPreview")); diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index bbd5bf005d2..3e7a1554367 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -156,16 +156,16 @@ print '
'; @@ -1836,7 +1836,7 @@ if ($action == 'create') { /* * Confirmation to move service toward another contract */ - if ($action == 'move' && !$_REQUEST["cancel"] && $user->rights->contrat->creer && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) { + if ($action == 'move' && !$_REQUEST["cancel"] && $user->hasRight('contrat', 'creer') && $object->lines[$cursorline - 1]->id == GETPOST('rowid')) { $arraycontractid = array(); foreach ($arrayothercontracts as $contractcursor) { $arraycontractid[$contractcursor->id] = $contractcursor->ref; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 97b586a2cde..c35b0c3515f 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -2062,7 +2062,7 @@ class Contrat extends CommonObject $label = implode($this->getTooltipContentArray($params)); $linkclose = ''; - if (empty($notooltip) && $user->rights->contrat->lire) { + if (empty($notooltip) && $user->hasRight('contrat', 'lire')) { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $label = $langs->trans("ShowContract"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 6ca7b9b86ef..2af24364604 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -61,7 +61,7 @@ $permissiontoadd = $user->rights->contrat->creer; // Used by the include * Actions */ -if ($action == 'addcontact' && $user->rights->contrat->creer) { +if ($action == 'addcontact' && $user->hasRight('contrat', 'creer')) { $result = $object->fetch($id); if ($result > 0 && $id > 0) { @@ -86,7 +86,7 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) { } // bascule du statut d'un contact -if ($action == 'swapstatut' && $user->rights->contrat->creer) { +if ($action == 'swapstatut' && $user->hasRight('contrat', 'creer')) { if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne', 'int')); } else { @@ -95,7 +95,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer) { } // Delete contact -if ($action == 'deletecontact' && $user->rights->contrat->creer) { +if ($action == 'deletecontact' && $user->hasRight('contrat', 'creer')) { $object->fetch($id); $result = $object->delete_contact(GETPOST("lineid", 'int')); diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index c40453ec7af..a8ca8a67444 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -239,7 +239,7 @@ print "
"; // Draft contracts -if (isModEnabled('contrat') && $user->rights->contrat->lire) { +if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) { $sql = "SELECT c.rowid, c.ref,"; $sql .= " s.nom as name, s.name_alias, s.logo, s.rowid as socid, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur"; $sql .= " FROM ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."societe as s"; diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 1cdecf6306d..af033c8cdd3 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -80,7 +80,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e if ($user->rights->$element->lire || $user->rights->$element->read || (isset($subelement) && ($user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read)) - || ($element == 'payment' && $user->rights->facture->lire) + || ($element == 'payment' && $user->hasRight('facture', 'lire')) || ($element == 'payment_supplier' && $user->rights->fournisseur->facture->lire)) { if ($type == 'select') { $methodname = 'load_cache_'.$loadmethod; diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 0254a7502f8..ec3ee105420 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -74,13 +74,13 @@ if (GETPOST('roworder', 'alpha', 3) && GETPOST('table_element_line', 'aZ09', 3) // Make test on permission $perm = 0; - if ($table_element_line == 'propaldet' && $user->rights->propal->creer) { + if ($table_element_line == 'propaldet' && $user->hasRight('propal', 'creer')) { $perm = 1; - } elseif ($table_element_line == 'commandedet' && $user->rights->commande->creer) { + } elseif ($table_element_line == 'commandedet' && $user->hasRight('commande', 'creer')) { $perm = 1; - } elseif ($table_element_line == 'facturedet' && $user->rights->facture->creer) { + } elseif ($table_element_line == 'facturedet' && $user->hasRight('facture', 'creer')) { $perm = 1; - } elseif ($table_element_line == 'facturedet_rec' && $user->rights->facture->creer) { + } elseif ($table_element_line == 'facturedet_rec' && $user->hasRight('facture', 'creer')) { $perm = 1; } elseif ($table_element_line == 'emailcollector_emailcollectoraction' && $user->admin) { $perm = 1; diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 433db55a515..81cd361f4a1 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -81,7 +81,7 @@ class box_services_contracts extends ModeleBoxes $this->info_box_head = array('text' => $langs->trans("BoxLastProductsInContract", $max)); - if ($user->rights->service->lire && $user->rights->contrat->lire) { + if ($user->rights->service->lire && $user->hasRight('contrat', 'lire')) { $contractstatic = new Contrat($this->db); $contractlinestatic = new ContratLigne($this->db); $thirdpartytmp = new Societe($this->db); diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index e919bf2c8b6..8fc0ce26f7d 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -432,7 +432,7 @@ function show_stats_for_company($product, $socid) print ''; // Customer proposals - if (isModEnabled("propal") && $user->rights->propal->lire) { + if (isModEnabled("propal") && $user->hasRight('propal', 'lire')) { $nblines++; $ret = $product->load_stats_propale($socid); if ($ret < 0) { @@ -470,7 +470,7 @@ function show_stats_for_company($product, $socid) print ''; } // Sales orders - if (isModEnabled('commande') && $user->rights->commande->lire) { + if (isModEnabled('commande') && $user->hasRight('commande', 'lire')) { $nblines++; $ret = $product->load_stats_commande($socid); if ($ret < 0) { @@ -508,7 +508,7 @@ function show_stats_for_company($product, $socid) print ''; } // Customer invoices - if (isModEnabled('facture') && $user->rights->facture->lire) { + if (isModEnabled('facture') && $user->hasRight('facture', 'lire')) { $nblines++; $ret = $product->load_stats_facture($socid); if ($ret < 0) { @@ -527,7 +527,7 @@ function show_stats_for_company($product, $socid) print ''; } // Customer template invoices - if (isModEnabled("facture") && $user->rights->facture->lire) { + if (isModEnabled("facture") && $user->hasRight('facture', 'lire')) { $nblines++; $ret = $product->load_stats_facturerec($socid); if ($ret < 0) { @@ -566,7 +566,7 @@ function show_stats_for_company($product, $socid) } // Contracts - if (isModEnabled('contrat') && $user->rights->contrat->lire) { + if (isModEnabled('contrat') && $user->hasRight('contrat', 'lire')) { $nblines++; $ret = $product->load_stats_contrat($socid); if ($ret < 0) { diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index f08a93b4339..6afa6d2efc6 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -945,25 +945,25 @@ class doc_generic_project_odt extends ModelePDFProjects 'title' => "ListProposalsAssociatedProject", 'class' => 'Propal', 'table' => 'propal', - 'test' => $conf->propal->enabled && $user->rights->propal->lire + 'test' => $conf->propal->enabled && $user->hasRight('propal', 'lire') ), 'order' => array( 'title' => "ListOrdersAssociatedProject", 'class' => 'Commande', 'table' => 'commande', - 'test' => $conf->commande->enabled && $user->rights->commande->lire + 'test' => $conf->commande->enabled && $user->hasRight('commande', 'lire') ), 'invoice' => array( 'title' => "ListInvoicesAssociatedProject", 'class' => 'Facture', 'table' => 'facture', - 'test' => $conf->facture->enabled && $user->rights->facture->lire + 'test' => $conf->facture->enabled && $user->hasRight('facture', 'lire') ), 'invoice_predefined' => array( 'title' => "ListPredefinedInvoicesAssociatedProject", 'class' => 'FactureRec', 'table' => 'facture_rec', - 'test' => $conf->facture->enabled && $user->rights->facture->lire + 'test' => $conf->facture->enabled && $user->hasRight('facture', 'lire') ), 'proposal_supplier' => array( 'title' => "ListSupplierProposalsAssociatedProject", @@ -987,7 +987,7 @@ class doc_generic_project_odt extends ModelePDFProjects 'title' => "ListContractAssociatedProject", 'class' => 'Contrat', 'table' => 'contrat', - 'test' => $conf->contrat->enabled && $user->rights->contrat->lire + 'test' => $conf->contrat->enabled && $user->hasRight('contrat', 'lire') ), 'intervention' => array( 'title' => "ListFichinterAssociatedProject", diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 7cf7c96aef2..8d13e69bdfe 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -374,7 +374,7 @@ class pdf_beluga extends ModelePDFProjects 'class'=>'Propal', 'table'=>'propal', 'datefieldname'=>'datep', - 'test'=>$conf->propal->enabled && $user->rights->propal->lire, + 'test'=>$conf->propal->enabled && $user->hasRight('propal', 'lire'), 'lang'=>'propal'), 'order'=>array( 'name'=>"CustomersOrders", @@ -382,7 +382,7 @@ class pdf_beluga extends ModelePDFProjects 'class'=>'Commande', 'table'=>'commande', 'datefieldname'=>'date_commande', - 'test'=>$conf->commande->enabled && $user->rights->commande->lire, + 'test'=>$conf->commande->enabled && $user->hasRight('commande', 'lire'), 'lang'=>'orders'), 'invoice'=>array( 'name'=>"CustomersInvoices", @@ -391,7 +391,7 @@ class pdf_beluga extends ModelePDFProjects 'margin'=>'add', 'table'=>'facture', 'datefieldname'=>'datef', - 'test'=>$conf->facture->enabled && $user->rights->facture->lire, + 'test'=>$conf->facture->enabled && $user->hasRight('facture', 'lire'), 'lang'=>'bills'), 'invoice_predefined'=>array( 'name'=>"PredefinedInvoices", @@ -399,7 +399,7 @@ class pdf_beluga extends ModelePDFProjects 'class'=>'FactureRec', 'table'=>'facture_rec', 'datefieldname'=>'datec', - 'test'=>$conf->facture->enabled && $user->rights->facture->lire, + 'test'=>$conf->facture->enabled && $user->hasRight('facture', 'lire'), 'lang'=>'bills'), 'order_supplier'=>array( 'name'=>"SuppliersOrders", @@ -424,7 +424,7 @@ class pdf_beluga extends ModelePDFProjects 'class'=>'Contrat', 'table'=>'contrat', 'datefieldname'=>'date_contrat', - 'test'=>$conf->contrat->enabled && $user->rights->contrat->lire, + 'test'=>$conf->contrat->enabled && $user->hasRight('contrat', 'lire'), 'lang'=>'contract'), 'intervention'=>array( 'name'=>"Interventions", diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index b4a89c5be30..c61249877a3 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -104,7 +104,7 @@ if (empty($reshook)) { if ($action == 'confirm_cloture' && GETPOST('confirm', 'alpha') == 'yes') { $object->fetch($id); $result = $object->cloture($user); - } elseif ($action == 'setref_client' && $user->rights->commande->creer) { + } elseif ($action == 'setref_client' && $user->hasRight('commande', 'creer')) { // Positionne ref commande client $result = $object->set_ref_client($user, GETPOST('ref_client')); if ($result < 0) { @@ -112,7 +112,7 @@ if (empty($reshook)) { } } - if ($action == 'setdatedelivery' && $user->rights->commande->creer) { + if ($action == 'setdatedelivery' && $user->hasRight('commande', 'creer')) { $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); @@ -122,7 +122,7 @@ if (empty($reshook)) { } } /* - if ($action == 'setdeliveryaddress' && $user->rights->commande->creer) + if ($action == 'setdeliveryaddress' && $user->hasRight('commande', 'creer')) { $object = new Commande($db); $object->fetch($id); @@ -131,7 +131,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } */ - if ($action == 'setmode' && $user->rights->commande->creer) { + if ($action == 'setmode' && $user->hasRight('commande', 'creer')) { $object->fetch($id); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) { @@ -139,7 +139,7 @@ if (empty($reshook)) { } } - if ($action == 'setavailability' && $user->rights->commande->creer) { + if ($action == 'setavailability' && $user->hasRight('commande', 'creer')) { $object->fetch($id); $result = $object->availability(GETPOST('availability_id')); if ($result < 0) { @@ -147,7 +147,7 @@ if (empty($reshook)) { } } - if ($action == 'setdemandreason' && $user->rights->commande->creer) { + if ($action == 'setdemandreason' && $user->hasRight('commande', 'creer')) { $object->fetch($id); $result = $object->demand_reason(GETPOST('demand_reason_id')); if ($result < 0) { @@ -155,7 +155,7 @@ if (empty($reshook)) { } } - if ($action == 'setconditions' && $user->rights->commande->creer) { + if ($action == 'setconditions' && $user->hasRight('commande', 'creer')) { $object->fetch($id); $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); if ($result < 0) { @@ -170,7 +170,7 @@ if (empty($reshook)) { } // shipping method - if ($action == 'setshippingmethod' && $user->rights->commande->creer) { + if ($action == 'setshippingmethod' && $user->hasRight('commande', 'creer')) { $object->fetch($id); $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); if ($result < 0) { @@ -179,7 +179,7 @@ if (empty($reshook)) { } // warehouse - if ($action == 'setwarehouse' && $user->rights->commande->creer) { + if ($action == 'setwarehouse' && $user->hasRight('commande', 'creer')) { $object->fetch($id); $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); if ($result < 0) { @@ -210,7 +210,7 @@ if (empty($reshook)) { } } - if ($action == 'set_thirdparty' && $user->rights->commande->creer) { + if ($action == 'set_thirdparty' && $user->hasRight('commande', 'creer')) { $object->fetch($id); $object->setValueFrom('fk_soc', $socid, '', '', 'date', '', $user, 'ORDER_MODIFY'); @@ -427,7 +427,7 @@ if ($id > 0 || !empty($ref)) { print ''; - if ($action != 'editwarehouse' && $user->rights->commande->creer) { + if ($action != 'editwarehouse' && $user->hasRight('commande', 'creer')) { print ''; } print '
'; print $langs->trans('Warehouse'); print 'id.'">'.img_edit($langs->trans('SetWarehouse'), 1).'
'; diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index accf1bb3cb5..253fcd004fd 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -456,7 +456,7 @@ if (empty($reshook)) { if ($result < 0) { dol_print_error($db, $object->error); } - } elseif ($action == 'setcontract' && $user->rights->contrat->creer) { + } elseif ($action == 'setcontract' && $user->hasRight('contrat', 'creer')) { // Set into a contract $result = $object->set_contrat($user, GETPOST('contratid', 'int')); if ($result < 0) { diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 5f58678985a..610bd41b1c1 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -2846,7 +2846,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == //print '
'; // Propals - if (isModEnabled("propal") && $user->rights->propal->creer) { + if (isModEnabled("propal") && $user->hasRight('propal', 'creer')) { $propal = new Propal($db); $langs->load("propal"); @@ -2867,7 +2867,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == } // Commande - if (isModEnabled('commande') && $user->rights->commande->creer) { + if (isModEnabled('commande') && $user->hasRight('commande', 'creer')) { $commande = new Commande($db); $langs->load("orders"); @@ -2887,7 +2887,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == } // Factures - if (isModEnabled('facture') && $user->rights->facture->creer) { + if (isModEnabled('facture') && $user->hasRight('facture', 'creer')) { $invoice = new Facture($db); $langs->load("bills"); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index 2adcf05fce9..55f2d51372c 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -1530,15 +1530,15 @@ if ($action == 'create' && $user->rights->projet->creer) { print''.$langs->trans("Create").''; print '