diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 2b7e624676f..e2ed822e35a 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -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'); } } diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 61b942e99bd..0987afb0c6a 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -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'); } } diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 406701d2500..1a0c8909829 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -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'); } } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 8781bc13f86..b9f84588079 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -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 diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 5ac5b2b5d10..675e9ac338e 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -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