Passed
Branch develop (3f4b05)
by Laurent
95:01
created
htdocs/install/step2.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@
 block discarded – undo
38 38
 // Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode.
39 39
 
40 40
 $err = error_reporting();
41
-error_reporting(0);      // Disable all errors
41
+error_reporting(0); // Disable all errors
42 42
 //error_reporting(E_ALL);
43
-@set_time_limit(1800);   // Need 1800 on some very slow OS like Windows 7/64
43
+@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64
44 44
 error_reporting($err);
45 45
 
46 46
 $action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]);
Please login to merge, or discard this patch.
htdocs/asset/list.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
 $show_files		= GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
39 39
 $confirm		= GETPOST('confirm', 'alpha'); // Result of a confirmation
40 40
 $cancel			= GETPOST('cancel', 'alpha'); // We click on a Cancel button
41
-$toselect		= GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
41
+$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
42 42
 $contextpage	= GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'assetlist'; // To manage different context of search
43 43
 $backtopage		= GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
44
-$optioncss		= GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
44
+$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
45 45
 
46 46
 $id = GETPOST('id', 'int');
47 47
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
 // Default sort order (if not yet defined by previous GETPOST)
73 73
 if (!$sortfield) {
74
-	reset($object->fields);					// Reset is required to avoid key() to return null.
74
+	reset($object->fields); // Reset is required to avoid key() to return null.
75 75
 	$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
76 76
 }
77 77
 if (!$sortorder) {
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 					$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
253 253
 				}
254 254
 				if (preg_match('/_dtend$/', $key)) {
255
-					$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
255
+					$sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'";
256 256
 				}
257 257
 			}
258 258
 		}
Please login to merge, or discard this patch.
htdocs/asset/document.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 	// Object card
118 118
 	// ------------------------------------------------------------
119
-	$linkback = '<a href="' . dol_buildpath('/asset/asset_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
119
+	$linkback = '<a href="'.dol_buildpath('/asset/asset_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
120 120
 
121 121
 	$morehtmlref = '<div class="refidno">';
122 122
 	$morehtmlref .= '</div>';
@@ -129,10 +129,10 @@  discard block
 block discarded – undo
129 129
 	print '<table class="border centpercent tableforfield">';
130 130
 
131 131
 	// Number of files
132
-	print '<tr><td class="titlefield">' . $langs->trans("NbOfAttachedFiles") . '</td><td colspan="3">' . count($filearray) . '</td></tr>';
132
+	print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
133 133
 
134 134
 	// Total size
135
-	print '<tr><td>' . $langs->trans("TotalSizeOfAttachedFiles") . '</td><td colspan="3">' . $totalsize . ' ' . $langs->trans("bytes") . '</td></tr>';
135
+	print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
136 136
 
137 137
 	print '</table>';
138 138
 
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
 	//  $permissiontoadd = 1;
146 146
 	$permtoedit = $user->rights->asset->write;
147 147
 	//  $permtoedit = 1;
148
-	$param = '&id=' . $object->id;
148
+	$param = '&id='.$object->id;
149 149
 
150 150
 	//$relativepathwithnofile='asset/' . dol_sanitizeFileName($object->id).'/';
151
-	$relativepathwithnofile = dol_sanitizeFileName($object->ref) . '/';
151
+	$relativepathwithnofile = dol_sanitizeFileName($object->ref).'/';
152 152
 
153
-	include DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
153
+	include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
154 154
 } else {
155 155
 	accessforbidden('', 0, 1);
156 156
 }
Please login to merge, or discard this patch.
htdocs/asset/note.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 
92 92
 	// Object card
93 93
 	// ------------------------------------------------------------
94
-	$linkback = '<a href="' . DOL_URL_ROOT . '/asset/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
94
+	$linkback = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
95 95
 
96 96
 	$morehtmlref = '<div class="refidno">';
97 97
 	$morehtmlref .= '</div>';
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 
106 106
 
107 107
 	$cssclass = "titlefield";
108
-	include DOL_DOCUMENT_ROOT . '/core/tpl/notes.tpl.php';
108
+	include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
109 109
 
110 110
 	print '</div>';
111 111
 
Please login to merge, or discard this patch.
htdocs/asset/disposal.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@
 block discarded – undo
91 91
 
92 92
 	// Object card
93 93
 	// ------------------------------------------------------------
94
-	$linkback = '<a href="' . DOL_URL_ROOT . '/asset/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
94
+	$linkback = '<a href="'.DOL_URL_ROOT.'/asset/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
95 95
 
96 96
 	$morehtmlref = '<div class="refidno">';
97 97
 	$morehtmlref .= '</div>';
Please login to merge, or discard this patch.
htdocs/asset/model/list.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 $show_files		= GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
38 38
 $confirm		= GETPOST('confirm', 'alpha'); // Result of a confirmation
39 39
 $cancel			= GETPOST('cancel', 'alpha'); // We click on a Cancel button
40
-$toselect		= GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
40
+$toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
41 41
 $contextpage	= GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'assetmodellist'; // To manage different context of search
42 42
 $backtopage		= GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
43
-$optioncss		= GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
43
+$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
44 44
 
45 45
 $id = GETPOST('id', 'int');
46 46
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 
71 71
 // Default sort order (if not yet defined by previous GETPOST)
72 72
 if (!$sortfield) {
73
-	reset($object->fields);					// Reset is required to avoid key() to return null.
73
+	reset($object->fields); // Reset is required to avoid key() to return null.
74 74
 	$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
75 75
 }
76 76
 if (!$sortorder) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 					$sql .= " AND t.".$columnName." >= '".$db->idate($search[$key])."'";
255 255
 				}
