forked from Wavyzz/dolibarr
NEW Bank name no more mandatory on creation. Can be generated if empty.
This commit is contained in:
@@ -257,13 +257,8 @@ if (empty($reshook)) {
|
||||
if ($action == 'add') {
|
||||
$error = 0;
|
||||
|
||||
if (!GETPOST('label', 'alpha') || !GETPOST('bank', 'alpha')) {
|
||||
if (!GETPOST('label', 'alpha')) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
}
|
||||
if (!GETPOST('bank', 'alpha')) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors');
|
||||
}
|
||||
if (!GETPOST('label', 'alpha')) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
$action = 'create';
|
||||
$error++;
|
||||
}
|
||||
@@ -274,6 +269,8 @@ if (empty($reshook)) {
|
||||
|
||||
$companybankaccount->socid = $object->id;
|
||||
|
||||
$companybankaccount->fetch_thirdparty();
|
||||
|
||||
$companybankaccount->bank = GETPOST('bank', 'alpha');
|
||||
$companybankaccount->label = GETPOST('label', 'alpha');
|
||||
$companybankaccount->courant = GETPOST('courant', 'alpha');
|
||||
@@ -293,6 +290,12 @@ if (empty($reshook)) {
|
||||
$companybankaccount->datec = dol_now();
|
||||
$companybankaccount->status = 1;
|
||||
|
||||
$companybankaccount->bank = trim($companybankaccount->bank);
|
||||
if (empty($companybankaccount->bank) && !empty($companybankaccount->thirdparty)) {
|
||||
$companybankaccount->bank = $langs->trans("Bank").' '.$companybankaccount->thirdparty->name;
|
||||
}
|
||||
$companybankaccount->bic = str_replace(' ', '', $companybankaccount->bic);
|
||||
|
||||
$db->begin();
|
||||
|
||||
// This test can be done only once properties were set
|
||||
@@ -1980,7 +1983,7 @@ if ($socid && $action == 'create' && $permissiontoaddupdatepaymentinformation) {
|
||||
print '<tr><td class="titlefieldcreate fieldrequired">'.$langs->trans("Label").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" id="label" name="label" value="'.(GETPOSTISSET('label') ? GETPOST('label') : $object->name).'"></td></tr>';
|
||||
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Bank").'</td>';
|
||||
print '<tr><td>'.$langs->trans("Bank").'</td>';
|
||||
print '<td><input class="minwidth200" type="text" id="bank" name="bank" value="'.GETPOST('bank').'"></td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
|
||||
Reference in New Issue
Block a user