NEW set thirdparty type with company modify trigger
This commit is contained in:
parent
a35d58fc01
commit
946c79ced0
@ -4932,15 +4932,16 @@ class Societe extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function setThirdpartyType($typent_id)
|
public function setThirdpartyType($typent_id)
|
||||||
{
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||||
|
|
||||||
if ($this->id) {
|
if ($this->id) {
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe";
|
$result = $this->setValueFrom('fk_typent', $typent_id, '', null, '', '', $user, 'COMPANY_MODIFY');
|
||||||
$sql .= " SET fk_typent = ".($typent_id > 0 ? $typent_id : "null");
|
|
||||||
$sql .= " WHERE rowid = ".((int) $this->id);
|
if ($result > 0) {
|
||||||
dol_syslog(get_class($this).'::setThirdpartyType', LOG_DEBUG);
|
|
||||||
$resql = $this->db->query($sql);
|
|
||||||
if ($resql) {
|
|
||||||
$this->typent_id = $typent_id;
|
$this->typent_id = $typent_id;
|
||||||
$this->typent_code = dol_getIdFromCode($this->db, $this->$typent_id, 'c_typent', 'id', 'code');
|
$this->typent_code = dol_getIdFromCode($this->db, $this->typent_id, 'c_typent', 'id', 'code');
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user