setPaymentTerms (#37232)

Co-authored-by: Anthony Berton <anthony.berton@bb2a.fr>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Anthony Berton 2026-02-17 01:37:13 +01:00 committed by GitHub
parent da4baf4255
commit 03ab77c861
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2062,24 +2062,7 @@ if (empty($reshook)) {
$result = $object->set_demand_reason($user, GETPOSTINT('demand_reason_id'));
} elseif ($action == 'setconditions' && $usercancreate) {
// Terms of payment
$sql = "SELECT code ";
$sql .= "FROM " . $db->prefix() . "c_payment_term";
$sql .= " WHERE rowid = " . ((int) GETPOST('cond_reglement_id', 'int'));
$result = $db->query($sql);
if ($result) {
$obj = $db->fetch_object($result);
if ($obj->code == 'DEP30PCTDEL') {
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTFLOAT('cond_reglement_id_deposit_percent'));
} else {
$object->deposit_percent = 0;
$object->update($user);
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), $object->deposit_percent);
}
}
//} elseif ($action == 'setremisepercent' && $usercancreate) {
// $result = $object->set_remise_percent($user, price2num(GETPOST('remise_percent'), '', 2));
//} elseif ($action == 'setremiseabsolue' && $usercancreate) {
// $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2));
$result = $object->setPaymentTerms(GETPOSTINT('cond_reglement_id'), GETPOSTFLOAT('cond_reglement_id_deposit_percent'));
} elseif ($action == 'setmode' && $usercancreate) {
// Payment choice
$result = $object->setPaymentMethods(GETPOSTINT('mode_reglement_id'));
@ -2311,7 +2294,6 @@ if ($action == 'create') {
$fk_account = GETPOSTINT('fk_account');
}
}
// Warehouse default if null
if ($soc->fk_warehouse > 0) {
$warehouse_id = $soc->fk_warehouse;