Merge pull request #13759 from OPEN-DSI/stcommcontact
NEW: Add prospect status managment for the contact with managment of custom icon
This commit is contained in:
commit
7297950308
@ -12,6 +12,7 @@
|
||||
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -90,7 +91,7 @@ $hookmanager->initHooks(array('admin'));
|
||||
// Put here declaration of dictionaries properties
|
||||
|
||||
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
|
||||
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 27, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 0, 15, 30, 0, 37, 0, 25, 0);
|
||||
$taborder = array(9, 0, 4, 3, 2, 0, 1, 8, 19, 16, 39, 27, 40, 38, 0, 5, 11, 0, 32, 33, 34, 0, 6, 0, 29, 0, 7, 24, 28, 17, 35, 36, 0, 10, 23, 12, 13, 0, 14, 0, 22, 20, 18, 21, 0, 15, 30, 0, 37, 0, 25, 0);
|
||||
|
||||
// Name of SQL tables of dictionaries
|
||||
$tabname = array();
|
||||
@ -133,6 +134,8 @@ $tabname[35] = MAIN_DB_PREFIX."c_exp_tax_cat";
|
||||
$tabname[36] = MAIN_DB_PREFIX."c_exp_tax_range";
|
||||
$tabname[37] = MAIN_DB_PREFIX."c_units";
|
||||
$tabname[38] = MAIN_DB_PREFIX."c_socialnetworks";
|
||||
$tabname[39] = MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||
$tabname[40] = MAIN_DB_PREFIX."c_stcommcontact";
|
||||
|
||||
// Dictionary labels
|
||||
$tablib = array();
|
||||
@ -174,6 +177,8 @@ $tablib[35] = "DictionaryExpenseTaxCat";
|
||||
$tablib[36] = "DictionaryExpenseTaxRange";
|
||||
$tablib[37] = "DictionaryMeasuringUnits";
|
||||
$tablib[38] = "DictionarySocialNetworks";
|
||||
$tablib[39] = "DictionaryProspectContactLevel";
|
||||
$tablib[40] = "DictionaryProspectContactStatus";
|
||||
|
||||
// Requests to extract data
|
||||
$tabsql = array();
|
||||
@ -203,7 +208,7 @@ $tabsql[23] = "SELECT t.rowid as rowid, t.taux, t.revenuestamp_type, c.label as
|
||||
$tabsql[24] = "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
|
||||
$tabsql[25] = "SELECT rowid as rowid, code, label, active, module FROM ".MAIN_DB_PREFIX."c_type_container as t WHERE t.entity IN (".getEntity('c_type_container').")";
|
||||
//$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
|
||||
$tabsql[27] = "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[27] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$tabsql[28] = "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
|
||||
$tabsql[29] = "SELECT rowid as rowid, code, label, percent, position, active FROM ".MAIN_DB_PREFIX."c_lead_status";
|
||||
$tabsql[30] = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards";
|
||||
@ -215,6 +220,8 @@ $tabsql[35] = "SELECT c.rowid, c.label, c.active, c.entity FROM ".MAIN_DB_PREFIX
|
||||
$tabsql[36] = "SELECT r.rowid, r.fk_c_exp_tax_cat, r.range_ik, r.active, r.entity FROM ".MAIN_DB_PREFIX."c_exp_tax_range r";
|
||||
$tabsql[37] = "SELECT r.rowid, r.code, r.label, r.short_label, r.unit_type, r.scale, r.active FROM ".MAIN_DB_PREFIX."c_units r";
|
||||
$tabsql[38] = "SELECT rowid, entity, code, label, url, icon, active FROM ".MAIN_DB_PREFIX."c_socialnetworks";
|
||||
$tabsql[39] = "SELECT code, label as libelle, sortorder, active FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||
$tabsql[40] = "SELECT id as rowid, code, libelle, picto, active FROM ".MAIN_DB_PREFIX."c_stcommcontact";
|
||||
|
||||
// Criteria to sort dictionaries
|
||||
$tabsqlsort = array();
|
||||
@ -256,6 +263,8 @@ $tabsqlsort[35] = "c.label ASC";
|
||||
$tabsqlsort[36] = "r.fk_c_exp_tax_cat ASC, r.range_ik ASC";
|
||||
$tabsqlsort[37] = "r.unit_type ASC, r.scale ASC, r.code ASC";
|
||||
$tabsqlsort[38] = "rowid, code ASC";
|
||||
$tabsqlsort[39] = "sortorder ASC";
|
||||
$tabsqlsort[40] = "code ASC";
|
||||
|
||||
// Field names in select result for dictionary display
|
||||
$tabfield = array();
|
||||
@ -285,7 +294,7 @@ $tabfield[23] = "country_id,country,taux,revenuestamp_type,accountancy_code_sell
|
||||
$tabfield[24] = "code,label";
|
||||
$tabfield[25] = "code,label";
|
||||
//$tabfield[26]= "code,label,short_label";
|
||||
$tabfield[27] = "code,libelle";
|
||||
$tabfield[27] = "code,libelle,picto";
|
||||
$tabfield[28] = "code,label,affect,delay,newbymonth,country_id,country";
|
||||
$tabfield[29] = "code,label,percent,position";
|
||||
$tabfield[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
@ -297,6 +306,8 @@ $tabfield[35] = "label";
|
||||
$tabfield[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfield[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfield[38] = "code,label,url,icon,entity";
|
||||
$tabfield[39] = "code,libelle,sortorder";
|
||||
$tabfield[40] = "code,libelle,picto";
|
||||
|
||||
// Edit field names for editing a record
|
||||
$tabfieldvalue = array();
|
||||
@ -326,7 +337,7 @@ $tabfieldvalue[23] = "country,taux,revenuestamp_type,accountancy_code_sell,accou
|
||||
$tabfieldvalue[24] = "code,label";
|
||||
$tabfieldvalue[25] = "code,label";
|
||||
//$tabfieldvalue[26]= "code,label,short_label";
|
||||
$tabfieldvalue[27] = "code,libelle";
|
||||
$tabfieldvalue[27] = "code,libelle,picto";
|
||||
$tabfieldvalue[28] = "code,label,affect,delay,newbymonth,country";
|
||||
$tabfieldvalue[29] = "code,label,percent,position";
|
||||
$tabfieldvalue[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
@ -338,6 +349,8 @@ $tabfieldvalue[35] = "label";
|
||||
$tabfieldvalue[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldvalue[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfieldvalue[38] = "code,label,url,icon";
|
||||
$tabfieldvalue[39] = "code,libelle,sortorder";
|
||||
$tabfieldvalue[40] = "code,libelle,picto";
|
||||
|
||||
// Field names in the table for inserting a record
|
||||
$tabfieldinsert = array();
|
||||
@ -367,7 +380,7 @@ $tabfieldinsert[23] = "fk_pays,taux,revenuestamp_type,accountancy_code_sell,acco
|
||||
$tabfieldinsert[24] = "code,label";
|
||||
$tabfieldinsert[25] = "code,label";
|
||||
//$tabfieldinsert[26]= "code,label,short_label";
|
||||
$tabfieldinsert[27] = "code,libelle";
|
||||
$tabfieldinsert[27] = "code,libelle,picto";
|
||||
$tabfieldinsert[28] = "code,label,affect,delay,newbymonth,fk_country";
|
||||
$tabfieldinsert[29] = "code,label,percent,position";
|
||||
$tabfieldinsert[30] = "code,name,paper_size,orientation,metric,leftmargin,topmargin,nx,ny,spacex,spacey,width,height,font_size,custom_x,custom_y";
|
||||
@ -380,6 +393,8 @@ $tabfieldinsert[35] = "label";
|
||||
$tabfieldinsert[36] = "range_ik,fk_c_exp_tax_cat";
|
||||
$tabfieldinsert[37] = "code,label,short_label,unit_type,scale";
|
||||
$tabfieldinsert[38] = "code,label,url,icon,entity";
|
||||
$tabfieldinsert[39] = "code,label,sortorder";
|
||||
$tabfieldinsert[40] = "code,libelle,picto";
|
||||
|
||||
// Rowid name of field depending if field is autoincrement on or off..
|
||||
// Use "" if id field is "rowid" and has autoincrement on
|
||||
@ -423,6 +438,8 @@ $tabrowid[35] = "";
|
||||
$tabrowid[36] = "";
|
||||
$tabrowid[37] = "";
|
||||
$tabrowid[38] = "";
|
||||
$tabrowid[39] = "code";
|
||||
$tabrowid[40] = "id";
|
||||
|
||||
// Condition to show dictionary in setup page
|
||||
$tabcond = array();
|
||||
@ -464,6 +481,8 @@ $tabcond[35] = !empty($conf->expensereport->enabled);
|
||||
$tabcond[36] = !empty($conf->expensereport->enabled);
|
||||
$tabcond[37] = !empty($conf->product->enabled);
|
||||
$tabcond[38] = !empty($conf->socialnetworks->enabled);
|
||||
$tabcond[39] = (! empty($conf->societe->enabled) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS));
|
||||
$tabcond[40] = ! empty($conf->societe->enabled);
|
||||
|
||||
// List of help for fields
|
||||
$tabhelp = array();
|
||||
@ -493,7 +512,7 @@ $tabhelp[23] = array('revenuestamp_type'=>'FixedOrPercent');
|
||||
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[25] = array('code'=>$langs->trans('EnterAnyCode'));
|
||||
//$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"),'picto'=>$langs->trans("PictoHelp"));
|
||||
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"), 'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
|
||||
$tabhelp[29] = array('code'=>$langs->trans("EnterAnyCode"), 'percent'=>$langs->trans("OpportunityPercent"), 'position'=>$langs->trans("PositionIntoComboList"));
|
||||
$tabhelp[30] = array('code'=>$langs->trans("EnterAnyCode"), 'name'=>$langs->trans("LabelName"), 'paper_size'=>$langs->trans("LabelPaperSize"));
|
||||
@ -505,6 +524,8 @@ $tabhelp[35] = array();
|
||||
$tabhelp[36] = array('range_ik'=>$langs->trans('PrevRangeToThisRange'));
|
||||
$tabhelp[37] = array('code'=>$langs->trans("EnterAnyCode"), 'unit_type' => $langs->trans('MeasuringUnitTypeDesc'), 'scale' => $langs->trans('MeasuringScaleDesc'));
|
||||
$tabhelp[38] = array('code'=>$langs->trans("EnterAnyCode"), 'url' => $langs->trans('UrlSocialNetworksDesc'), 'icon' => $langs->trans('FafaIconSocialNetworksDesc'));
|
||||
$tabhelp[39] = array('code'=>$langs->trans("EnterAnyCode"));
|
||||
$tabhelp[40] = array('code'=>$langs->trans("EnterAnyCode"),'picto'=>$langs->trans("PictoHelp"));
|
||||
|
||||
// List of check for fields (NOT USED YET)
|
||||
$tabfieldcheck = array();
|
||||
@ -546,6 +567,8 @@ $tabfieldcheck[35] = array();
|
||||
$tabfieldcheck[36] = array();
|
||||
$tabfieldcheck[37] = array();
|
||||
$tabfieldcheck[38] = array();
|
||||
$tabfieldcheck[39] = array();
|
||||
$tabfieldcheck[40] = array();
|
||||
|
||||
// Complete all arrays with entries found into modules
|
||||
complete_dictionary_with_modules($taborder, $tabname, $tablib, $tabsql, $tabsqlsort, $tabfield, $tabfieldvalue, $tabfieldinsert, $tabrowid, $tabcond, $tabhelp, $tabfieldcheck);
|
||||
@ -647,7 +670,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify'))
|
||||
if ($value == 'dayrule' && empty($_POST['dayrule'])) continue;
|
||||
if ($value == 'sortorder') continue; // For a column name 'sortorder', we use the field name 'position'
|
||||
if ((!isset($_POST[$value]) || $_POST[$value] == '')
|
||||
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking')) // Fields that are not mandatory
|
||||
&& (!in_array($listfield[$f], array('decalage', 'module', 'accountancy_code', 'accountancy_code_sell', 'accountancy_code_buy', 'tracking', 'picto')) // Fields that are not mandatory
|
||||
&& (!($id == 10 && $listfield[$f] == 'code')) // Code is mandatory fir table 10
|
||||
)
|
||||
) {
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
* Copyright (C) 2013 Alexandre Spangaro <aspangaro@open-dsi.fr>
|
||||
* Copyright (C) 2015-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -557,10 +558,10 @@ if ($object->id > 0)
|
||||
print '<div class="floatright">';
|
||||
foreach ($object->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$titlealt = 'default';
|
||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?socid='.$object->id.'&stcomm='.$val['code'].'&action=setstcomm">'.img_action($titlealt, $val['code']).'</a>';
|
||||
}
|
||||
$titlealt = 'default';
|
||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?socid=' . $object->id . '&stcomm=' . $val['code'] . '&action=setstcomm">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
|
||||
}
|
||||
print '</div></td></tr>';
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -71,7 +72,7 @@ if (!empty($conf->propal->enabled))
|
||||
*
|
||||
*/
|
||||
|
||||
$sql = "SELECT count(*) as cc, st.libelle, st.id";
|
||||
$sql = "SELECT count(*) as cc, st.libelle, st.picto, st.id";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st ";
|
||||
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@ -98,7 +99,7 @@ if ($resql)
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print '<a href="prospects.php?page=0&stcomm='.$obj->id.'">';
|
||||
print img_action($langs->trans("Show"), $obj->id).' ';
|
||||
print img_action($langs->trans("Show"), $obj->id, $obj->picto).' ';
|
||||
print $langs->trans("StatusProspect".$obj->id);
|
||||
print '</a></td><td class="right">'.$obj->cc.'</td></tr>';
|
||||
$i++;
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018-2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -458,6 +459,23 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'setprospectcontactlevel' && $user->rights->societe->contact->creer)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel = GETPOST('prospect_contact_level_id', 'alpha');
|
||||
$result = $object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// set communication status
|
||||
if ($action == 'setstcomm')
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact');
|
||||
$result = $object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$triggersendname = 'CONTACT_SENTBYMAIL';
|
||||
$paramname = 'id';
|
||||
@ -1334,6 +1352,48 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
|
||||
print '</table>';
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
if ($object->thirdparty->client == 2 || $object->thirdparty->client == 3)
|
||||
{
|
||||
print '<br>';
|
||||
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Level of prospect
|
||||
print '<tr><td class="titlefield nowrap">';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
|
||||
print $langs->trans('ProspectLevel');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->contact->creer) print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editlevel&id=' . $object->id . '">' . img_edit($langs->trans('Modify'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editlevel')
|
||||
{
|
||||
$formcompany->formProspectContactLevel($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_prospectlevel, 'prospect_contact_level_id', 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $object->getLibProspLevel();
|
||||
}
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Status
|
||||
$object->loadCacheOfProspStatus();
|
||||
print '<tr><td>' . $langs->trans("StatusProsp") . '</td><td>' . $object->getLibProspCommStatut(4, $object->cacheprospectstatus[$object->stcomm_id]['label']);
|
||||
print ' ';
|
||||
print '<div class="floatright">';
|
||||
foreach ($object->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$titlealt = 'default';
|
||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||
if ($object->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&stcomm=' . $val['code'] . '&action=setstcomm">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
|
||||
}
|
||||
print '</div></td></tr>';
|
||||
print "</table>";
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '<div class="fichehalfright"><div class="ficheaddleft">';
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -89,6 +90,8 @@ class Contact extends CommonObject
|
||||
'socialnetworks' =>array('type'=>'text', 'label'=>'SocialNetworks', 'enabled'=>1, 'visible'=>-1, 'position'=>115),
|
||||
'photo' =>array('type'=>'varchar(255)', 'label'=>'Photo', 'enabled'=>1, 'visible'=>-1, 'position'=>170),
|
||||
'priv' =>array('type'=>'smallint(6)', 'label'=>'Private', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>175),
|
||||
'fk_stcomm' =>array('type'=>'integer', 'label'=>'Fk stcommcontact', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>220),
|
||||
'fk_prospectlevel' =>array('type'=>'varchar(12)', 'label'=>'ProspectLevel', 'enabled'=>1, 'visible'=>-1, 'position'=>255),
|
||||
'no_email' =>array('type'=>'smallint(6)', 'label'=>'No email', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>180),
|
||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'position'=>185),
|
||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>190),
|
||||
@ -209,6 +212,11 @@ class Contact extends CommonObject
|
||||
|
||||
public $roles = array();
|
||||
|
||||
public $cacheprospectstatus = array();
|
||||
public $fk_prospectlevel;
|
||||
public $stcomm_id;
|
||||
public $statut_commercial;
|
||||
public $stcomm_picto;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -328,6 +336,7 @@ class Contact extends CommonObject
|
||||
$sql .= ", firstname";
|
||||
$sql .= ", fk_user_creat";
|
||||
$sql .= ", priv";
|
||||
$sql.= ", fk_stcommcontact";
|
||||
$sql .= ", statut";
|
||||
$sql .= ", canvas";
|
||||
$sql .= ", entity";
|
||||
@ -341,6 +350,7 @@ class Contact extends CommonObject
|
||||
$sql .= "'".$this->db->escape($this->firstname)."',";
|
||||
$sql .= " ".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "null").",";
|
||||
$sql .= " ".$this->db->escape($this->priv).",";
|
||||
$sql.= " 0,";
|
||||
$sql .= " ".$this->db->escape($this->statut).",";
|
||||
$sql .= " ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null").",";
|
||||
$sql .= " ".$this->db->escape($this->entity).",";
|
||||
@ -465,6 +475,11 @@ 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)."'";
|
||||
if (isset($this->stcomm_id))
|
||||
{
|
||||
$sql .= ", fk_stcommcontact = ".($this->stcomm_id > 0 || $this->stcomm_id == -1 ? $this->stcomm_id : "0");
|
||||
}
|
||||
$sql .= ", statut = ".$this->db->escape($this->statut);
|
||||
$sql .= ", fk_user_modif=".($user->id > 0 ? "'".$this->db->escape($user->id)."'" : "NULL");
|
||||
$sql .= ", default_lang=".($this->default_lang ? "'".$this->db->escape($this->default_lang)."'" : "NULL");
|
||||
@ -818,6 +833,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.import_key,";
|
||||
$sql .= " c.datec as date_creation, c.tms as date_modification,";
|
||||
$sql .= " co.label as country, co.code as country_code,";
|
||||
@ -829,6 +845,7 @@ class Contact extends CommonObject
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d ON c.fk_departement = d.rowid";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_stcommcontact as st ON c.fk_stcommcontact = st.id';
|
||||
if ($id) $sql .= " WHERE c.rowid = ".$id;
|
||||
else {
|
||||
$sql .= " WHERE c.entity IN (".getEntity($this->element).")";
|
||||
@ -884,6 +901,14 @@ class Contact extends CommonObject
|
||||
$this->poste = $obj->poste;
|
||||
$this->statut = $obj->statut;
|
||||
|
||||
$this->fk_prospectlevel = $obj->fk_prospectcontactlevel;
|
||||
|
||||
$transcode=$langs->trans('StatusProspect'.$obj->fk_stcommcontact);
|
||||
$libelle=($transcode!='StatusProspect'.$obj->fk_stcommcontact?$transcode:$obj->stcomm);
|
||||
$this->stcomm_id = $obj->fk_stcommcontact; // id statut commercial
|
||||
$this->statut_commercial = $libelle; // libelle statut commercial
|
||||
$this->stcomm_picto = $obj->stcomm_picto; // Picto statut commercial
|
||||
|
||||
$this->phone_pro = trim($obj->phone);
|
||||
$this->fax = trim($obj->fax);
|
||||
$this->phone_perso = trim($obj->phone_perso);
|
||||
@ -1701,4 +1726,140 @@ class Contact extends CommonObject
|
||||
return $error * -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load array of prospect status
|
||||
*
|
||||
* @param int $active 1=Active only, 0=Not active only, -1=All
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function loadCacheOfProspStatus($active = 1)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT id, code, libelle as label, picto FROM " . MAIN_DB_PREFIX . "c_stcommcontact";
|
||||
if ($active >= 0) $sql .= " WHERE active = " . $active;
|
||||
$resql = $this->db->query($sql);
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->cacheprospectstatus[$obj->id] = array('id' => $obj->id, 'code' => $obj->code, 'label' => ($langs->trans("ST_" . strtoupper($obj->code)) == "ST_" . strtoupper($obj->code)) ? $obj->label : $langs->trans("ST_" . strtoupper($obj->code)), 'picto' => $obj->picto);
|
||||
$i++;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prostect level
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
public function getLibProspLevel()
|
||||
{
|
||||
return $this->libProspLevel($this->fk_prospectlevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of prospect level
|
||||
*
|
||||
* @param int $fk_prospectlevel Prospect level
|
||||
* @return string label of level
|
||||
*/
|
||||
public function libProspLevel($fk_prospectlevel)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$lib = $langs->trans("ProspectLevel" . $fk_prospectlevel);
|
||||
// If lib not found in language file, we get label from cache/databse
|
||||
if ($lib == $langs->trans("ProspectLevel" . $fk_prospectlevel))
|
||||
{
|
||||
$lib = $langs->getLabelFromKey($this->db, $fk_prospectlevel, 'c_prospectlevel', 'code', 'label');
|
||||
}
|
||||
return $lib;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set prospect level
|
||||
*
|
||||
* @param User $user Utilisateur qui definie la remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
public function setProspectLevel(User $user)
|
||||
{
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status of prospect
|
||||
*
|
||||
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long
|
||||
* @param string $label Label to use for status for added status
|
||||
* @return string Libelle
|
||||
*/
|
||||
public function getLibProspCommStatut($mode = 0, $label = '')
|
||||
{
|
||||
return $this->libProspCommStatut($this->stcomm_id, $mode, $label, $this->stcomm_picto);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of a given status
|
||||
*
|
||||
* @param int|string $statut Id or code for prospection status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @param string $label Label to use for status for added status
|
||||
* @param string $picto Name of image file to show ('filenew', ...)
|
||||
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
|
||||
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
||||
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
|
||||
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
|
||||
* @return string Libelle du statut
|
||||
*/
|
||||
public function libProspCommStatut($statut, $mode = 0, $label = '', $picto = '')
|
||||
{
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto) . ' ' . $langs->trans("StatusProspect-1");
|
||||
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto) . ' ' . $langs->trans("StatusProspect0");
|
||||
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto) . ' ' . $langs->trans("StatusProspect1");
|
||||
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto) . ' ' . $langs->trans("StatusProspect2");
|
||||
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto) . ' ' . $langs->trans("StatusProspect3");
|
||||
else
|
||||
{
|
||||
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto) . ' ' . (($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label);
|
||||
}
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto);
|
||||
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto);
|
||||
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto);
|
||||
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto);
|
||||
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto);
|
||||
else
|
||||
{
|
||||
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto);
|
||||
}
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($statut == '-1' || $statut == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto) . ' ' . $langs->trans("StatusProspect-1");
|
||||
elseif ($statut == '0' || $statut == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto) . ' ' . $langs->trans("StatusProspect0");
|
||||
elseif ($statut == '1' || $statut == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto) . ' ' . $langs->trans("StatusProspect1");
|
||||
elseif ($statut == '2' || $statut == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto) . ' ' . $langs->trans("StatusProspect2");
|
||||
elseif ($statut == '3' || $statut == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto) . ' ' . $langs->trans("StatusProspect3");
|
||||
else
|
||||
{
|
||||
return img_action(($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label, 0, $picto) . ' ' . (($langs->trans("StatusProspect" . $statut) != "StatusProspect" . $statut) ? $langs->trans("StatusProspect" . $statut) : $label);
|
||||
}
|
||||
}
|
||||
|
||||
return "Error, mode/status not found";
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
* Copyright (C) 2018 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -91,6 +92,8 @@ $search_town = GETPOST('search_town', 'alpha');
|
||||
$search_import_key = GETPOST("search_import_key", "alpha");
|
||||
$search_country = GETPOST("search_country", 'intcomma');
|
||||
$search_roles = GETPOST("search_roles", 'array');
|
||||
$search_level = GETPOST("search_level", "array");
|
||||
$search_stcomm = GETPOST('search_stcomm', 'int');
|
||||
|
||||
if ($search_status == '') $search_status = 1; // always display active customer first
|
||||
|
||||
@ -176,6 +179,8 @@ $arrayfields = array(
|
||||
'p.no_email'=>array('label'=>"No_Email", 'position'=>41, 'checked'=>0, 'enabled'=>(!empty($conf->mailing->enabled))),
|
||||
'p.thirdparty'=>array('label'=>"ThirdParty", 'position'=>50, 'checked'=>1, 'enabled'=>empty($conf->global->SOCIETE_DISABLE_CONTACTS)),
|
||||
'p.priv'=>array('label'=>"ContactVisibility", 'checked'=>1, 'position'=>200),
|
||||
'p.fk_prospectcontactlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>1),
|
||||
'p.fk_stcommcontact'=>array('label'=>"StatusProsp", 'checked'=>1),
|
||||
'p.datec'=>array('label'=>"DateCreationShort", 'checked'=>0, 'position'=>500),
|
||||
'p.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500),
|
||||
'p.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000),
|
||||
@ -256,6 +261,8 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
$search_priv = "";
|
||||
$search_stcomm='';
|
||||
$search_level='';
|
||||
$search_status = -1;
|
||||
$search_categ = '';
|
||||
$search_categ_thirdparty = '';
|
||||
@ -273,6 +280,17 @@ if (empty($reshook))
|
||||
$permissiontodelete = $user->rights->societe->supprimer;
|
||||
$uploaddir = $conf->societe->dir_output;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||
|
||||
if ($action == 'setstcomm')
|
||||
{
|
||||
$object = new Contact($db);
|
||||
$result = $object->fetch(GETPOST('stcommcontactid'));
|
||||
$object->stcomm_id = dol_getIdFromCode($db, GETPOST('stcomm', 'alpha'), 'c_stcommcontact');
|
||||
$result = $object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
||||
$action = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ($search_priv < 0) $search_priv = '';
|
||||
@ -286,13 +304,35 @@ $form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formcompany = new FormCompany($db);
|
||||
$contactstatic = new Contact($db);
|
||||
$contactstatic->thirdparty->client=2;
|
||||
$contactstatic->loadCacheOfProspStatus();
|
||||
|
||||
$title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("Contacts") : $langs->trans("ContactsAddresses"));
|
||||
|
||||
// Select every potentiels, and note each potentiels which fit in search parameters
|
||||
$tab_level = array();
|
||||
$sql = "SELECT code, label, sortorder";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectcontactlevel";
|
||||
$sql.= " WHERE active > 0";
|
||||
$sql.= " ORDER BY sortorder";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
while ($obj = $db->fetch_object($resql))
|
||||
{
|
||||
// Compute level text
|
||||
$level=$langs->trans($obj->code);
|
||||
if ($level == $obj->code) $level=$langs->trans($obj->label);
|
||||
$tab_level[$obj->code] = $level;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
|
||||
$sql = "SELECT s.rowid as socid, s.nom as name,";
|
||||
$sql .= " p.rowid, p.lastname as lastname, p.statut, p.firstname, p.zip, p.town, p.poste, p.email, p.no_email,";
|
||||
$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.= " st.libelle as stcomm, st.picto as stcomm_picto, p.fk_stcommcontact as stcomm_id, p.fk_prospectcontactlevel,";
|
||||
$sql .= " co.label as country, co.code as country_code";
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
@ -306,6 +346,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p";
|
||||
if (is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (p.rowid = ef.fk_object)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = p.fk_pays";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_stcommcontact as st ON st.id = p.fk_stcommcontact";
|
||||
if (!empty($search_categ)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_contact as cc ON p.rowid = cc.fk_socpeople"; // We need this table joined to the select in order to filter by categ
|
||||
if (!empty($search_categ_thirdparty)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||
if (!empty($search_categ_supplier)) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs2 ON s.rowid = cs2.fk_soc"; // We need this table joined to the select in order to filter by categ
|
||||
@ -319,6 +360,8 @@ if (!empty($userid)) // propre au commercial
|
||||
{
|
||||
$sql .= " AND p.fk_user_creat=".$db->escape($userid);
|
||||
}
|
||||
if ($search_level) $sql .= natural_search("p.fk_prospectcontactlevel", join(',', $search_level), 3);
|
||||
if ($search_stcomm != '' && $search_stcomm != -2) $sql .= natural_search("p.fk_stcommcontact", $search_stcomm, 2);
|
||||
|
||||
// Filter to exclude not owned private contacts
|
||||
if ($search_priv != '0' && $search_priv != '1')
|
||||
@ -461,6 +504,8 @@ if ($search_email != '') $param .= '&search_email='.urlencode($search_email)
|
||||
if ($search_no_email != '') $param .= '&search_no_email='.urlencode($search_no_email);
|
||||
if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
|
||||
if ($search_priv == '0' || $search_priv == '1') $param .= "&search_priv=".urlencode($search_priv);
|
||||
if ($search_stcomm != '') $param.='&search_stcomm='.$search_stcomm;
|
||||
if (is_array($search_level) && count($search_level)) foreach($search_level as $slevel) $param.='&search_level[]='.urlencode($slevel);
|
||||
if ($search_import_key != '') $param .= '&search_import_key='.urlencode($search_import_key);
|
||||
if ($optioncss != '') $param .= '&optioncss='.$optioncss;
|
||||
if (count($search_roles) > 0) $param .= implode('&search_roles[]=', $search_roles);
|
||||
@ -678,6 +723,25 @@ if (!empty($arrayfields['p.priv']['checked']))
|
||||
print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
|
||||
print '</td>';
|
||||
}
|
||||
// Prospect level
|
||||
if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre center">';
|
||||
print $form->multiselectarray('search_level', $tab_level, $search_level, 0, 0, 'width75', 0, 0, '', '', '', 2);
|
||||
print '</td>';
|
||||
}
|
||||
// Prospect status
|
||||
if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre maxwidthonsmartphone center">';
|
||||
$arraystcomm=array();
|
||||
foreach($prospectstatic->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']);
|
||||
}
|
||||
print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2, 0, 0, '', 0, 0, 0, '', 'nowrap ');
|
||||
print '</td>';
|
||||
}
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
|
||||
|
||||
@ -746,6 +810,8 @@ if (!empty($conf->socialnetworks->enabled)) {
|
||||
}
|
||||
if (!empty($arrayfields['p.thirdparty']['checked'])) print_liste_field_titre($arrayfields['p.thirdparty']['label'], $_SERVER["PHP_SELF"], "s.nom", $begin, $param, '', $sortfield, $sortorder);
|
||||
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_stcommcontact']['checked'])) print_liste_field_titre($arrayfields['p.fk_stcommcontact']['label'], $_SERVER["PHP_SELF"], "p.fk_stcommcontact", "", $param, '', $sortfield, $sortorder, 'center ');
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
|
||||
// Hook fields
|
||||
@ -796,6 +862,8 @@ while ($i < min($num, $limit))
|
||||
$contactstatic->country_code = $obj->country_code;
|
||||
$contactstatic->photo = $obj->photo;
|
||||
|
||||
$contactstatic->fk_prospectlevel=$obj->fk_prospectcontactlevel;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
|
||||
// ID
|
||||
@ -924,6 +992,30 @@ while ($i < min($num, $limit))
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['p.fk_prospectcontactlevel']['checked']))
|
||||
{
|
||||
// Prospect level
|
||||
print '<td class="center">';
|
||||
print $contactstatic->getLibProspLevel();
|
||||
print "</td>";
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
if (! empty($arrayfields['p.fk_stcommcontact']['checked']))
|
||||
{
|
||||
// Prospect status
|
||||
print '<td class="center nowrap"><div class="nowrap">';
|
||||
print '<div class="inline-block">' . $contactstatic->libProspCommStatut($obj->stcomm_id, 2, $contactstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
|
||||
print '</div> - <div class="inline-block">';
|
||||
foreach ($contactstatic->cacheprospectstatus as $key => $val) {
|
||||
$titlealt = 'default';
|
||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?stcommcontactid=' . $obj->rowid . '&stcomm=' . $val['code'] . '&action=setstcomm' . $param . ($page ? '&page=' . urlencode($page) : '') . '">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
|
||||
}
|
||||
print '</div></div></td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
}
|
||||
|
||||
// Extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
|
||||
// Fields from hook
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -172,6 +173,58 @@ class FormCompany extends Form
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Affiche formulaire de selection des niveau de prospection pour les contacts
|
||||
*
|
||||
* @param int $page Page
|
||||
* @param int $selected Id or code preselected
|
||||
* @param string $htmlname Nom du formulaire select
|
||||
* @param int $empty Add empty value in list
|
||||
* @return void
|
||||
*/
|
||||
public function formProspectContactLevel($page, $selected = '', $htmlname = 'prospect_contact_level_id', $empty = 0)
|
||||
{
|
||||
global $user, $langs;
|
||||
|
||||
print '<form method="post" action="' . $page . '">';
|
||||
print '<input type="hidden" name="action" value="setprospectcontactlevel">';
|
||||
print '<input type="hidden" name="token" value="' . newToken() . '">';
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
$sql = "SELECT code, label";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_prospectcontactlevel";
|
||||
$sql .= " WHERE active > 0";
|
||||
$sql .= " ORDER BY sortorder";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$options = array();
|
||||
|
||||
if ($empty)
|
||||
{
|
||||
$options[''] = '';
|
||||
}
|
||||
|
||||
while ($obj = $this->db->fetch_object($resql))
|
||||
{
|
||||
$level = $langs->trans($obj->code);
|
||||
|
||||
if ($level == $obj->code)
|
||||
{
|
||||
$level = $langs->trans($obj->label);
|
||||
}
|
||||
|
||||
$options[$obj->code] = $level;
|
||||
}
|
||||
|
||||
print Form::selectarray($htmlname, $options, $selected);
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
if (!empty($htmlname) && $user->admin) print ' ' . info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
|
||||
print '<input type="submit" class="button valignmiddle" value="' . $langs->trans("Modify") . '">';
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
/**
|
||||
* Returns the drop-down list of departments/provinces/cantons for all countries or for a given country.
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2019 Thibault Foucart <support@ptibogxiv.net>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -3306,9 +3307,14 @@ function img_picto_common($titlealt, $picto, $moreatt = '', $pictoisfullpath = 0
|
||||
*
|
||||
* @param string $titlealt Text on alt and title of image. Alt only if param notitle is set to 1. If text is "TextA:TextB", use Text A on alt and Text B on title.
|
||||
* @param string $numaction Action id or code to show
|
||||
* @param string $picto Name of image file to show ('filenew', ...)
|
||||
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
|
||||
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
||||
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
|
||||
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
|
||||
* @return string Return an img tag
|
||||
*/
|
||||
function img_action($titlealt, $numaction)
|
||||
function img_action($titlealt, $numaction, $picto = '')
|
||||
{
|
||||
global $langs;
|
||||
|
||||
@ -3336,7 +3342,7 @@ function img_action($titlealt, $numaction)
|
||||
}
|
||||
if (!is_numeric($numaction)) $numaction = 0;
|
||||
|
||||
return img_picto($titlealt, 'stcomm'.$numaction.'.png');
|
||||
return img_picto($titlealt, !empty($picto) ? $picto : 'stcomm'.$numaction.'.png');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
31
htdocs/install/mysql/data/llx_c_prospectcontactlevel.sql
Normal file
31
htdocs/install/mysql/data/llx_c_prospectcontactlevel.sql
Normal file
@ -0,0 +1,31 @@
|
||||
-- Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
--
|
||||
|
||||
--
|
||||
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- de l'install et tous les sigles '--' sont supprimés.
|
||||
--
|
||||
|
||||
--
|
||||
-- Prospect level for contacts
|
||||
--
|
||||
|
||||
delete from llx_c_prospectcontactlevel;
|
||||
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_NONE', 'None', 1);
|
||||
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2);
|
||||
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3);
|
||||
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4);
|
||||
32
htdocs/install/mysql/data/llx_c_stcommcontact.sql
Normal file
32
htdocs/install/mysql/data/llx_c_stcommcontact.sql
Normal file
@ -0,0 +1,32 @@
|
||||
-- Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
--
|
||||
|
||||
--
|
||||
-- Ne pas placer de commentaire en fin de ligne, ce fichier est parsé lors
|
||||
-- de l'install et tous les sigles '--' sont supprimés.
|
||||
--
|
||||
|
||||
--
|
||||
-- Types action st for contacts
|
||||
--
|
||||
|
||||
delete from llx_c_stcommcontact;
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values (-1, 'ST_NO', 'Do not contact');
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values ( 0, 'ST_NEVER', 'Never contacted');
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values ( 1, 'ST_TODO', 'To contact');
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values ( 2, 'ST_PEND', 'Contact in progress');
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values ( 3, 'ST_DONE', 'Contacted');
|
||||
@ -305,6 +305,36 @@ ALTER TABLE llx_categorie ADD COLUMN fk_user_modif integer;
|
||||
|
||||
ALTER TABLE llx_commandedet ADD CONSTRAINT fk_commandedet_fk_commandefourndet FOREIGN KEY (fk_commandefourndet) REFERENCES llx_commande_fournisseurdet (rowid);
|
||||
|
||||
create table llx_c_prospectcontactlevel
|
||||
(
|
||||
code varchar(12) PRIMARY KEY,
|
||||
label varchar(30),
|
||||
sortorder smallint,
|
||||
active smallint DEFAULT 1 NOT NULL,
|
||||
module varchar(32) NULL
|
||||
) ENGINE=innodb;
|
||||
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_NONE', 'None', 1);
|
||||
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_LOW', 'Low', 2);
|
||||
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_MEDIUM', 'Medium', 3);
|
||||
insert into llx_c_prospectcontactlevel (code,label,sortorder) values ('PL_HIGH', 'High', 4);
|
||||
|
||||
create table llx_c_stcommcontact
|
||||
(
|
||||
id integer PRIMARY KEY,
|
||||
code varchar(12) NOT NULL,
|
||||
libelle varchar(30),
|
||||
picto varchar(128),
|
||||
active tinyint default 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
ALTER TABLE llx_c_stcommcontact ADD UNIQUE INDEX uk_c_stcommcontact(code);
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values (-1, 'ST_NO', 'Do not contact');
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values ( 0, 'ST_NEVER', 'Never contacted');
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values ( 1, 'ST_TODO', 'To contact');
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values ( 2, 'ST_PEND', 'Contact in progress');
|
||||
insert into llx_c_stcommcontact (id,code,libelle) values ( 3, 'ST_DONE', 'Contacted');
|
||||
|
||||
ALTER TABLE llx_socpeople ADD COLUMN fk_prospectcontactlevel varchar(12) AFTER priv;
|
||||
ALTER TABLE llx_socpeople ADD COLUMN fk_stcommcontact integer DEFAULT 0 NOT NULL AFTER fk_prospectcontactlevel;
|
||||
|
||||
-- VMYSQL4.3 ALTER TABLE llx_prelevement_facture_demande MODIFY COLUMN fk_facture INTEGER NULL;
|
||||
-- VPGSQL8.2 ALTER TABLE llx_prelevement_facture_demande ALTER COLUMN fk_facture DROP NOT NULL;
|
||||
|
||||
27
htdocs/install/mysql/tables/llx_c_prospectcontactlevel.sql
Normal file
27
htdocs/install/mysql/tables/llx_c_prospectcontactlevel.sql
Normal file
@ -0,0 +1,27 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_c_prospectcontactlevel
|
||||
(
|
||||
code varchar(12) PRIMARY KEY,
|
||||
label varchar(30),
|
||||
sortorder smallint,
|
||||
active smallint DEFAULT 1 NOT NULL,
|
||||
module varchar(32) NULL
|
||||
) ENGINE=innodb;
|
||||
|
||||
19
htdocs/install/mysql/tables/llx_c_stcommcontact.key.sql
Normal file
19
htdocs/install/mysql/tables/llx_c_stcommcontact.key.sql
Normal file
@ -0,0 +1,19 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
ALTER TABLE llx_c_stcommcontact ADD UNIQUE INDEX uk_c_stcommcontact(code);
|
||||
27
htdocs/install/mysql/tables/llx_c_stcommcontact.sql
Normal file
27
htdocs/install/mysql/tables/llx_c_stcommcontact.sql
Normal file
@ -0,0 +1,27 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- ========================================================================
|
||||
|
||||
create table llx_c_stcommcontact
|
||||
(
|
||||
id integer PRIMARY KEY,
|
||||
code varchar(12) NOT NULL,
|
||||
libelle varchar(30),
|
||||
picto varchar(128),
|
||||
active tinyint default 1 NOT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
-- Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2005-2010 Regis Houssin <regis.houssin@inodbox.com>
|
||||
-- Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
--
|
||||
-- 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
|
||||
@ -57,6 +58,8 @@ 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_stcommcontact integer DEFAULT 0 NOT NULL, -- commercial statut
|
||||
fk_user_creat integer DEFAULT 0, -- user qui a creel'enregistrement
|
||||
fk_user_modif integer,
|
||||
note_private text,
|
||||
|
||||
@ -950,7 +950,8 @@ Permission63003=Delete resources
|
||||
Permission63004=Link resources to agenda events
|
||||
DictionaryCompanyType=Third-party types
|
||||
DictionaryCompanyJuridicalType=Third-party legal entities
|
||||
DictionaryProspectLevel=Prospect potential
|
||||
DictionaryProspectLevel=Prospect potential level for companies
|
||||
DictionaryProspectContactLevel=Prospect potential level for contacts
|
||||
DictionaryCanton=States/Provinces
|
||||
DictionaryRegion=Regions
|
||||
DictionaryCountry=Countries
|
||||
@ -980,7 +981,8 @@ DictionaryEMailTemplates=Email Templates
|
||||
DictionaryUnits=Units
|
||||
DictionaryMeasuringUnits=Measuring Units
|
||||
DictionarySocialNetworks=Social Networks
|
||||
DictionaryProspectStatus=Prospect status
|
||||
DictionaryProspectStatus=Prospect status for companies
|
||||
DictionaryProspectContactStatus=Prospect status for contacts
|
||||
DictionaryHolidayTypes=Types of leave
|
||||
DictionaryOpportunityStatus=Lead status for project/lead
|
||||
DictionaryExpenseTaxCat=Expense report - Transportation categories
|
||||
@ -1821,6 +1823,7 @@ EnterAnyCode=This field contains a reference to identify line. Enter any value o
|
||||
Enter0or1=Enter 0 or 1
|
||||
UnicodeCurrency=Enter here between braces, list of byte number that represent the currency symbol. For example: for $, enter [36] - for brazil real R$ [82,36] - for €, enter [8364]
|
||||
ColorFormat=The RGB color is in HEX format, eg: FF0000
|
||||
PictoHelp=Icon name in dolibarr format ('image.png' if into the current theme directory, 'image.png@nom_du_module' if into the directory /img/ of a module)
|
||||
PositionIntoComboList=Position of line into combo lists
|
||||
SellTaxRate=Sale tax rate
|
||||
RecuperableOnly=Yes for VAT "Not Perceived but Recoverable" dedicated for some state in France. Keep value to "No" in all other cases.
|
||||
|
||||
@ -948,7 +948,8 @@ Permission63003=Supprimer les ressources
|
||||
Permission63004=Lier les ressources aux événements de l'agenda
|
||||
DictionaryCompanyType=Type de Tiers
|
||||
DictionaryCompanyJuridicalType=Formes juridiques des Tiers
|
||||
DictionaryProspectLevel=Niveau de potentiel des prospects
|
||||
DictionaryProspectLevel=Niveau de potentiel des prospects pour les tiers
|
||||
DictionaryProspectContactLevel=Niveau de potentiel des prospects pour les contacts
|
||||
DictionaryCanton=Etats/Province
|
||||
DictionaryRegion=Régions
|
||||
DictionaryCountry=Pays
|
||||
@ -978,7 +979,8 @@ DictionaryEMailTemplates=Modèles des courriels
|
||||
DictionaryUnits=Unités
|
||||
DictionaryMeasuringUnits=Unités de mesure
|
||||
DictionarySocialNetworks=Réseaux sociaux
|
||||
DictionaryProspectStatus=Statut prospect
|
||||
DictionaryProspectStatus=Statuts de prospection des tiers
|
||||
DictionaryProspectContactStatus=Statuts de prospection des contacts
|
||||
DictionaryHolidayTypes=Type de congés
|
||||
DictionaryOpportunityStatus=Statut d'opportunités pour les affaires/projets
|
||||
DictionaryExpenseTaxCat=Note de frais - catégories de déplacement
|
||||
@ -1819,6 +1821,7 @@ EnterAnyCode=Ce champ contient une référence pour identifier le champ. Entrez
|
||||
Enter0or1=Saisir 0 ou 1
|
||||
UnicodeCurrency=Saisissez ici entre accolades, la liste du numéro des octets qui représentent le symbole de la monnaie. Pour exemple: pour $, entrez [36] - pour le Real Brésilien R$ [82,36] - pour l'euro €, entrez [8364]
|
||||
ColorFormat=La couleur RVB au format HEX est, par exemple: FF0000
|
||||
PictoHelp=Nom de l'icone au format dolibarr ('image.png' si mise dans le répertoire du thème actuel, 'image.png@nom_du_module' si mise dans le repertoire /img/ d'un module)
|
||||
PositionIntoComboList=Position de la ligne dans des listes déroulantes
|
||||
SellTaxRate=Taux de TVA
|
||||
RecuperableOnly=Oui pour une TVA "Non Perçue mais Récupérable" dédiée à certains pays comme la France. Gardez la valeur à "Non" dans tous les autres cas.
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -100,14 +101,14 @@ class Client extends Societe
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT id, code, libelle as label FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
$sql="SELECT id, code, libelle as label, picto FROM ".MAIN_DB_PREFIX."c_stcomm";
|
||||
if ($active >= 0) $sql .= " WHERE active = ".$active;
|
||||
$resql = $this->db->query($sql);
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
while ($i < $num) {
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$this->cacheprospectstatus[$obj->id] = array('id'=>$obj->id, 'code'=>$obj->code, 'label'=> ($langs->trans("ST_".strtoupper($obj->code)) == "ST_".strtoupper($obj->code)) ? $obj->label : $langs->trans("ST_".strtoupper($obj->code)));
|
||||
$this->cacheprospectstatus[$obj->id] = array('id'=>$obj->id, 'code'=>$obj->code, 'label'=>($langs->trans("ST_".strtoupper($obj->code))=="ST_".strtoupper($obj->code))?$obj->label:$langs->trans("ST_".strtoupper($obj->code)), 'picto'=>$obj->picto);
|
||||
$i++;
|
||||
}
|
||||
return 1;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
* Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2019-2020 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
*
|
||||
* 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
|
||||
@ -572,6 +573,12 @@ class Societe extends CommonObject
|
||||
*/
|
||||
public $stcomm_id;
|
||||
|
||||
/**
|
||||
* Status prospect picto
|
||||
* @var string
|
||||
*/
|
||||
public $stcomm_picto;
|
||||
|
||||
/**
|
||||
* Status prospect label
|
||||
* @var int
|
||||
@ -1489,7 +1496,7 @@ class Societe extends CommonObject
|
||||
$sql .= ', e.libelle as effectif';
|
||||
$sql .= ', c.code as country_code, c.label as country';
|
||||
$sql .= ', d.code_departement as state_code, d.nom as state';
|
||||
$sql .= ', st.libelle as stcomm';
|
||||
$sql .= ', st.libelle as stcomm, st.picto as stcomm_picto';
|
||||
$sql .= ', te.code as typent_code';
|
||||
$sql .= ', i.libelle as label_incoterms';
|
||||
$sql .= ', sr.remise_client, model_pdf';
|
||||
@ -1562,6 +1569,7 @@ class Societe extends CommonObject
|
||||
$label = ($transcode != 'StatusProspect'.$obj->fk_stcomm ? $transcode : $obj->stcomm);
|
||||
$this->stcomm_id = $obj->fk_stcomm; // id status prospect
|
||||
$this->status_prospect_label = $label; // label status prospect
|
||||
$this->stcomm_picto = $obj->stcomm_picto; // picto statut commercial
|
||||
|
||||
$this->email = $obj->email;
|
||||
$this->socialnetworks = (array) json_decode($obj->socialnetworks, true);
|
||||
@ -3891,7 +3899,7 @@ class Societe extends CommonObject
|
||||
*/
|
||||
public function getLibProspCommStatut($mode = 0, $label = '')
|
||||
{
|
||||
return $this->LibProspCommStatut($this->stcomm_id, $mode, $label);
|
||||
return $this->LibProspCommStatut($this->stcomm_id, $mode, $label, $this->stcomm_picto);
|
||||
}
|
||||
|
||||
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
|
||||
@ -3901,45 +3909,45 @@ class Societe extends CommonObject
|
||||
* @param int|string $status Id or code for prospection status
|
||||
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto
|
||||
* @param string $label Label to use for status for added status
|
||||
* @param string $picto Name of image file to show ('filenew', ...)
|
||||
* If no extension provided, we use '.png'. Image must be stored into theme/xxx/img directory.
|
||||
* Example: picto.png if picto.png is stored into htdocs/theme/mytheme/img
|
||||
* Example: picto.png@mymodule if picto.png is stored into htdocs/mymodule/img
|
||||
* Example: /mydir/mysubdir/picto.png if picto.png is stored into htdocs/mydir/mysubdir (pictoisfullpath must be set to 1)
|
||||
* @return string Label of prospection status
|
||||
*/
|
||||
public function LibProspCommStatut($status, $mode = 0, $label = '')
|
||||
public function LibProspCommStatut($status, $mode = 0, $label = '', $picto = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
$langs->load('customers');
|
||||
|
||||
if ($mode == 2)
|
||||
{
|
||||
if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1).' '.$langs->trans("StatusProspect-1");
|
||||
elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
|
||||
elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
|
||||
elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
|
||||
elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
|
||||
if ($mode == 2) {
|
||||
if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto).' '.$langs->trans("StatusProspect-1");
|
||||
elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto).' '.$langs->trans("StatusProspect0");
|
||||
elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto).' '.$langs->trans("StatusProspect1");
|
||||
elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto).' '.$langs->trans("StatusProspect2");
|
||||
elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto).' '.$langs->trans("StatusProspect3");
|
||||
else {
|
||||
return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0).' '.(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label);
|
||||
return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0, $picto).' '.(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label);
|
||||
}
|
||||
}
|
||||
if ($mode == 3)
|
||||
{
|
||||
if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1);
|
||||
elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0);
|
||||
elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1);
|
||||
elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2);
|
||||
elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3);
|
||||
} elseif ($mode == 3) {
|
||||
if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto);
|
||||
elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto);
|
||||
elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto);
|
||||
elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto);
|
||||
elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto);
|
||||
else {
|
||||
return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0);
|
||||
return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0, $picto);
|
||||
}
|
||||
}
|
||||
if ($mode == 4)
|
||||
{
|
||||
if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1).' '.$langs->trans("StatusProspect-1");
|
||||
elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0");
|
||||
elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1");
|
||||
elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2");
|
||||
elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3");
|
||||
} elseif ($mode == 4) {
|
||||
if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1, $picto).' '.$langs->trans("StatusProspect-1");
|
||||
elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0, $picto).' '.$langs->trans("StatusProspect0");
|
||||
elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1, $picto).' '.$langs->trans("StatusProspect1");
|
||||
elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2, $picto).' '.$langs->trans("StatusProspect2");
|
||||
elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3, $picto).' '.$langs->trans("StatusProspect3");
|
||||
else {
|
||||
return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0).' '.(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label);
|
||||
return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0, $picto).' '.(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
|
||||
* Copyright (C) 2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2020 Open-Dsi <support@open-dsi.fr>
|
||||
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -392,7 +393,7 @@ if ($resql)
|
||||
|
||||
$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,";
|
||||
$sql .= " s.entity,";
|
||||
$sql .= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
|
||||
$sql .= " st.libelle as stcomm, st.picto as stcomm_picto, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,";
|
||||
$sql .= " s.email, s.phone, s.fax, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,";
|
||||
$sql .= " s.tms as date_update, s.datec as date_creation,";
|
||||
$sql .= " s.code_compta, s.code_compta_fournisseur, s.parent as fk_parent,";
|
||||
@ -1241,13 +1242,13 @@ while ($i < min($num, $limit))
|
||||
{
|
||||
// Prospect status
|
||||
print '<td class="center nowrap"><div class="nowrap">';
|
||||
print '<div class="inline-block">'.$companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']);
|
||||
print '<div class="inline-block">' . $companystatic->LibProspCommStatut($obj->stcomm_id, 2, $prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label'], $obj->stcomm_picto);
|
||||
print '</div> - <div class="inline-block">';
|
||||
foreach ($prospectstatic->cacheprospectstatus as $key => $val)
|
||||
{
|
||||
$titlealt = 'default';
|
||||
if (!empty($val['code']) && !in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt = $val['label'];
|
||||
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="'.$_SERVER["PHP_SELF"].'?stcommsocid='.$obj->rowid.'&stcomm='.$val['code'].'&action=setstcomm'.$param.($page ? '&page='.urlencode($page) : '').'">'.img_action($titlealt, $val['code']).'</a>';
|
||||
if ($obj->stcomm_id != $val['id']) print '<a class="pictosubstatus" href="' . $_SERVER["PHP_SELF"] . '?stcommsocid=' . $obj->rowid . '&stcomm=' . $val['code'] . '&action=setstcomm' . $param . ($page ? '&page=' . urlencode($page) : '') . '">' . img_action($titlealt, $val['code'], $val['picto']) . '</a>';
|
||||
}
|
||||
print '</div></div></td>';
|
||||
if (!$i) $totalarray['nbfield']++;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user