256 256
 				if (preg_match('/_dtend$/', $key)) {
257
-					$sql .= " AND t." . $columnName . " <= '" . $db->idate($search[$key]) . "'";
257
+					$sql .= " AND t.".$columnName." <= '".$db->idate($search[$key])."'";
258 258
 				}
259 259
 			}
260 260
 		}
Please login to merge, or discard this patch.
htdocs/asset/class/assetmodel.class.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	/**
101 101
 	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
102 102
 	 */
103
-	public $fields=array(
103
+	public $fields = array(
104 104
 		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
105 105
 		'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1'),
106 106
 		'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2', 'validate'=>'1',),
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 
447 447
 		// Protection
448 448
 		if ($this->status == self::STATUS_VALIDATED) {
449
-			dol_syslog(get_class($this) . "::validate action abandonned: already validated", LOG_WARNING);
449
+			dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
450 450
 			return 0;
451 451
 		}
452 452
 
@@ -455,17 +455,17 @@  discard block
 block discarded – undo
455 455
 		$this->db->begin();
456 456
 
457 457
 		// Validate
458
-		$sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element;
459
-		$sql .= " SET status = " . self::STATUS_VALIDATED;
458
+		$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
459
+		$sql .= " SET status = ".self::STATUS_VALIDATED;
460 460
 		if (!empty($this->fields['date_validation'])) {
461
-			$sql .= ", date_validation = '" . $this->db->idate($now) . "'";
461
+			$sql .= ", date_validation = '".$this->db->idate($now)."'";
462 462
 		}
463 463
 		if (!empty($this->fields['fk_user_valid'])) {
464
-			$sql .= ", fk_user_valid = " . ((int) $user->id);
464
+			$sql .= ", fk_user_valid = ".((int) $user->id);
465 465
 		}
466
-		$sql .= " WHERE rowid = " . ((int) $this->id);
466
+		$sql .= " WHERE rowid = ".((int) $this->id);
467 467
 
468
-		dol_syslog(get_class($this) . "::validate()", LOG_DEBUG);
468
+		dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
469 469
 		$resql = $this->db->query($sql);
