Commit temporaire
This commit is contained in:
parent
82dda5723b
commit
6ad617842d
@ -27,10 +27,15 @@
|
||||
* \brief Page to show customer card of a third party
|
||||
*/
|
||||
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', true);
|
||||
ini_set('html_errors', false);
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
if (! empty($conf->facture->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
@ -109,6 +114,15 @@ if ($action == 'setassujtva' && $user->rights->societe->creer)
|
||||
if (! $result) dol_print_error($result);
|
||||
}
|
||||
|
||||
// set prospect level
|
||||
if ($action == 'setprospectlevel' && $user->rights->societe->creer)
|
||||
{
|
||||
$object->fetch($socid);
|
||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','int');
|
||||
$object->set_prospect_level($user);
|
||||
if ($result < 0) setEventMessage($object->error,'errors');
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -121,6 +135,7 @@ llxHeader('',$langs->trans('CustomerCard'));
|
||||
$contactstatic = new Contact($db);
|
||||
$userstatic=new User($db);
|
||||
$form = new Form($db);
|
||||
$formcompany=new FormCompany($db);
|
||||
|
||||
|
||||
if ($mode == 'search')
|
||||
@ -359,6 +374,21 @@ if ($id > 0)
|
||||
print '</td><td colspan="3">'.$object->price_level."</td>";
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Level of prospect
|
||||
print '<tr><td nowrap>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td nowrap>';
|
||||
print $langs->trans('ProspectLevelShort');
|
||||
print '<td>';
|
||||
if ($action != 'editlevel' && $user->rights->societe->creer) print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editlevel&socid='.$object->id.'">'.img_edit($langs->trans('Modify'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td colspan="3">';
|
||||
if ($action == 'editlevel')
|
||||
$formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id,$object->fk_prospectlevel,'prospect_level_id',1);
|
||||
else
|
||||
print $object->getLibProspLevel();
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
|
||||
// Sales representative
|
||||
include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
|
||||
|
||||
@ -148,9 +148,9 @@ class Prospect extends Societe
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibLevel()
|
||||
function getLibProspLevel()
|
||||
{
|
||||
return $this->LibLevel($this->fk_prospectlevel);
|
||||
return $this->LibProspLevel($this->fk_prospectlevel);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +159,7 @@ class Prospect extends Societe
|
||||
* @param int $fk_prospectlevel Prospect level
|
||||
* @return string Libelle du niveau
|
||||
*/
|
||||
function LibLevel($fk_prospectlevel)
|
||||
function LibProspLevel($fk_prospectlevel)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
|
||||
@ -2655,6 +2655,73 @@ class Societe extends CommonObject
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return prostect level
|
||||
*
|
||||
* @return string Libelle
|
||||
*/
|
||||
function getLibProspLevel()
|
||||
{
|
||||
return $this->LibProspLevel($this->fk_prospectlevel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return label of prospect level
|
||||
*
|
||||
* @param int $fk_prospectlevel Prospect level
|
||||
* @return string label of level
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Definit la societe comme un client
|
||||
*
|
||||
* @param float $remise Valeur en % de la remise
|
||||
* @param string $note Note/Motif de modification de la remise
|
||||
* @param User $user Utilisateur qui definie la remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function set_prospect_level($user)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Positionne remise courante
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " fk_prospectlevel='".$this->fk_prospectlevel."'";
|
||||
$sql.= " ,fk_user_modif='".$user->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
dol_syslog(get_class($this)."::set_prospect_level sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user