Merge branch

'14.0_fix_show_prospecting_level_on_contact_list_by_normalize_the_field_name'
of https://github.com/OPEN-DSI/dolibarr into
OPEN-DSI-14.0_fix_show_prospecting_level_on_contact_list_by_normalize_the_field_name
This commit is contained in:
Laurent Destailleur 2022-12-27 00:46:07 +01:00
commit 9828d27a6a
5 changed files with 19 additions and 16 deletions

View File

@ -353,9 +353,9 @@ class Contact extends CommonObject
$this->fields['fk_soc']['searchall'] = 0; $this->fields['fk_soc']['searchall'] = 0;
} }
if (empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { // Default behaviour if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->THIRDPARTY_ENABLE_PROSPECTION_ON_ALTERNATIVE_ADRESSES)) { // Default behaviour
$this->field['fk_stcommcontact']['enabled'] = 0; $this->fields['fk_stcommcontact']['enabled'] = 0;
$this->field['fk_prospectcontactlevel']['enabled'] = 0; $this->fields['fk_prospectlevel']['enabled'] = 0;
} }
// Unset fields that are disabled // 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_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 .= ", phone_mobile = ".(isset($this->phone_mobile) ? "'".$this->db->escape($this->phone_mobile)."'" : "NULL");
$sql .= ", priv = '".$this->db->escape($this->priv)."'"; $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)) { if (isset($this->stcomm_id)) {
$sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0"); $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.socialnetworks,";
$sql .= " c.photo,"; $sql .= " c.photo,";
$sql .= " c.priv, c.note_private, c.note_public, c.default_lang, c.canvas,"; $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.import_key,";
$sql .= " c.datec as date_creation, c.tms as date_modification,"; $sql .= " c.datec as date_creation, c.tms as date_modification,";
$sql .= " co.label as country, co.code as country_code,"; $sql .= " co.label as country, co.code as country_code,";
@ -1054,7 +1054,7 @@ class Contact extends CommonObject
$this->poste = $obj->poste; $this->poste = $obj->poste;
$this->statut = $obj->statut; $this->statut = $obj->statut;
$this->fk_prospectlevel = $obj->fk_prospectcontactlevel; $this->fk_prospectlevel = $obj->fk_prospectlevel;
$transcode = $langs->trans('StatusProspect'.$obj->fk_stcommcontact); $transcode = $langs->trans('StatusProspect'.$obj->fk_stcommcontact);
$libelle = ($transcode != 'StatusProspect'.$obj->fk_stcommcontact ? $transcode : $obj->stcomm); $libelle = ($transcode != 'StatusProspect'.$obj->fk_stcommcontact ? $transcode : $obj->stcomm);

View File

@ -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.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.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 .= " 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"; $sql .= " co.label as country, co.code as country_code";
// Add fields from extrafields // Add fields from extrafields
if (!empty($extrafields->attributes[$object->table_element]['label'])) { 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); $sql .= " AND p.fk_user_creat=".((int) $userid);
} }
if ($search_level) { 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) { if ($search_stcomm != '' && $search_stcomm != -2) {
$sql .= natural_search("p.fk_stcommcontact", $search_stcomm, 2); $sql .= natural_search("p.fk_stcommcontact", $search_stcomm, 2);
@ -1000,7 +1000,7 @@ if (!empty($arrayfields['p.priv']['checked'])) {
print '</td>'; print '</td>';
} }
// Prospect level // Prospect level
if (!empty($arrayfields['p.fk_prospectcontactlevel']['checked'])) { if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
print '<td class="liste_titre center">'; print '<td class="liste_titre center">';
print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2); print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2);
print '</td>'; print '</td>';
@ -1117,8 +1117,8 @@ if (!empty($arrayfields['s.nom']['checked'])) {
if (!empty($arrayfields['p.priv']['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 '); 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'])) { if (!empty($arrayfields['p.fk_prospectlevel']['checked'])) {
print_liste_field_titre($arrayfields['p.fk_prospectcontactlevel']['label'], $_SERVER["PHP_SELF"], "p.fk_prospectcontactlevel", "", $param, '', $sortfield, $sortorder, 'center '); 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'])) { 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 '); 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->photo = $obj->photo;
$contactstatic->import_key = $obj->import_key; $contactstatic->import_key = $obj->import_key;
$contactstatic->fk_prospectlevel = $obj->fk_prospectcontactlevel; $contactstatic->fk_prospectlevel = $obj->fk_prospectlevel;
if ($mode == 'kanban') { if ($mode == 'kanban') {
if ($i == 0) { if ($i == 0) {
@ -1196,7 +1196,7 @@ while ($i < min($num, $limit)) {
print '</td></tr>'; print '</td></tr>';
} }
} else { } else {
print '<tr class="oddeven">'; print '<tr class="oddeven" id="rowid-'.((int) $obj->rowid).'">';
// Action column // Action column
if (!empty($conf->global->MAIN_CHECKBOX_LEFT_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 // Prospect level
print '<td class="center">'; print '<td class="center">';
print $contactstatic->getLibProspLevel(); print $contactstatic->getLibProspLevel();

View File

@ -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_opensurvey_comments ADD COLUMN date_creation datetime NULL;
ALTER TABLE llx_c_tva ADD COLUMN use_default tinyint DEFAULT 0; ALTER TABLE llx_c_tva ADD COLUMN use_default tinyint DEFAULT 0;

View File

@ -37,3 +37,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value
-- amount was removed in v12 -- amount was removed in v12
ALTER TABLE llx_facture DROP COLUMN amount; ALTER TABLE llx_facture DROP COLUMN amount;
-- Rename prospect level on contact
ALTER TABLE llx_socpeople CHANGE fk_prospectcontactlevel fk_prospectlevel varchar(12);

View File

@ -58,7 +58,7 @@ create table llx_socpeople
photo varchar(255), photo varchar(255),
no_email smallint NOT NULL DEFAULT 0, -- deprecated. Use table llx_mailing_unsubscribe instead no_email smallint NOT NULL DEFAULT 0, -- deprecated. Use table llx_mailing_unsubscribe instead
priv smallint NOT NULL DEFAULT 0, 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_stcommcontact integer DEFAULT 0 NOT NULL, -- commercial statut
fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
fk_user_modif integer, fk_user_modif integer,