Completed
Branch develop (7cec96)
by
unknown
15:04
created
htdocs/asset/model/agenda.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 
25 25
 // Load Dolibarr environment
26 26
 require '../../main.inc.php';
27
-require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php';
28
-require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php';
29
-require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php';
30
-require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
31
-require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
28
+require_once DOL_DOCUMENT_ROOT.'/asset/class/assetmodel.class.php';
29
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
31
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
32 32
 
33 33
 // Load translation files required by the page
34 34
 $langs->loadLangs(array("assets", "other"));
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 // Initialize technical objects
72 72
 $object = new AssetModel($db);
73 73
 $extrafields = new ExtraFields($db);
74
-$diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id;
74
+$diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id;
75 75
 $hookmanager->initHooks(array('assetmodelagenda', 'globalcard')); // Note that conf->hooks_modules contains array
76 76
 // Fetch optionals attributes and labels
77 77
 $extrafields->fetch_name_optionals_label($object->table_element);
78 78
 
79 79
 // Load object
80
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
80
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
81 81
 if ($id > 0 || !empty($ref)) {
82
-	$upload_dir = $conf->asset->multidir_output[$object->entity] . "/model/" . $object->id;
82
+	$upload_dir = $conf->asset->multidir_output[$object->entity]."/model/".$object->id;
83 83
 }
84 84
 
85 85
 $permissiontoread = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read')));
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 if (empty($reshook)) {
108 108
 	// Cancel
109 109
 	if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
110
-		header("Location: " . $backtopage);
110
+		header("Location: ".$backtopage);
111 111
 		exit;
112 112
 	}
113 113
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 
142 142
 	// Object card
143 143
 	// ------------------------------------------------------------
144
-	$linkback = '<a href="' . DOL_URL_ROOT . '/asset/model/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
144
+	$linkback = '<a href="'.DOL_URL_ROOT.'/asset/model/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
145 145
 
146 146
 	$morehtmlref = '<div class="refidno">';
147 147
 	$morehtmlref .= '</div>';
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
 	$objthirdparty = $object;
166 166
 	$objcon = new stdClass();
167 167
 
168
-	$out = '&origin=' . urlencode($object->element . '@' . $object->module) . '&originid=' . urlencode($object->id);
169
-	$urlbacktopage = $_SERVER['PHP_SELF'] . '?id=' . $object->id;
170
-	$out .= '&backtopage=' . urlencode($urlbacktopage);
168
+	$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
169
+	$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
170
+	$out .= '&backtopage='.urlencode($urlbacktopage);
171 171
 	$permok = $user->hasRight('agenda', 'myactions', 'create');
172 172
 	if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
173 173
 		//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
174 174
 		if (get_class($objthirdparty) == 'Societe') {
175
-			$out .= '&socid=' . urlencode($objthirdparty->id);
175
+			$out .= '&socid='.urlencode($objthirdparty->id);
176 176
 		}
177
-		$out .= (!empty($objcon->id) ? '&contactid=' . urlencode($objcon->id) : '');
177
+		$out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '');
178 178
 		//$out.=$langs->trans("AddAnAction").' ';
179 179
 		//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
180 180
 		//$out.="</a>";
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,12 +86,20 @@
 block discarded – undo
86 86
 $permissiontoadd = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'write')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'write'))); // Used by the include of actions_addupdatedelete.inc.php
87 87
 
88 88
 // Security check (enable the most restrictive one)
89
-if ($user->socid > 0) accessforbidden();
90
-if ($user->socid > 0) $socid = $user->socid;
89
+if ($user->socid > 0) {
90
+	accessforbidden();
91
+}
92
+if ($user->socid > 0) {
93
+	$socid = $user->socid;
94
+}
91 95
 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
92 96
 restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
93
-if (!isModEnabled('asset')) accessforbidden();
94
-if (!$permissiontoread) accessforbidden();
97
+if (!isModEnabled('asset')) {
98
+	accessforbidden();
99
+}
100
+if (!$permissiontoread) {
101
+	accessforbidden();
102
+}
95 103
 
96 104
 
