Update lettering.class.php

add check colum date_validated IS NULL for block process lettering in fiscalyear is lasted validated
This commit is contained in:
oscim 2020-01-31 08:43:09 +01:00 committed by GitHub
parent 51c6540a56
commit a0d3370b86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,6 +76,7 @@ class Lettering extends BookKeeping
$sql .= " ) AND (bk.date_lettering ='' OR bk.date_lettering IS NULL) ";
$sql .= " AND (bk.lettering_code != '' OR bk.lettering_code IS NULL) ";
$sql .= ' AND bk.date_validated IS NULL ';
$sql .= $this->db->order('bk.doc_date', 'DESC');
// echo $sql;
@ -253,7 +254,7 @@ class Lettering extends BookKeeping
}
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE ";
$sql .= " rowid IN (" . implode(',', $ids) . ") ";
$sql .= " rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL ";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
@ -275,7 +276,7 @@ class Lettering extends BookKeeping
$sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping SET";
$sql .= " lettering_code='" . $lettre . "'";
$sql .= " , date_lettering = '" . $this->db->idate($now) . "'"; // todo correct date it's false
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") ";
$sql .= " WHERE rowid IN (" . implode(',', $ids) . ") AND date_validated IS NULL ";
$this->db->begin();
dol_syslog(get_class($this) . "::update sql=" . $sql, LOG_DEBUG);