Better fix fox #20807
This commit is contained in:
parent
7d3ae7d4b8
commit
8ef75ecc7c
@ -52,11 +52,12 @@ if (!empty($conf->salaries->enabled)) {
|
||||
|
||||
|
||||
$id = GETPOST('rowid', 'int');
|
||||
$accountid = (GETPOST('id', 'int') ? GETPOST('id', 'int') : GETPOST('account', 'int'));
|
||||
$rowid = GETPOST("rowid", 'int');
|
||||
$accountoldid = GETPOST('account', 'int'); // GETPOST('account') is old account id
|
||||
$accountid = GETPOST('accountid', 'int'); // GETPOST('accountid') is new account id
|
||||
$ref = GETPOST('ref', 'alpha');
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$confirm = GETPOST('confirm', 'alpha');
|
||||
$rowid = GETPOST("rowid", 'int');
|
||||
$orig_account = GETPOST("orig_account");
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$cancel = GETPOST('cancel', 'alpha');
|
||||
@ -68,7 +69,7 @@ if ($user->socid) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
$result = restrictedArea($user, 'banque', $accountid, 'bank_account');
|
||||
$result = restrictedArea($user, 'banque', $accountoldid, 'bank_account');
|
||||
if (!$user->rights->banque->lire && !$user->rights->banque->consolidate) {
|
||||
accessforbidden();
|
||||
}
|
||||
@ -126,15 +127,19 @@ if ($user->rights->banque->modifier && $action == "update") {
|
||||
$acline->fetch($rowid);
|
||||
|
||||
$acsource = new Account($db);
|
||||
$acsource->fetch($id);
|
||||
$acsource->fetch($accountoldid);
|
||||
|
||||
$actarget = new Account($db);
|
||||
if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) { // We ask to change bank account
|
||||
$actarget->fetch(GETPOST('accountid', 'int'));
|
||||
} else {
|
||||
$actarget->fetch($id);
|
||||
$actarget->fetch($accountoldid);
|
||||
}
|
||||
|
||||
if (!($actarget->id > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFailedToLoadBankAccount"), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if ($actarget->courant == Account::TYPE_CASH && GETPOST('value', 'alpha') != 'LIQ') {
|
||||
setEventMessages($langs->trans("ErrorCashAccountAcceptsOnlyCashMoney"), null, 'errors');
|
||||
$error++;
|
||||
@ -228,7 +233,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action ==
|
||||
$db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."bank";
|
||||
$sql .= " SET num_releve=".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
|
||||
$sql .= " SET num_releve = ".($num_rel ? "'".$db->escape($num_rel)."'" : "null");
|
||||
if (empty($num_rel)) {
|
||||
$sql .= ", rappro = 0";
|
||||
} else {
|
||||
@ -302,7 +307,6 @@ if ($result) {
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="orig_account" value="'.$orig_account.'">';
|
||||
print '<input type="hidden" name="account" value="'.$acct->id.'">';
|
||||
print '<input type="hidden" name="id" value="'.$acct->id.'">';
|
||||
|
||||
print dol_get_fiche_head($head, 'bankline', $langs->trans('LineRecord'), 0, 'accountline', 0);
|
||||
|
||||
@ -607,11 +611,7 @@ if ($result) {
|
||||
print dol_get_fiche_end();
|
||||
|
||||
|
||||
if (!$objp->rappro) {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div><br>';
|
||||
} else {
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'" disabled></div><br>';
|
||||
}
|
||||
print '<div class="center"><input type="submit" class="button" value="'.$langs->trans("Update").'"></div><br>';
|
||||
|
||||
print "</form>";
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user