97 105
 /*
Please login to merge, or discard this patch.
htdocs/asset/model/depreciation_options.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 
25 25
 // Load Dolibarr environment
26 26
 require '../../main.inc.php';
27
-require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php';
28
-require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php';
29
-require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
28
+require_once DOL_DOCUMENT_ROOT.'/asset/class/assetmodel.class.php';
29
+require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
30 30
 
31 31
 // Load translation files required by the page
32 32
 $langs->loadLangs(array("assets", "companies"));
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
 $object = new AssetModel($db);
43 43
 $assetdepreciationoptions = new AssetDepreciationOptions($db);
44 44
 $extrafields = new ExtraFields($db);
45
-$diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id;
45
+$diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id;
46 46
 $hookmanager->initHooks(array('assetmodeldeprectationoptions', 'globalcard')); // Note that conf->hooks_modules contains array
47 47
 // Fetch optionals attributes and labels
48 48
 $extrafields->fetch_name_optionals_label($object->table_element);
49 49
 
50 50
 // Load object
51
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
51
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
52 52
 if ($id > 0 || !empty($ref)) {
53
-	$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
53
+	$upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id;
54 54
 }
55 55
 
56 56
 $permissiontoread = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read')));
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			$action = 'edit';
112 112
 		} else {
113 113
 			setEventMessage($langs->trans('RecordSaved'));
114
-			header("Location: " . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
114
+			header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
115 115
 			exit;
116 116
 		}
117 117
 	}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
 	// Object card
135 135
 	// ------------------------------------------------------------
136
-	$linkback = '<a href="' . DOL_URL_ROOT . '/asset/model/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
136
+	$linkback = '<a href="'.DOL_URL_ROOT.'/asset/model/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
137 137
 
138 138
 	$morehtmlref = '<div class="refidno">';
139 139
 	$morehtmlref .= '</div>';
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
 	print '</div>';
146 146
 
147 147
 	if ($action == 'edit') {
148
-		print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">';
149
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
148
+		print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
149
+		print '<input type="hidden" name="token" value="'.newToken().'">';
150 150
 		print '<input type="hidden" name="action" value="update">';
151 151
 		if ($backtopage) {
152
-			print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
152
+			print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
153 153
 		}
154 154
 		if ($backtopageforcancel) {
155
-			print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
155
+			print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
156 156
 		}
157 157
 
158 158
 		print dol_get_fiche_head(array(), '');
159 159
 
160
-		include DOL_DOCUMENT_ROOT . '/asset/tpl/depreciation_options_edit.tpl.php';
160
+		include DOL_DOCUMENT_ROOT.'/asset/tpl/depreciation_options_edit.tpl.php';
161 161
 
162 162
 		print dol_get_fiche_end();
163 163
 
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 
166 166
 		print '</form>';
167 167
 	} else {
168
-		include DOL_DOCUMENT_ROOT . '/asset/tpl/depreciation_options_view.tpl.php';
168
+		include DOL_DOCUMENT_ROOT.'/asset/tpl/depreciation_options_view.tpl.php';
169 169
 	}
170 170
 
171 171
 	print dol_get_fiche_end();
172 172
 
173 173
 	if ($action != 'edit') {
174
-		print '<div class="tabsAction">' . "\n";
174
+		print '<div class="tabsAction">'."\n";
175 175
 		$parameters = array();
176 176
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
177 177
 		if ($reshook < 0) {
@@ -180,10 +180,10 @@  discard block
 block discarded – undo
180 180
 
181 181
 		if (empty($reshook)) {
182 182
 			if ($object->status == $object::STATUS_DRAFT/* && !empty($object->enabled_modes)*/) {
183
-				print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
183
+				print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
184 184
 			}
185 185
 		}
186
-		print '</div>' . "\n";
186
+		print '</div>'."\n";
187 187
 	}
188 188
 }
189 189
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -57,11 +57,17 @@  discard block
 block discarded – undo
57 57
 $permissiontoadd = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'write')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'write'))); // Used by the include of actions_addupdatedelete.inc.php
58 58
 
59 59
 // Security check (enable the most restrictive one)
60
-if ($user->socid > 0) accessforbidden();
60
+if ($user->socid > 0) {
61
+	accessforbidden();
62
+}
61 63
 $isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
