Merge branch '21.0' of git@github.com:Dolibarr/dolibarr.git into 22.0
This commit is contained in:
commit
2e9ec3a9da
4 changed files with 15 additions and 7 deletions
|
|
@ -1036,13 +1036,12 @@ class Asset extends CommonObject
|
|||
}
|
||||
|
||||
// Delete old lines
|
||||
$sql = "DELETE " . MAIN_DB_PREFIX . "asset_depreciation FROM " . MAIN_DB_PREFIX . "asset_depreciation";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as ab ON ab.doc_type = 'asset' AND ab.fk_docdet = " . MAIN_DB_PREFIX . "asset_depreciation.rowid";
|
||||
$sql .= " WHERE " . MAIN_DB_PREFIX . "asset_depreciation.fk_asset = " . (int) $this->id;
|
||||
$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
|
||||
$sql .= " AND ab.fk_docdet IS NULL";
|
||||
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation";
|
||||
$sql .= " WHERE fk_asset = " . (int) $this->id;
|
||||
$sql .= " AND depreciation_mode = '" . $this->db->escape($mode_key) . "'";
|
||||
$sql .= " AND NOT EXISTS (SELECT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset' AND fk_docdet = " . MAIN_DB_PREFIX . "asset_depreciation.rowid)";
|
||||
if ($last_depreciation_date !== "") {
|
||||
$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''";
|
||||
$sql .= " AND ref <> ''";
|
||||
}
|
||||
$resql = $this->db->query($sql);
|
||||
if (!$resql) {
|
||||
|
|
|
|||
|
|
@ -1231,9 +1231,13 @@ EOPHAN;
|
|||
|
||||
$db->begin();
|
||||
$nbok = 0;
|
||||
|
||||
$objecttmp = new $objectclass($db);
|
||||
|
||||
foreach ($toselect as $toselectid) {
|
||||
$objecttmp = new $objectclass($db);
|
||||
$objecttmp->thirdparty = null; // Clear if another value was already set by fetch_thirdparty later
|
||||
$result = $objecttmp->fetch($toselectid);
|
||||
|
||||
if ($result > 0) {
|
||||
$outputlangs = $langs;
|
||||
$newlang = '';
|
||||
|
|
|
|||
|
|
@ -546,7 +546,10 @@ class CommandeFournisseur extends CommonOrder
|
|||
|
||||
$this->ref = $obj->ref;
|
||||
$this->ref_supplier = $obj->ref_supplier;
|
||||
|
||||
$this->socid = $obj->fk_soc;
|
||||
$this->thirdparty = null; // Clear if another value was already set by fetch_thirdparty
|
||||
|
||||
$this->fourn_id = $obj->fk_soc;
|
||||
$this->statut = $obj->status; // deprecated
|
||||
$this->status = $obj->status;
|
||||
|
|
|
|||
|
|
@ -1013,6 +1013,8 @@ class FactureFournisseur extends CommonInvoice
|
|||
|
||||
$this->socid = $obj->socid;
|
||||
|
||||
$this->thirdparty = null; // Clear if another value was already set by fetch_thirdparty
|
||||
|
||||
// Retrieve all extrafield
|
||||
// fetch optionals attributes and labels
|
||||
$this->fetch_optionals();
|
||||
|
|
|
|||
Loading…
Reference in a new issue