Clean code
This commit is contained in:
parent
dd4810aef6
commit
8d64f8617c
@ -454,27 +454,12 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
|
||||
$sql = "";
|
||||
|
||||
// FIXME sql error with Mysql 5.7
|
||||
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
$sql .= "WITH in_accounting_bookkeeping(fk_docdet) AS (";
|
||||
$sql .= " SELECT DISTINCT fk_docdet";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping";
|
||||
$sql .= " WHERE doc_type = 'asset'";
|
||||
$sql .= ") ";
|
||||
}*/
|
||||
|
||||
$sql .= "SELECT ad.fk_asset AS rowid, a.ref AS asset_ref, a.label AS asset_label, a.acquisition_value_ht AS asset_acquisition_value_ht";
|
||||
$sql .= ", a.disposal_date AS asset_disposal_date, a.disposal_amount_ht AS asset_disposal_amount_ht, a.disposal_subject_to_vat AS asset_disposal_subject_to_vat";
|
||||
$sql .= ", ad.rowid AS depreciation_id, ad.depreciation_mode, ad.ref AS depreciation_ref, ad.depreciation_date, ad.depreciation_ht, ad.accountancy_code_debit, ad.accountancy_code_credit";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation as ad";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "asset as a ON a.rowid = ad.fk_asset";
|
||||
// FIXME sql error with Mysql 5.7
|
||||
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
$sql .= " LEFT JOIN in_accounting_bookkeeping as iab ON iab.fk_docdet = ad.rowid";
|
||||
}*/
|
||||
$sql .= " WHERE a.entity IN (" . getEntity('asset', 0) . ')'; // We don't share object for accountancy, we use source object sharing
|
||||
// Compatibility with Mysql 5.7
|
||||
if ($in_bookkeeping == 'already') {
|
||||
$sql .= " AND EXISTS (SELECT iab.fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping AS iab WHERE iab.fk_docdet = ad.rowid AND doc_type = 'asset')";
|
||||
} elseif ($in_bookkeeping == 'notyet') {
|
||||
@ -488,11 +473,6 @@ class AccountingJournal extends CommonObject
|
||||
if (!empty($conf->global->ACCOUNTING_DATE_START_BINDING)) {
|
||||
$sql .= " AND ad.depreciation_date >= '" . $this->db->idate($conf->global->ACCOUNTING_DATE_START_BINDING) . "'";
|
||||
}
|
||||
// Already in bookkeeping or not
|
||||
// FIXME sql error with Mysql 5.7
|
||||
/*if ($in_bookkeeping == 'already' || $in_bookkeeping == 'notyet') {
|
||||
$sql .= " AND iab.fk_docdet IS" . ($in_bookkeeping == 'already' ? " NOT" : "") . " NULL";
|
||||
}*/
|
||||
$sql .= " ORDER BY ad.depreciation_date";
|
||||
|
||||
dol_syslog(__METHOD__, LOG_DEBUG);
|
||||
@ -755,7 +735,7 @@ class AccountingJournal extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$journal_data[$pre_data_id] = $element;
|
||||
$journal_data[(int) $pre_data_id] = $element;
|
||||
}
|
||||
unset($pre_data);
|
||||
|
||||
|
||||
@ -477,8 +477,8 @@ class ActionComm extends CommonObject
|
||||
$this->elementtype = 'contract';
|
||||
}
|
||||
|
||||
if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead fo array
|
||||
$tmpid = $this->userassigned;
|
||||
if (!is_array($this->userassigned) && !empty($this->userassigned)) { // For backward compatibility when userassigned was an int instead of an array
|
||||
$tmpid = (int) $this->userassigned;
|
||||
$this->userassigned = array();
|
||||
$this->userassigned[$tmpid] = array('id'=>$tmpid, 'transparency'=>$this->transparency);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user