62 64
 restrictedArea($user, 'asset', $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
63
-if (!isModEnabled('asset')) accessforbidden();
64
-if (!$permissiontoread) accessforbidden();
65
+if (!isModEnabled('asset')) {
66
+	accessforbidden();
67
+}
68
+if (!$permissiontoread) {
69
+	accessforbidden();
70
+}
65 71
 
66 72
 $object->asset_depreciation_options = &$assetdepreciationoptions;
67 73
 $result = $assetdepreciationoptions->fetchDeprecationOptions(0, $object->id);
@@ -105,7 +111,9 @@  discard block
 block discarded – undo
105 111
 
106 112
 	if ($action == "update") {
107 113
 		$result = $assetdepreciationoptions->setDeprecationOptionsFromPost(1);
108
-		if ($result > 0) $result = $assetdepreciationoptions->updateDeprecationOptions($user, 0, $object->id);
114
+		if ($result > 0) {
115
+			$result = $assetdepreciationoptions->updateDeprecationOptions($user, 0, $object->id);
116
+		}
109 117
 		if ($result < 0) {
110 118
 			setEventMessages($assetdepreciationoptions->error, $assetdepreciationoptions->errors, 'errors');
111 119
 			$action = 'edit';
Please login to merge, or discard this patch.
htdocs/asset/model/note.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 
25 25
 // Load Dolibarr environment
26 26
 require '../../main.inc.php';
27
-require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php';
28
-require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
28
+require_once DOL_DOCUMENT_ROOT.'/asset/class/assetmodel.class.php';
29 29
 
30 30
 // Load translation files required by the page
31 31
 $langs->loadLangs(array("assets", "companies"));
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 // Initialize technical objects
41 41
 $object = new AssetModel($db);
42 42
 $extrafields = new ExtraFields($db);
43
-$diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id;
43
+$diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id;
44 44
 $hookmanager->initHooks(array('assetmodelnote', 'globalcard')); // Note that conf->hooks_modules contains array
45 45
 // Fetch optionals attributes and labels
46 46
 $extrafields->fetch_name_optionals_label($object->table_element);
47 47
 
48 48
 // Load object
49
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
49
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
50 50
 if ($id > 0 || !empty($ref)) {
51
-	$upload_dir = $conf->asset->multidir_output[$object->entity] . "/" . $object->id;
51
+	$upload_dir = $conf->asset->multidir_output[$object->entity]."/".$object->id;
52 52
 }
53 53
 
54 54
 $permissiontoread = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read')));
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
75 75
 }
76 76
 if (empty($reshook)) {
77
-	include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not include_once
77
+	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
78 78
 }
79 79
 
80 80
 
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 	// Object card
98 98
 	// ------------------------------------------------------------
99
-	$linkback = '<a href="' . DOL_URL_ROOT . '/asset/model/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
99
+	$linkback = '<a href="'.DOL_URL_ROOT.'/asset/model/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
100 100
 
101 101
 	$morehtmlref = '<div class="refidno">';
102 102
 	$morehtmlref .= '</div>';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 
111 111
 
112 112
 	$cssclass = "titlefield";
113
-	include DOL_DOCUMENT_ROOT . '/core/tpl/notes.tpl.php';
113
+	include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
114 114
 
115 115
 	print '</div>';
116 116
 
Please login to merge, or discard this patch.
htdocs/asset/model/card.php 1 patch
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 
25 25
 // Load Dolibarr environment
26 26
 require '../../main.inc.php';
27
-require_once DOL_DOCUMENT_ROOT . '/core/lib/asset.lib.php';
28
-require_once DOL_DOCUMENT_ROOT . '/asset/class/assetmodel.class.php';
29
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
30
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
27
+require_once DOL_DOCUMENT_ROOT.'/core/lib/asset.lib.php';
28
+require_once DOL_DOCUMENT_ROOT.'/asset/class/assetmodel.class.php';
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
31 31
 
32 32
 // Load translation files required by the page
33 33
 $langs->loadLangs(array("assets", "other"));
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 // Initialize technical objects
46 46
 $object = new AssetModel($db);
47 47
 $extrafields = new ExtraFields($db);
48
-$diroutputmassaction = $conf->asset->dir_output . '/temp/massgeneration/' . $user->id;
48
+$diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id;
49 49
 $hookmanager->initHooks(array('assetmodelcard', 'globalcard')); // Note that conf->hooks_modules contains array
50 50
 
51 51
 // Fetch optionals attributes and labels
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
 $search_all = GETPOST("search_all", 'alpha');
58 58
 $search = array();
59 59
 foreach ($object->fields as $key => $val) {
60
-	if (GETPOST('search_' . $key, 'alpha')) {
61
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
60
+	if (GETPOST('search_'.$key, 'alpha')) {
61
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
62 62
 	}
63 63
 }
64 64
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 }
68 68
 
69 69
 // Load object
70
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
70
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
71 71
 
72 72
 $permissiontoread = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'read')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'read')));
73 73
 $permissiontoadd = ((!getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'write')) || (getDolGlobalString('MAIN_USE_ADVANCED_PERMS') && $user->hasRight('asset', 'model_advance', 'write'))); // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
 if (empty($reshook)) {
99 99
 	$error = 0;
100 100
 
101
-	$backurlforlist = DOL_URL_ROOT . '/asset/model/list.php';
101
+	$backurlforlist = DOL_URL_ROOT.'/asset/model/list.php';
102 102
 
103 103
 	if (empty($backtopage) || ($cancel && empty($id))) {
104 104
 		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
105 105
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
106 106
 				$backtopage = $backurlforlist;
107 107
 			} else {
108
-				$backtopage = DOL_URL_ROOT . '/asset/model/card.php?id=' . ((!empty($id) && $id > 0) ? $id : '__ID__');
108
+				$backtopage = DOL_URL_ROOT.'/asset/model/card.php?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
109 109
 			}
110 110
 		}
111 111
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	}
122 122
 
123 123
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
124
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
124
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
125 125
 }
126 126
 
127 127
 
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 $form = new Form($db);
135 135
 $formfile = new FormFile($db);
136 136
 
137
-$title = $langs->trans("AssetModel") . ' - ' . $langs->trans("Card");
137
+$title = $langs->trans("AssetModel").' - '.$langs->trans("Card");
138 138
 $help_url = '';
139 139
 llxHeader('', $title, $help_url);
140 140
 
141 141
 // Part to create
142 142
 if ($action == 'create') {
143
-	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("AssetModel")), '', 'object_' . $object->picto);
143
+	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("AssetModel")), '', 'object_'.$object->picto);
144 144
 
145
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
146
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
145
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
146
+	print '<input type="hidden" name="token" value="'.newToken().'">';
147 147
 	print '<input type="hidden" name="action" value="add">';
148 148
 	if ($backtopage) {
149
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
149
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
150 150
 	}
