Fix error message
This commit is contained in:
parent
b0e0ceb8f6
commit
67ade177c7
@ -168,10 +168,13 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) {
|
|||||||
$object->labelshort = GETPOST('labelshort', 'alpha');
|
$object->labelshort = GETPOST('labelshort', 'alpha');
|
||||||
|
|
||||||
$result = $object->update($user);
|
$result = $object->update($user);
|
||||||
|
|
||||||
if ($result > 0) {
|
if ($result > 0) {
|
||||||
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
|
$urltogo = $backtopage ? $backtopage : ($_SERVER["PHP_SELF"] . "?id=" . $id);
|
||||||
header("Location: " . $urltogo);
|
header("Location: " . $urltogo);
|
||||||
exit();
|
exit();
|
||||||
|
} elseif ($result == -2) {
|
||||||
|
setEventMessages($langs->trans("ErrorAccountNumberAlreadyExists", $object->account_number), null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessages($object->error, null, 'errors');
|
setEventMessages($object->error, null, 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -347,8 +347,8 @@ class AccountingAccount extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* Update record
|
* Update record
|
||||||
*
|
*
|
||||||
* @param User $user Use making update
|
* @param User $user User making update
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO (-2 = duplicate), >0 if OK
|
||||||
*/
|
*/
|
||||||
public function update($user)
|
public function update($user)
|
||||||
{
|
{
|
||||||
@ -378,6 +378,12 @@ class AccountingAccount extends CommonObject
|
|||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
|
if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
|
$this->error = $this->db->lasterror();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
$this->error = $this->db->lasterror();
|
$this->error = $this->db->lasterror();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@ -427,6 +427,7 @@ SorryThisModuleIsNotCompatibleWithTheExperimentalFeatureOfSituationInvoices=Sorr
|
|||||||
AccountancyErrorMismatchLetterCode=Mismatch in reconcile code
|
AccountancyErrorMismatchLetterCode=Mismatch in reconcile code
|
||||||
AccountancyErrorMismatchBalanceAmount=The balance (%s) is not equal to 0
|
AccountancyErrorMismatchBalanceAmount=The balance (%s) is not equal to 0
|
||||||
AccountancyErrorLetteringBookkeeping=Errors have occurred concerning the transactions: %s
|
AccountancyErrorLetteringBookkeeping=Errors have occurred concerning the transactions: %s
|
||||||
|
ErrorAccountNumberAlreadyExists=The accounting number %s already exists
|
||||||
|
|
||||||
## Import
|
## Import
|
||||||
ImportAccountingEntries=Accounting entries
|
ImportAccountingEntries=Accounting entries
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user