470 470
 		if (!$resql) {
471 471
 			dol_print_error($this->db);
Please login to merge, or discard this patch.
htdocs/asset/class/assetaccountancycodes.class.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		foreach ($this->accountancy_codes_fields as $mode_key => $mode_info) {
90 90
 			$this->accountancy_codes[$mode_key] = array();
91 91
 			foreach ($mode_info['fields'] as $field_key => $field_info) {
92
-				$accountancy_code = GETPOST($mode_key . '_' . $field_key, 'aZ09');
92
+				$accountancy_code = GETPOST($mode_key.'_'.$field_key, 'aZ09');
93 93
 				if (empty($accountancy_code) || $accountancy_code == '-1') $accountancy_code = '';
94 94
 				$this->accountancy_codes[$mode_key][$field_key] = $accountancy_code;
95 95
 			}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	public function fetchAccountancyCodes($asset_id = 0, $asset_model_id = 0)
107 107
 	{
108 108
 		global $langs, $hookmanager;
109
-		dol_syslog(__METHOD__ . " asset_id=$asset_id, asset_model_id=$asset_model_id");
109
+		dol_syslog(__METHOD__." asset_id=$asset_id, asset_model_id=$asset_model_id");
110 110
 
111 111
 		$error = 0;
112 112
 		$this->errors = array();
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		$asset_model_id = $asset_model_id > 0 ? $asset_model_id : 0;
118 118
 
119 119
 		if (!is_object($hookmanager)) {
120
-			require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
120
+			require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
121 121
 			$hookmanager = new HookManager($this->db);
122 122
 		}
123 123
 
@@ -134,15 +134,15 @@  discard block
 block discarded – undo
134 134
 			$error++;
135 135
 		}
136 136
 		if ($error) {
137
-			dol_syslog(__METHOD__ . " Error check parameters: " . $this->errorsToString(), LOG_ERR);
137
+			dol_syslog(__METHOD__." Error check parameters: ".$this->errorsToString(), LOG_ERR);
138 138
 			return -1;
139 139
 		}
140 140
 
141 141
 		$accountancy_codes = array();
142 142
 		foreach ($this->accountancy_codes_fields as $mode_key => $mode_info) {
143
-			$sql = "SELECT " . implode(',', array_keys($mode_info['fields']));
144
-			$sql .= " FROM " . MAIN_DB_PREFIX . $mode_info['table'];
145
-			$sql .= " WHERE " . ($asset_id > 0 ? " fk_asset = " . (int) $asset_id : " fk_asset_model = " . (int) $asset_model_id);
143
+			$sql = "SELECT ".implode(',', array_keys($mode_info['fields']));
144
+			$sql .= " FROM ".MAIN_DB_PREFIX.$mode_info['table'];
145
+			$sql .= " WHERE ".($asset_id > 0 ? " fk_asset = ".(int) $asset_id : " fk_asset_model = ".(int) $asset_model_id);
146 146
 
147 147
 			$resql = $this->db->query($sql);
148 148
 			if ($resql) {
@@ -153,13 +153,13 @@  discard block
 block discarded – undo
153 153
 					}
154 154
 				}
155 155
 			} else {
156
-				$this->errors[] = $langs->trans('AssetErrorFetchAccountancyCodesForMode', $mode_key) . ': ' . $this->db->lasterror();
156
+				$this->errors[] = $langs->trans('AssetErrorFetchAccountancyCodesForMode', $mode_key).': '.$this->db->lasterror();
157 157
 				$error++;
158 158
 			}
159 159
 		}
160 160
 