151 151
 	if ($backtopageforcancel) {
152
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
152
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
153 153
 	}
154 154
 
155 155
 	print dol_get_fiche_head(array(), '');
@@ -157,15 +157,15 @@  discard block
 block discarded – undo
157 157
 	// Set some default values
158 158
 	//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
159 159
 
160
-	print '<table class="border centpercent tableforfieldcreate">' . "\n";
160
+	print '<table class="border centpercent tableforfieldcreate">'."\n";
161 161
 
162 162
 	// Common attributes
163
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
163
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
164 164
 
165 165
 	// Other attributes
166
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
166
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
167 167
 
168
-	print '</table>' . "\n";
168
+	print '</table>'."\n";
169 169
 
170 170
 	print dol_get_fiche_end();
171 171
 
@@ -178,28 +178,28 @@  discard block
 block discarded – undo
178 178
 
179 179
 // Part to edit record
180 180
 if (($id || $ref) && $action == 'edit') {
181
-	print load_fiche_titre($langs->trans("AssetModel"), '', 'object_' . $object->picto);
181
+	print load_fiche_titre($langs->trans("AssetModel"), '', 'object_'.$object->picto);
182 182
 
183
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
184
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
183
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
184
+	print '<input type="hidden" name="token" value="'.newToken().'">';
185 185
 	print '<input type="hidden" name="action" value="update">';
186
-	print '<input type="hidden" name="id" value="' . $object->id . '">';
186
+	print '<input type="hidden" name="id" value="'.$object->id.'">';
187 187
 	if ($backtopage) {
188
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
188
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
189 189
 	}
190 190
 	if ($backtopageforcancel) {
191
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
191
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
192 192
 	}
193 193
 
194 194
 	print dol_get_fiche_head();
195 195
 
196
-	print '<table class="border centpercent tableforfieldedit">' . "\n";
196
+	print '<table class="border centpercent tableforfieldedit">'."\n";
197 197
 
198 198
 	// Common attributes
199
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
199
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
200 200
 
201 201
 	// Other attributes
202
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
202
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
203 203
 
204 204
 	print '</table>';
205 205
 
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
 
222 222
 	// Confirmation to delete
223 223
 	if ($action == 'delete') {
224
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteAssetModel'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
224
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssetModel'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
225 225
 	} elseif ($action == 'clone') {
226 226
 		// Clone confirmation
227 227
 		// Create an array for form
228 228
 		$formquestion = array();
229
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
229
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
230 230
 	}
231 231
 
232 232
 	// Call Hook formConfirm
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 	// Object card
246 246
 	// ------------------------------------------------------------
247
-	$linkback = '<a href="' . DOL_URL_ROOT . '/asset/model/list.php?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
247
+	$linkback = '<a href="'.DOL_URL_ROOT.'/asset/model/list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
248 248
 
249 249
 	$morehtmlref = '<div class="refidno">';
250 250
 	$morehtmlref .= '</div>';
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
 	print '<div class="fichecenter">';
257 257
 	print '<div class="fichehalfleft">';
258 258
 	print '<div class="underbanner clearboth"></div>';
259
-	print '<table class="border centpercent tableforfield">' . "\n";
259
+	print '<table class="border centpercent tableforfield">'."\n";
260 260
 
261 261
 	// Common attributes
262
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
262
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
263 263
 
264 264
 	// Other attributes. Fields from hook formObjectOptions and Extrafields.
265
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
265
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
266 266
 
267 267
 	print '</table>';
268 268
 	print '</div>';
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 
276 276
 	// Buttons for actions
277 277
 	if ($action != 'editline') {
278
-		print '<div class="tabsAction">' . "\n";
278
+		print '<div class="tabsAction">'."\n";
279 279
 		$parameters = array();
280 280
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
281 281
 		if ($reshook < 0) {
@@ -284,16 +284,16 @@  discard block
 block discarded – undo
284 284
 
285 285
 		if (empty($reshook)) {
286 286
 			if ($object->status == $object::STATUS_DRAFT) {
287
-				print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
287
+				print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
288 288
 			}
289 289
 
290 290
 			// Back to draft
291 291
 			if ($object->status != $object::STATUS_DRAFT) {
292
-				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd);
292
+				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
293 293
 			}
294 294
 
295 295
 			if ($object->status != $object::STATUS_VALIDATED) {
296
-				print dolGetButtonAction($langs->trans('Enable'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=confirm_validate&confirm=yes&token=' . newToken(), '', $permissiontoadd);
296
+				print dolGetButtonAction($langs->trans('Enable'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd);
297 297
 			}
298 298
 
299 299
 			if ($object->status != $object::STATUS_CANCELED) {
@@ -301,12 +301,12 @@  discard block
 block discarded – undo
301 301
 			}
302 302
 
303 303
 			// Clone
304
-			print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'] . '?id=' . $object->id . (!empty($socid) ? '&socid=' . $socid : '') . '&action=clone&token=' . newToken(), '', $permissiontoadd);
304
+			print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($socid) ? '&socid='.$socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd);
305 305
 
306 306
 			// Delete (need delete permission, or if draft, just need create/modify permission)
307
-			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
307
+			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
308 308
 		}
309
-		print '</div>' . "\n";
309
+		print '</div>'."\n";
310 310
 	}
311 311
 
312 312
 	print '<div class="fichecenter"><div class="fichehalfleft">';
Please login to merge, or discard this patch.
htdocs/asset/class/asset.class.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 */
61 61
 	public $picto = 'asset';
62 62
 
63
-	const STATUS_DRAFT = 0; 	// In progress
64
-	const STATUS_DISPOSED = 9;	// Disposed
63
+	const STATUS_DRAFT = 0; // In progress
64
+	const STATUS_DISPOSED = 9; // Disposed
65 65
 
66 66
 	/**
67 67
 	 *  'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password')
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	/**
95 95
 	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
96 96
 	 */
97
-	public $fields=array(
97
+	public $fields = array(
98 98
 		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
99 99
 		'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1', 'comment'=>"Reference of object"),
100 100
 		'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',),
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
 		// Check parameters
527 527
 		$error = 0;
528 528
 		if (empty($this->id)) {
529
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
529
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
530 530
 			$error++;
531 531
 		}
532 532
 		if (empty($this->fk_asset_model)) {
533
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
533
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetModel").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
534 534
 			$error++;
535 535
 		}
536 536
 		if ($error) {
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 
542 542
 		// Get depreciation options
543 543
 		//---------------------------
544
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
544
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
545 545
 		$options_model = new AssetDepreciationOptions($this->db);
546 546
 		$result = $options_model->fetchDeprecationOptions(0, $this->fk_asset_model);
547 547
 		if ($result < 0) {
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 		// Get accountancy codes
577 577
 		//---------------------------
578 578
 		if (!$error) {
579
-			require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
579
+			require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
580 580
 			$accountancy_codes_model = new AssetAccountancyCodes($this->db);
581 581
 			$result = $accountancy_codes_model->fetchAccountancyCodes(0, $this->fk_asset_model);
582 582
 			if ($result < 0) {
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 		// Check parameters
636 636
 		$error = 0;
637 637
 		if (empty($this->id)) {
638
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
638
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
639 639
 			$error++;
640 640
 		}
641 641
 		if ($error) {
@@ -658,15 +658,15 @@  discard block
 block discarded – undo
658 658
 		*/
659 659
 
660 660
 		$sql = "SELECT ad.rowid, ad.depreciation_mode, ad.ref, ad.depreciation_date, ad.depreciation_ht, ad.cumulative_depreciation_ht";
661
-		$sql .= ", " . $this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0) . " AS bookkeeping";
662
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
663
-		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
664
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
661
+		$sql .= ", ".$this->db->ifsql('iab.fk_docdet IS NOT NULL', 1, 0)." AS bookkeeping";
662
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
663
+		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
664
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
665 665
 		$sql .= " ORDER BY ad.depreciation_date ASC";
666 666
 
667 667
 		$resql = $this->db->query($sql);
668 668
 		if (!$resql) {
669
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
669
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
670 670
 			return -1;
671 671
 		}
672 672
 
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 		// Check parameters
702 702
 		$error = 0;
703 703
 		if (empty($this->id)) {
704
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
704
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
705 705
 			$error++;
706 706
 		}
707 707
 		if ($error) {
@@ -723,14 +723,14 @@  discard block
 block discarded – undo
723 723
 		*/
724 724
 
725 725
 		$sql = "SELECT COUNT(*) AS has_bookkeeping";
726
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
727
-		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
728
-		$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
726
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
727
+		$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
728
+		$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
729 729
 		$sql .= " AND iab.fk_docdet IS NOT NULL";
730 730
 
731 731
 		$resql = $this->db->query($sql);
732 732
 		if (!$resql) {
733
-			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines') . ': ' . $this->db->lasterror();
733
+			$this->errors[] = $langs->trans('AssetErrorFetchDepreciationLines').': '.$this->db->lasterror();
734 734
 			return -1;
735 735
 		}
736 736
 
@@ -768,28 +768,28 @@  discard block
 block discarded – undo
768 768
 		// Check parameters
769 769
 		$error = 0;
770 770
 		if (empty($this->id)) {
771
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
771
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
772 772
 			$error++;
773 773
 		}
774 774
 		if ($error) {
775 775
 			return -1;
776 776
 		}
777 777
 
778
-		$sql = "INSERT INTO " . MAIN_DB_PREFIX . "asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)";
778
+		$sql = "INSERT INTO ".MAIN_DB_PREFIX."asset_depreciation(fk_asset, depreciation_mode, ref, depreciation_date, depreciation_ht, cumulative_depreciation_ht, accountancy_code_debit, accountancy_code_credit)";
779 779
 		$sql .= " VALUES ( ";
780
-		$sql .= " " . (int) $this->id;
781
-		$sql .= ", '" . $this->db->escape($mode) . "'";
782
-		$sql .= ", '" . $this->db->escape($ref) . "'";
783
-		$sql .= ", '" . $this->db->idate($depreciation_date) . "'";
784
-		$sql .= ", " . (double) $depreciation_ht;
785
-		$sql .= ", " . (double) $cumulative_depreciation_ht;
786
-		$sql .= ", '" . $this->db->escape($accountancy_code_debit) . "'";
787
-		$sql .= ", '" . $this->db->escape($accountancy_code_credit) . "'";
780
+		$sql .= " ".(int) $this->id;
781
+		$sql .= ", '".$this->db->escape($mode)."'";
782
+		$sql .= ", '".$this->db->escape($ref)."'";
783
+		$sql .= ", '".$this->db->idate($depreciation_date)."'";
784
+		$sql .= ", ".(double) $depreciation_ht;
785
+		$sql .= ", ".(double) $cumulative_depreciation_ht;
786
+		$sql .= ", '".$this->db->escape($accountancy_code_debit)."'";
787
+		$sql .= ", '".$this->db->escape($accountancy_code_credit)."'";
788 788
 		$sql .= ")";
789 789
 
790 790
 		$resql = $this->db->query($sql);
791 791
 		if (!$resql) {
792
-			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine') . ': ' . $this->db->lasterror();
792
+			$this->errors[] = $langs->trans('AssetErrorAddDepreciationLine').': '.$this->db->lasterror();
793 793
 			return -1;
794 794
 		}
795 795
 
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 		// Check parameters
813 813
 		$error = 0;
814 814
 		if (empty($this->id)) {
815
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
815
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Asset").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
816 816
 			$error++;
817 817
 		}
818 818
 		if ($error) {
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 
822 822
 		// Get depreciation options
823 823
 		//---------------------------
824
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
824
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
825 825
 		$options = new AssetDepreciationOptions($this->db);
826 826
 		$result = $options->fetchDeprecationOptions($this->id);
827 827
 		if ($result < 0) {
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 
833 833
 		// Get accountancy codes
834 834
 		//---------------------------
835
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetaccountancycodes.class.php';
835
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetaccountancycodes.class.php';
836 836
 		$accountancy_codes = new AssetAccountancyCodes($this->db);
837 837
 		$result = $accountancy_codes->fetchAccountancyCodes($this->id);
838 838
 		if ($result < 0) {
@@ -848,20 +848,20 @@  discard block
 block discarded – undo
848 848
 		foreach ($options->deprecation_options as $mode_key => $fields) {
849 849
 			$modes[$mode_key] = $this->db->escape($mode_key);
850 850
 		}
851
-		$sql = "DELETE FROM " . MAIN_DB_PREFIX . "asset_depreciation";
852
-		$sql .= " WHERE fk_asset = " . (int) $this->id;
853
-		$sql .= " AND depreciation_mode NOT IN ('" . $this->db->sanitize(implode("', '", $modes)) . "')";
851
+		$sql = "DELETE FROM ".MAIN_DB_PREFIX."asset_depreciation";
852
+		$sql .= " WHERE fk_asset = ".(int) $this->id;
853
+		$sql .= " AND depreciation_mode NOT IN ('".$this->db->sanitize(implode("', '", $modes))."')";
854 854
 
855 855
 		$resql = $this->db->query($sql);
856 856
 		if (!$resql) {
857
-			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
857
+			$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
858 858
 			$error++;
859 859
 		}
860 860
 
861 861
 		if (!$error) {
862 862
 			// Get fiscal period
863
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
864
-			require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php';
863
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
864
+			require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
865 865
 			$dates = getDefaultDatesForTransfer();
866 866
 			$init_fiscal_period_start = $dates['date_start'];
867 867
 			$init_fiscal_period_end = $dates['date_end'];
@@ -894,17 +894,17 @@  discard block
 block discarded – undo
894 894
 				*/
895 895
 
896 896
 				$sql = "SELECT ad.depreciation_date, ad.cumulative_depreciation_ht";
897
-				$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation AS ad";
898
-				$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
899
-				$sql .= " WHERE ad.fk_asset = " . (int) $this->id;
900
-				$sql .= " AND ad.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
897
+				$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation AS ad";
898
+				$sql .= " LEFT JOIN (SELECT DISTINCT fk_docdet FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE doc_type = 'asset') AS iab ON iab.fk_docdet = ad.rowid";
899
+				$sql .= " WHERE ad.fk_asset = ".(int) $this->id;
900
+				$sql .= " AND ad.depreciation_mode = '".$this->db->escape($mode_key)."'";
901 901
 				$sql .= " AND iab.fk_docdet IS NOT NULL";
902 902
 				$sql .= " ORDER BY ad.depreciation_date DESC";
903 903
 				$sql .= " LIMIT 1";
904 904
 
905 905
 				$resql = $this->db->query($sql);
906 906
 				if (!$resql) {
907
-					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key) . ': ' . $this->db->lasterror();
907
+					$this->errors[] = $langs->trans('AssetErrorFetchMaxDepreciationDateForMode', $mode_key).': '.$this->db->lasterror();
908 908
 					$error++;
909 909
 					break;
910 910
 				}
@@ -916,26 +916,26 @@  discard block
 block discarded – undo
916 916
 				}
917 917
 
918 918
 				// Set last cumulative depreciation
919
-				$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
920
-				$sql .= " SET total_amount_last_depreciation_ht = " . (empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
921
-				$sql .= " WHERE fk_asset = " . (int) $this->id;
919
+				$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
920
+				$sql .= " SET total_amount_last_depreciation_ht = ".(empty($last_cumulative_depreciation_ht) ? 0 : $last_cumulative_depreciation_ht);
921
+				$sql .= " WHERE fk_asset = ".(int) $this->id;
922 922
 				$resql = $this->db->query($sql);
923 923
 				if (!$resql) {
924
-					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
924
+					$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
925 925
 					$error++;
926 926
 					break;
927 927
 				}
928 928
 
929 929
 				// Delete old lines
930
-				$sql = "DELETE " . MAIN_DB_PREFIX . "asset_depreciation FROM " . MAIN_DB_PREFIX . "asset_depreciation";
931
-				$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";
932
-				$sql .= " WHERE " . MAIN_DB_PREFIX . "asset_depreciation.fk_asset = " . (int) $this->id;
933
-				$sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.depreciation_mode = '" . $this->db->escape($mode_key) . "'";
930
+				$sql = "DELETE ".MAIN_DB_PREFIX."asset_depreciation FROM ".MAIN_DB_PREFIX."asset_depreciation";
931
+				$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";
932
+				$sql .= " WHERE ".MAIN_DB_PREFIX."asset_depreciation.fk_asset = ".(int) $this->id;
933
+				$sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.depreciation_mode = '".$this->db->escape($mode_key)."'";
934 934
 				$sql .= " AND ab.fk_docdet IS NULL";
935
-				if ($last_depreciation_date !== "") $sql .= " AND " . MAIN_DB_PREFIX . "asset_depreciation.ref != ''";
935
+				if ($last_depreciation_date !== "") $sql .= " AND ".MAIN_DB_PREFIX."asset_depreciation.ref != ''";
936 936
 				$resql = $this->db->query($sql);
937 937
 				if (!$resql) {
938
-					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines') . ': ' . $this->db->lasterror();
938
+					$this->errors[] = $langs->trans('AssetErrorClearDepreciationLines').': '.$this->db->lasterror();
939 939
 					$error++;
940 940
 					break;
941 941
 				}
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 				$first_period_found = false;
1003 1003
 				$first_period_date = isset($begin_period) && $begin_period > $fiscal_period_start ? $begin_period : $fiscal_period_start;
1004 1004
 
1005
-				$ref_date_format = "%Y" . ($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '') . ($fields['duration_type'] == 2 ? '-%d' : '');
1005
+				$ref_date_format = "%Y".($fields['duration_type'] == 1 || $fields['duration_type'] == 2 ? '-%m' : '').($fields['duration_type'] == 2 ? '-%d' : '');
1006 1006
 
1007 1007
 				// Loop security
1008 1008
 				$idx_loop = 0;
@@ -1022,9 +1022,9 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
 						$period_begin = dol_print_date($fiscal_period_start, $ref_date_format);
1024 1024
 						$period_end = dol_print_date($fiscal_period_end, $ref_date_format);
1025
-						$ref = $period_begin . ($period_begin != $period_end ? ' - ' . $period_end : '');
1025
+						$ref = $period_begin.($period_begin != $period_end ? ' - '.$period_end : '');
1026 1026
 						if ($fiscal_period_start <= $disposal_date && $disposal_date <= $fiscal_period_end) {
1027
-							$ref .= ' - ' . $langs->transnoentitiesnoconv('AssetDisposal');
1027
+							$ref .= ' - '.$langs->transnoentitiesnoconv('AssetDisposal');
1028 1028
 						}
1029 1029
 
1030 1030
 						$begin_date = $fiscal_period_start < $start_date && $start_date <= $fiscal_period_end ? $start_date : $fiscal_period_start;
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 		// Check parameters
1104 1104
 		$error = 0;
1105 1105
 		if (empty($asset_depreciation_id)) {
1106
-			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation") . ' (' . $langs->transnoentitiesnoconv("TechnicalID") . ')');
1106
+			$this->errors[] = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("AssetDepreciation").' ('.$langs->transnoentitiesnoconv("TechnicalID").')');
1107 1107
 			$error++;
1108 1108
 		}
1109 1109
 		if ($error) {
@@ -1112,28 +1112,28 @@  discard block
 block discarded – undo
1112 1112
 
1113 1113
 		$this->db->begin();
1114 1114
 
1115
-		require_once DOL_DOCUMENT_ROOT . '/asset/class/assetdepreciationoptions.class.php';
1115
+		require_once DOL_DOCUMENT_ROOT.'/asset/class/assetdepreciationoptions.class.php';
1116 1116
 		$options = new AssetDepreciationOptions($this->db);
1117 1117
 
1118 1118
 		// Get last depreciation lines save in bookkeeping
1119 1119
 		//-----------------------------------------------------
1120 1120
 		$sql = "SELECT fk_asset, depreciation_mode, cumulative_depreciation_ht";
1121
-		$sql .= " FROM " . MAIN_DB_PREFIX . "asset_depreciation";
1122
-		$sql .= " WHERE rowid = " . (int) $asset_depreciation_id;
1121
+		$sql .= " FROM ".MAIN_DB_PREFIX."asset_depreciation";
1122
+		$sql .= " WHERE rowid = ".(int) $asset_depreciation_id;
1123 1123
 		$resql = $this->db->query($sql);
1124 1124
 		if (!$resql) {
1125
-			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation') . ': ' . $this->db->lasterror();
1125
+			$this->errors[] = $langs->trans('AssetErrorFetchCumulativeDepreciation').': '.$this->db->lasterror();
1126 1126
 			$error++;
1127 1127
 		} else {
1128 1128
 			if ($obj = $this->db->fetch_object($resql)) {
1129 1129
 				$mode_key = $obj->depreciation_mode;
1130 1130
 				if (!empty($options->deprecation_options_fields[$mode_key])) {
1131
-					$sql = "UPDATE " . MAIN_DB_PREFIX . $options->deprecation_options_fields[$mode_key]['table'];
1132
-					$sql .= " SET total_amount_last_depreciation_ht = " . $obj->cumulative_depreciation_ht;
1133
-					$sql .= " WHERE fk_asset = " . (int) $obj->fk_asset;
1131
+					$sql = "UPDATE ".MAIN_DB_PREFIX.$options->deprecation_options_fields[$mode_key]['table'];
1132
+					$sql .= " SET total_amount_last_depreciation_ht = ".$obj->cumulative_depreciation_ht;
1133
+					$sql .= " WHERE fk_asset = ".(int) $obj->fk_asset;
1134 1134
 					$resql = $this->db->query($sql);
1135 1135
 					if (!$resql) {
1136
-						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation') . ': ' . $this->db->lasterror();
1136
+						$this->errors[] = $langs->trans('AssetErrorSetLastCumulativeDepreciation').': '.$this->db->lasterror();
1137 1137
 						$error++;
1138 1138
 					}
1139 1139
 				}
@@ -1378,7 +1378,7 @@  discard block
 block discarded – undo
1378 1378
 		if ($withpicto != 2) {
1379 1379
 			$name = $this->ref;
1380 1380
 			if ($option == 'label') $name = $this->label;
1381
-			elseif ($option == 'with_label') $name .= ' - ' . $this->label;
1381
+			elseif ($option == 'with_label') $name .= ' - '.$this->label;
1382 1382
 			$result .= dol_escape_htmltag($maxlen ? dol_trunc($name, $maxlen) : $name);
1383 1383
 		}
1384 1384
 
@@ -1386,7 +1386,7 @@  discard block
 block discarded – undo
1386 1386
 		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
1387 1387
 
1388 1388
 		global $action;
1389
-		$hookmanager->initHooks(array($this->element . 'dao'));
1389
+		$hookmanager->initHooks(array($this->element.'dao'));
1390 1390
 		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
1391 1391
 		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
1392 1392
 		if ($reshook > 0) {
@@ -1524,7 +1524,7 @@  discard block
 block discarded – undo
1524 1524
 		if (getDolGlobalString('ASSET_ASSET_ADDON')) {
1525 1525
 			$mybool = false;
1526 1526
 
1527
-			$file = getDolGlobalString('ASSET_ASSET_ADDON') . ".php";
1527
+			$file = getDolGlobalString('ASSET_ASSET_ADDON').".php";
1528 1528
 			$classname = $conf->global->ASSET_ASSET_ADDON;
1529 1529
 
1530 1530
 			// Include file with class
Please login to merge, or discard this patch.
dev/tools/rector/rector.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,19 +6,19 @@
 block discarded – undo
6 6
 use Rector\Core\ValueObject\PhpVersion;
7 7
 use Rector\Set\ValueObject\LevelSetList;
8 8
 
9
-return static function (RectorConfig $rectorConfig): void {
9
+return static function(RectorConfig $rectorConfig): void {
10 10
 	$rectorConfig->phpVersion(PhpVersion::PHP_71);
11 11
 	//$rectorConfig->indent(' ', 4);
12 12
 	$rectorConfig->paths([
13
-		__DIR__ . '/../../../htdocs/',
14
-		__DIR__ . '/../../../scripts/',
15
-		__DIR__ . '/../../../test/phpunit/',
13
+		__DIR__.'/../../../htdocs/',
14
+		__DIR__.'/../../../scripts/',
15
+		__DIR__.'/../../../test/phpunit/',
16 16
 	]);
17 17
 	$rectorConfig->skip([
18 18
 		'**/includes/**',
19 19
 		'**/custom/**',
20
-		__DIR__ . '/../../../htdocs/custom/',
21
-		__DIR__ . '/../../../htdocs/install/doctemplates/*'
20
+		__DIR__.'/../../../htdocs/custom/',
21
+		__DIR__.'/../../../htdocs/install/doctemplates/*'
22 22
 	]);
23 23
 	$rectorConfig->parallel(240);
24 24
 
Please login to merge, or discard this patch.