@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | 'table' => 'asset_depreciation_options_economic', |
81 | 81 | 'fields' => array( |
82 | 82 | 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDepreciationTypeLinear', 1 => 'AssetDepreciationOptionDepreciationTypeDegressive', 2 => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => 1,), |
83 | - 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,'enabled_field' => 'economic:depreciation_type:1'), |
|
83 | + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'enabled_field' => 'economic:depreciation_type:1'), |
|
84 | 84 | 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), |
85 | 85 | 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDurationTypeAnnual', 1 => 'AssetDepreciationOptionDurationTypeMonthly'/*, 2=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => 1,), |
86 | 86 | 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => 1, 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'computed' => '$object->asset_depreciation_options->getRate("economic")',), |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'enabled_field' => 'economic:accelerated_depreciation_option:1', |
97 | 97 | 'fields' => array( |
98 | 98 | 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDepreciationTypeLinear', 1 => 'AssetDepreciationOptionDepreciationTypeDegressive', 2 => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => 1,), |
99 | - 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,'enabled_field' => 'accelerated_depreciation:depreciation_type:1'), |
|
99 | + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'enabled_field' => 'accelerated_depreciation:depreciation_type:1'), |
|
100 | 100 | 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), |
101 | 101 | 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDurationTypeAnnual', 1 => 'AssetDepreciationOptionDurationTypeMonthly'/*, 2=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => 1,), |
102 | 102 | 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => 1, 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | continue; |
239 | 239 | } |
240 | 240 | |
241 | - $html_name = $mode_key . '_' . $field_key; |
|
241 | + $html_name = $mode_key.'_'.$field_key; |
|
242 | 242 | if ($field_info['type'] == 'duration') { |
243 | - if (GETPOST($html_name . 'hour') == '' && GETPOST($html_name . 'min') == '') { |
|
243 | + if (GETPOST($html_name.'hour') == '' && GETPOST($html_name.'min') == '') { |
|
244 | 244 | continue; // The field was not submitted to be saved |
245 | 245 | } |
246 | 246 | } else { |
@@ -262,17 +262,17 @@ discard block |
||
262 | 262 | if (in_array($field_info['type'], array('text', 'html'))) { |
263 | 263 | $value = GETPOST($html_name, 'restricthtml'); |
264 | 264 | } elseif ($field_info['type'] == 'date') { |
265 | - $value = dol_mktime(0, 0, 0, GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'gmt'); // for date without hour, we use gmt |
|
265 | + $value = dol_mktime(0, 0, 0, GETPOSTINT($html_name.'month'), GETPOSTINT($html_name.'day'), GETPOSTINT($html_name.'year'), 'gmt'); // for date without hour, we use gmt |
|
266 | 266 | } elseif ($field_info['type'] == 'datetime') { |
267 | - $value = dol_mktime(GETPOSTINT($html_name . 'hour'), GETPOSTINT($html_name . 'min'), GETPOSTINT($html_name . 'sec'), GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'tzuserrel'); |
|
267 | + $value = dol_mktime(GETPOSTINT($html_name.'hour'), GETPOSTINT($html_name.'min'), GETPOSTINT($html_name.'sec'), GETPOSTINT($html_name.'month'), GETPOSTINT($html_name.'day'), GETPOSTINT($html_name.'year'), 'tzuserrel'); |
|
268 | 268 | } elseif ($field_info['type'] == 'duration') { |
269 | - $value = 60 * 60 * GETPOSTINT($html_name . 'hour') + 60 * GETPOSTINT($html_name . 'min'); |
|
269 | + $value = 60 * 60 * GETPOSTINT($html_name.'hour') + 60 * GETPOSTINT($html_name.'min'); |
|
270 | 270 | } elseif (preg_match('/^(integer|price|real|double)/', $field_info['type'])) { |
271 | 271 | $value = price2num(GETPOST($html_name, 'alphanohtml')); // To fix decimal separator according to lang setup |
272 | 272 | } elseif ($field_info['type'] == 'boolean') { |
273 | 273 | $value = ((GETPOST($html_name) == '1' || GETPOST($html_name) == 'on') ? 1 : 0); |
274 | 274 | } elseif ($field_info['type'] == 'reference') { |
275 | - $value = GETPOST($html_name) . ',' . GETPOST($html_name . '2'); |
|
275 | + $value = GETPOST($html_name).','.GETPOST($html_name.'2'); |
|
276 | 276 | } else { |
277 | 277 | if ($field_key == 'lang') { |
278 | 278 | $value = GETPOST($html_name, 'aZ09') ? GETPOST($html_name, 'aZ09') : ""; |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public function fetchDeprecationOptions($asset_id = 0, $asset_model_id = 0) |
339 | 339 | { |
340 | 340 | global $langs, $hookmanager; |
341 | - dol_syslog(__METHOD__ . " asset_id=$asset_id, asset_model_id=$asset_model_id"); |
|
341 | + dol_syslog(__METHOD__." asset_id=$asset_id, asset_model_id=$asset_model_id"); |
|
342 | 342 | |
343 | 343 | $error = 0; |
344 | 344 | $this->errors = array(); |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $error++; |
362 | 362 | } |
363 | 363 | if ($error) { |
364 | - dol_syslog(__METHOD__ . " Error check parameters: " . $this->errorsToString(), LOG_ERR); |
|
364 | + dol_syslog(__METHOD__." Error check parameters: ".$this->errorsToString(), LOG_ERR); |
|
365 | 365 | return -1; |
366 | 366 | } |
367 | 367 | |
@@ -370,9 +370,9 @@ discard block |
||
370 | 370 | foreach ($this->deprecation_options_fields as $mode_key => $mode_info) { |
371 | 371 | $this->setInfosForMode($mode_key, $class_type); |
372 | 372 | |
373 | - $result = $this->fetchCommon(0, '', " AND " . ($asset_id > 0 ? " fk_asset = " . (int) $asset_id : " fk_asset_model = " . (int) $asset_model_id)); |
|
373 | + $result = $this->fetchCommon(0, '', " AND ".($asset_id > 0 ? " fk_asset = ".(int) $asset_id : " fk_asset_model = ".(int) $asset_model_id)); |
|
374 | 374 | if ($result < 0) { |
375 | - $this->errors = array_merge(array($langs->trans('AssetErrorFetchDepreciationOptionsForMode', $mode_key) . ':'), $this->errors); |
|
375 | + $this->errors = array_merge(array($langs->trans('AssetErrorFetchDepreciationOptionsForMode', $mode_key).':'), $this->errors); |
|
376 | 376 | $error++; |
377 | 377 | } elseif ($result > 0) { |
378 | 378 | foreach ($this->fields as $field_key => $field_info) { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | if ($error) { |
397 | - dol_syslog(__METHOD__ . " Error fetch accountancy codes: " . $this->errorsToString(), LOG_ERR); |
|
397 | + dol_syslog(__METHOD__." Error fetch accountancy codes: ".$this->errorsToString(), LOG_ERR); |
|
398 | 398 | return -1; |
399 | 399 | } else { |
400 | 400 | $this->deprecation_options = $deprecation_options; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | public function getGeneralDepreciationInfoForMode($mode) |
412 | 412 | { |
413 | 413 | global $hookmanager; |
414 | - dol_syslog(__METHOD__ . " mode=$mode"); |
|
414 | + dol_syslog(__METHOD__." mode=$mode"); |
|
415 | 415 | |
416 | 416 | $this->errors = array(); |
417 | 417 | |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | public function updateDeprecationOptions($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0) |
450 | 450 | { |
451 | 451 | global $langs, $hookmanager; |
452 | - dol_syslog(__METHOD__ . " user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger); |
|
452 | + dol_syslog(__METHOD__." user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger); |
|
453 | 453 | |
454 | 454 | $error = 0; |
455 | 455 | $this->errors = array(); |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $error++; |
472 | 472 | } |
473 | 473 | if ($error) { |
474 | - dol_syslog(__METHOD__ . " Error check parameters: " . $this->errorsToString(), LOG_ERR); |
|
474 | + dol_syslog(__METHOD__." Error check parameters: ".$this->errorsToString(), LOG_ERR); |
|
475 | 475 | return -1; |
476 | 476 | } |
477 | 477 | |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | |
490 | 490 | foreach ($this->deprecation_options_fields as $mode_key => $mode_info) { |
491 | 491 | // Delete old accountancy codes |
492 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $mode_info['table']; |
|
493 | - $sql .= " WHERE " . ($asset_id > 0 ? " fk_asset = " . (int) $asset_id : " fk_asset_model = " . (int) $asset_model_id); |
|
492 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$mode_info['table']; |
|
493 | + $sql .= " WHERE ".($asset_id > 0 ? " fk_asset = ".(int) $asset_id : " fk_asset_model = ".(int) $asset_model_id); |
|
494 | 494 | $resql = $this->db->query($sql); |
495 | 495 | if (!$resql) { |
496 | - $this->errors[] = $langs->trans('AssetErrorDeleteDepreciationOptionsForMode', $mode_key) . ': ' . $this->db->lasterror(); |
|
496 | + $this->errors[] = $langs->trans('AssetErrorDeleteDepreciationOptionsForMode', $mode_key).': '.$this->db->lasterror(); |
|
497 | 497 | $error++; |
498 | 498 | } |
499 | 499 | |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | |
510 | 510 | $result = $this->createCommon($user, 1); |
511 | 511 | if ($result < 0) { |
512 | - $this->errors = array_merge(array($langs->trans('AssetErrorInsertDepreciationOptionsForMode', $mode_key) . ':'), $this->errors); |
|
512 | + $this->errors = array_merge(array($langs->trans('AssetErrorInsertDepreciationOptionsForMode', $mode_key).':'), $this->errors); |
|
513 | 513 | $error++; |
514 | 514 | } |
515 | 515 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | |
518 | 518 | if (!$error && $this->fk_asset > 0) { |
519 | 519 | // Calculation of depreciation lines (reversal and future) |
520 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; |
|
520 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php'; |
|
521 | 521 | $asset = new Asset($this->db); |
522 | 522 | $result = $asset->fetch($this->fk_asset); |
523 | 523 | if ($result > 0) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $search_date_endday = GETPOSTINT('search_date_endday'); |
71 | 71 | $search_date_endmonth = GETPOSTINT('search_date_endmonth'); |
72 | 72 | $search_date_endyear = GETPOSTINT('search_date_endyear'); |
73 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
73 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
74 | 74 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
75 | 75 | $search_country = GETPOST('search_country', 'aZ09'); |
76 | 76 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -110,23 +110,23 @@ discard block |
||
110 | 110 | |
111 | 111 | // Initialize technical objects |
112 | 112 | $contextpage = 'accountancycustomerlines'; |
113 | -$hookmanager->initHooks([$contextpage ]); |
|
113 | +$hookmanager->initHooks([$contextpage]); |
|
114 | 114 | $formaccounting = new FormAccounting($db); |
115 | 115 | |
116 | 116 | $object = new stdClass(); |
117 | 117 | |
118 | 118 | $arrayfields = array( |
119 | - 'fd.rowid' => array('label' => "LineId", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
120 | - 'f.ref' => array('label' => "Invoice", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
121 | - 'f.datef' => array('label' => "Date", 'position' => 1, 'checked' => '1', 'enabled' => '1'), // f.datef, f.ref, fd.rowid |
|
122 | - 'p.ref' => array('label' => "ProductRef", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
123 | - 'fd.description' => array('label' => "ProductDescription", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
124 | - 'fd.total_ht' => array('label' => "Amount", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
125 | - 'fd.tva_tx' => array('label' => "VATRate", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
126 | - 's.nom' => array('label' => "ThirdParty", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
127 | - 'co.label' => array('label' => "Country", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
128 | - 's.tva_intra' => array('label' => "VATIntra", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
129 | - 'aa.account_number' => array('label' => "AccountAccounting", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
119 | + 'fd.rowid' => array('label' => "LineId", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
120 | + 'f.ref' => array('label' => "Invoice", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
121 | + 'f.datef' => array('label' => "Date", 'position' => 1, 'checked' => '1', 'enabled' => '1'), // f.datef, f.ref, fd.rowid |
|
122 | + 'p.ref' => array('label' => "ProductRef", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
123 | + 'fd.description' => array('label' => "ProductDescription", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
124 | + 'fd.total_ht' => array('label' => "Amount", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
125 | + 'fd.tva_tx' => array('label' => "VATRate", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
126 | + 's.nom' => array('label' => "ThirdParty", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
127 | + 'co.label' => array('label' => "Country", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
128 | + 's.tva_intra' => array('label' => "VATIntra", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
129 | + 'aa.account_number' => array('label' => "AccountAccounting", 'position' => 1, 'checked' => '1', 'enabled' => '1'), |
|
130 | 130 | ); |
131 | 131 | // @phpstan-ignore-next-line |
132 | 132 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
@@ -266,13 +266,13 @@ discard block |
||
266 | 266 | $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; |
267 | 267 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; |
268 | 268 | if (getDolGlobalString('MAIN_PRODUCT_PERENTITY_SHARED')) { |
269 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
269 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
270 | 270 | } |
271 | 271 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; |
272 | 272 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; |
273 | 273 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
274 | 274 | if (getDolGlobalString('MAIN_COMPANY_PERENTITY_SHARED')) { |
275 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
275 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
276 | 276 | } |
277 | 277 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
278 | 278 | // Add table from hooks |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | $moreforfilter = ''; |
451 | 451 | |
452 | 452 | $varpage = $contextpage; |
453 | - $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup |
|
453 | + $htmlofselectarray = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, $conf->main_checkbox_left_column); // This also change content of $arrayfields with user setup |
|
454 | 454 | $selectedfields = $htmlofselectarray; |
455 | 455 | $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); |
456 | 456 |