Fix: uniformize code
This commit is contained in:
parent
150f3ecfe3
commit
deb30b6f17
@ -89,13 +89,9 @@ if ($action == 'setcustomeraccountancycode')
|
|||||||
if ($action == 'setconditions' && $user->rights->societe->creer)
|
if ($action == 'setconditions' && $user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->cond_reglement=$_POST['cond_reglement_id'];
|
$object->cond_reglement=GETPOST('cond_reglement_id','int');
|
||||||
|
$result=$object->setPaymentTerms($object->cond_reglement);
|
||||||
// TODO move to DAO class
|
if ($result < 0) dol_print_error($db,$object->error);
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."societe SET cond_reglement='".$_POST['cond_reglement_id'];
|
|
||||||
$sql.= "' WHERE rowid='".$id."'";
|
|
||||||
$result = $db->query($sql);
|
|
||||||
if (! $result) dol_print_error($result);
|
|
||||||
}
|
}
|
||||||
// mode de reglement
|
// mode de reglement
|
||||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||||
|
|||||||
@ -871,8 +871,12 @@ abstract class CommonObject
|
|||||||
function setPaymentTerms($id)
|
function setPaymentTerms($id)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this).'::setPaymentTerms('.$id.')');
|
dol_syslog(get_class($this).'::setPaymentTerms('.$id.')');
|
||||||
if ($this->statut >= 0)
|
if ($this->statut >= 0 || $this->element == 'societe')
|
||||||
{
|
{
|
||||||
|
// TODO uniformize field name
|
||||||
|
$fieldname = 'fk_cond_reglement';
|
||||||
|
if ($this->element == 'societe') $fieldname = 'cond_reglement';
|
||||||
|
|
||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
|
||||||
$sql .= ' SET fk_cond_reglement = '.$id;
|
$sql .= ' SET fk_cond_reglement = '.$id;
|
||||||
$sql .= ' WHERE rowid='.$this->id;
|
$sql .= ' WHERE rowid='.$this->id;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user