Fix missing default bank account on form

This commit is contained in:
Laurent Destailleur 2022-11-17 23:29:42 +01:00
parent 28833e71a1
commit 2f0d9e18bd
3 changed files with 39 additions and 10 deletions

View File

@ -158,7 +158,7 @@ if (empty($reshook)) {
$action = "";
}
// set accountancy code
// Set accountancy code
if ($action == 'setcustomeraccountancycode') {
$result = $object->fetch($id);
$object->code_compta_client = GETPOST("customeraccountancycode");
@ -169,7 +169,7 @@ if (empty($reshook)) {
}
}
// terms of the settlement
// Payment terms of the settlement
if ($action == 'setconditions' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'), GETPOST('cond_reglement_id_deposit_percent', 'alpha'));
@ -178,7 +178,7 @@ if (empty($reshook)) {
}
}
// mode de reglement
// Payment mode
if ($action == 'setmode' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
@ -187,7 +187,7 @@ if (empty($reshook)) {
}
}
// transport mode
// Transport mode
if ($action == 'settransportmode' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setTransportMode(GETPOST('transport_mode_id', 'alpha'));
@ -421,7 +421,7 @@ if ($object->id > 0) {
print "</td>";
print '</tr>';
// Mode de reglement par defaut
// Default payment mode
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentMode');
@ -440,7 +440,7 @@ if ($object->id > 0) {
print '</tr>';
if (isModEnabled("banque")) {
// Compte bancaire par défaut
// Default bank account for payments
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentBankAccount');

View File

@ -106,7 +106,7 @@ if (empty($reshook)) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// terms of the settlement
// Set payment terms of the settlement
if ($action == 'setconditions' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentTerms(GETPOST('cond_reglement_supplier_id', 'int'));
@ -114,7 +114,7 @@ if (empty($reshook)) {
dol_print_error($db, $object->error);
}
}
// mode de reglement
// Payment mode
if ($action == 'setmode' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setPaymentMethods(GETPOST('mode_reglement_supplier_id', 'int'));
@ -123,6 +123,15 @@ if (empty($reshook)) {
}
}
// Bank account
if ($action == 'setbankaccount' && $user->rights->societe->creer) {
$object->fetch($id);
$result = $object->setBankAccount(GETPOST('fk_account', 'int'));
if ($result < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
// update supplier order min amount
if ($action == 'setsupplier_order_min_amount') {
$object->fetch($id);
@ -276,7 +285,7 @@ if ($object->id > 0) {
print "</td>";
print '</tr>';
// Mode de reglement par defaut
// Default payment mode
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentMode');
@ -294,6 +303,26 @@ if ($object->id > 0) {
print "</td>";
print '</tr>';
if (isModEnabled("banque")) {
// Default bank account for payments
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('PaymentBankAccount');
print '<td>';
if (($action != 'editbankaccount') && $user->rights->societe->creer) {
print '<td class="right"><a class="editfielda" href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&token='.newToken().'&socid='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'), 1).'</a></td>';
}
print '</tr></table>';
print '</td><td>';
if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1);
} else {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none');
}
print "</td>";
print '</tr>';
}
// Relative discounts (Discounts-Drawbacks-Rebates)
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';

View File

@ -44,7 +44,7 @@ create table llx_societe
town varchar(50), -- town
fk_departement integer DEFAULT 0, --
fk_pays integer DEFAULT 0, --
fk_account integer DEFAULT 0, --
fk_account integer DEFAULT 0, -- default bank account
phone varchar(20), -- phone number
fax varchar(20), -- fax number
url varchar(255), --