From 9e353c328432eaa5b340605f7a5011e90db73cd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Jan 2023 11:55:41 +0100 Subject: [PATCH 1/5] fix undeclared properties --- .../class/companypaymentmode.class.php | 17 +++- htdocs/societe/class/societe.class.php | 95 ++++++++++++------- htdocs/societe/class/societeaccount.class.php | 3 +- 3 files changed, 77 insertions(+), 38 deletions(-) diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index eb77a928f14..1e221695a11 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -122,7 +122,7 @@ class CompanyPaymentMode extends CommonObject 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>20), 'tms' =>array('type'=>'timestamp', 'label'=>'Tms', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>25), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'Import key', 'enabled'=>1, 'visible'=>-2, 'position'=>105), - //'aaa' =>array('type'=>'date', 'label'=>'Ending date', 'enabled'=>0, 'visible'=>-2, 'position'=>185), + //'aaa' =>array('type'=>'date', 'label'=>'Ending date', 'enabled'=>0, 'visible'=>-2, 'position'=>185), ); /** @@ -146,6 +146,18 @@ class CompanyPaymentMode extends CommonObject public $number; public $cle_rib; public $bic; + + /** + * @var string iban + * @deprecated + * @see iban_prefix + */ + public $iban; + + /** + * iban_prefix + * @var string + */ public $iban_prefix; public $domiciliation; public $proprio; @@ -255,8 +267,7 @@ class CompanyPaymentMode extends CommonObject // Clear fields $object->ref = "copy_of_".$object->ref; - $object->title = $langs->trans("CopyOf")." ".$object->title; - // ... + // $object->title = $langs->trans("CopyOf")." ".$object->title; // Create clone $object->context['createfromclone'] = 'createfromclone'; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 29f400fc778..c5b8df20d0e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -15,7 +15,7 @@ * Copyright (C) 2017 Rui Strecht * Copyright (C) 2018 Philippe Grand * Copyright (C) 2019-2020 Josep Lluís Amador - * Copyright (C) 2019-2022 Frédéric France + * Copyright (C) 2019-2023 Frédéric France * Copyright (C) 2020 Open-Dsi * Copyright (C) 2022 ButterflyOfFire * @@ -128,6 +128,22 @@ class Societe extends CommonObject */ public $restrictiononfksoc = 1; + /** + * @var Societe To store a cloned copy of object before to edit it and keep track of old properties + */ + public $oldcopy; + + /** + * array of supplier categories + * @var array + */ + public $SupplierCategories = array(); + + /** + * prefixCustomerIsRequired + * @var int + */ + public $prefixCustomerIsRequired; /** * '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') @@ -351,12 +367,19 @@ class Societe extends CommonObject * @var string */ public $fax; + /** * Email * @var string */ public $email; + /** + * No Email + * @var int + */ + public $no_email; + /** * @var array array of socialnetworks */ @@ -462,6 +485,12 @@ class Societe extends CommonObject */ public $idprof6; + /** + * Object of company + * @var string + */ + public $object; + /** * @var string Prefix comm */ @@ -4257,14 +4286,14 @@ class Societe extends CommonObject global $langs; $this->id = 0; - $this->name = empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM; - $this->address = empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? '' : $conf->global->MAIN_INFO_SOCIETE_ADDRESS; - $this->zip = empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? '' : $conf->global->MAIN_INFO_SOCIETE_ZIP; - $this->town = empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? '' : $conf->global->MAIN_INFO_SOCIETE_TOWN; - $this->region_code = empty($conf->global->MAIN_INFO_SOCIETE_REGION) ? '' : $conf->global->MAIN_INFO_SOCIETE_REGION; - $this->object = empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? '' : $conf->global->MAIN_INFO_SOCIETE_OBJECT; + $this->name = getDolGlobalString('MAIN_INFO_SOCIETE_NOM'); + $this->address = getDolGlobalString('MAIN_INFO_SOCIETE_ADDRESS'); + $this->zip = getDolGlobalString('MAIN_INFO_SOCIETE_ZIP'); + $this->town = getDolGlobalString('MAIN_INFO_SOCIETE_TOWN'); + $this->region_code = getDolGlobalString('MAIN_INFO_SOCIETE_REGION'); + $this->object = getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT'); - $this->note_private = empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOTE; + $this->note_private = getDolGlobalString('MAIN_INFO_SOCIETE_NOTE'); $this->nom = $this->name; // deprecated @@ -4276,8 +4305,8 @@ class Societe extends CommonObject if (!empty($tmp[1])) { // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label" $country_code = $tmp[1]; $country_label = $tmp[2]; - } else // For backward compatibility - { + } else { + // For backward compatibility dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_WARNING); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; $country_code = getCountry($country_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore @@ -4314,40 +4343,40 @@ class Societe extends CommonObject $this->state = ($langs->trans('State'.$state_code) != 'State'.$state_code) ? $langs->trans('State'.$state_code) : $state_label; } - $this->phone = empty($conf->global->MAIN_INFO_SOCIETE_TEL) ? '' : $conf->global->MAIN_INFO_SOCIETE_TEL; - $this->fax = empty($conf->global->MAIN_INFO_SOCIETE_FAX) ? '' : $conf->global->MAIN_INFO_SOCIETE_FAX; - $this->url = empty($conf->global->MAIN_INFO_SOCIETE_WEB) ? '' : $conf->global->MAIN_INFO_SOCIETE_WEB; + $this->phone = getDolGlobalString('MAIN_INFO_SOCIETE_TEL'); + $this->fax = getDolGlobalString('MAIN_INFO_SOCIETE_FAX'); + $this->url = getDolGlobalString('MAIN_INFO_SOCIETE_WEB'); // Social networks - $this->facebook_url = empty($conf->global->MAIN_INFO_SOCIETE_FACEBOOK_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_FACEBOOK_URL; - $this->twitter_url = empty($conf->global->MAIN_INFO_SOCIETE_TWITTER_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_TWITTER_URL; - $this->linkedin_url = empty($conf->global->MAIN_INFO_SOCIETE_LINKEDIN_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_LINKEDIN_URL; - $this->instagram_url = empty($conf->global->MAIN_INFO_SOCIETE_INSTAGRAM_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_INSTAGRAM_URL; - $this->youtube_url = empty($conf->global->MAIN_INFO_SOCIETE_YOUTUBE_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_YOUTUBE_URL; - $this->github_url = empty($conf->global->MAIN_INFO_SOCIETE_GITHUB_URL) ? '' : $conf->global->MAIN_INFO_SOCIETE_GITHUB_URL; + $facebook_url = getDolGlobalString('MAIN_INFO_SOCIETE_FACEBOOK_URL'); + $twitter_url = getDolGlobalString('MAIN_INFO_SOCIETE_TWITTER_URL'); + $linkedin_url = getDolGlobalString('MAIN_INFO_SOCIETE_LINKEDIN_URL'); + $instagram_url = getDolGlobalString('MAIN_INFO_SOCIETE_INSTAGRAM_URL'); + $youtube_url = getDolGlobalString('MAIN_INFO_SOCIETE_YOUTUBE_URL'); + $github_url = getDolGlobalString('MAIN_INFO_SOCIETE_GITHUB_URL'); $this->socialnetworks = array(); - if (!empty($this->facebook_url)) { - $this->socialnetworks['facebook'] = $this->facebook_url; + if (!empty($facebook_url)) { + $this->socialnetworks['facebook'] = $facebook_url; } - if (!empty($this->twitter_url)) { - $this->socialnetworks['twitter'] = $this->twitter_url; + if (!empty($twitter_url)) { + $this->socialnetworks['twitter'] = $twitter_url; } - if (!empty($this->linkedin_url)) { - $this->socialnetworks['linkedin'] = $this->linkedin_url; + if (!empty($linkedin_url)) { + $this->socialnetworks['linkedin'] = $linkedin_url; } - if (!empty($this->instagram_url)) { - $this->socialnetworks['instagram'] = $this->instagram_url; + if (!empty($instagram_url)) { + $this->socialnetworks['instagram'] = $instagram_url; } - if (!empty($this->youtube_url)) { - $this->socialnetworks['youtube'] = $this->youtube_url; + if (!empty($youtube_url)) { + $this->socialnetworks['youtube'] = $youtube_url; } - if (!empty($this->github_url)) { - $this->socialnetworks['github'] = $this->github_url; + if (!empty($github_url)) { + $this->socialnetworks['github'] = $github_url; } // Id prof generiques - $this->idprof1 = empty($conf->global->MAIN_INFO_SIREN) ? '' : $conf->global->MAIN_INFO_SIREN; - $this->idprof2 = empty($conf->global->MAIN_INFO_SIRET) ? '' : $conf->global->MAIN_INFO_SIRET; + $this->idprof1 = getDolGlobalString('MAIN_INFO_SIREN'); + $this->idprof2 = getDolGlobalString('MAIN_INFO_SIRET'); $this->idprof3 = empty($conf->global->MAIN_INFO_APE) ? '' : $conf->global->MAIN_INFO_APE; $this->idprof4 = empty($conf->global->MAIN_INFO_RCS) ? '' : $conf->global->MAIN_INFO_RCS; $this->idprof5 = empty($conf->global->MAIN_INFO_PROFID5) ? '' : $conf->global->MAIN_INFO_PROFID5; diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 79f5aedbe68..411b11a4cd9 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -216,8 +216,7 @@ class SocieteAccount extends CommonObject // Clear fields $object->ref = "copy_of_".$object->ref; - $object->title = $langs->trans("CopyOf")." ".$object->title; - // ... + // $object->title = $langs->trans("CopyOf")." ".$object->title; // Create clone $object->context['createfromclone'] = 'createfromclone'; From 9bd3cb927dd3b3984c44c124baff58d7fb90da80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 19 Jan 2023 18:41:49 +0100 Subject: [PATCH 2/5] fix undeclared properties --- htdocs/societe/class/societe.class.php | 32 +++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c5b8df20d0e..a6027eccd02 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -4377,22 +4377,22 @@ class Societe extends CommonObject // Id prof generiques $this->idprof1 = getDolGlobalString('MAIN_INFO_SIREN'); $this->idprof2 = getDolGlobalString('MAIN_INFO_SIRET'); - $this->idprof3 = empty($conf->global->MAIN_INFO_APE) ? '' : $conf->global->MAIN_INFO_APE; - $this->idprof4 = empty($conf->global->MAIN_INFO_RCS) ? '' : $conf->global->MAIN_INFO_RCS; - $this->idprof5 = empty($conf->global->MAIN_INFO_PROFID5) ? '' : $conf->global->MAIN_INFO_PROFID5; - $this->idprof6 = empty($conf->global->MAIN_INFO_PROFID6) ? '' : $conf->global->MAIN_INFO_PROFID6; - $this->tva_intra = empty($conf->global->MAIN_INFO_TVAINTRA) ? '' : $conf->global->MAIN_INFO_TVAINTRA; // VAT number, not necessarly INTRA. - $this->managers = empty($conf->global->MAIN_INFO_SOCIETE_MANAGERS) ? '' : $conf->global->MAIN_INFO_SOCIETE_MANAGERS; - $this->capital = empty($conf->global->MAIN_INFO_CAPITAL) ? '' : $conf->global->MAIN_INFO_CAPITAL; - $this->forme_juridique_code = empty($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) ? '' : $conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE; - $this->email = empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? '' : $conf->global->MAIN_INFO_SOCIETE_MAIL; - $this->default_lang = (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT); - $this->logo = empty($conf->global->MAIN_INFO_SOCIETE_LOGO) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO; - $this->logo_small = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL; - $this->logo_mini = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; - $this->logo_squarred = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; - $this->logo_squarred_small = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; - $this->logo_squarred_mini = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; + $this->idprof3 = getDolGlobalString('MAIN_INFO_APE'); + $this->idprof4 = getDolGlobalString('MAIN_INFO_RCS'); + $this->idprof5 = getDolGlobalString('MAIN_INFO_PROFID5'); + $this->idprof6 = getDolGlobalString('MAIN_INFO_PROFID6'); + $this->tva_intra = getDolGlobalString('MAIN_INFO_TVAINTRA'); // VAT number, not necessarly INTRA. + $this->managers = getDolGlobalString('MAIN_INFO_SOCIETE_MANAGERS'); + $this->capital = getDolGlobalString('MAIN_INFO_CAPITAL'); + $this->forme_juridique_code = getDolGlobalString('MAIN_INFO_SOCIETE_FORME_JURIDIQUE'); + $this->email = getDolGlobalString('MAIN_INFO_SOCIETE_MAIL'); + $this->default_lang = getDolGlobalString('MAIN_LANG_DEFAULT', 'auto'); + $this->logo =getDolGlobalString('MAIN_INFO_SOCIETE_LOGO'); + $this->logo_small = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SMALL'); + $this->logo_mini = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_MINI'); + $this->logo_squarred = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED'); + $this->logo_squarred_small = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL'); + $this->logo_squarred_mini = getDolGlobalString('MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI'); // Define if company use vat or not $this->tva_assuj = $conf->global->FACTURE_TVAOPTION; From 0279f1ec44e377135ffb25b38cbfdfdcb9973caf Mon Sep 17 00:00:00 2001 From: Christian Humpel Date: Sun, 29 Jan 2023 23:05:39 +0100 Subject: [PATCH 3/5] filter on extrafields --- htdocs/projet/class/api_projects.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 8cbb3949cd5..fc10f49d38d 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -122,6 +122,7 @@ class Projects extends DolibarrApi $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects) } $sql .= " FROM ".MAIN_DB_PREFIX."projet as t"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_extrafields AS ef ON ef.fk_object = t.rowid"; // So we will be able to filter on extrafields if ($category > 0) { $sql .= ", ".MAIN_DB_PREFIX."categorie_project as c"; } From 854bd4efa1f4d0be7037aa7db56644f1bde07e04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Jan 2023 05:08:05 +0000 Subject: [PATCH 4/5] Bump JetBrains/qodana-action from 2022.3.0 to 2022.3.2 Bumps [JetBrains/qodana-action](https://github.com/JetBrains/qodana-action) from 2022.3.0 to 2022.3.2. - [Release notes](https://github.com/JetBrains/qodana-action/releases) - [Commits](https://github.com/JetBrains/qodana-action/compare/v2022.3.0...v2022.3.2) --- updated-dependencies: - dependency-name: JetBrains/qodana-action dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/code_quality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 65f350e1b53..e5351acaf78 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -18,7 +18,7 @@ jobs: fetch-depth: 1 #php-version: '7.1' - name: 'Qodana Scan' - uses: JetBrains/qodana-action@v2022.3.0 + uses: JetBrains/qodana-action@v2022.3.2 #with: # php-version: '7.1' env: From c533b7235157cadfa5ec1cb494f6f527c9da6e01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 30 Jan 2023 13:59:36 +0100 Subject: [PATCH 5/5] Update societe.class.php --- htdocs/societe/class/societe.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index a6027eccd02..d1796e54577 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -486,10 +486,10 @@ class Societe extends CommonObject public $idprof6; /** - * Object of company + * Social object of the company * @var string */ - public $object; + public $socialobject; /** * @var string Prefix comm