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)
|
||||
{
|
||||
$object->fetch($id);
|
||||
$object->cond_reglement=$_POST['cond_reglement_id'];
|
||||
|
||||
// TODO move to DAO class
|
||||
$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);
|
||||
$object->cond_reglement=GETPOST('cond_reglement_id','int');
|
||||
$result=$object->setPaymentTerms($object->cond_reglement);
|
||||
if ($result < 0) dol_print_error($db,$object->error);
|
||||
}
|
||||
// mode de reglement
|
||||
if ($action == 'setmode' && $user->rights->societe->creer)
|
||||
|
||||
@ -871,8 +871,12 @@ abstract class CommonObject
|
||||
function 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 .= ' SET fk_cond_reglement = '.$id;
|
||||
$sql .= ' WHERE rowid='.$this->id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user