161 161
 		if ($error) {
162
-			dol_syslog(__METHOD__ . " Error fetch accountancy codes: " . $this->errorsToString(), LOG_ERR);
162
+			dol_syslog(__METHOD__." Error fetch accountancy codes: ".$this->errorsToString(), LOG_ERR);
163 163
 			return -1;
164 164
 		} else {
165 165
 			$this->accountancy_codes = $accountancy_codes;
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 	public function updateAccountancyCodes($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0)
180 180
 	{
181 181
 		global $langs, $hookmanager;
182
-		dol_syslog(__METHOD__ . " user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger");
182
+		dol_syslog(__METHOD__." user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger");
183 183
 
184 184
 		$error = 0;
185 185
 		$this->errors = array();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		$asset_model_id = $asset_model_id > 0 ? $asset_model_id : 0;
190 190
 
191 191
 		if (!is_object($hookmanager)) {
192
-			require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
192
+			require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
193 193
 			$hookmanager = new HookManager($this->db);
194 194
 		}
195 195
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 			$error++;
207 207
 		}
208 208
 		if ($error) {
209
-			dol_syslog(__METHOD__ . " Error check parameters: " . $this->errorsToString(), LOG_ERR);
209
+			dol_syslog(__METHOD__." Error check parameters: ".$this->errorsToString(), LOG_ERR);
210 210
 			return -1;
211 211
 		}
212 212
 
@@ -215,32 +215,32 @@  discard block
 block discarded – undo
215 215
 
216 216
 		foreach ($this->accountancy_codes_fields as $mode_key => $mode_info) {
217 217
 			// Delete old accountancy codes
218
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . $mode_info['table'];
219
-			$sql .= " WHERE " . ($asset_id > 0 ? " fk_asset = " . (int) $asset_id : " fk_asset_model = " . (int) $asset_model_id);
218
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX.$mode_info['table'];
219
+			$sql .= " WHERE ".($asset_id > 0 ? " fk_asset = ".(int) $asset_id : " fk_asset_model = ".(int) $asset_model_id);
220 220
 			$resql = $this->db->query($sql);
221 221
 			if (!$resql) {
222
-				$this->errors[] = $langs->trans('AssetErrorDeleteAccountancyCodesForMode', $mode_key) . ': ' . $this->db->lasterror();
222
+				$this->errors[] = $langs->trans('AssetErrorDeleteAccountancyCodesForMode', $mode_key).': '.$this->db->lasterror();
223 223
 				$error++;
224 224
 			}
225 225
 
226 226
 			if (!$error && !empty($this->accountancy_codes[$mode_key])) {
227 227
 				// Insert accountancy codes
228
-				$sql = "INSERT INTO " . MAIN_DB_PREFIX . $mode_info['table'] . "(";
228
+				$sql = "INSERT INTO ".MAIN_DB_PREFIX.$mode_info['table']."(";
229 229
 				$sql .= $asset_id > 0 ? "fk_asset," : "fk_asset_model,";
230 230
 				$sql .= implode(',', array_keys($mode_info['fields']));
231 231
 				$sql .= ", tms, fk_user_modif";
232 232
 				$sql .= ") VALUES(";
233 233
 				$sql .= $asset_id > 0 ? $asset_id : $asset_model_id;
234 234
 				foreach ($mode_info['fields'] as $field_key => $field_info) {
235
-					$sql .= ', ' . (empty($this->accountancy_codes[$mode_key][$field_key]) ? 'NULL' : "'" . $this->db->escape($this->accountancy_codes[$mode_key][$field_key]) . "'");
235
+					$sql .= ', '.(empty($this->accountancy_codes[$mode_key][$field_key]) ? 'NULL' : "'".$this->db->escape($this->accountancy_codes[$mode_key][$field_key])."'");
236 236
 				}
237
-				$sql .= ", '" . $this->db->idate($now) . "'";
238
-				$sql .= ", " . $user->id;
237
+				$sql .= ", '".$this->db->idate($now)."'";
238
+				$sql .= ", ".$user->id;
239 239
 				$sql .= ")";
240 240
 
241 241
 				$resql = $this->db->query($sql);
242 242
 				if (!$resql) {
243
-					$this->errors[] = $langs->trans('AssetErrorInsertAccountancyCodesForMode', $mode_key) . ': ' . $this->db->lasterror();
243
+					$this->errors[] = $langs->trans('AssetErrorInsertAccountancyCodesForMode', $mode_key).': '.$this->db->lasterror();
244 244
 					$error++;
245 245
 				}
246 246
 			}
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 
249 249
 		if (!$error && $asset_id > 0) {
250 250
 			// Calculation of depreciation lines (reversal and future)
251
-			require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
251
+			require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
252 252
 			$asset = new Asset($this->db);
253 253
 			$result = $asset->fetch($asset_id);
254 254
 			if ($result > 0) $result = $asset->calculationDepreciation();
Please login to merge, or discard this patch.
htdocs/asset/class/assetdepreciationoptions.class.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 			'table'	=> 'asset_depreciation_options_economic',
79 79
 			'fields' => array(
80 80
 				'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',),
81
-				'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'),
81
+				'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'),
82 82
 				'duration' => array('type'=>'integer', 'label'=>'AssetDepreciationOptionDuration', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',),
83 83
 				'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',),
84 84
 				'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")',),
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 			'enabled_field' => 'economic:accelerated_depreciation_option:1',
95 95
 			'fields' => array(
96 96
 				'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',),
97
-				'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'),
97
+				'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'),
98 98
 				'duration' => array('type'=>'integer', 'label'=>'AssetDepreciationOptionDuration', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'validate'=>'1',),
99 99
 				'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',),
100 100
 				'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")',),
@@ -207,9 +207,9 @@  discard block
 block discarded – undo
207 207
 					continue;
208 208
 				}
209 209
 
