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: 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"; } 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 9a8aaf7d96b..e8e8d044b74 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 * @@ -130,6 +130,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') @@ -353,12 +369,19 @@ class Societe extends CommonObject * @var string */ public $fax; + /** * Email * @var string */ public $email; + /** + * No Email + * @var int Set if company email found into unsubscribe of emailing list table + */ + public $no_email; + /** * @var array array of socialnetworks */ @@ -464,6 +487,12 @@ class Societe extends CommonObject */ public $idprof6; + /** + * Social object of the company + * @var string + */ + public $socialobject; + /** * @var string Prefix comm */ @@ -786,11 +815,6 @@ class Societe extends CommonObject */ public $multicurrency_code; - /** - * @var string Set if company email found into unsubscribe of emailing list table - */ - public $no_email; - // Fields loaded by fetchPartnerships() public $partnerships = array(); @@ -4263,14 +4287,15 @@ 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->socialobject = 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->note_private = empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOTE; + $this->socialobject = getDolGlobalString('MAIN_INFO_SOCIETE_OBJECT'); + + $this->note_private = getDolGlobalString('MAIN_INFO_SOCIETE_NOTE'); $this->nom = $this->name; // deprecated @@ -4282,8 +4307,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 @@ -4320,56 +4345,56 @@ 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->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->idprof1 = getDolGlobalString('MAIN_INFO_SIREN'); + $this->idprof2 = getDolGlobalString('MAIN_INFO_SIRET'); + $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; 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';