diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index c028c80b07b..871ae62db36 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -353,9 +353,9 @@ class Contact extends CommonObject $this->fields['fk_soc']['searchall'] = 0; } - if (empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { // Default behaviour - $this->field['fk_stcommcontact']['enabled'] = 0; - $this->field['fk_prospectcontactlevel']['enabled'] = 0; + if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { // Default behaviour + $this->fields['fk_stcommcontact']['enabled'] = 0; + $this->fields['fk_prospectlevel']['enabled'] = 0; } // Unset fields that are disabled @@ -608,7 +608,7 @@ class Contact extends CommonObject $sql .= ", phone_perso = ".(isset($this->phone_perso) ? "'".$this->db->escape($this->phone_perso)."'" : "NULL"); $sql .= ", phone_mobile = ".(isset($this->phone_mobile) ? "'".$this->db->escape($this->phone_mobile)."'" : "NULL"); $sql .= ", priv = '".$this->db->escape($this->priv)."'"; - $sql .= ", fk_prospectcontactlevel = '".$this->db->escape($this->fk_prospectlevel)."'"; + $sql .= ", fk_prospectlevel = '".$this->db->escape($this->fk_prospectlevel)."'"; if (isset($this->stcomm_id)) { $sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0"); } @@ -987,7 +987,7 @@ class Contact extends CommonObject $sql .= " c.socialnetworks,"; $sql .= " c.photo,"; $sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,"; - $sql .= " c.fk_prospectcontactlevel, c.fk_stcommcontact, st.libelle as stcomm, st.picto as stcomm_picto,"; + $sql .= " c.fk_prospectlevel, c.fk_stcommcontact, st.libelle as stcomm, st.picto as stcomm_picto,"; $sql .= " c.import_key,"; $sql .= " c.datec as date_creation, c.tms as date_modification,"; $sql .= " co.label as country, co.code as country_code,"; @@ -1054,7 +1054,7 @@ class Contact extends CommonObject $this->poste = $obj->poste; $this->statut = $obj->statut; - $this->fk_prospectlevel = $obj->fk_prospectcontactlevel; + $this->fk_prospectlevel = $obj->fk_prospectlevel; $transcode = $langs->trans('StatusProspect'.$obj->fk_stcommcontact); $libelle = ($transcode != 'StatusProspect'.$obj->fk_stcommcontact ? $transcode : $obj->stcomm); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 633fcd1a10a..e392978ecc1 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -378,7 +378,7 @@ $sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.address, p.z $sql .= " p.socialnetworks, p.photo,"; $sql .= " p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.fk_pays, p.priv, p.datec as date_creation, p.tms as date_update,"; $sql .= " p.import_key,"; -$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,"; +$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectlevel,"; $sql .= " co.label as country, co.code as country_code"; // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { @@ -414,7 +414,7 @@ if (!empty($userid)) { // propre au commercial $sql .= " AND p.fk_user_creat=".((int) $userid); } if ($search_level) { - $sql .= natural_search("p.fk_prospectcontactlevel", join(',', $search_level), 3); + $sql .= natural_search("p.fk_prospectlevel", join(',', $search_level), 3); } if ($search_stcomm != '' && $search_stcomm != -2) { $sql .= natural_search("p.fk_stcommcontact", $search_stcomm, 2); @@ -1000,7 +1000,7 @@ if (!empty($arrayfields['p.priv']['checked'])) { print ''; } // Prospect level -if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) { +if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) { print ''; print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2); print ''; @@ -1117,8 +1117,8 @@ if (!empty($arrayfields['s.nom']['checked'])) { if (!empty($arrayfields['p.priv']['checked'])) { print_liste_field_titre($arrayfields['p.priv']['label'], $_SERVER["PHP_SELF"], "p.priv", $begin, $param, '', $sortfield, $sortorder, 'center '); } -if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) { - print_liste_field_titre($arrayfields['p.fk_prospectcontactlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectcontactlevel", "", $param, '', $sortfield, $sortorder, 'center '); +if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_prospectlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectlevel", "", $param, '', $sortfield, $sortorder, 'center '); } if (!empty($arrayfields['p.fk_stcommcontact']['checked'])) { print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'], $_SERVER["PHP_SELF"], "p.fk_stcommcontact", "", $param, '', $sortfield, $sortorder, 'center '); @@ -1177,7 +1177,7 @@ while ($i < min($num, $limit)) { $contactstatic->photo = $obj->photo; $contactstatic->import_key = $obj->import_key; - $contactstatic->fk_prospectlevel = $obj->fk_prospectcontactlevel; + $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel; if ($mode == 'kanban') { if ($i == 0) { @@ -1196,7 +1196,7 @@ while ($i < min($num, $limit)) { print ''; } } else { - print ''; + print ''; // Action column if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { @@ -1367,7 +1367,7 @@ while ($i < min($num, $limit)) { } } - if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) { + if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) { // Prospect level print ''; print $contactstatic->getLibProspLevel(); diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 306a8cdf1c5..3a5fdbba4b5 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -390,4 +390,3 @@ ALTER TABLE llx_opensurvey_user_studs ADD COLUMN date_creation datetime NULL; ALTER TABLE llx_opensurvey_comments ADD COLUMN date_creation datetime NULL; ALTER TABLE llx_c_tva ADD COLUMN use_default tinyint DEFAULT 0; - diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index 946dfe91b20..09feb039ac3 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -37,3 +37,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value -- amount was removed in v12 ALTER TABLE llx_facture DROP COLUMN amount; + +-- Rename prospect level on contact +ALTER TABLE llx_socpeople CHANGE fk_prospectcontactlevel fk_prospectlevel varchar(12); + diff --git a/htdocs/install/mysql/tables/llx_socpeople.sql b/htdocs/install/mysql/tables/llx_socpeople.sql index 59bd22ddfdc..5cad6a4bdc3 100644 --- a/htdocs/install/mysql/tables/llx_socpeople.sql +++ b/htdocs/install/mysql/tables/llx_socpeople.sql @@ -58,7 +58,7 @@ create table llx_socpeople photo varchar(255), no_email smallint NOT NULL DEFAULT 0, -- deprecated. Use table llx_mailing_unsubscribe instead priv smallint NOT NULL DEFAULT 0, - fk_prospectcontactlevel varchar(12), -- prospect level (in llx_c_prospectcontactlevel) + fk_prospectlevel varchar(12), -- prospect level (in llx_c_prospectcontactlevel) fk_stcommcontact integer DEFAULT 0 NOT NULL, -- commercial statut fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement fk_user_modif integer,