FIX message for automatic binding not clear of what was done or not

This commit is contained in:
Laurent Destailleur 2021-12-13 19:04:25 +01:00
parent d0bc32047d
commit 582caf0e7a
5 changed files with 16 additions and 6 deletions

View File

@ -93,7 +93,7 @@ if (empty($user->rights->accounting->mouvements->lire)) {
*/
if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accounting->bind->write) {
// Clean database
// Clean database by removing binding done on non existing or no more existing accounts
$db->begin();
$sql1 = "UPDATE ".MAIN_DB_PREFIX."facturedet as fd";
$sql1 .= " SET fk_code_ventilation = 0";
@ -119,6 +119,8 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') {
$error = 0;
$nbbinddone = 0;
$db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
@ -277,6 +279,8 @@ if ($action == 'validatehistory') {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
} else {
$nbbinddone++;
}
}
@ -288,7 +292,7 @@ if ($action == 'validatehistory') {
$db->rollback();
} else {
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone), null, 'mesgs');
}
}

View File

@ -131,8 +131,10 @@ if ($action == 'validatehistory') {
$db->rollback();
setEventMessages($db->lasterror(), null, 'errors');
} else {
$nbbinddone = $db->affected_rows($resql1);
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone), null, 'mesgs');
}
}

View File

@ -117,6 +117,8 @@ if (($action == 'clean' || $action == 'validatehistory') && $user->rights->accou
if ($action == 'validatehistory') {
$error = 0;
$nbbinddone = 0;
$db->begin();
// Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind
@ -273,6 +275,8 @@ if ($action == 'validatehistory') {
$error++;
setEventMessages($db->lasterror(), null, 'errors');
break;
} else {
$nbbinddone++;
}
}
@ -284,7 +288,7 @@ if ($action == 'validatehistory') {
$db->rollback();
} else {
$db->commit();
setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs');
setEventMessages($langs->trans('AutomaticBindingDone', $nbbinddone), null, 'mesgs');
}
}

View File

@ -286,7 +286,7 @@ ValidateMovements=Validate movements
DescValidateMovements=Any modification or deletion of writing, lettering and deletes will be prohibited. All entries for an exercise must be validated otherwise closing will not be possible
ValidateHistory=Bind Automatically
AutomaticBindingDone=Automatic binding done
AutomaticBindingDone=Automatic bindings done (%s)
ErrorAccountancyCodeIsAlreadyUse=Error, you cannot delete this accounting account because it is used
MvtNotCorrectlyBalanced=Movement not correctly balanced. Debit = %s | Credit = %s

View File

@ -286,7 +286,7 @@ ValidateMovements=Valider les mouvements
DescValidateMovements=Toute modification ou suppression d'écriture, de lettrage et de suppression sera interdite. Toutes les entrées pour un exercice doivent être validées, sinon la fermeture ne sera pas possible
ValidateHistory=Lier automatiquement
AutomaticBindingDone=Liaison automatique faite
AutomaticBindingDone=Liaisons automatiques faites (%s)
ErrorAccountancyCodeIsAlreadyUse=Erreur, vous ne pouvez pas détruire de compte comptable car il est utilisé
MvtNotCorrectlyBalanced=Mouvement non équilibré. Débit = %s| Crédit = %s