Merge pull request #5029 from marcosgdf/deprecated-functions
NEW Deprecated Societe::set_prospect_level, Societe::set_commnucation_level, Societe::set_OutstandingBill functions
This commit is contained in:
commit
3ba87be4ef
@ -146,7 +146,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->fk_prospectlevel=GETPOST('prospect_level_id','alpha');
|
||||
$result=$object->set_prospect_level($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ if (empty($reshook))
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->outstanding_limit=GETPOST('outstanding_limit');
|
||||
$result=$object->set_OutstandingBill($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
@ -678,6 +678,7 @@ class Societe extends CommonObject
|
||||
$this->idprof5 = (! empty($this->idprof5)?trim($this->idprof5):'');
|
||||
$this->idprof6 = (! empty($this->idprof6)?trim($this->idprof6):'');
|
||||
$this->prefix_comm = trim($this->prefix_comm);
|
||||
$this->outstanding_limit = price2num($this->outstanding_limit);
|
||||
|
||||
$this->tva_assuj = trim($this->tva_assuj);
|
||||
$this->tva_intra = dol_sanitizeFileName($this->tva_intra,'');
|
||||
@ -831,7 +832,7 @@ class Societe extends CommonObject
|
||||
$sql .= ",prefix_comm = ".(! empty($this->prefix_comm)?"'".$this->db->escape($this->prefix_comm)."'":"null");
|
||||
|
||||
$sql .= ",fk_effectif = ".(! empty($this->effectif_id)?"'".$this->db->escape($this->effectif_id)."'":"null");
|
||||
|
||||
$sql .= ",fk_stcomm='".$this->stcomm_id."'";
|
||||
$sql .= ",fk_typent = ".(! empty($this->typent_id)?"'".$this->db->escape($this->typent_id)."'":"0");
|
||||
|
||||
$sql .= ",fk_forme_juridique = ".(! empty($this->forme_juridique_code)?"'".$this->db->escape($this->forme_juridique_code)."'":"null");
|
||||
@ -847,6 +848,8 @@ class Societe extends CommonObject
|
||||
$sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null");
|
||||
$sql .= ",default_lang = ".(! empty($this->default_lang)?"'".$this->db->escape($this->default_lang)."'":"null");
|
||||
$sql .= ",logo = ".(! empty($this->logo)?"'".$this->db->escape($this->logo)."'":"null");
|
||||
$sql .= ",outstanding_limit= '".($this->outstanding_limit!=''?$this->outstanding_limit:'null')."'";
|
||||
$sql .= ",fk_prospectlevel='".$this->fk_prospectlevel."'";
|
||||
|
||||
$sql .= ",webservices_url = ".(! empty($this->webservices_url)?"'".$this->db->escape($this->webservices_url)."'":"null");
|
||||
$sql .= ",webservices_key = ".(! empty($this->webservices_key)?"'".$this->db->escape($this->webservices_key)."'":"null");
|
||||
@ -3178,30 +3181,11 @@ class Societe extends CommonObject
|
||||
*
|
||||
* @param User $user Utilisateur qui definie la remise
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
function set_prospect_level(User $user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// 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", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->error();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3274,31 +3258,11 @@ class Societe extends CommonObject
|
||||
*
|
||||
* @param User $user User making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
function set_commnucation_level($user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Positionne remise courante
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " fk_stcomm='".$this->stcomm_id."'";
|
||||
$sql.= ",fk_user_modif='".$user->id."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_commnucation_level", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql)
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3306,35 +3270,11 @@ class Societe extends CommonObject
|
||||
*
|
||||
* @param User $user User making change
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* @deprecated Use update function instead
|
||||
*/
|
||||
function set_OutstandingBill(User $user)
|
||||
{
|
||||
if ($this->id)
|
||||
{
|
||||
$this->db->begin();
|
||||
|
||||
// Clean parameters
|
||||
$outstanding = price2num($this->outstanding_limit);
|
||||
|
||||
// Set outstanding amount
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET ";
|
||||
$sql.= " outstanding_limit= '".($outstanding!=''?$outstanding:'null')."'";
|
||||
$sql.= " WHERE rowid = ".$this->id;
|
||||
|
||||
dol_syslog(get_class($this)."::set_outstanding", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return $this->update($this->id, $user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -191,7 +191,7 @@ if (empty($reshook))
|
||||
$object = new Client($db);
|
||||
$result=$object->fetch(GETPOST('stcommsocid'));
|
||||
$object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm');
|
||||
$result=$object->set_commnucation_level($user);
|
||||
$result=$object->update($object->id, $user);
|
||||
if ($result < 0) setEventMessages($object->error,$object->errors,'errors');
|
||||
|
||||
$action='';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user