210
-				$html_name = $mode_key . '_' . $field_key;
210
+				$html_name = $mode_key.'_'.$field_key;
211 211
 				if ($field_info['type'] == 'duration') {
212
-					if (GETPOST($html_name . 'hour') == '' && GETPOST($html_name . 'min') == '') {
212
+					if (GETPOST($html_name.'hour') == '' && GETPOST($html_name.'min') == '') {
213 213
 						continue; // The field was not submited to be saved
214 214
 					}
215 215
 				} else {
@@ -231,11 +231,11 @@  discard block
 block discarded – undo
231 231
 				if (in_array($field_info['type'], array('text', 'html'))) {
232 232
 					$value = GETPOST($html_name, 'restricthtml');
233 233
 				} elseif ($field_info['type'] == 'date') {
234
-					$value = dol_mktime(12, 0, 0, GETPOST($html_name . 'month', 'int'), GETPOST($html_name . 'day', 'int'), GETPOST($html_name . 'year', 'int')); // for date without hour, we use gmt
234
+					$value = dol_mktime(12, 0, 0, GETPOST($html_name.'month', 'int'), GETPOST($html_name.'day', 'int'), GETPOST($html_name.'year', 'int')); // for date without hour, we use gmt
235 235
 				} elseif ($field_info['type'] == 'datetime') {
236
-					$value = dol_mktime(GETPOST($html_name . 'hour', 'int'), GETPOST($html_name . 'min', 'int'), GETPOST($html_name . 'sec', 'int'), GETPOST($html_name . 'month', 'int'), GETPOST($html_name . 'day', 'int'), GETPOST($html_name . 'year', 'int'), 'tzuserrel');
236
+					$value = dol_mktime(GETPOST($html_name.'hour', 'int'), GETPOST($html_name.'min', 'int'), GETPOST($html_name.'sec', 'int'), GETPOST($html_name.'month', 'int'), GETPOST($html_name.'day', 'int'), GETPOST($html_name.'year', 'int'), 'tzuserrel');
237 237
 				} elseif ($field_info['type'] == 'duration') {
238
-					$value = 60 * 60 * GETPOST($html_name . 'hour', 'int') + 60 * GETPOST($html_name . 'min', 'int');
238
+					$value = 60 * 60 * GETPOST($html_name.'hour', 'int') + 60 * GETPOST($html_name.'min', 'int');
239 239
 				} elseif (preg_match('/^(integer|price|real|double)/', $field_info['type'])) {
240 240
 					$value = price2num(GETPOST($html_name, 'alphanohtml')); // To fix decimal separator according to lang setup
241 241
 				} elseif ($field_info['type'] == 'boolean') {
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				} elseif ($field_info['type'] == 'reference') {
244 244
 					// todo to check
245 245
 					$tmparraykey = array(); //array_keys($object->param_list);
246
-					$value = $tmparraykey[GETPOST($html_name)] . ',' . GETPOST($html_name . '2');
246
+					$value = $tmparraykey[GETPOST($html_name)].','.GETPOST($html_name.'2');
247 247
 				} else {
248 248
 					if ($field_key == 'lang') {
249 249
 						$value = GETPOST($html_name, 'aZ09') ? GETPOST($html_name, 'aZ09') : "";
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	public function fetchDeprecationOptions($asset_id = 0, $asset_model_id = 0)
310 310
 	{
311 311
 		global $langs, $hookmanager;
312
-		dol_syslog(__METHOD__ . " asset_id=$asset_id, asset_model_id=$asset_model_id");
312
+		dol_syslog(__METHOD__." asset_id=$asset_id, asset_model_id=$asset_model_id");
313 313
 
314 314
 		$error = 0;
315 315
 		$this->errors = array();
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 		$asset_model_id = $asset_model_id > 0 ? $asset_model_id : 0;
321 321
 
322 322
 		if (!is_object($hookmanager)) {
323
-			require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
323
+			require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
324 324
 			$hookmanager = new HookManager($this->db);
325 325
 		}
326 326
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 			$error++;
338 338
 		}
339 339
 		if ($error) {
340
-			dol_syslog(__METHOD__ . " Error check parameters: " . $this->errorsToString(), LOG_ERR);
340
+			dol_syslog(__METHOD__." Error check parameters: ".$this->errorsToString(), LOG_ERR);
341 341
 			return -1;
342 342
 		}
343 343
 
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 		foreach ($this->deprecation_options_fields as $mode_key => $mode_info) {
347 347
 			$this->setInfosForMode($mode_key, $class_type);
348 348
 
349
-			$result = $this->fetchCommon(0, '', " AND " . ($asset_id > 0 ? " fk_asset = " . (int) $asset_id : " fk_asset_model = " . (int) $asset_model_id));
349
+			$result = $this->fetchCommon(0, '', " AND ".($asset_id > 0 ? " fk_asset = ".(int) $asset_id : " fk_asset_model = ".(int) $asset_model_id));
350 350
 			if ($result < 0) {
351
-				$this->errors = array_merge(array($langs->trans('AssetErrorFetchDepreciationOptionsForMode', $mode_key) . ':'), $this->errors);
351
+				$this->errors = array_merge(array($langs->trans('AssetErrorFetchDepreciationOptionsForMode', $mode_key).':'), $this->errors);
352 352
 				$error++;
353 353
 			} elseif ($result > 0) {
354 354
 				foreach ($this->fields as $field_key => $field_info) {
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 		}
369 369
 
370 370
 		if ($error) {
371
-			dol_syslog(__METHOD__ . " Error fetch accountancy codes: " . $this->errorsToString(), LOG_ERR);
371
+			dol_syslog(__METHOD__." Error fetch accountancy codes: ".$this->errorsToString(), LOG_ERR);
372 372
 			return -1;
373 373
 		} else {
374 374
 			$this->deprecation_options = $deprecation_options;
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 	public function getGeneralDepreciationInfoForMode($mode)
386 386
 	{
387 387
 		global $hookmanager;
388
-		dol_syslog(__METHOD__ . " mode=$mode");
388
+		dol_syslog(__METHOD__." mode=$mode");
389 389
 
390 390
 		$this->errors = array();
391 391
 
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 		$mode = strtolower(trim($mode));
394 394
 
395 395
 		if (!is_object($hookmanager)) {
396
-			require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
396
+			require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
397 397
 			$hookmanager = new HookManager($this->db);
398 398
 		}
399 399
 
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	public function updateDeprecationOptions($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0)
429 429
 	{
430 430
 		global $langs, $hookmanager;
431
-		dol_syslog(__METHOD__ . " user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger");
431
+		dol_syslog(__METHOD__." user_id={$user->id}, asset_id=$asset_id, asset_model_id=$asset_model_id, notrigger=$notrigger");
432 432
 
433 433
 		$error = 0;
434 434
 		$this->errors = array();
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		$asset_model_id = $asset_model_id > 0 ? $asset_model_id : 0;
439 439
 
440 440
 		if (!is_object($hookmanager)) {
441
-			require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
441
+			require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
442 442
 			$hookmanager = new HookManager($this->db);
443 443
 		}
444 444
 
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
 			$error++;
456 456
 		}
457 457
 		if ($error) {
458
-			dol_syslog(__METHOD__ . " Error check parameters: " . $this->errorsToString(), LOG_ERR);
458
+			dol_syslog(__METHOD__." Error check parameters: ".$this->errorsToString(), LOG_ERR);
459 459
 			return -1;
460 460
 		}
461 461
 
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 
474 474
 		foreach ($this->deprecation_options_fields as $mode_key => $mode_info) {
475 475
 			// Delete old accountancy codes
476
-			$sql = "DELETE FROM " . MAIN_DB_PREFIX . $mode_info['table'];
477
-			$sql .= " WHERE " . ($asset_id > 0 ? " fk_asset = " . (int) $asset_id : " fk_asset_model = " . (int) $asset_model_id);
476
+			$sql = "DELETE FROM ".MAIN_DB_PREFIX.$mode_info['table'];
477
+			$sql .= " WHERE ".($asset_id > 0 ? " fk_asset = ".(int) $asset_id : " fk_asset_model = ".(int) $asset_model_id);
478 478
 			$resql = $this->db->query($sql);
479 479
 			if (!$resql) {
480
-				$this->errors[] = $langs->trans('AssetErrorDeleteDepreciationOptionsForMode', $mode_key) . ': ' . $this->db->lasterror();
480
+				$this->errors[] = $langs->trans('AssetErrorDeleteDepreciationOptionsForMode', $mode_key).': '.$this->db->lasterror();
481 481
 				$error++;
482 482
 			}
483 483
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 
494 494
 				$result = $this->createCommon($user, 1);
495 495
 				if ($result < 0) {
496
-					$this->errors = array_merge(array($langs->trans('AssetErrorInsertDepreciationOptionsForMode', $mode_key) . ':'), $this->errors);
496
+					$this->errors = array_merge(array($langs->trans('AssetErrorInsertDepreciationOptionsForMode', $mode_key).':'), $this->errors);
497 497
 					$error++;
498 498
 				}
499 499
 			}
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
 
502 502
 		if (!$error && $this->fk_asset > 0) {
503 503
 			// Calculation of depreciation lines (reversal and future)
504
-			require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php';
504
+			require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php';
505 505
 			$asset = new Asset($this->db);
506 506
 			$result = $asset->fetch($this->fk_asset);
507 507
 			if ($result > 0) $result = $asset->calculationDepreciation();
Please login to merge, or discard this patch.