From d0830b31596017a498e4dcdf46149d510b5dee2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 5 May 2024 00:34:19 +0200 Subject: [PATCH 1/2] fix phpstan (#29602) * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix travis * fix phpstan * fix phpstan * fix phan * fix phpstan * fix phpstan * fix phpstan * fix phpstan fix phpstan fix phpstan fix phpstan fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix phpstan * fix travis * fix phpstan * fix phpstan * fix phpstan --------- Co-authored-by: Laurent Destailleur --- .../class/accountingaccount.class.php | 10 ++--- .../class/accountingjournal.class.php | 8 +--- htdocs/adherents/class/adherent.class.php | 7 +--- .../adherents/class/adherent_type.class.php | 8 +--- htdocs/adherents/class/subscription.class.php | 10 +---- htdocs/asset/class/asset.class.php | 7 +--- htdocs/bom/class/bom.class.php | 7 +--- htdocs/bookcal/class/availabilities.class.php | 13 +----- htdocs/bookcal/class/calendar.class.php | 20 +++------- htdocs/bookmarks/class/bookmark.class.php | 9 ++--- htdocs/comm/action/class/actioncomm.class.php | 8 +--- .../action/class/actioncommreminder.class.php | 8 +--- htdocs/comm/mailing/class/mailing.class.php | 6 +-- htdocs/comm/propal/class/propal.class.php | 7 +--- htdocs/commande/class/commande.class.php | 20 +++------- htdocs/compta/bank/class/account.class.php | 8 +--- .../cashcontrol/class/cashcontrol.class.php | 15 ++----- .../deplacement/class/deplacement.class.php | 9 +---- htdocs/compta/facture/class/facture.class.php | 14 ++----- htdocs/contact/class/contact.class.php | 13 +----- htdocs/contrat/class/contrat.class.php | 14 ++----- htdocs/core/class/commonobject.class.php | 8 ++-- htdocs/core/class/defaultvalues.class.php | 14 ++----- .../core/class/emailsenderprofile.class.php | 8 +--- htdocs/core/class/fiscalyear.class.php | 7 +--- htdocs/core/class/timespent.class.php | 14 ++----- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/modules/modTicket.class.php | 1 + htdocs/delivery/class/delivery.class.php | 5 --- htdocs/don/class/don.class.php | 21 ++-------- .../class/emailcollector.class.php | 14 ++----- .../class/emailcollectoraction.class.php | 14 ++----- .../class/emailcollectorfilter.class.php | 14 ++----- .../class/conferenceorbooth.class.php | 15 ++----- .../class/conferenceorboothattendee.class.php | 21 +++------- htdocs/expedition/class/expedition.class.php | 14 ++----- .../class/expensereport.class.php | 10 ----- .../class/fournisseur.commande.class.php | 18 +-------- .../fourn/class/fournisseur.facture.class.php | 8 +--- htdocs/holiday/class/holiday.class.php | 8 +--- htdocs/hrm/class/establishment.class.php | 8 +--- htdocs/hrm/class/evaluation.class.php | 14 ++----- htdocs/hrm/class/evaluationdet.class.php | 14 ++----- htdocs/hrm/class/job.class.php | 21 +++------- htdocs/hrm/class/position.class.php | 21 +++------- htdocs/hrm/class/skill.class.php | 14 ++----- htdocs/hrm/class/skilldet.class.php | 14 ++----- htdocs/hrm/class/skillrank.class.php | 14 ++----- .../class/intracommreport.class.php | 8 +--- .../class/knowledgerecord.class.php | 27 +++---------- htdocs/modulebuilder/index.php | 5 ++- .../template/class/myobject.class.php | 20 ++-------- htdocs/mrp/class/mo.class.php | 30 ++++---------- .../partnership/class/partnership.class.php | 20 +++------- .../class/partnership_type.class.php | 8 +--- htdocs/product/class/product.class.php | 15 ++----- .../class/productfournisseurprice.class.php | 14 ++----- .../inventory/class/inventory.class.php | 36 +++++++---------- htdocs/product/stock/class/entrepot.class.php | 14 +------ .../product/stock/class/productlot.class.php | 8 +--- .../class/stocktransfer.class.php | 40 ++----------------- .../class/stocktransferline.class.php | 15 ++----- htdocs/projet/class/project.class.php | 17 ++------ htdocs/projet/class/task.class.php | 10 ----- htdocs/reception/class/reception.class.php | 8 +--- .../class/receptionlinebatch.class.php | 10 ----- .../class/recruitmentcandidature.class.php | 14 ++----- .../class/recruitmentjobposition.class.php | 14 ++----- .../class/companypaymentmode.class.php | 14 ++----- htdocs/societe/class/societe.class.php | 13 +----- htdocs/societe/class/societeaccount.class.php | 8 +--- .../class/supplier_proposal.class.php | 7 +--- htdocs/ticket/class/cticketcategory.class.php | 20 ++-------- htdocs/ticket/class/ticket.class.php | 25 ++---------- htdocs/user/class/user.class.php | 13 +----- htdocs/user/class/usergroup.class.php | 8 +--- .../variants/class/ProductAttribute.class.php | 16 ++------ .../class/ProductAttributeValue.class.php | 15 ++----- htdocs/webhook/class/target.class.php | 21 +++------- .../class/webportalinvoice.class.php | 8 ++-- .../webportal/class/webportalmember.class.php | 8 ++-- .../webportal/class/webportalorder.class.php | 8 ++-- .../class/webportalpartnership.class.php | 8 ++-- .../webportal/class/webportalpropal.class.php | 8 ++-- htdocs/website/class/website.class.php | 10 +---- .../workstation/class/workstation.class.php | 14 ++----- htdocs/zapier/class/hook.class.php | 14 ++----- 87 files changed, 246 insertions(+), 882 deletions(-) diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index af27c4ea850..2207aaf771e 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -4,7 +4,7 @@ * Copyright (C) 2013-2021 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -51,12 +51,6 @@ class AccountingAccount extends CommonObject */ public $picto = 'billr'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -168,6 +162,8 @@ class AccountingAccount extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; $this->next_prev_filter = "fk_pcg_version IN (SELECT pcg_version FROM ".MAIN_DB_PREFIX."accounting_system WHERE rowid = ".((int) getDolGlobalInt('CHARTOFACCOUNTS')).")"; // Used to add a filter in Form::showrefnav method } diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 2aa6ea4abc6..f9fc361d91d 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -43,12 +43,6 @@ class AccountingJournal extends CommonObject */ public $fk_element = ''; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -105,6 +99,8 @@ class AccountingJournal extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 0; } /** diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 2209e378ed5..6b41328ef84 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -59,12 +59,6 @@ class Adherent extends CommonObject */ public $table_element = 'adherent'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string picto */ @@ -389,6 +383,7 @@ class Adherent extends CommonObject $this->status = self::STATUS_DRAFT; // l'adherent n'est pas public par default $this->public = 0; + $this->ismultientitymanaged = 1; $this->isextrafieldmanaged = 1; // les champs optionnels sont vides $this->array_options = array(); diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 9e2bd437880..605c9b248e6 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -50,12 +50,6 @@ class AdherentType extends CommonObject */ public $picto = 'members'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string * @deprecated Use label @@ -151,6 +145,8 @@ class AdherentType extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; $this->status = 1; } diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 4cd7f06b713..2e9eeba7553 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -44,14 +44,6 @@ class Subscription extends CommonObject */ public $table_element = 'subscription'; - /** - * Does this object supports the multicompany module ? - * - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 'fk_adherent@adherent'; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -132,6 +124,8 @@ class Subscription extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 'fk_adherent@adherent'; } diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index b238ba7525d..6e15a35a283 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -46,12 +46,6 @@ class Asset extends CommonObject */ public $table_element = 'asset'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string String with name of icon for asset. Must be the part after the 'object_' into object_asset.png */ @@ -179,6 +173,7 @@ class Asset extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; $this->isextrafieldmanaged = 1; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { diff --git a/htdocs/bom/class/bom.class.php b/htdocs/bom/class/bom.class.php index 062dbbbfb59..505c345c256 100644 --- a/htdocs/bom/class/bom.class.php +++ b/htdocs/bom/class/bom.class.php @@ -58,12 +58,6 @@ class BOM extends CommonObject */ public $table_element = 'bom_bom'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string String with name of icon for bom. Must be the part after the 'object_' into object_bom.png */ @@ -264,6 +258,7 @@ class BOM extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; $this->isextrafieldmanaged = 1; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { diff --git a/htdocs/bookcal/class/availabilities.class.php b/htdocs/bookcal/class/availabilities.class.php index fe7533ac7cb..7a93c574f9f 100644 --- a/htdocs/bookcal/class/availabilities.class.php +++ b/htdocs/bookcal/class/availabilities.class.php @@ -49,12 +49,6 @@ class Availabilities extends CommonObject */ public $table_element = 'bookcal_availabilities'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 'fk_bookcal_calendar@bookcal_calendar'; - /** * @var string String with name of icon for availabilities. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'availabilities@bookcal' if picto is file 'img/object_availabilities.png'. */ @@ -198,6 +192,7 @@ class Availabilities extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 'fk_bookcal_calendar@bookcal_calendar'; $this->isextrafieldmanaged = 1; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { @@ -1082,11 +1077,6 @@ class AvailabilitiesLine extends CommonObjectLine // To complete with content of an object AvailabilitiesLine // We should have a field rowid, fk_availabilities and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Constructor * @@ -1095,5 +1085,6 @@ class AvailabilitiesLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/bookcal/class/calendar.class.php b/htdocs/bookcal/class/calendar.class.php index 58d1feaab67..7759ad8919e 100644 --- a/htdocs/bookcal/class/calendar.class.php +++ b/htdocs/bookcal/class/calendar.class.php @@ -49,17 +49,6 @@ class Calendar extends CommonObject */ public $table_element = 'bookcal_calendar'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for calendar. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'calendar@bookcal' if picto is file 'img/object_calendar.png'. */ @@ -163,6 +152,9 @@ class Calendar extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { $this->fields['rowid']['visible'] = 0; } @@ -1076,10 +1068,6 @@ class CalendarLine extends CommonObjectLine // To complete with content of an object CalendarLine // We should have a field rowid, fk_calendar and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; /** * Constructor @@ -1089,5 +1077,7 @@ class CalendarLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/bookmarks/class/bookmark.class.php b/htdocs/bookmarks/class/bookmark.class.php index ee6e71fc4ce..6732a28a835 100644 --- a/htdocs/bookmarks/class/bookmark.class.php +++ b/htdocs/bookmarks/class/bookmark.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2015 Marcos García + * Copyright (C) 2024 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 @@ -38,12 +39,6 @@ class Bookmark extends CommonObject */ public $table_element = 'bookmark'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -102,6 +97,8 @@ class Bookmark extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; } /** diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index eea391bc8c6..5dd4427aa35 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -59,12 +59,6 @@ class ActionComm extends CommonObject */ public $picto = 'action'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var int<0,2> 0=Default * 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user @@ -436,6 +430,8 @@ class ActionComm extends CommonObject public function __construct(DoliDB $db) { $this->db = $db; + + $this->ismultientitymanaged = 1; } /** diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 9addb976976..27a063dea7b 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -42,12 +42,6 @@ class ActionCommReminder extends CommonObject */ public $table_element = 'actioncomm_reminder'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - /** * @var string String with name of icon for actioncommreminder. Must be the part after the 'object_' into object_actioncommreminder.png */ @@ -157,6 +151,8 @@ class ActionCommReminder extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 96f21c650ee..78e47e9697f 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2024 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 @@ -162,11 +163,6 @@ class Mailing extends CommonObject */ public $statut_dest = array(); - /** - * @var array labelStatus - */ - public $labelStatus = array(); - /** * @var array substitutionarray */ diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0894c490da6..a2b7074214e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -85,12 +85,6 @@ class Propal extends CommonObject */ public $picto = 'propal'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -400,6 +394,7 @@ class Propal extends CommonObject { $this->db = $db; + $this->ismultientitymanaged = 1; $this->socid = $socid; $this->id = $propalid; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index e2b051a9595..b7d72bdb608 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -11,9 +11,9 @@ * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2016-2022 Ferran Marcet - * Copyright (C) 2021-2024 Frédéric France - * Copyright (C) 2022 Gauthier VERDOL - * Copyright (C) 2024 MDW + * Copyright (C) 2021-2024 Frédéric France + * Copyright (C) 2022 Gauthier VERDOL + * Copyright (C) 2024 MDW * * 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 @@ -78,17 +78,6 @@ class Commande extends CommonOrder */ public $picto = 'order'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -390,6 +379,9 @@ class Commande extends CommonOrder public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; } /** diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 4f57f7a0c42..c9e0a6a8e72 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -50,12 +50,6 @@ class Account extends CommonObject */ public $table_element = 'bank_account'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -422,6 +416,8 @@ class Account extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->balance = 0; $this->type_lib = array( diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index a599e3babf1..f4f8970dc8d 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2016 Marcos García * Copyright (C) 2018 Andreu Bisquerra * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -40,17 +41,6 @@ class CashControl extends CommonObject */ public $table_element = 'pos_cash_fence'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does pos_cash_fence support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for pos_cash_fence. Must be the part after the 'object_' into object_pos_cash_fence.png */ @@ -151,6 +141,9 @@ class CashControl extends CommonObject public function __construct(DoliDB $db) { $this->db = $db; + + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 0; } diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 2abebe6865b..2195f0b5a3e 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -52,13 +52,6 @@ class Deplacement extends CommonObject */ public $fk_element = ''; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - public $fk_soc; public $date; public $type; @@ -127,6 +120,8 @@ class Deplacement extends CommonObject public function __construct(DoliDB $db) { $this->db = $db; + + $this->ismultientitymanaged = 0; } /** diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 9e6eca9c4a9..25ecfb6653b 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -87,17 +87,6 @@ class Facture extends CommonInvoice */ public $picto = 'bill'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -435,6 +424,9 @@ class Facture extends CommonInvoice public function __construct(DoliDB $db) { $this->db = $db; + + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; } /** diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 8e5e7847bff..b744df70156 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -56,17 +56,6 @@ class Contact extends CommonObject */ public $table_element = 'socpeople'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -372,6 +361,8 @@ class Contact extends CommonObject { $this->db = $db; $this->statut = 1; // By default, status is enabled + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; if (!isModEnabled('mailing')) { $this->fields['no_email']['enabled'] = 0; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 3234107fd0f..1a271d32edf 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -69,17 +69,6 @@ class Contrat extends CommonObject */ public $picto = 'contract'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -311,6 +300,9 @@ class Contrat extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; } /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 400e3c9c810..b3235088bb7 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2157,7 +2157,7 @@ abstract class CommonObject * @param User|string $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none' * @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY') * @param string $fk_user_field Name of field to save user id making change - * @return int<-1,1> Return integer <0 if KO, >0 if OK + * @return int<-2,1> Return integer <0 if KO, >0 if OK * @see updateExtraField() */ public function setValueFrom($field, $value, $table = '', $id = null, $format = '', $id_field = '', $fuser = null, $trigkey = '', $fk_user_field = 'fk_user_modif') @@ -2290,7 +2290,7 @@ abstract class CommonObject * Example: "((t.field1:=:'aa') OR (t.field2:=:'bb'))". * @param string $fieldid Name of field to use for the select MAX and MIN * @param int<0,1> $nodbprefix Do not include DB prefix to forge table name - * @return int<-1,1> Return integer <0 if KO, >0 if OK + * @return int<-2,1> Return integer <0 if KO, >0 if OK */ public function load_previous_next_ref($filter, $fieldid, $nodbprefix = 0) { @@ -9813,7 +9813,7 @@ abstract class CommonObject * * @param User $user User that creates * @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers - * @return int<-1,-1> Return integer <0 if KO, Id of created object if OK + * @return int<-1,max> Return integer <0 if KO, Id of created object if OK */ public function createCommon(User $user, $notrigger = 0) { @@ -10003,7 +10003,7 @@ abstract class CommonObject * @param string $ref Ref * @param string $morewhere More SQL filters (' AND ...') * @param int<0,1> $noextrafields 0=Default to load extrafields, 1=No extrafields - * @return int<-1,1> Return integer <0 if KO, 0 if not found, >0 if OK + * @return int<-4,1> Return integer <0 if KO, 0 if not found, >0 if OK */ public function fetchCommon($id, $ref = null, $morewhere = '', $noextrafields = 0) { diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php index ee28eca0244..100f57246fb 100644 --- a/htdocs/core/class/defaultvalues.class.php +++ b/htdocs/core/class/defaultvalues.class.php @@ -43,17 +43,6 @@ class DefaultValues extends CommonObject */ public $table_element = 'default_values'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -146,6 +135,9 @@ class DefaultValues extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index d57aa383367..e2b85f3e79c 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -45,12 +45,6 @@ class EmailSenderProfile extends CommonObject */ public $table_element = 'c_email_senderprofile'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string String with name of icon for emailsenderprofile */ @@ -145,6 +139,8 @@ class EmailSenderProfile extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index c69fd96e29d..947ea1874a9 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -56,12 +56,6 @@ class Fiscalyear extends CommonObject */ public $fk_element = ''; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var int ID */ @@ -124,6 +118,7 @@ class Fiscalyear extends CommonObject { $this->db = $db; + $this->ismultientitymanaged = 1; $this->labelStatusShort = array(self::STATUS_OPEN => 'Opened', self::STATUS_CLOSED => 'Closed'); $this->labelStatus = array(self::STATUS_OPEN => 'Opened', self::STATUS_CLOSED => 'Closed'); } diff --git a/htdocs/core/class/timespent.class.php b/htdocs/core/class/timespent.class.php index 47216f9abb2..af0d00d9c15 100644 --- a/htdocs/core/class/timespent.class.php +++ b/htdocs/core/class/timespent.class.php @@ -49,17 +49,6 @@ class TimeSpent extends CommonObject */ public $table_element = 'element_time'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for timespent. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'timespent@timespent' if picto is file 'img/object_timespent.png'. */ @@ -164,6 +153,9 @@ class TimeSpent extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 53399caf8b0..25e1f8a92eb 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018-2022 Frédéric France + * Copyright (C) 2018-2024 Frédéric France * Copyright (C) 2021 Gauthier VERDOL * Copyright (C) 2024 MDW * diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index fa736177cb8..c7fc6240b39 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2024 MDW + * Copyright (C) 2024 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/htdocs/delivery/class/delivery.class.php b/htdocs/delivery/class/delivery.class.php index 9b964889136..01041a3c570 100644 --- a/htdocs/delivery/class/delivery.class.php +++ b/htdocs/delivery/class/delivery.class.php @@ -110,11 +110,6 @@ class Delivery extends CommonObject public $commande_id; - /** - * @var array Status labels - */ - public $labelStatus; - /** * @var DeliveryLine[] lines */ diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index addf9a37fed..f43556a8b85 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -56,12 +56,6 @@ class Don extends CommonObject */ public $fk_element = 'fk_donation'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string String with name of icon for object don. Must be the part after the 'object_' into object_myobject.png */ @@ -154,18 +148,6 @@ class Don extends CommonObject public $paid; - - /** - * @var array Array of status label - */ - public $labelStatus; - - /** - * @var array Array of status label short - */ - public $labelStatusShort; - - const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; const STATUS_PAID = 2; @@ -180,6 +162,8 @@ class Don extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; } @@ -305,6 +289,7 @@ class Don extends CommonObject $error_string = array(); $err = 0; + $amount_invalid = 0; if (dol_strlen(trim($this->societe)) == 0) { if ((dol_strlen(trim($this->lastname)) + dol_strlen(trim($this->firstname))) == 0) { diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 76431dbe564..8a44636eaf8 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -68,17 +68,6 @@ class EmailCollector extends CommonObject */ public $table_element = 'emailcollector_emailcollector'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does emailcollector support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for emailcollector. Must be the part after the 'object_' into object_emailcollector.png */ @@ -247,6 +236,9 @@ class EmailCollector extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index 821cb841cf4..d0e0e80ad28 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -42,17 +42,6 @@ class EmailCollectorAction extends CommonObject */ public $table_element = 'emailcollector_emailcollectoraction'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does emailcollectoraction support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for emailcollectoraction. Must be the part after the 'object_' into object_emailcollectoraction.png */ @@ -123,6 +112,9 @@ class EmailCollectorAction extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 359f5b5383c..c5f0b3b9815 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -44,17 +44,6 @@ class EmailCollectorFilter extends CommonObject */ public $table_element = 'emailcollector_emailcollectorfilter'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does emailcollectorfilter support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for emailcollectorfilter. Must be the part after the 'object_' into object_emailcollectorfilter.png */ @@ -125,6 +114,9 @@ class EmailCollectorFilter extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 556c46cbfff..9a0365ca27b 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -49,18 +49,6 @@ class ConferenceOrBooth extends ActionComm */ public $table_element = 'actioncomm'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int<0,1> Does this object support extrafields ? - * 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for conferenceorbooth. Must be the part after the 'object_' into object_conferenceorbooth.png */ @@ -162,6 +150,9 @@ class ConferenceOrBooth extends ActionComm $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['id']['visible'] = 0; } diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index a59153781fb..b7632a2f404 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -49,17 +49,6 @@ class ConferenceOrBoothAttendee extends CommonObject */ public $table_element = 'eventorganization_conferenceorboothattendee'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 'fk_project@projet'; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for conferenceorboothattendee. Must be the part after the 'object_' into object_conferenceorboothattendee.png */ @@ -198,6 +187,9 @@ class ConferenceOrBoothAttendee extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 'fk_project@projet'; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } @@ -1120,11 +1112,6 @@ class ConferenceOrBoothAttendeeLine extends CommonObjectLine // To complete with content of an object ConferenceOrBoothAttendeeLine // We should have a field rowid, fk_conferenceorboothattendee and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Constructor * @@ -1133,5 +1120,7 @@ class ConferenceOrBoothAttendeeLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 18453c80294..75ff4241bd1 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -74,17 +74,6 @@ class Expedition extends CommonObject */ public $table_element_line = "expeditiondet"; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -282,6 +271,9 @@ class Expedition extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + // List of long language codes for status $this->labelStatus = array(); $this->labelStatus[-1] = 'StatusSendingCanceled'; diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 758d5639f4e..134b9d1f05e 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -247,16 +247,6 @@ class ExpenseReport extends CommonObject public $localtax1; // for backward compatibility (real field should be total_localtax1 defined into CommonObject) public $localtax2; // for backward compatibility (real field should be total_localtax2 defined into CommonObject) - /** - * @var array - */ - public $labelStatus = array(); - - /** - * @var array - */ - public $labelStatusShort = array(); - /** * Draft status */ diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 858725e0963..629c4a52cf5 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -74,12 +74,6 @@ class CommandeFournisseur extends CommonOrder */ public $picto = 'supplier_order'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -122,16 +116,6 @@ class CommandeFournisseur extends CommonOrder // -> 9=Refused -> (reopen) 1=Validated // Note: billed or not is on another field "billed" - /** - * @var array List of status - */ - public $labelStatus; - - /** - * @var array List of status short - */ - public $labelStatusShort; - public $billed; /** @@ -464,6 +448,8 @@ class CommandeFournisseur extends CommonOrder public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index f1815f0e241..4dd2746cf49 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -77,12 +77,6 @@ class FactureFournisseur extends CommonInvoice */ public $picto = 'supplier_invoice'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -378,6 +372,8 @@ class FactureFournisseur extends CommonInvoice public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; } /** diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index cf8435ef599..5b2a0405be1 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -44,12 +44,6 @@ class Holiday extends CommonObject */ public $table_element = 'holiday'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - /** * @var string Field with ID of parent key if this field has a parent */ @@ -201,6 +195,8 @@ class Holiday extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 0; } diff --git a/htdocs/hrm/class/establishment.class.php b/htdocs/hrm/class/establishment.class.php index c310ca01a1a..601dfbbab5c 100644 --- a/htdocs/hrm/class/establishment.class.php +++ b/htdocs/hrm/class/establishment.class.php @@ -50,12 +50,6 @@ class Establishment extends CommonObject */ public $fk_element = 'fk_establishment'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -160,6 +154,8 @@ class Establishment extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; } /** diff --git a/htdocs/hrm/class/evaluation.class.php b/htdocs/hrm/class/evaluation.class.php index 964b1a27d14..be26c853199 100644 --- a/htdocs/hrm/class/evaluation.class.php +++ b/htdocs/hrm/class/evaluation.class.php @@ -52,17 +52,6 @@ class Evaluation extends CommonObject */ public $table_element = 'hrm_evaluation'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for evaluation. Must be the part after the 'object_' into object_evaluation.png */ @@ -186,6 +175,9 @@ class Evaluation extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/hrm/class/evaluationdet.class.php b/htdocs/hrm/class/evaluationdet.class.php index 2c1b6fb5af9..005bb6b7fd8 100644 --- a/htdocs/hrm/class/evaluationdet.class.php +++ b/htdocs/hrm/class/evaluationdet.class.php @@ -52,17 +52,6 @@ class EvaluationLine extends CommonObjectLine */ public $table_element = 'hrm_evaluationdet'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for evaluationdet. Must be the part after the 'object_' into object_evaluationdet.png */ @@ -174,6 +163,9 @@ class EvaluationLine extends CommonObjectLine $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/hrm/class/job.class.php b/htdocs/hrm/class/job.class.php index 381f04f5386..72e83fffbd1 100644 --- a/htdocs/hrm/class/job.class.php +++ b/htdocs/hrm/class/job.class.php @@ -51,17 +51,6 @@ class Job extends CommonObject */ public $table_element = 'hrm_job'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for job. Must be the part after the 'object_' into object_job.png */ @@ -177,6 +166,9 @@ class Job extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } @@ -1109,11 +1101,6 @@ class JobLine extends CommonObjectLine // To complete with content of an object JobLine // We should have a field rowid, fk_job and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Constructor * @@ -1122,5 +1109,7 @@ class JobLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/hrm/class/position.class.php b/htdocs/hrm/class/position.class.php index e3ac01dd65d..7d257e5d41c 100644 --- a/htdocs/hrm/class/position.class.php +++ b/htdocs/hrm/class/position.class.php @@ -50,17 +50,6 @@ class Position extends CommonObject */ public $table_element = 'hrm_job_user'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for position. Must be the part after the 'object_' into object_position.png */ @@ -184,6 +173,9 @@ class Position extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { //$this->fields['rowid']['visible'] = 0; } @@ -1134,11 +1126,6 @@ class PositionLine extends CommonObjectLine // To complete with content of an object PositionLine // We should have a field rowid , fk_position and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Constructor * @@ -1147,5 +1134,7 @@ class PositionLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/hrm/class/skill.class.php b/htdocs/hrm/class/skill.class.php index 445b50e9b69..659de91bb31 100644 --- a/htdocs/hrm/class/skill.class.php +++ b/htdocs/hrm/class/skill.class.php @@ -56,17 +56,6 @@ class Skill extends CommonObject */ public $table_element_line = 'skilldet'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for skill. Must be the part after the 'object_' into object_skill.png */ @@ -186,6 +175,9 @@ class Skill extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/hrm/class/skilldet.class.php b/htdocs/hrm/class/skilldet.class.php index cdd227a0b72..8e84bffd2a5 100644 --- a/htdocs/hrm/class/skilldet.class.php +++ b/htdocs/hrm/class/skilldet.class.php @@ -50,17 +50,6 @@ class Skilldet extends CommonObjectLine */ public $table_element = 'hrm_skilldet'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for skilldet. Must be the part after the 'object_' into object_skilldet.png */ @@ -166,6 +155,9 @@ class Skilldet extends CommonObjectLine $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/hrm/class/skillrank.class.php b/htdocs/hrm/class/skillrank.class.php index 6830adc1bef..3f647aff863 100644 --- a/htdocs/hrm/class/skillrank.class.php +++ b/htdocs/hrm/class/skillrank.class.php @@ -51,17 +51,6 @@ class SkillRank extends CommonObject */ public $table_element = 'hrm_skillrank'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for skillrank. Must be the part after the 'object_' into object_skillrank.png */ @@ -176,6 +165,9 @@ class SkillRank extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index 1cffc432215..5eea6b85842 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -48,12 +48,6 @@ class IntracommReport extends CommonObject */ public $fk_element = 'fk_intracommreport'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - public $picto = 'intracommreport'; /** @@ -106,6 +100,8 @@ class IntracommReport extends CommonObject public function __construct(DoliDB $db) { $this->db = $db; + + $this->ismultientitymanaged = 1; $this->exporttype = 'deb'; } diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index 4d2a6c25b94..99cac4712f4 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -48,17 +48,6 @@ class KnowledgeRecord extends CommonObject */ public $table_element = 'knowledgemanagement_knowledgerecord'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for knowledgerecord. Must be the part after the 'object_' into object_knowledgerecord.png */ @@ -193,6 +182,9 @@ class KnowledgeRecord extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } @@ -200,12 +192,6 @@ class KnowledgeRecord extends CommonObject $this->fields['entity']['enabled'] = 0; } - // Example to show how to set values of fields definition dynamically - /*if ($user->hasRight('knowledgemanagement', 'knowledgerecord', 'read')) { - $this->fields['myfield']['visible'] = 1; - $this->fields['myfield']['noteditable'] = 0; - }*/ - // Unset fields that are disabled foreach ($this->fields as $key => $val) { if (isset($val['enabled']) && empty($val['enabled'])) { @@ -1190,11 +1176,6 @@ class KnowledgeRecordLine extends CommonObjectLine // To complete with content of an object KnowledgeRecordLine // We should have a field rowid, fk_knowledgerecord and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Constructor * @@ -1203,5 +1184,7 @@ class KnowledgeRecordLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 31975f8d97c..bd97ea7e062 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2018-2019 Nicolas ZABOURI * Copyright (C) 2023 Alexandre Janniaux * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -541,9 +542,9 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module)) { } } - // Now we update the object file to set $isextrafieldmanaged to 1 + // Now we update the object file to set $this->isextrafieldmanaged to 1 $srcfile = $dirins.'/'.strtolower($module).'/class/'.strtolower($objectname).'.class.php'; - $arrayreplacement = array('/\$isextrafieldmanaged = 0;/' => '$isextrafieldmanaged = 1;'); + $arrayreplacement = array('/\$this->isextrafieldmanaged = 0;/' => '$this->isextrafieldmanaged = 1;'); dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 07ab92a0318..460bc877d19 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -54,17 +54,6 @@ class MyObject extends CommonObject */ //public $element_for_permission = 'mymodule'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for myobject. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'myobject@mymodule' if picto is file 'img/object_myobject.png'. */ @@ -251,6 +240,8 @@ class MyObject extends CommonObject global $langs; $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; if (!getDolGlobalInt('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid']) && !empty($this->fields['ref'])) { $this->fields['rowid']['visible'] = 0; @@ -1258,11 +1249,6 @@ class MyObjectLine extends CommonObjectLine // To complete with content of an object MyObjectLine // We should have a field rowid, fk_myobject and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Constructor * @@ -1271,5 +1257,7 @@ class MyObjectLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 0d2d62c159f..63552840d90 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -44,17 +44,6 @@ class Mo extends CommonObject */ public $table_element = 'mrp_mo'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does mo support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for mo. Must be the part after the 'object_' into object_mo.png */ @@ -247,7 +236,7 @@ class Mo extends CommonObject public $fk_parent_line; /** - * @var array tpl + * @var array tpl */ public $tpl = array(); @@ -263,6 +252,9 @@ class Mo extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } @@ -1998,17 +1990,6 @@ class MoLine extends CommonObjectLine */ public $table_element = 'mrp_production'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does moline support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - public $fields = array( 'rowid' => array('type' => 'integer', 'label' => 'ID', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 10), 'fk_mo' => array('type' => 'integer', 'label' => 'Mo', 'enabled' => 1, 'visible' => -1, 'notnull' => 1, 'position' => 15), @@ -2071,6 +2052,9 @@ class MoLine extends CommonObjectLine $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 6add3fb5f79..0355ae0e9e8 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -49,17 +49,6 @@ class Partnership extends CommonObject */ public $table_element = 'partnership'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for partnership. Must be the part after the 'object_' into object_partnership.png */ @@ -166,6 +155,9 @@ class Partnership extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') { $this->fields['fk_member'] = array('type' => 'integer:Adherent:adherents/class/adherent.class.php:1', 'label' => 'Member', 'enabled' => '1', 'position' => 50, 'notnull' => -1, 'visible' => 1, 'index' => 1, 'picto' => 'member', 'csslist' => 'tdoverflowmax150'); } else { @@ -1375,10 +1367,6 @@ class PartnershipLine extends CommonObjectLine // To complete with content of an object PartnershipLine // We should have a field rowid, fk_partnership and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; /** * Constructor @@ -1388,5 +1376,7 @@ class PartnershipLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/partnership/class/partnership_type.class.php b/htdocs/partnership/class/partnership_type.class.php index cafdf5fc1cf..82719f1338f 100644 --- a/htdocs/partnership/class/partnership_type.class.php +++ b/htdocs/partnership/class/partnership_type.class.php @@ -51,12 +51,6 @@ class PartnershipType extends CommonObject */ public $picto = 'generic'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string Partnership code */ @@ -91,6 +85,8 @@ class PartnershipType extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f0ae934cc43..01d81829bb6 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -89,17 +89,6 @@ class Product extends CommonObject 'commande_fournisseurdet' => array('name' => 'SupplierOrder', 'parent' => 'commande_fournisseur', 'parentkey' => 'fk_commande') ); - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string picto */ @@ -628,6 +617,10 @@ class Product extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + $this->canvas = ''; } diff --git a/htdocs/product/class/productfournisseurprice.class.php b/htdocs/product/class/productfournisseurprice.class.php index 8c086b6454c..9a66040e440 100644 --- a/htdocs/product/class/productfournisseurprice.class.php +++ b/htdocs/product/class/productfournisseurprice.class.php @@ -42,17 +42,6 @@ class ProductFournisseurPrice extends CommonObject */ public $table_element = 'product_fournisseur_price'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for productfournisseurprice. Must be the part after the 'object_' into object_productfournisseurprice.png */ @@ -178,6 +167,9 @@ class ProductFournisseurPrice extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 49f7e5f5882..612d54796e2 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -48,17 +48,6 @@ class Inventory extends CommonObject */ public $table_element = 'inventory'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for inventory */ @@ -232,6 +221,9 @@ class Inventory extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) { $this->fields['rowid']['visible'] = 0; } @@ -808,17 +800,6 @@ class InventoryLine extends CommonObjectLine */ public $table_element = 'inventorydet'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for inventory */ @@ -876,7 +857,18 @@ class InventoryLine extends CommonObjectLine public $pmp_real; public $pmp_expected; + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 0; + } /** * Create object in database * diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index ea1a8325f39..6399cb12986 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -50,12 +50,6 @@ class Entrepot extends CommonObject */ public $picto = 'stock'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string Label * @deprecated @@ -120,12 +114,6 @@ class Entrepot extends CommonObject */ public $warehouse_usage; - /** - * @var array List of short language codes for status - */ - public $labelStatus = array(); - - /** * 'type' field format: * 'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', @@ -226,6 +214,8 @@ class Entrepot extends CommonObject { $this->db = $db; + $this->ismultientitymanaged = 1; + $this->labelStatus[self::STATUS_CLOSED] = 'Closed2'; if (getDolGlobalString('ENTREPOT_EXTRA_STATUS')) { $this->labelStatus[self::STATUS_OPEN_ALL] = 'OpenAnyMovement'; diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index c35b3479f5e..90fd63b1b47 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -52,12 +52,6 @@ class Productlot extends CommonObject */ public $picto = 'lot'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - public $stats_propale; public $stats_commande; public $stats_contrat; @@ -173,6 +167,8 @@ class Productlot extends CommonObject public function __construct(DoliDB $db) { $this->db = $db; + + $this->ismultientitymanaged = 1; } /** diff --git a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php index b7c1c88017c..6b0f5adabe5 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransfer.class.php @@ -52,18 +52,6 @@ class StockTransfer extends CommonObject */ public $table_element_line = 'stocktransfer_stocktransferline'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - - /** * @var string[] List of child tables. To know object to delete on cascade. * If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will @@ -195,6 +183,10 @@ class StockTransfer extends CommonObject global $conf, $langs; $this->db = $db; + + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + $this->origin_type = 'StockTransfer@product/stock/stocktransfer'; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { @@ -1078,27 +1070,3 @@ class StockTransfer extends CommonObject return $error; } } - -/** - * Class StockTransferLine. You can also remove this and generate a CRUD class for lines objects. - */ -//class StockTransferLine -//{ -// // To complete with content of an object StockTransferLine -// // We should have a field rowid, fk_stocktransfer and position -// -// /** -// * @var int Does object support extrafields ? 0=No, 1=Yes -// */ -// public $isextrafieldmanaged = 0; -// -// /** -// * Constructor -// * -// * @param DoliDB $db Database handler -// */ -// public function __construct(DoliDB $db) -// { -// $this->db = $db; -// } -//} diff --git a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php index c8d0038cafc..3439cea673b 100644 --- a/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php +++ b/htdocs/product/stock/stocktransfer/class/stocktransferline.class.php @@ -45,23 +45,11 @@ class StockTransferLine extends CommonObjectLine */ public $table_element = 'stocktransfer_stocktransferline'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for stocktransferline. Must be the part after the 'object_' into object_stocktransferline.png */ public $picto = 'stocktransferline@stocktransfer'; - const STATUS_DRAFT = 0; const STATUS_VALIDATED = 1; const STATUS_CANCELED = 9; @@ -136,6 +124,9 @@ class StockTransferLine extends CommonObjectLine $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 706b8f20aed..814f26ae42c 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -62,17 +62,6 @@ class Project extends CommonObject */ public $fk_element = 'fk_projet'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -204,9 +193,6 @@ class Project extends CommonObject */ public $max_attendees; - public $labelStatusShort; - public $labelStatus; - public $statut; // 0=draft, 1=opened, 2=closed public $opp_status; // opportunity status, into table llx_c_lead_status @@ -366,6 +352,9 @@ class Project extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + $this->labelStatusShort = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); $this->labelStatus = array(0 => 'Draft', 1 => 'Opened', 2 => 'Closed'); diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index 302b5a7c88e..f333e85d6d1 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -149,16 +149,6 @@ class Task extends CommonObjectLine public $comments = array(); - /** - * @var array - */ - public $labelStatus; - - /** - * @var array - */ - public $labelStatusShort; - // Properties calculated from sum of llx_element_time linked to task public $tobill; public $billed; diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index f474a3badea..36be9b86706 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -69,12 +69,6 @@ class Reception extends CommonObject public $table_element = "reception"; public $table_element_line = "receptiondet_batch"; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -154,6 +148,8 @@ class Reception extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe } /** diff --git a/htdocs/reception/class/receptionlinebatch.class.php b/htdocs/reception/class/receptionlinebatch.class.php index 3f1739f2960..9df90f141dc 100644 --- a/htdocs/reception/class/receptionlinebatch.class.php +++ b/htdocs/reception/class/receptionlinebatch.class.php @@ -39,16 +39,6 @@ class ReceptionLineBatch extends CommonObjectLine */ public $db; - /** - * @var string Error code (or message) - */ - public $error; - - /** - * @var string[] Error codes (or messages) - */ - public $errors = array(); - /** * @var string ID to identify managed object */ diff --git a/htdocs/recruitment/class/recruitmentcandidature.class.php b/htdocs/recruitment/class/recruitmentcandidature.class.php index c4a4bcaa991..4d63b18ca89 100644 --- a/htdocs/recruitment/class/recruitmentcandidature.class.php +++ b/htdocs/recruitment/class/recruitmentcandidature.class.php @@ -48,17 +48,6 @@ class RecruitmentCandidature extends CommonObject */ public $table_element = 'recruitment_recruitmentcandidature'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for recruitmentcandidature. Must be the part after the 'object_' into object_recruitmentcandidature.png */ @@ -174,6 +163,9 @@ class RecruitmentCandidature extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/recruitment/class/recruitmentjobposition.class.php b/htdocs/recruitment/class/recruitmentjobposition.class.php index 7fa8b258c54..250be53a87f 100644 --- a/htdocs/recruitment/class/recruitmentjobposition.class.php +++ b/htdocs/recruitment/class/recruitmentjobposition.class.php @@ -49,17 +49,6 @@ class RecruitmentJobPosition extends CommonObject */ public $table_element = 'recruitment_recruitmentjobposition'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for recruitmentjobposition. Must be the part after the 'object_' into object_recruitmentjobposition.png */ @@ -195,6 +184,9 @@ class RecruitmentJobPosition extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 20526bb32d9..087fbf03d95 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -43,17 +43,6 @@ class CompanyPaymentMode extends CommonObject */ public $table_element = 'societe_rib'; - /** - * @var string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table - */ - public $ismultientitymanaged = 'fk_soc@societe'; - - /** - * @var int Does companypaymentmode support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for companypaymentmode. Must be the part after the 'object_' into object_companypaymentmode.png */ @@ -214,6 +203,9 @@ class CompanyPaymentMode extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 'fk_soc@societe'; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index cc21964b1bc..326a535e778 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -127,17 +127,6 @@ class Societe extends CommonObject */ public $picto = 'company'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -889,6 +878,8 @@ class Societe extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; $this->client = 0; $this->prospect = 0; $this->fournisseur = 0; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 188a77be1a7..bfa843e26c7 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -46,12 +46,6 @@ class SocieteAccount extends CommonObject */ public $table_element = 'societe_account'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - /** * @var string String with name of icon for societeaccount. Must be the part after the 'object_' into object_myobject.png */ @@ -199,6 +193,8 @@ class SocieteAccount extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID')) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 2922a32aa84..5cfc1a462be 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -77,12 +77,6 @@ class SupplierProposal extends CommonObject */ public $picto = 'supplier_proposal'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * 0=Default, 1=View may be restricted to sales representative only if no permission to see all or to company of external user if external user * @var integer @@ -235,6 +229,7 @@ class SupplierProposal extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; $this->socid = $socid; $this->id = $supplier_proposalid; } diff --git a/htdocs/ticket/class/cticketcategory.class.php b/htdocs/ticket/class/cticketcategory.class.php index 24de76501af..617dbcbeceb 100644 --- a/htdocs/ticket/class/cticketcategory.class.php +++ b/htdocs/ticket/class/cticketcategory.class.php @@ -49,17 +49,6 @@ class CTicketCategory extends CommonObject */ public $table_element = 'c_ticket_category'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -183,6 +172,9 @@ class CTicketCategory extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } @@ -190,12 +182,6 @@ class CTicketCategory extends CommonObject $this->fields['entity']['enabled'] = 0; } - // Example to show how to set values of fields definition dynamically - /*if ($user->hasRight('mymodule', 'myobject', 'read')) { - $this->fields['myfield']['visible'] = 1; - $this->fields['myfield']['noteditable'] = 0; - }*/ - // Unset fields that are disabled foreach ($this->fields as $key => $val) { if (isset($val['enabled']) && empty($val['enabled'])) { diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5289a2424e4..84000fa6692 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -59,23 +59,11 @@ class Ticket extends CommonObject */ public $fk_element = 'fk_ticket'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does ticketcore support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for ticketcore. Must be the part after the 'object_' into object_ticketcore.png */ public $picto = 'ticket'; - /** * @var ?string Hash to identify ticket publicly */ @@ -234,16 +222,6 @@ class Ticket extends CommonObject */ public $cache_msgs_ticket; - /** - * @var array status labels - */ - public $labelStatus; - - /** - * @var array status short labels - */ - public $labelStatusShort; - /** * @var int Notify thirdparty at create */ @@ -366,6 +344,9 @@ class Ticket extends CommonObject { $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; + $this->labelStatusShort = array( self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 423d6ef12af..ad60f72ced9 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -65,17 +65,6 @@ class User extends CommonObject */ public $fk_element = 'fk_user'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string picto */ @@ -421,6 +410,8 @@ class User extends CommonObject { $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 1; // User preference $this->clicktodial_loaded = 0; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 258490f691f..46d0f1645e0 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -50,12 +50,6 @@ class UserGroup extends CommonObject */ public $table_element = 'usergroup'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ @@ -151,6 +145,8 @@ class UserGroup extends CommonObject public function __construct($db) { $this->db = $db; + + $this->ismultientitymanaged = 1; $this->nb_rights = 0; } diff --git a/htdocs/variants/class/ProductAttribute.class.php b/htdocs/variants/class/ProductAttribute.class.php index 1e8776a9efa..4973e72efcf 100644 --- a/htdocs/variants/class/ProductAttribute.class.php +++ b/htdocs/variants/class/ProductAttribute.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2022 Open-Dsi - * Copyright (C) 2023 Frédéric France + * Copyright (C) 2023-2024 Frédéric France * Copyright (C) 2024 MDW * * This program is free software; you can redistribute it and/or modify @@ -66,17 +66,6 @@ class ProductAttribute extends CommonObject */ public $fk_element = 'fk_product_attribute'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for conferenceorbooth. Must be the part after the 'object_' into object_conferenceorbooth.png */ @@ -176,6 +165,9 @@ class ProductAttribute extends CommonObject global $conf, $langs; $this->db = $db; + + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 0; $this->entity = $conf->entity; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { diff --git a/htdocs/variants/class/ProductAttributeValue.class.php b/htdocs/variants/class/ProductAttributeValue.class.php index b99db84fc68..e8e71f5a671 100644 --- a/htdocs/variants/class/ProductAttributeValue.class.php +++ b/htdocs/variants/class/ProductAttributeValue.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2016 Marcos García * Copyright (C) 2022 Open-Dsi * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -39,17 +40,6 @@ class ProductAttributeValue extends CommonObjectLine */ public $table_element = 'product_attribute_value'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" @@ -101,6 +91,9 @@ class ProductAttributeValue extends CommonObjectLine global $conf, $langs; $this->db = $db; + + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 0; $this->entity = $conf->entity; if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index a0c43455874..9f0c59816a8 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -49,17 +49,6 @@ class Target extends CommonObject */ public $table_element = 'webhook_target'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for target. Must be the part after the 'object_' into object_target.png */ @@ -182,6 +171,9 @@ class Target extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } @@ -1007,11 +999,6 @@ class TargetLine extends CommonObjectLine // To complete with content of an object TargetLine // We should have a field rowid, fk_target and position - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Constructor * @@ -1020,5 +1007,7 @@ class TargetLine extends CommonObjectLine public function __construct(DoliDB $db) { $this->db = $db; + + $this->isextrafieldmanaged = 0; } } diff --git a/htdocs/webportal/class/webportalinvoice.class.php b/htdocs/webportal/class/webportalinvoice.class.php index 751bb28e10f..7f50185b435 100644 --- a/htdocs/webportal/class/webportalinvoice.class.php +++ b/htdocs/webportal/class/webportalinvoice.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -36,11 +37,6 @@ class WebPortalInvoice extends Facture */ public $module = 'webportal'; - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Status list (short label) */ @@ -152,6 +148,8 @@ class WebPortalInvoice extends Facture { $this->db = $db; + $this->isextrafieldmanaged = 0; + $this->getInvoiceStatic(); } diff --git a/htdocs/webportal/class/webportalmember.class.php b/htdocs/webportal/class/webportalmember.class.php index cfa979279f3..bc937a5613a 100644 --- a/htdocs/webportal/class/webportalmember.class.php +++ b/htdocs/webportal/class/webportalmember.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -36,11 +37,6 @@ class WebPortalMember extends Adherent */ public $module = 'webportal'; - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Status list (short label) */ @@ -198,6 +194,8 @@ class WebPortalMember extends Adherent $this->db = $db; + $this->isextrafieldmanaged = 0; + $this->getMemberStatic(); // Translate some data of arrayofkeyval diff --git a/htdocs/webportal/class/webportalorder.class.php b/htdocs/webportal/class/webportalorder.class.php index 157dcb25775..a6f8007da7c 100644 --- a/htdocs/webportal/class/webportalorder.class.php +++ b/htdocs/webportal/class/webportalorder.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -36,11 +37,6 @@ class WebPortalOrder extends Commande */ public $module = 'webportal'; - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Status list (short label) */ @@ -153,6 +149,8 @@ class WebPortalOrder extends Commande $this->db = $db; + $this->isextrafieldmanaged = 0; + $this->getOrderStatic(); } diff --git a/htdocs/webportal/class/webportalpartnership.class.php b/htdocs/webportal/class/webportalpartnership.class.php index c72ae9397f0..75bcdf64d95 100644 --- a/htdocs/webportal/class/webportalpartnership.class.php +++ b/htdocs/webportal/class/webportalpartnership.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -36,11 +37,6 @@ class WebPortalPartnership extends Partnership */ public $module = 'webportal'; - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Status list (short label) */ @@ -174,6 +170,8 @@ class WebPortalPartnership extends Partnership $this->db = $db; + $this->isextrafieldmanaged = 0; + $this->getPartnershipStatic(); // Translate some data of arrayofkeyval diff --git a/htdocs/webportal/class/webportalpropal.class.php b/htdocs/webportal/class/webportalpropal.class.php index 8432aaa662b..5bfa4a69e5f 100644 --- a/htdocs/webportal/class/webportalpropal.class.php +++ b/htdocs/webportal/class/webportalpropal.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2023-2024 Laurent Destailleur * Copyright (C) 2023-2024 Lionel Vessiller * Copyright (C) 2024 MDW + * Copyright (C) 2024 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 @@ -36,11 +37,6 @@ class WebPortalPropal extends Propal */ public $module = 'webportal'; - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * Status list (short label) */ @@ -153,6 +149,8 @@ class WebPortalPropal extends Propal $this->db = $db; + $this->isextrafieldmanaged = 0; + $this->getPropalStatic(); } diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index bd77a37d8a9..cfb81181505 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -47,16 +47,8 @@ class Website extends CommonObject */ public $table_element = 'website'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - protected $childtablesoncascade = array(); - /** * @var string String with name of icon for website. Must be the part after the 'object_' into object_myobject.png */ @@ -149,6 +141,8 @@ class Website extends CommonObject public function __construct(DoliDB $db) { $this->db = $db; + + $this->ismultientitymanaged = 1; } /** diff --git a/htdocs/workstation/class/workstation.class.php b/htdocs/workstation/class/workstation.class.php index c7fe7aaf676..11be711bb79 100644 --- a/htdocs/workstation/class/workstation.class.php +++ b/htdocs/workstation/class/workstation.class.php @@ -47,17 +47,6 @@ class Workstation extends CommonObject */ public $table_element = 'workstation_workstation'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 1; - - /** - * @var int Does object support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 0; - /** * @var string String with name of icon for workstation. Must be the part after the 'object_' into object_workstation.png */ @@ -198,6 +187,9 @@ class Workstation extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 1; + $this->isextrafieldmanaged = 0; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index 65daef8827b..cd743d99bad 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -39,17 +39,6 @@ class Hook extends CommonObject */ public $table_element = 'zapier_hook'; - /** - * @var int<0,1>|string Does this object support multicompany module ? - * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table (example 'fk_soc@societe') - */ - public $ismultientitymanaged = 0; - - /** - * @var int Does hook support extrafields ? 0=No, 1=Yes - */ - public $isextrafieldmanaged = 1; - /** * @var string String with name of icon for hook. Must be the part after the 'object_' into object_hook.png */ @@ -257,6 +246,9 @@ class Hook extends CommonObject $this->db = $db; + $this->ismultientitymanaged = 0; + $this->isextrafieldmanaged = 1; + if (!getDolGlobalString('MAIN_SHOW_TECHNICAL_ID') && isset($this->fields['rowid'])) { $this->fields['rowid']['visible'] = 0; } From 373ee15009b53a9e4b36ac6b6d2313d6b71a83ba Mon Sep 17 00:00:00 2001 From: lamrani abdelwadoud Date: Sun, 5 May 2024 01:15:32 +0200 Subject: [PATCH 2/2] New function to display 2 sitweb export function in a popup (#29592) * new function to display 2 sitweb export function in a popup * Update website.lang * update function overwriteTemplate for handle the path to export website * update function for check the relative/absolute path * add infoBull for explain to user where it will exported --------- Co-authored-by: Laurent Destailleur --- htdocs/core/lib/functions.lib.php | 107 +++++++++++++++++++++---- htdocs/langs/en_US/website.lang | 6 +- htdocs/website/class/website.class.php | 44 ++++++++-- htdocs/website/index.php | 13 +-- 4 files changed, 144 insertions(+), 26 deletions(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b5bc097d8e2..e16bec4b678 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2151,6 +2151,83 @@ function dol_syslog($message, $level = LOG_INFO, $ident = 0, $suffixinfilename = } } +/** + * Create a dialog with two buttons for export and overwrite of a website + * + * @param string $name Unique identifier for the dialog + * @param string $label Title of the dialog + * @param string $buttonstring Text for the button that opens the dialog + * @param string $exportSiteName Name of the "submit" input for site export + * @param string $overwriteGitUrl URL for the link that triggers the overwrite action in GIT + * @return string HTML and JavaScript code for the button and the dialog + */ +function dolButtonToOpenExportDialog($name, $label, $buttonstring, $exportSiteName, $overwriteGitUrl) +{ + global $langs, $db; + + $form = new Form($db); + + $out = ''; + $out .= ''; + + // for generate popup + $out .= ''; + + return $out; +} + + /** * Return HTML code to output a button to open a dialog popup box. * Such buttons must be included inside a HTML form. @@ -11944,21 +12021,21 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st * @param int|boolean $userRight User action right * // phpcs:disable * @param array $params = [ // Various params for future : recommended rather than adding more function arguments - * 'attr' => [ // to add or override button attributes - * 'xxxxx' => '', // your xxxxx attribute you want - * 'class' => 'reposition', // to add more css class to the button class attribute - * 'classOverride' => '' // to replace class attribute of the button - * ], - * 'confirm' => [ - * 'url' => 'http://', // Override Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm. - * 'title' => '', // Override title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key - * 'action-btn-label' => '', // Override label of action button, if empty default label use "Confirm" lang key - * 'cancel-btn-label' => '', // Override label of cancel button, if empty default label use "CloseDialog" lang key - * 'content' => '', // Override text of content, if empty default content use "ConfirmBtnCommonContent" lang key - * 'modal' => true, // true|false to display dialog as a modal (with dark background) - * 'isDropDrown' => false, // true|false to display dialog as a dropdown (with dark background) - * ], - * ] + * 'attr' => [ // to add or override button attributes + * 'xxxxx' => '', // your xxxxx attribute you want + * 'class' => 'reposition', // to add more css class to the button class attribute + * 'classOverride' => '' // to replace class attribute of the button + * ], + * 'confirm' => [ + * 'url' => 'http://', // Override Url to go when user click on action btn, if empty default url is $url.?confirm=yes, for no js compatibility use $url for fallback confirm. + * 'title' => '', // Override title of modal, if empty default title use "ConfirmBtnCommonTitle" lang key + * 'action-btn-label' => '', // Override label of action button, if empty default label use "Confirm" lang key + * 'cancel-btn-label' => '', // Override label of cancel button, if empty default label use "CloseDialog" lang key + * 'content' => '', // Override text of content, if empty default content use "ConfirmBtnCommonContent" lang key + * 'modal' => true, // true|false to display dialog as a modal (with dark background) + * 'isDropDrown' => false, // true|false to display dialog as a dropdown (with dark background) + * ], + * ] * // phpcs:enable * @return string html button */ diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index ed816460ea5..a810fd8d926 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -90,7 +90,7 @@ DisableSiteFirst=Disable website first MyContainerTitle=My web site title AnotherContainer=This is how to include content of another page/container (you may have an error here if you enable dynamic code because the embedded subcontainer may not exists) SorryWebsiteIsCurrentlyOffLine=Sorry, this website is currently off line. Please comme back later... -WEBSITE_USE_WEBSITE_ACCOUNTS=Enable the web site account table +WEBSITE_USE_WEBSITE_ACCOUNTS=Enable the web site account table$val = $fields[$fieldKey]; WEBSITE_USE_WEBSITE_ACCOUNTSTooltip=Enable the table to store web site accounts (login/pass) for each website / third party YouMustDefineTheHomePage=You must first define the default Home page OnlyEditionOfSourceForGrabbedContentFuture=Warning: Creating a web page by importing an external web page is reserved for experienced users. Depending on the complexity of source page, the result of importation may differ from the original. Also if the source page uses common CSS styles or conflicting JavaScript, it may break the look or features of the Website editor when working on this page. This method is a quicker way to create a page but it is recommended to create your new page from scratch or from a suggested page template.
Note also that the inline editor may not works correctty when used on a grabbed external page. @@ -236,3 +236,7 @@ WebPortalGroupMenuAdmin=Administration WebPortalGroupMenuTechnical=System PreviewPageContent=Page content Cart=Cart +ExportSiteLabel=Would you like to export the website by downloading a zip file ? +ExportSiteGitLabel=Would you like to export into a directory on the server ? +ExportPath=path to export file +SourceFiles = *If the path is absolute, it must start with a / *If not it will be within install/doctemplates/websites/ followed by the entered path. diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index cfb81181505..490a6de6372 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1653,9 +1653,10 @@ class Website extends CommonObject * Overite template by copying all files * * @param string $pathtotmpzip Path to the tmp zip file + * @param string $exportPath Path to export files to (specified by the user) * @return int Return integer <0 if KO, >0 if OK */ - public function overwriteTemplate(string $pathtotmpzip) + public function overwriteTemplate(string $pathtotmpzip, $exportPath = '') { global $conf; @@ -1677,21 +1678,54 @@ class Website extends CommonObject // Replace modified files into the doctemplates directory. if (getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE') == '1') { - $destdirrel = 'install/doctemplates/websites/'.$website->name_template; - $destdir = DOL_DOCUMENT_ROOT.'/'.$destdirrel; + // If the user has not specified a path + if (empty($exportPath)) { + $destdirrel = 'install/doctemplates/websites/'.$website->name_template; + $destdir = DOL_DOCUMENT_ROOT.'/'.$destdirrel; + } else { + $exportPath = rtrim($exportPath, '/'); + if (strpos($exportPath, '..') !== false) { + setEventMessages("Invalid path.", null, 'errors'); + return -1; + } + // if path start with / (absolute path) + if (strpos($exportPath, '/') === 0) { + if (!is_dir($exportPath)) { + setEventMessages("The specified absolute path does not exist.", null, 'errors'); + return -1; + } + + if (!is_writable($exportPath)) { + setEventMessages("The specified absolute path is not writable.", null, 'errors'); + return -1; + } + } else { + // relatif path + $destdirrel = 'install/doctemplates/websites/'.$exportPath; + $destdir = DOL_DOCUMENT_ROOT.'/'.$destdirrel; + } + } } else { $destdirrel = basename(dirname(getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE'))).'/'.basename(getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')); $destdir = getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE'); } + dol_mkdir($destdir); + if (!is_writable($destdir)) { + setEventMessages("The specified path is not writable.", null, 'errors'); + return -1; + } + // Export on target sources $resultarray = dol_uncompress($pathtotmpzip, $destdir); // Remove the file README and LICENSE from the $destdir (already into the containers directory) - dol_delete_file($destdir.'/README.md'); - dol_delete_file($destdir.'/LICENSE'); + if (empty($exportPath)) { + dol_delete_file($destdir.'/README.md'); + dol_delete_file($destdir.'/LICENSE'); + } // Remove non required files (will be re-generated during the import) dol_delete_file($destdir.'/containers/index.php'); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 6bb5cd5e1d1..dcf3c05a2f0 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2466,9 +2466,9 @@ if ($action == 'exportsite' && $user->hasRight('website', 'export')) { if ($action == 'overwritesite' && $user->hasRight('website', 'export')) { if (getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')) { $fileofzip = $object->exportWebSite(); - + $pathToExport = GETPOST('export_path'); if ($fileofzip) { - $object->overwriteTemplate($fileofzip); + $object->overwriteTemplate($fileofzip, $pathToExport); } else { setEventMessages($object->error, $object->errors, 'errors'); } @@ -3070,12 +3070,15 @@ if (!GETPOST('hide_websitemenu')) { print ''; } - // Export web site - print ''; + // // Export web site + $extraCssClass = getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE') ? 'hideobject' : ''; + print ''; if (getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')) { // Overwrite template in sources - print 'ref).'" class="button bordertransp" title="'.dol_escape_htmltag($langs->trans("ExportIntoGIT").". Directory ".getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')).'">'.dol_escape_htmltag($langs->trans("ExportIntoGIT")).''; + $overwriteGitUrl = $_SERVER["PHP_SELF"] . '?action=overwritesite&website=' . urlencode($website->ref); + print dolButtonToOpenExportDialog('exportpopup', $langs->trans('ExportOptions'), $langs->trans('ExportSite'), 'exportsite', $overwriteGitUrl); + //print 'ref).'" class="button bordertransp hideobject" title="'.dol_escape_htmltag($langs->trans("ExportIntoGIT").". Directory ".getDolGlobalString('WEBSITE_ALLOW_OVERWRITE_GIT_SOURCE')).'">'.dol_escape_htmltag($langs->trans("ExportIntoGIT")).''; } // Clone web site