FIX Found duplicate line when it is not.

This commit is contained in:
Laurent Destailleur 2017-04-29 14:59:40 +02:00
parent 05fe0d7fcd
commit 04b1535b12
2 changed files with 16 additions and 5 deletions

View File

@ -169,7 +169,15 @@ class BookKeeping extends CommonObject
if (empty($this->numero_compte) || $this->numero_compte == '-1')
{
$langs->load("errors");
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet);
if (in_array($this->doc_type, array('bank', 'expense_report')))
{
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type);
}
else
{
$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->fk_doc, $this->doc_type);
}
return -1;
}
@ -178,11 +186,12 @@ class BookKeeping extends CommonObject
$this->piece_num = 0;
// first check if line not yet in bookkeeping
// First check if line not yet already in bookkeeping
$sql = "SELECT count(*) as nb";
$sql .= " FROM " . MAIN_DB_PREFIX . $this->table_element;
$sql .= " WHERE doc_type = '" . $this->doc_type . "'";
$sql .= " AND fk_docdet = " . $this->fk_docdet;
$sql .= " AND fk_doc = " . $this->fk_doc;
$sql .= " AND fk_docdet = " . $this->fk_docdet; // This field can be 0 is record is for several lines
$sql .= " AND numero_compte = '" . $this->numero_compte . "'";
$sql .= " AND entity IN (" . getEntity("accountancy", 1) . ")";

View File

@ -11,6 +11,7 @@ ErrorLoginAlreadyExists=Login %s already exists.
ErrorGroupAlreadyExists=Group %s already exists.
ErrorRecordNotFound=Record not found.
ErrorFailToCopyFile=Failed to copy file '<b>%s</b>' into '<b>%s</b>'.
ErrorFailToCopyDir=Failed to copy directory '<b>%s</b>' into '<b>%s</b>'.
ErrorFailToRenameFile=Failed to rename file '<b>%s</b>' into '<b>%s</b>'.
ErrorFailToDeleteFile=Failed to remove file '<b>%s</b>'.
ErrorFailToCreateFile=Failed to create file '<b>%s</b>'.
@ -115,7 +116,7 @@ ErrorNoActivatedBarcode=No barcode type activated
ErrUnzipFails=Failed to unzip %s with ZipArchive
ErrNoZipEngine=No engine to unzip %s file in this PHP
ErrorFileMustBeADolibarrPackage=The file %s must be a Dolibarr zip package
ErrorFileRequired=It takes a package Dolibarr file
ErrorModuleFileRequired=You must select a Dolibarr module package file
ErrorPhpCurlNotInstalled=The PHP CURL is not installed, this is essential to talk with Paypal
ErrorFailedToAddToMailmanList=Failed to add record %s to Mailman list %s or SPIP base
ErrorFailedToRemoveToMailmanList=Failed to remove record %s to Mailman list %s or SPIP base
@ -176,7 +177,8 @@ ErrorStockIsNotEnoughToAddProductOnShipment=Stock is not enough for product %s t
ErrorStockIsNotEnoughToAddProductOnProposal=Stock is not enough for product %s to add it into a new proposal.
ErrorFailedToLoadLoginFileForMode=Failed to get the login key for mode '%s'.
ErrorModuleNotFound=File of module was not found.
ErrorFieldAccountNotDefinedForBankLine=Value for Accounting account not defined for source bank line %s
ErrorFieldAccountNotDefinedForBankLine=Value for Accounting account not defined for source line id %s (%s)
ErrorFieldAccountNotDefinedForInvoiceLine=Value for Accounting account not defined for invoice id %s (%s)
ErrorBankStatementNameMustFollowRegex=Error, bank statement name must follow the following syntax rule %s
ErrorPhpMailDelivery=Check that you don't use a too high number of recipients and that your email content is not similar to a Spam. Ask also your administrator to check firewall and server logs files for a more complete information.
ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter time consumed.