Completed
Branch develop (21bcc8)
by
unknown
19:13
created
htdocs/core/class/rssparser.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@
 block discarded – undo
240 240
 			if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
241 241
 				//print 'xx'.LIBXML_NOCDATA;
242 242
 				libxml_use_internal_errors(false);
243
-				$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA|LIBXML_NOCDATA);
243
+				$rss = simplexml_load_string($str, "SimpleXMLElement", LIBXML_NOCDATA | LIBXML_NOCDATA);
244 244
 			} else {
245 245
 				if (!function_exists('xml_parser_create')) {
246 246
 					$this->error = 'Function xml_parser_create are not supported by your PHP';
Please login to merge, or discard this patch.
htdocs/admin/system/dolibarr.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 	$result = getURLContent('https://sourceforge.net/projects/dolibarr/rss');
52 52
 	//var_dump($result['content']);
53 53
 	if (function_exists('simplexml_load_string')) {
54
-		$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
54
+		$sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET);
55 55
 	} else {
56 56
 		setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors');
57 57
 	}
Please login to merge, or discard this patch.
htdocs/admin/system/filecheck.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -165,13 +165,13 @@
 block discarded – undo
165 165
 	}
166 166
 }
167 167
 if (GETPOST('target') == 'remote') {
168
-	$xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0);	// Accept http or https links on external remote server only. Same is used into api_setup.class.php.
168
+	$xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only. Same is used into api_setup.class.php.
169 169
 
170 170
 	// Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
171 171
 	if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
172 172
 		$xmlfile = $xmlarray['content'];
173 173
 		//print "xmlfilestart".$xmlfile."xmlfileend";
174
-		$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET);
174
+		$xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET);
175 175
 	} else {
176 176
 		$errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
177 177
 		setEventMessages($errormsg, null, 'errors');
Please login to merge, or discard this patch.
htdocs/projet/index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@
 block discarded – undo
152 152
 	while ($i < $num) {
153 153
 		$objp = $db->fetch_object($resql);
154 154
 		$listofoppstatus[$objp->rowid] = $objp->percent;
155
-		$listofopplabel[$objp->rowid] = $objp->label;		// default label if translation from "OppStatus".code not found.
155
+		$listofopplabel[$objp->rowid] = $objp->label; // default label if translation from "OppStatus".code not found.
156 156
 		$listofoppcode[$objp->rowid] = $objp->code;
157 157
 		switch ($objp->code) {
158 158
 			case 'PROSP':
Please login to merge, or discard this patch.
htdocs/hrm/position_document.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -81,9 +81,9 @@
 block discarded – undo
81 81
 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
82 82
 require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
83 83
 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
84
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
85
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';
86
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
84
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php';
85
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php';
86
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
87 87
 
88 88
 // Load translation files required by the page
89 89
 $langs->loadLangs(array("hrm", "companies", "other", "mails"));
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -136,8 +136,12 @@
 block discarded – undo
136 136
 //if ($user->socid > 0) $socid = $user->socid;
137 137
 //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
138 138
 //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
139
-if (empty($conf->hrm->enabled)) accessforbidden();
140
-if (!$permissiontoread) accessforbidden();
139
+if (empty($conf->hrm->enabled)) {
140
+	accessforbidden();
141
+}
142
+if (!$permissiontoread) {
143
+	accessforbidden();
144
+}
141 145
 
142 146
 
143 147
 /*
Please login to merge, or discard this patch.
htdocs/hrm/class/evaluation.class.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -240,7 +240,9 @@  discard block
 block discarded – undo
240 240
 					$line->fk_rank = 0;
241 241
 
242 242
 					$res = $line->create($user, $notrigger);
243
-					if ($res > 0) $this->lines[] = $line;
243
+					if ($res > 0) {
244
+						$this->lines[] = $line;
245
+					}
244 246
 				}
245 247
 			}
246 248
 		}
@@ -637,8 +639,9 @@  discard block
 block discarded – undo
637 639
 
638 640
 		$Tab = $this->db->fetch_object($res);
639 641
 
640
-		if (empty($Tab)) return null;
641
-		else {
642
+		if (empty($Tab)) {
643
+			return null;
644
+		} else {
642 645
 			$evaluation = new Evaluation($this->db);
643 646
 			$evaluation->fetch($Tab->rowid);
644 647
 
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
  */
27 27
 
28 28
 // Put here all includes required by your class file
29
-require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php';
30
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluationdet.class.php';
29
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
30
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluationdet.class.php';
31 31
 //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
32 32
 //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
33 33
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	/**
105 105
 	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
106 106
 	 */
107
-	public $fields=array(
107
+	public $fields = array(
108 108
 		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
109 109
 		'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
110 110
 		'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2',),
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		}
195 195
 
196 196
 		if (empty($user->rights->hrm->evaluation->readall)) {
197
-			$this->fields['fk_user']['type'].= ':rowid IN('.$this->db->sanitize(implode(", ", $user->getAllChildIds(1))).')';
197
+			$this->fields['fk_user']['type'] .= ':rowid IN('.$this->db->sanitize(implode(", ", $user->getAllChildIds(1))).')';
198 198
 		}
199 199
 
200 200
 		$this->date_eval = dol_now();
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 		$resultcreate = $this->createCommon($user, $notrigger);
231 231
 
232 232
 		if ($resultcreate > 0) {
233
-			require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php';
233
+			require_once DOL_DOCUMENT_ROOT.'/hrm/class/skillrank.class.php';
234 234
 			$skillRank = new SkillRank($this->db);
235 235
 			$TRequiredRanks = $skillRank->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object='.$this->fk_job." AND objecttype='job'"));
236 236
 
@@ -632,12 +632,12 @@  discard block
 block discarded – undo
632 632
 	public function getLastEvaluationForUser($fk_user)
633 633
 	{
634 634
 		$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."hrm_evaluation ";
635
-		$sql.=	"WHERE fk_user=".((int) $fk_user)." ";
636
-		$sql.=	"ORDER BY date_eval DESC ";
637
-		$sql.=	"LIMIT 1 ";
635
+		$sql .= "WHERE fk_user=".((int) $fk_user)." ";
636
+		$sql .= "ORDER BY date_eval DESC ";
637
+		$sql .= "LIMIT 1 ";
638 638
 
639 639
 		$res = $this->db->query($sql);
640
-		if (!$res) { dol_print_error($this->db);}
640
+		if (!$res) { dol_print_error($this->db); }
641 641
 
642 642
 		$Tab = $this->db->fetch_object($res);
643 643
 
Please login to merge, or discard this patch.
htdocs/hrm/job_card.php 2 patches
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -139,8 +139,12 @@  discard block
 block discarded – undo
139 139
 //if ($user->socid > 0) $socid = $user->socid;
140 140
 //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
141 141
 //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
142
-if (empty($conf->hrm->enabled)) accessforbidden();
143
-if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
142
+if (empty($conf->hrm->enabled)) {
143
+	accessforbidden();
144
+}
145
+if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
146
+	accessforbidden();
147
+}
144 148
 
145 149
 
146 150
 /*
@@ -435,9 +439,12 @@  discard block
 block discarded – undo
435 439
 
436 440
 				$parameters = array();
437 441
 				$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
438
-				if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
439
-				if (empty($reshook))
440
-					$object->formAddObjectLine(1, $mysoc, $soc);
442
+				if ($reshook < 0) {
443
+					setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
444
+				}
445
+				if (empty($reshook)) {
446
+									$object->formAddObjectLine(1, $mysoc, $soc);
447
+				}
441 448
 			}
442 449
 		}
443 450
 
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -29,14 +29,14 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 require '../main.inc.php';
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php';
37 37
 
38 38
 // Load translation files required by the page
39
-$langs->loadLangs(array('hrm', 'other', 'products'));   // why products?
39
+$langs->loadLangs(array('hrm', 'other', 'products')); // why products?
40 40
 
41 41
 // Get parameters
42 42
 $id = GETPOST('id', 'int');
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search
48 48
 $backtopage = GETPOST('backtopage', 'alpha');
49 49
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
50
-$lineid   = GETPOST('lineid', 'int');
50
+$lineid = GETPOST('lineid', 'int');
51 51
 
52 52
 // Initialize technical objects
53 53
 $object = new Job($db);
54 54
 $extrafields = new ExtraFields($db);
55
-$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
55
+$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
56 56
 $hookmanager->initHooks(array('jobcard', 'globalcard')); // Note that conf->hooks_modules contains array
57 57
 
58 58
 // Fetch optionals attributes and labels
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 $search_all = GETPOST("search_all", 'alpha');
65 65
 $search = array();
66 66
 foreach ($object->fields as $key => $val) {
67
-	if (GETPOST('search_' . $key, 'alpha')) {
68
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
67
+	if (GETPOST('search_'.$key, 'alpha')) {
68
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
69 69
 	}
70 70
 }
71 71
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 }
75 75
 
76 76
 // Load object
77
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
77
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
78 78
 
79 79
 // Permissions
80 80
 $permissiontoread = $user->rights->hrm->all->read;
81 81
 $permissiontoadd  = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
82 82
 $permissiontodelete = $user->rights->hrm->all->delete;
83
-$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/job';
83
+$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/job';
84 84
 
85 85
 // Security check (enable the most restrictive one)
86 86
 //if ($user->socid > 0) accessforbidden();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
112 112
 				$backtopage = $backurlforlist;
113 113
 			} else {
114
-				$backtopage = dol_buildpath('/hrm/job_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__');
114
+				$backtopage = dol_buildpath('/hrm/job_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
115 115
 			}
116 116
 		}
117 117
 	}
@@ -120,19 +120,19 @@  discard block
 block discarded – undo
120 120
 
121 121
 
122 122
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
123
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
123
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
124 124
 
125 125
 	// Actions when linking object each other
126
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
126
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
127 127
 
128 128
 	// Actions when printing a doc from card
129
-	include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php';
129
+	include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
130 130
 
131 131
 	// Action to move up and down lines of object
132 132
 	//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
133 133
 
134 134
 	// Action to build doc
135
-	include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
135
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
136 136
 
137 137
 	if ($action == 'set_thirdparty' && $permissiontoadd) {
138 138
 		$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname);
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
 	// Actions to send emails
145 145
 	$triggersendname = 'hrm_JOB_SENTBYMAIL';
146 146
 	$autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO';
147
-	$trackid = 'job' . $object->id;
148
-	include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
147
+	$trackid = 'job'.$object->id;
148
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
149 149
 }
150 150
 
151 151
 
@@ -181,36 +181,36 @@  discard block
 block discarded – undo
181 181
 
182 182
 // Part to create
183 183
 if ($action == 'create') {
184
-	print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_' . $object->picto);
184
+	print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_'.$object->picto);
185 185
 
186
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
187
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
186
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
187
+	print '<input type="hidden" name="token" value="'.newToken().'">';
188 188
 	print '<input type="hidden" name="action" value="add">';
189 189
 	if ($backtopage) {
190
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
190
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
191 191
 	}
192 192
 	if ($backtopageforcancel) {
193
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
193
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
194 194
 	}
195 195
 
196 196
 	print dol_get_fiche_head(array(), '');
197 197
 
198
-	print '<table class="border centpercent tableforfieldcreate">' . "\n";
198
+	print '<table class="border centpercent tableforfieldcreate">'."\n";
199 199
 
200 200
 	// Common attributes
201
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php';
201
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
202 202
 
203 203
 	// Other attributes
204
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php';
204
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
205 205
 
206
-	print '</table>' . "\n";
206
+	print '</table>'."\n";
207 207
 
208 208
 	print dol_get_fiche_end();
209 209
 
210 210
 	print '<div class="center">';
211
-	print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">';
211
+	print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">';
212 212
 	print '&nbsp; ';
213
-	print '<input type="' . ($backtopage ? "submit" : "button") . '" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '"' . ($backtopage ? '' : ' onclick="history.go(-1)"') . '>'; // Cancel for create does not post form if we don't know the backtopage
213
+	print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage
214 214
 	print '</div>';
215 215
 
216 216
 	print '</form>';
@@ -220,35 +220,35 @@  discard block
 block discarded – undo
220 220
 
221 221
 // Part to edit record
222 222
 if (($id || $ref) && $action == 'edit') {
223
-	print load_fiche_titre($langs->trans("JobProfile"), '', 'object_' . $object->picto);
223
+	print load_fiche_titre($langs->trans("JobProfile"), '', 'object_'.$object->picto);
224 224
 
225
-	print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">';
226
-	print '<input type="hidden" name="token" value="' . newToken() . '">';
225
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
226
+	print '<input type="hidden" name="token" value="'.newToken().'">';
227 227
 	print '<input type="hidden" name="action" value="update">';
228
-	print '<input type="hidden" name="id" value="' . $object->id . '">';
228
+	print '<input type="hidden" name="id" value="'.$object->id.'">';
229 229
 	if ($backtopage) {
230
-		print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
230
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
231 231
 	}
232 232
 	if ($backtopageforcancel) {
233
-		print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
233
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
234 234
 	}
235 235
 
236 236
 	print dol_get_fiche_head();
237 237
 
238
-	print '<table class="border centpercent tableforfieldedit">' . "\n";
238
+	print '<table class="border centpercent tableforfieldedit">'."\n";
239 239
 
240 240
 	// Common attributes
241
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
241
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
242 242
 
243 243
 	// Other attributes
244
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
244
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
245 245
 
246 246
 	print '</table>';
247 247
 
248 248
 	print dol_get_fiche_end();
249 249
 
250
-	print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">';
251
-	print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
250
+	print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
251
+	print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
252 252
 	print '</div>';
253 253
 
254 254
 	print '</form>';
@@ -266,17 +266,17 @@  discard block
 block discarded – undo
266 266
 
267 267
 	// Confirmation to delete
268 268
 	if ($action == 'delete') {
269
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
269
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
270 270
 	}
271 271
 	// Confirmation to delete line
272 272
 	if ($action == 'deleteline') {
273
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
273
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
274 274
 	}
275 275
 	// Clone confirmation
276 276
 	if ($action == 'clone') {
277 277
 		// Create an array for form
278 278
 		$formquestion = array();
279
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
279
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
280 280
 	}
281 281
 
282 282
 	// Confirmation of action xxxx
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 			// array('type' => 'other',    'name' => 'idwarehouse',   'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
293 293
 		);
294 294
 		*/
295
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
295
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
296 296
 	}
297 297
 
298 298
 	// Call Hook formConfirm
@@ -310,10 +310,10 @@  discard block
 block discarded – undo
310 310
 
311 311
 	// Object card
312 312
 	// ------------------------------------------------------------
313
-	$linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
313
+	$linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
314 314
 
315 315
 	$morehtmlref = '<div class="refid">';
316
-	$morehtmlref.= $object->label;
316
+	$morehtmlref .= $object->label;
317 317
 	$morehtmlref .= '</div>';
318 318
 
319 319
 
@@ -329,11 +329,11 @@  discard block
 block discarded – undo
329 329
 	//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
330 330
 	//unset($object->fields['fk_project']);				// Hide field already shown in banner
331 331
 	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
332
-	$object->fields['label']['visible']=0; // Already in banner
333
-	include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
332
+	$object->fields['label']['visible'] = 0; // Already in banner
333
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
334 334
 
335 335
 	// Other attributes. Fields from hook formObjectOptions and Extrafields.
336
-	include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
336
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
337 337
 
338 338
 	print '</table>';
339 339
 	print '</div>';
@@ -352,16 +352,16 @@  discard block
 block discarded – undo
352 352
 		// Show object lines
353 353
 		$result = $object->getLinesArray();
354 354
 
355
-		print '	<form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST">
356
-		<input type="hidden" name="token" value="' . newToken() . '">
357
-		<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '">
355
+		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
356
+		<input type="hidden" name="token" value="' . newToken().'">
357
+		<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
358 358
 		<input type="hidden" name="mode" value="">
359 359
 		<input type="hidden" name="page_y" value="">
360
-		<input type="hidden" name="id" value="' . $object->id . '">
360
+		<input type="hidden" name="id" value="' . $object->id.'">
361 361
 		';
362 362
 
363 363
 		if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
364
-			include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php';
364
+			include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
365 365
 		}
366 366
 
367 367
 		print '<div class="div-table-responsive-no-min">';
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
 	// Buttons for actions
399 399
 
400 400
 	if ($action != 'presend' && $action != 'editline') {
401
-		print '<div class="tabsAction">' . "\n";
401
+		print '<div class="tabsAction">'."\n";
402 402
 		$parameters = array();
403 403
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
404 404
 		if ($reshook < 0) {
@@ -408,15 +408,15 @@  discard block
 block discarded – undo
408 408
 		if (empty($reshook)) {
409 409
 			// Back to draft
410 410
 			if ($object->status == $object::STATUS_VALIDATED) {
411
-				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd);
411
+				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
412 412
 			}
413 413
 
414
-			print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
414
+			print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
415 415
 
416 416
 			// Delete (need delete permission, or if draft, just need create/modify permission)
417
-			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete);
417
+			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
418 418
 		}
419
-		print '</div>' . "\n";
419
+		print '</div>'."\n";
420 420
 	}
421 421
 
422 422
 
@@ -434,12 +434,12 @@  discard block
 block discarded – undo
434 434
 		// Documents
435 435
 		if ($includedocgeneration) {
436 436
 			$objref = dol_sanitizeFileName($object->ref);
437
-			$relativepath = $objref . '/' . $objref . '.pdf';
438
-			$filedir = $conf->hrm->dir_output . '/' . $object->element . '/' . $objref;
439
-			$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
437
+			$relativepath = $objref.'/'.$objref.'.pdf';
438
+			$filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref;
439
+			$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
440 440
 			$genallowed = $user->rights->hrm->job->read; // If you can read, you can build the PDF to read content
441 441
 			$delallowed = $user->rights->hrm->job->write; // If you can create/edit, you can remove a file on card
442
-			print $formfile->showdocuments('hrm:Job', $object->element . '/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
442
+			print $formfile->showdocuments('hrm:Job', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
443 443
 		}
444 444
 
445 445
 		// Show links to link elements
@@ -454,9 +454,9 @@  discard block
 block discarded – undo
454 454
 		$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/job_agenda.php?id='.$object->id);
455 455
 
456 456
 		// List of actions on element
457
-		include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
457
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
458 458
 		$formactions = new FormActions($db);
459
-		$somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
459
+		$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
460 460
 
461 461
 		print '</div></div>';
462 462
 	}
@@ -465,9 +465,9 @@  discard block
 block discarded – undo
465 465
 	$modelmail = 'job';
466 466
 	$defaulttopic = 'InformationMessage';
467 467
 	$diroutput = $conf->hrm->dir_output;
468
-	$trackid = 'job' . $object->id;
468
+	$trackid = 'job'.$object->id;
469 469
 
470
-	include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php';
470
+	include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
471 471
 }
472 472
 
473 473
 // End of page
Please login to merge, or discard this patch.
htdocs/hrm/position_card.php 2 patches
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -113,8 +113,12 @@
 block discarded – undo
113 113
 //if ($user->socid > 0) $socid = $user->socid;
114 114
 //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
115 115
 //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
116
-if (empty($conf->hrm->enabled)) accessforbidden();
117
-if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden();
116
+if (empty($conf->hrm->enabled)) {
117
+	accessforbidden();
118
+}
119
+if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) {
120
+	accessforbidden();
121
+}
118 122
 
119 123
 $langs->loadLangs(array("hrm", "other"));
120 124
 
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 // Load Dolibarr environment
30 30
 require '../main.inc.php';
31 31
 
32
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
33
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
34
-require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
35
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php';
32
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
33
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
34
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
35
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php';
38 38
 //dol_include_once('/hrm/position.php');
39 39
 
40 40
 // Get Parameters
41
-$action 	= GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
41
+$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
42 42
 $backtopage = GETPOST('backtopage', 'alpha');
43 43
 $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
44
-$id 	= GETPOST('id', 'int');
44
+$id = GETPOST('id', 'int');
45 45
 
46 46
 // Initialize technical objects
47 47
 $form = new Form($db);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
57 57
 $permissiontodelete = $user->rights->hrm->all->delete;
58 58
 $permissiondellink = $user->rights->hrm->all->write; // Used by the include of actions_dellink.inc.php
59
-$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position';
59
+$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/position';
60 60
 
61 61
 // Security check (enable the most restrictive one)
62 62
 //if ($user->socid > 0) accessforbidden();
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 
72 72
 
73 73
 // Get parameters
74
-$id 	= GETPOST('id', 'int');
74
+$id = GETPOST('id', 'int');
75 75
 $fk_job = GETPOST('fk_job', 'int');
76 76
 
77
-$ref 	= GETPOST('ref', 'alpha');
77
+$ref = GETPOST('ref', 'alpha');
78 78
 $action = GETPOST('action', 'aZ09');
79 79
 $confirm = GETPOST('confirm', 'alpha');
80 80
 $cancel = GETPOST('cancel', 'aZ09');
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 $extrafields = new ExtraFields($db);
94 94
 
95
-$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id;
95
+$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id;
96 96
 $hookmanager->initHooks(array('positioncard', 'globalcard')); // Note that conf->hooks_modules contains array
97 97
 
98 98
 // Fetch optionals attributes and labels
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 $search_all = GETPOST("search_all", 'alpha');
105 105
 $search = array();
106 106
 foreach ($object->fields as $key => $val) {
107
-	if (GETPOST('search_' . $key, 'alpha')) {
108
-		$search[$key] = GETPOST('search_' . $key, 'alpha');
107
+	if (GETPOST('search_'.$key, 'alpha')) {
108
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
109 109
 	}
110 110
 }
111 111
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 }
115 115
 
116 116
 // Load object
117
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
117
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
118 118
 
119 119
 
120 120
 /*
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
138 138
 				$backtopage = $backurlforlist;
139 139
 			} else {
140
-				$backtopage = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__');
140
+				$backtopage = dol_buildpath('/hrm/position_card.php', 1).'?id='.($id > 0 ? $id : '__ID__');
141 141
 			}
142 142
 		}
143 143
 	}
@@ -145,19 +145,19 @@  discard block
 block discarded – undo
145 145
 	$triggermodname = 'hrm_POSITION_MODIFY'; // Name of trigger action code to execute when we modify record
146 146
 
147 147
 	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
148
-	include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php';
148
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
149 149
 
150 150
 	// Actions when linking object each other
151
-	include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php';
151
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
152 152
 
153 153
 	// Actions when printing a doc from card
154
-	include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php';
154
+	include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
155 155
 
156 156
 	// Action to move up and down lines of object
157 157
 	//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
158 158
 
159 159
 	// Action to build doc
160
-	include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php';
160
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
161 161
 
162 162
 	if ($action == 'set_thirdparty' && $permissiontoadd) {
163 163
 		$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname);
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	// Actions to send emails
170 170
 	$triggersendname = 'hrm_POSITION_SENTBYMAIL';
171 171
 	$autocopy = 'MAIN_MAIL_AUTOCOPY_POSITION_TO';
172
-	$trackid = 'position' . $object->id;
173
-	include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php';
172
+	$trackid = 'position'.$object->id;
173
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
174 174
 }
175 175
 
176 176
 
@@ -214,36 +214,36 @@  discard block
 block discarded – undo
214 214
 
215 215
 	// Part to edit record
216 216
 	if (($id || $ref) && $action == 'edit') {
217
-		print load_fiche_titre($langs->trans("Position"), '', 'object_' . $object->picto);
217
+		print load_fiche_titre($langs->trans("Position"), '', 'object_'.$object->picto);
218 218
 
219
-		print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">';
220
-		print '<input type="hidden" name="token" value="' . newToken() . '">';
219
+		print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
220
+		print '<input type="hidden" name="token" value="'.newToken().'">';
221 221
 		print '<input type="hidden" name="action" value="update">';
222
-		print '<input type="hidden" name="id" value="' . $object->id . '">';
222
+		print '<input type="hidden" name="id" value="'.$object->id.'">';
223 223
 
224 224
 		if ($backtopage) {
225
-			print '<input type="hidden" name="backtopage" value="' . $backtopage . '">';
225
+			print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
226 226
 		}
227 227
 		if ($backtopageforcancel) {
228
-			print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">';
228
+			print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
229 229
 		}
230 230
 
231 231
 		print dol_get_fiche_head();
232 232
 
233
-		print '<table class="border centpercent tableforfieldedit">' . "\n";
233
+		print '<table class="border centpercent tableforfieldedit">'."\n";
234 234
 
235 235
 		// Common attributes
236
-		include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php';
236
+		include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
237 237
 
238 238
 		// Other attributes
239
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php';
239
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
240 240
 
241 241
 		print '</table>';
242 242
 
243 243
 		print dol_get_fiche_end();
244 244
 
245
-		print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">';
246
-		print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">';
245
+		print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">';
246
+		print ' &nbsp; <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
247 247
 		print '</div>';
248 248
 
249 249
 		print '</form>';
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 
263 263
 		// Confirmation to delete
264 264
 		if ($action == 'delete') {
265
-			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeletePosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
265
+			$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeletePosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
266 266
 		}
267 267
 
268 268
 		// Call Hook formConfirm
@@ -297,18 +297,18 @@  discard block
 block discarded – undo
297 297
 		print '<div class="fichecenter">';
298 298
 		print '<div class="fichehalfleft">';
299 299
 		print '<div class="underbanner clearboth"></div>';
300
-		print '<table class="border centpercent tableforfield">' . "\n";
300
+		print '<table class="border centpercent tableforfield">'."\n";
301 301
 
302 302
 		// Common attributes
303 303
 		//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
304 304
 		//unset($object->fields['fk_project']);				// Hide field already shown in banner
305 305
 		//unset($object->fields['fk_soc']);					// Hide field already shown in banner
306
-		$object->fields['fk_user']['visible']=0; // Already in banner
307
-		$object->fields['fk_job']['visible']=0; // Already in banner
308
-		include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
306
+		$object->fields['fk_user']['visible'] = 0; // Already in banner
307
+		$object->fields['fk_job']['visible'] = 0; // Already in banner
308
+		include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
309 309
 
310 310
 		// Other attributes. Fields from hook formObjectOptions and Extrafields.
311
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
311
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
312 312
 
313 313
 		print '</table>';
314 314
 		print '</div>';
@@ -327,10 +327,10 @@  discard block
 block discarded – undo
327 327
 		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
328 328
 
329 329
 
330
-		print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd);
330
+		print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
331 331
 
332 332
 		// Delete (need delete permission, or if draft, just need create/modify permission)
333
-		print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete);
333
+		print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete);
334 334
 	}
335 335
 }
336 336
 
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
 //}
369 369
 
370 370
 
371
-print '</table>' . "\n";
372
-print '</div>' . "\n";
371
+print '</table>'."\n";
372
+print '</div>'."\n";
373 373
 
374
-print '</form>' . "\n";
374
+print '</form>'."\n";
375 375
 
376 376
 
377 377
 if ($action !== 'edit' && $action !== 'create') {
@@ -389,9 +389,9 @@  discard block
 block discarded – undo
389 389
 	$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/position_agenda.php?id='.$object->id);
390 390
 
391 391
 	// List of actions on element
392
-	include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php';
392
+	include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
393 393
 	$formactions = new FormActions($db);
394
-	$somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
394
+	$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
395 395
 
396 396
 	print '</div></div>';
397 397
 }
Please login to merge, or discard this patch.
htdocs/core/class/commonobject.class.php 2 patches
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3647,7 +3647,9 @@  discard block
 block discarded – undo
3647 3647
 		// Hook for explicitly set the targettype if it must be differtent than $this->element
3648 3648
 		$reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
3649 3649
 		if ($reshook > 0) {
3650
-			if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype'];
3650
+			if (!empty($hookmanager->resArray['targettype'])) {
3651
+				$targettype = $hookmanager->resArray['targettype'];
3652
+			}
3651 3653
 		}
3652 3654
 
3653 3655
 		$this->db->begin();
@@ -3729,10 +3731,18 @@  discard block
 block discarded – undo
3729 3731
 		// Hook for explicitly set the targettype if it must be differtent than $this->element
3730 3732
 		$reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
3731 3733
 		if ($reshook > 0) {
3732
-			if (!empty($hookmanager->resArray['sourcetype'])) $sourcetype = $hookmanager->resArray['sourcetype'];
3733
-			if (!empty($hookmanager->resArray['sourceid'])) $sourceid = $hookmanager->resArray['sourceid'];
3734
-			if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype'];
3735
-			if (!empty($hookmanager->resArray['targetid'])) $targetid = $hookmanager->resArray['targetid'];
3734
+			if (!empty($hookmanager->resArray['sourcetype'])) {
3735
+				$sourcetype = $hookmanager->resArray['sourcetype'];
3736
+			}
3737
+			if (!empty($hookmanager->resArray['sourceid'])) {
3738
+				$sourceid = $hookmanager->resArray['sourceid'];
3739
+			}
3740
+			if (!empty($hookmanager->resArray['targettype'])) {
3741
+				$targettype = $hookmanager->resArray['targettype'];
3742
+			}
3743
+			if (!empty($hookmanager->resArray['targetid'])) {
3744
+				$targetid = $hookmanager->resArray['targetid'];
3745
+			}
3736 3746
 		}
3737 3747
 
3738 3748
 		if (!empty($sourceid) && !empty($sourcetype) && empty($targetid)) {
@@ -6600,7 +6610,9 @@  discard block
 block discarded – undo
6600 6610
 			$showtime = 1;
6601 6611
 
6602 6612
 			// Do not show current date when field not required (see selectDate() method)
6603
-			if (!$required && $value == '') $value = '-1';
6613
+			if (!$required && $value == '') {
6614
+				$value = '-1';
6615
+			}
6604 6616
 
6605 6617
 			// TODO Must also support $moreparam
6606 6618
 			$out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1, '', '', '', 1, '', '', 'tzuserrel');
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -846,16 +846,16 @@  discard block
 block discarded – undo
846 846
 				}
847 847
 				$labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]);
848 848
 				if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') {
849
-					$datas[$key]= '<br><b><u>'. $labelextra . '</u></b>';
849
+					$datas[$key] = '<br><b><u>'.$labelextra.'</u></b>';
850 850
 				} else {
851
-					$value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]);
852
-					$datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element);
851
+					$value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]);
852
+					$datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element);
853 853
 					$count++;
854 854
 				}
855 855
 			}
856 856
 		}
857 857
 
858
-		$hookmanager->initHooks(array($this->element . 'dao'));
858
+		$hookmanager->initHooks(array($this->element.'dao'));
859 859
 		$parameters = array(
860 860
 			'tooltipcontentarray' => &$datas,
861 861
 			'params' => $params,
@@ -1334,7 +1334,7 @@  discard block
 block discarded – undo
1334 1334
 		if ($source == 'external' || $source == 'thirdparty') {
1335 1335
 			$sql .= " AND tc.source = 'external'";
1336 1336
 			if ($status >= 0) {
1337
-				$sql .= " AND t.statut = ".((int) $status);	// t is llx_socpeople
1337
+				$sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople
1338 1338
 			}
1339 1339
 		}
1340 1340
 		$sql .= " AND tc.active = 1";
@@ -1693,8 +1693,8 @@  discard block
 block discarded – undo
1693 1693
 		if ($idtofetch) {
1694 1694
 			$thirdparty = new Societe($this->db);
1695 1695
 			$result = $thirdparty->fetch($idtofetch);
1696
-			if ($result<0) {
1697
-				$this->errors=array_merge($this->errors, $thirdparty->errors);
1696
+			if ($result < 0) {
1697
+				$this->errors = array_merge($this->errors, $thirdparty->errors);
1698 1698
 			}
1699 1699
 			$this->thirdparty = $thirdparty;
1700 1700
 
@@ -1996,9 +1996,9 @@  discard block
 block discarded – undo
1996 1996
 		if ($trigkey) {
1997 1997
 			$oldvalue = null;
1998 1998
 
1999
-			$sql = "SELECT " . $field;
2000
-			$sql .= " FROM " . MAIN_DB_PREFIX . $table;
2001
-			$sql .= " WHERE " . $id_field . " = " . ((int) $id);
1999
+			$sql = "SELECT ".$field;
2000
+			$sql .= " FROM ".MAIN_DB_PREFIX.$table;
2001
+			$sql .= " WHERE ".$id_field." = ".((int) $id);
2002 2002
 
2003 2003
 			$resql = $this->db->query($sql);
2004 2004
 			if ($resql) {
@@ -2127,7 +2127,7 @@  discard block
 block discarded – undo
2127 2127
 		}
2128 2128
 		$restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc;
2129 2129
 		$sql = "SELECT MAX(te.".$fieldid.")";
2130
-		$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
2130
+		$sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te";
2131 2131
 		if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
2132 2132
 			$sql .= ",".$this->db->prefix()."usergroup_user as ug";
2133 2133
 		}
@@ -2201,7 +2201,7 @@  discard block
 block discarded – undo
2201 2201
 		$this->ref_previous = $row[0];
2202 2202
 
2203 2203
 		$sql = "SELECT MIN(te.".$fieldid.")";
2204
-		$sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te";
2204
+		$sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te";
2205 2205
 		if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
2206 2206
 			$sql .= ",".$this->db->prefix()."usergroup_user as ug";
2207 2207
 		}
@@ -2359,7 +2359,7 @@  discard block
 block discarded – undo
2359 2359
 		// Triggers
2360 2360
 		if (!$error && !$notrigger) {
2361 2361
 			// Call triggers
2362
-			$result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user);
2362
+			$result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user);
2363 2363
 			if ($result < 0) {
2364 2364
 				$error++;
2365 2365
 			} //Do also here what you must do to rollback action if trigger fail
@@ -2724,7 +2724,7 @@  discard block
 block discarded – undo
2724 2724
 			$sql = 'UPDATE '.$this->db->prefix().$this->table_element;
2725 2725
 			$sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL');
2726 2726
 			if (in_array($this->table_element, array('propal', 'commande', 'societe'))) {
2727
-				$sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
2727
+				$sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'");
2728 2728
 			}
2729 2729
 			$sql .= ' WHERE rowid='.((int) $this->id);
2730 2730
 
@@ -3074,10 +3074,10 @@  discard block
 block discarded – undo
3074 3074
 		$sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line;
3075 3075
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3076 3076
 		if (!$renum) {
3077
-			$sql .= " AND " . $fieldposition . " = 0";
3077
+			$sql .= " AND ".$fieldposition." = 0";
3078 3078
 		}
3079 3079
 		if ($renum) {
3080
-			$sql .= " AND " . $fieldposition . " <> 0";
3080
+			$sql .= " AND ".$fieldposition." <> 0";
3081 3081
 		}
3082 3082
 
3083 3083
 		dol_syslog(get_class($this)."::line_order", LOG_DEBUG);
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
 			if ($fk_parent_line) {
3099 3099
 				$sql .= ' AND fk_parent_line IS NULL';
3100 3100
 			}
3101
-			$sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder;
3101
+			$sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder;
3102 3102
 
3103 3103
 			dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG);
3104 3104
 			$resql = $this->db->query($sql);
@@ -3149,7 +3149,7 @@  discard block
 block discarded – undo
3149 3149
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3150 3150
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3151 3151
 		$sql .= ' AND fk_parent_line = '.((int) $id);
3152
-		$sql .= " ORDER BY " . $fieldposition . " ASC";
3152
+		$sql .= " ORDER BY ".$fieldposition." ASC";
3153 3153
 
3154 3154
 		dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG);
3155 3155
 		$resql = $this->db->query($sql);
@@ -3232,8 +3232,8 @@  discard block
 block discarded – undo
3232 3232
 			dol_print_error($this->db);
3233 3233
 			return -1;
3234 3234
 		} else {
3235
-			$parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition);
3236
-			$action='';
3235
+			$parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition);
3236
+			$action = '';
3237 3237
 			$reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action);
3238 3238
 			return 1;
3239 3239
 		}
@@ -3272,7 +3272,7 @@  discard block
 block discarded – undo
3272 3272
 
3273 3273
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3274 3274
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3275
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1));
3275
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang - 1));
3276 3276
 			if ($this->db->query($sql)) {
3277 3277
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1));
3278 3278
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3303,7 +3303,7 @@  discard block
 block discarded – undo
3303 3303
 
3304 3304
 			$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang);
3305 3305
 			$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3306
-			$sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1));
3306
+			$sql .= " AND ".$fieldposition." = ".((int) ($rang + 1));
3307 3307
 			if ($this->db->query($sql)) {
3308 3308
 				$sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1));
3309 3309
 				$sql .= ' WHERE rowid = '.((int) $rowid);
@@ -3329,7 +3329,7 @@  discard block
 block discarded – undo
3329 3329
 			$fieldposition = 'position';
3330 3330
 		}
3331 3331
 
3332
-		$sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line;
3332
+		$sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line;
3333 3333
 		$sql .= " WHERE rowid = ".((int) $rowid);
3334 3334
 
3335 3335
 		dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG);
@@ -3357,7 +3357,7 @@  discard block
 block discarded – undo
3357 3357
 
3358 3358
 		$sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line;
3359 3359
 		$sql .= " WHERE ".$this->fk_element." = ".((int) $this->id);
3360
-		$sql .= " AND " . $fieldposition . " = ".((int) $rang);
3360
+		$sql .= " AND ".$fieldposition." = ".((int) $rang);
3361 3361
 		$resql = $this->db->query($sql);
3362 3362
 		if ($resql) {
3363 3363
 			$row = $this->db->fetch_row($resql);
@@ -3474,7 +3474,7 @@  discard block
 block discarded – undo
3474 3474
 			$newsuffix = '';
3475 3475
 		}
3476 3476
 		if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) {
3477
-			$fieldusermod =  "fk_user_mod";
3477
+			$fieldusermod = "fk_user_mod";
3478 3478
 		} elseif ($this->table_element == 'ecm_files') {
3479 3479
 			$fieldusermod = "fk_user_m";
3480 3480
 		} else {
@@ -3846,7 +3846,7 @@  discard block
 block discarded – undo
3846 3846
 		// It's because an entry for this element may be exist in llx_element_element before this modification (version <=14.2) and ave named only with their element name in fk_source or fk_target.
3847 3847
 		$coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset');
3848 3848
 		// Add module part to target type if object has $module property and isn't in core modules.
3849
-		$targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
3849
+		$targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element;
3850 3850
 
3851 3851
 		$parameters = array('targettype'=>$targettype);
3852 3852
 		// Hook for explicitly set the targettype if it must be differtent than $this->element
@@ -3858,19 +3858,19 @@  discard block
 block discarded – undo
3858 3858
 		$this->db->begin();
3859 3859
 		$error = 0;
3860 3860
 
3861
-		$sql = "INSERT INTO " . $this->db->prefix() . "element_element (";
3861
+		$sql = "INSERT INTO ".$this->db->prefix()."element_element (";
3862 3862
 		$sql .= "fk_source";
3863 3863
 		$sql .= ", sourcetype";
3864 3864
 		$sql .= ", fk_target";
3865 3865
 		$sql .= ", targettype";
3866 3866
 		$sql .= ") VALUES (";
3867 3867
 		$sql .= ((int) $origin_id);
3868
-		$sql .= ", '" . $this->db->escape($origin) . "'";
3869
-		$sql .= ", " . ((int) $this->id);
3870
-		$sql .= ", '" . $this->db->escape($targettype) . "'";
3868
+		$sql .= ", '".$this->db->escape($origin)."'";
3869
+		$sql .= ", ".((int) $this->id);
3870
+		$sql .= ", '".$this->db->escape($targettype)."'";
3871 3871
 		$sql .= ")";
3872 3872
 
3873
-		dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG);
3873
+		dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG);
3874 3874
 		if ($this->db->query($sql)) {
3875 3875
 			if (!$notrigger) {
3876 3876
 				// Call trigger
@@ -4177,20 +4177,20 @@  discard block
 block discarded – undo
4177 4177
 		$this->db->begin();
4178 4178
 		$error = 0;
4179 4179
 
4180
-		$sql = "UPDATE " . $this->db->prefix() . "element_element SET ";
4180
+		$sql = "UPDATE ".$this->db->prefix()."element_element SET ";
4181 4181
 		if ($updatesource) {
4182
-			$sql .= "fk_source = " . ((int) $sourceid);
4183
-			$sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'";
4184
-			$sql .= " WHERE fk_target = " . ((int) $this->id);
4185
-			$sql .= " AND targettype = '" . $this->db->escape($this->element) . "'";
4182
+			$sql .= "fk_source = ".((int) $sourceid);
4183
+			$sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'";
4184
+			$sql .= " WHERE fk_target = ".((int) $this->id);
4185
+			$sql .= " AND targettype = '".$this->db->escape($this->element)."'";
4186 4186
 		} elseif ($updatetarget) {
4187
-			$sql .= "fk_target = " . ((int) $targetid);
4188
-			$sql .= ", targettype = '" . $this->db->escape($targettype) . "'";
4189
-			$sql .= " WHERE fk_source = " . ((int) $this->id);
4190
-			$sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4187
+			$sql .= "fk_target = ".((int) $targetid);
4188
+			$sql .= ", targettype = '".$this->db->escape($targettype)."'";
4189
+			$sql .= " WHERE fk_source = ".((int) $this->id);
4190
+			$sql .= " AND sourcetype = '".$this->db->escape($this->element)."'";
4191 4191
 		}
4192 4192
 
4193
-		dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG);
4193
+		dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG);
4194 4194
 		if ($this->db->query($sql)) {
4195 4195
 			if (!$notrigger) {
4196 4196
 				// Call trigger
@@ -4266,25 +4266,25 @@  discard block
 block discarded – undo
4266 4266
 		}
4267 4267
 
4268 4268
 		if (!$error) {
4269
-			$sql = "DELETE FROM " . $this->db->prefix() . "element_element";
4269
+			$sql = "DELETE FROM ".$this->db->prefix()."element_element";
4270 4270
 			$sql .= " WHERE";
4271 4271
 			if ($rowid > 0) {
4272
-				$sql .= " rowid = " . ((int) $rowid);
4272
+				$sql .= " rowid = ".((int) $rowid);
4273 4273
 			} else {
4274 4274
 				if ($deletesource) {
4275
-					$sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'";
4276
-					$sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'";
4275
+					$sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'";
4276
+					$sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'";
4277 4277
 				} elseif ($deletetarget) {
4278
-					$sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'";
4279
-					$sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'";
4278
+					$sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'";
4279
+					$sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'";
4280 4280
 				} else {
4281
-					$sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')";
4281
+					$sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')";
4282 4282
 					$sql .= " OR";
4283
-					$sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')";
4283
+					$sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')";
4284 4284
 				}
4285 4285
 			}
4286 4286
 
4287
-			dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG);
4287
+			dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG);
4288 4288
 			if (!$this->db->query($sql)) {
4289 4289
 				$this->error = $this->db->lasterror();
4290 4290
 				$this->errors[] = $this->error;
@@ -4446,14 +4446,14 @@  discard block
 block discarded – undo
4446 4446
 			$sql .= ", date_validation = '".$this->db->idate(dol_now())."'";
4447 4447
 		}
4448 4448
 		$sql .= " WHERE rowid = ".((int) $elementId);
4449
-		$sql .= " AND ".$fieldstatus." <> ".((int) $status);	// We avoid update if status already correct
4449
+		$sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct
4450 4450
 
4451 4451
 		dol_syslog(get_class($this)."::setStatut", LOG_DEBUG);
4452 4452
 		$resql = $this->db->query($sql);
4453 4453
 		if ($resql) {
4454 4454
 			$error = 0;
4455 4455
 
4456
-			$nb_rows_affected = $this->db->affected_rows($resql);	// should be 1 or 0 if status was already correct
4456
+			$nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct
4457 4457
 
4458 4458
 			if ($nb_rows_affected > 0) {
4459 4459
 				if (empty($trigkey)) {
@@ -4607,7 +4607,7 @@  discard block
 block discarded – undo
4607 4607
 			return -1;
4608 4608
 		}
4609 4609
 
4610
-		$arraytoscan = $this->childtables;		// array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4610
+		$arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...)
4611 4611
 		// For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...)
4612 4612
 		$tmparray = array_keys($this->childtables);
4613 4613
 		if (is_numeric($tmparray[0])) {
@@ -4620,26 +4620,26 @@  discard block
 block discarded – undo
4620 4620
 			//print $id.'-'.$table.'-'.$elementname.'<br>';
4621 4621
 			// Check if element can be deleted
4622 4622
 			$sql = "SELECT COUNT(*) as nb";
4623
-			$sql.= " FROM ".$this->db->prefix().$table." as c";
4623
+			$sql .= " FROM ".$this->db->prefix().$table." as c";
4624 4624
 			if (!empty($element['parent']) && !empty($element['parentkey'])) {
4625
-				$sql.= ", ".$this->db->prefix().$element['parent']." as p";
4625
+				$sql .= ", ".$this->db->prefix().$element['parent']." as p";
4626 4626
 			}
4627 4627
 			if (!empty($element['fk_element'])) {
4628
-				$sql.= " WHERE c.".$element['fk_element']." = ".((int) $id);
4628
+				$sql .= " WHERE c.".$element['fk_element']." = ".((int) $id);
4629 4629
 			} else {
4630
-				$sql.= " WHERE c.".$this->fk_element." = ".((int) $id);
4630
+				$sql .= " WHERE c.".$this->fk_element." = ".((int) $id);
4631 4631
 			}
4632 4632
 			if (!empty($element['parent']) && !empty($element['parentkey'])) {
4633
-				$sql.= " AND c.".$element['parentkey']." = p.rowid";
4633
+				$sql .= " AND c.".$element['parentkey']." = p.rowid";
4634 4634
 			}
4635 4635
 			if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) {
4636
-				$sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
4636
+				$sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'";
4637 4637
 			}
4638 4638
 			if (!empty($entity)) {
4639 4639
 				if (!empty($element['parent']) && !empty($element['parentkey'])) {
4640
-					$sql.= " AND p.entity = ".((int) $entity);
4640
+					$sql .= " AND p.entity = ".((int) $entity);
4641 4641
 				} else {
4642
-					$sql.= " AND c.entity = ".((int) $entity);
4642
+					$sql .= " AND c.entity = ".((int) $entity);
4643 4643
 				}
4644 4644
 			}
4645 4645
 
@@ -4653,9 +4653,9 @@  discard block
 block discarded – undo
4653 4653
 					if (is_numeric($element)) {	// very old usage array('table1', 'table2', ...)
4654 4654
 						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table);
4655 4655
 					} elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...)
4656
-						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType",  method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element));
4656
+						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element));
4657 4657
 					} else { // new usage: $element['name']=Translation key
4658
-						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType",  method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name']));
4658
+						$this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name']));
4659 4659
 					}
4660 4660
 					break; // We found at least one, we stop here
4661 4661
 				}
@@ -4714,7 +4714,7 @@  discard block
 block discarded – undo
4714 4714
 	 */
4715 4715
 	public function getTotalDiscount()
4716 4716
 	{
4717
-		if (!empty($this->table_element_line) ) {
4717
+		if (!empty($this->table_element_line)) {
4718 4718
 			$total_discount = 0.00;
4719 4719
 
4720 4720
 			$sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht";
@@ -5661,7 +5661,7 @@  discard block
 block discarded – undo
5661 5661
 			$setsharekey = false;
5662 5662
 			if ($this->element == 'propal' || $this->element == 'proposal') {
5663 5663
 				if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) {
5664
-					$setsharekey = true;	// feature to make online signature is not set or set to on (default)
5664
+					$setsharekey = true; // feature to make online signature is not set or set to on (default)
5665 5665
 				}
5666 5666
 				if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) {
5667 5667
 					$setsharekey = true;
@@ -5719,7 +5719,7 @@  discard block
 block discarded – undo
5719 5719
 				$ecmfile->gen_or_uploaded = 'generated';
5720 5720
 				$ecmfile->description = ''; // indexed content
5721 5721
 				$ecmfile->keywords = ''; // keyword content
5722
-				$ecmfile->src_object_type = $this->table_element;	// $this->table_name is 'myobject' or 'mymodule_myobject'.
5722
+				$ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'.
5723 5723
 				$ecmfile->src_object_id   = $this->id;
5724 5724
 
5725 5725
 				$result = $ecmfile->create($user);
@@ -5771,7 +5771,7 @@  discard block
 block discarded – undo
5771 5771
 			$maxwidthmini = $tmparraysize['maxwidthmini'];
5772 5772
 			$maxheightmini = $tmparraysize['maxheightmini'];
5773 5773
 			//$quality = $tmparraysize['quality'];
5774
-			$quality = 50;	// For thumbs, we force quality to 50
5774
+			$quality = 50; // For thumbs, we force quality to 50
5775 5775
 
5776 5776
 			// Create small thumbs for company (Ratio is near 16/9)
5777 5777
 			// Used on logon for example
@@ -5872,8 +5872,8 @@  discard block
 block discarded – undo
5872 5872
 	{
5873 5873
 		// phpcs:enable
5874 5874
 		global $langs, $conf;
5875
-		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) {
5876
-			dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.');
5875
+		if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) {
5876
+			dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.');
5877 5877
 			exit;
5878 5878
 		}
5879 5879
 		if (!is_object($langs)) {	// If lang was not defined, we set it. It is required by run_triggers().
@@ -6166,9 +6166,9 @@  discard block
 block discarded – undo
6166 6166
 						if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) {
6167 6167
 							//var_dump($conf->disable_compute);
6168 6168
 							if (empty($conf->disable_compute)) {
6169
-								global $objectoffield;        // We set a global variable to $objectoffield so
6170
-								$objectoffield = $this;        // we can use it inside computed formula
6171
-								$this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6169
+								global $objectoffield; // We set a global variable to $objectoffield so
6170
+								$objectoffield = $this; // we can use it inside computed formula
6171
+								$this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2');
6172 6172
 							}
6173 6173
 						}
6174 6174
 					}
@@ -6182,7 +6182,7 @@  discard block
 block discarded – undo
6182 6182
 					return 0;
6183 6183
 				}
6184 6184
 			} else {
6185
-				$this->errors[]=$this->db->lasterror;
6185
+				$this->errors[] = $this->db->lasterror;
6186 6186
 				return -1;
6187 6187
 			}
6188 6188
 		}
@@ -6945,7 +6945,7 @@  discard block
 block discarded – undo
6945 6945
 		// Special case that force options and type ($type can be integer, varchar, ...)
6946 6946
 		if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) {
6947 6947
 			$param['options'] = $this->fields[$key]['arrayofkeyval'];
6948
-			$type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select');
6948
+			$type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select');
6949 6949
 		}
6950 6950
 
6951 6951
 		$label = $this->fields[$key]['label'];
@@ -6997,7 +6997,7 @@  discard block
 block discarded – undo
6997 6997
 
6998 6998
 		// Add validation state class
6999 6999
 		if (!empty($validationClass)) {
7000
-			$morecss.= $validationClass;
7000
+			$morecss .= $validationClass;
7001 7001
 		}
7002 7002
 
7003 7003
 		if (in_array($type, array('date'))) {
@@ -7141,8 +7141,8 @@  discard block
 block discarded – undo
7141 7141
 					}
7142 7142
 
7143 7143
 					$sqlwhere = '';
7144
-					$sql = "SELECT " . $keyList;
7145
-					$sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0];
7144
+					$sql = "SELECT ".$keyList;
7145
+					$sql .= " FROM ".$this->db->prefix().$InfoFieldList[0];
7146 7146
 					if (!empty($InfoFieldList[4])) {
7147 7147
 						// can use SELECT request
7148 7148
 						if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -7158,24 +7158,24 @@  discard block
 block discarded – undo
7158 7158
 
7159 7159
 						//We have to join on extrafield table
7160 7160
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7161
-							$sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra";
7162
-							$sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4];
7161
+							$sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra";
7162
+							$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
7163 7163
 						} else {
7164
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
7164
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
7165 7165
 						}
7166 7166
 					} else {
7167 7167
 						$sqlwhere .= ' WHERE 1=1';
7168 7168
 					}
7169 7169
 					// Some tables may have field, some other not. For the moment we disable it.
7170 7170
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7171
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7171
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7172 7172
 					}
7173 7173
 					$sql .= $sqlwhere;
7174 7174
 					//print $sql;
7175 7175
 
7176
-					$sql .= ' ORDER BY ' . implode(', ', $fields_label);
7176
+					$sql .= ' ORDER BY '.implode(', ', $fields_label);
7177 7177
 
7178
-					dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG);
7178
+					dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG);
7179 7179
 					$resql = $this->db->query($sql);
7180 7180
 					if ($resql) {
7181 7181
 						$out .= '<option value="0">&nbsp;</option>';
@@ -7191,7 +7191,7 @@  discard block
 block discarded – undo
7191 7191
 							if (count($fields_label) > 1) {
7192 7192
 								$notrans = true;
7193 7193
 								foreach ($fields_label as $field_toshow) {
7194
-									$labeltoshow .= $obj->$field_toshow . ' ';
7194
+									$labeltoshow .= $obj->$field_toshow.' ';
7195 7195
 								}
7196 7196
 							} else {
7197 7197
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7202,12 +7202,12 @@  discard block
 block discarded – undo
7202 7202
 								foreach ($fields_label as $field_toshow) {
7203 7203
 									$translabel = $langs->trans($obj->$field_toshow);
7204 7204
 									if ($translabel != $obj->$field_toshow) {
7205
-										$labeltoshow = dol_trunc($translabel) . ' ';
7205
+										$labeltoshow = dol_trunc($translabel).' ';
7206 7206
 									} else {
7207
-										$labeltoshow = dol_trunc($obj->$field_toshow) . ' ';
7207
+										$labeltoshow = dol_trunc($obj->$field_toshow).' ';
7208 7208
 									}
7209 7209
 								}
7210
-								$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
7210
+								$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
7211 7211
 							} else {
7212 7212
 								if (!$notrans) {
7213 7213
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
@@ -7221,34 +7221,34 @@  discard block
 block discarded – undo
7221 7221
 									$labeltoshow = '(not defined)';
7222 7222
 								}
7223 7223
 								if ($value == $obj->rowid) {
7224
-									$out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>';
7224
+									$out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
7225 7225
 								}
7226 7226
 
7227 7227
 								if (!empty($InfoFieldList[3]) && $parentField) {
7228
-									$parent = $parentName . ':' . $obj->{$parentField};
7228
+									$parent = $parentName.':'.$obj->{$parentField};
7229 7229
 									$isDependList = 1;
7230 7230
 								}
7231 7231
 
7232
-								$out .= '<option value="' . $obj->rowid . '"';
7232
+								$out .= '<option value="'.$obj->rowid.'"';
7233 7233
 								$out .= ($value == $obj->rowid ? ' selected' : '');
7234
-								$out .= (!empty($parent) ? ' parent="' . $parent . '"' : '');
7235
-								$out .= '>' . $labeltoshow . '</option>';
7234
+								$out .= (!empty($parent) ? ' parent="'.$parent.'"' : '');
7235
+								$out .= '>'.$labeltoshow.'</option>';
7236 7236
 							}
7237 7237
 
7238 7238
 							$i++;
7239 7239
 						}
7240 7240
 						$this->db->free($resql);
7241 7241
 					} else {
7242
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
7242
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
7243 7243
 					}
7244 7244
 				} else {
7245 7245
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7246 7246
 					$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
7247 7247
 					$out .= '<option value="0">&nbsp;</option>';
7248 7248
 					foreach ($data as $data_key => $data_value) {
7249
-						$out .= '<option value="' . $data_key . '"';
7249
+						$out .= '<option value="'.$data_key.'"';
7250 7250
 						$out .= ($value == $data_key ? ' selected' : '');
7251
-						$out .= '>' . $data_value . '</option>';
7251
+						$out .= '>'.$data_value.'</option>';
7252 7252
 					}
7253 7253
 				}
7254 7254
 			}
@@ -7313,8 +7313,8 @@  discard block
 block discarded – undo
7313 7313
 					}
7314 7314
 
7315 7315
 					$sqlwhere = '';
7316
-					$sql = "SELECT " . $keyList;
7317
-					$sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0];
7316
+					$sql = "SELECT ".$keyList;
7317
+					$sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0];
7318 7318
 					if (!empty($InfoFieldList[4])) {
7319 7319
 						// can use SELECT request
7320 7320
 						if (strpos($InfoFieldList[4], '$SEL$') !== false) {
@@ -7330,23 +7330,23 @@  discard block
 block discarded – undo
7330 7330
 
7331 7331
 						// We have to join on extrafield table
7332 7332
 						if (strpos($InfoFieldList[4], 'extra') !== false) {
7333
-							$sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra';
7334
-							$sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4];
7333
+							$sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra';
7334
+							$sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4];
7335 7335
 						} else {
7336
-							$sqlwhere .= " WHERE " . $InfoFieldList[4];
7336
+							$sqlwhere .= " WHERE ".$InfoFieldList[4];
7337 7337
 						}
7338 7338
 					} else {
7339 7339
 						$sqlwhere .= ' WHERE 1=1';
7340 7340
 					}
7341 7341
 					// Some tables may have field, some other not. For the moment we disable it.
7342 7342
 					if (in_array($InfoFieldList[0], array('tablewithentity'))) {
7343
-						$sqlwhere .= " AND entity = " . ((int) $conf->entity);
7343
+						$sqlwhere .= " AND entity = ".((int) $conf->entity);
7344 7344
 					}
7345 7345
 					// $sql.=preg_replace('/^ AND /','',$sqlwhere);
7346 7346
 					// print $sql;
7347 7347
 
7348 7348
 					$sql .= $sqlwhere;
7349
-					dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG);
7349
+					dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG);
7350 7350
 					$resql = $this->db->query($sql);
7351 7351
 					if ($resql) {
7352 7352
 						$num = $this->db->num_rows($resql);
@@ -7364,7 +7364,7 @@  discard block
 block discarded – undo
7364 7364
 							if (count($fields_label) > 1) {
7365 7365
 								$notrans = true;
7366 7366
 								foreach ($fields_label as $field_toshow) {
7367
-									$labeltoshow .= $obj->$field_toshow . ' ';
7367
+									$labeltoshow .= $obj->$field_toshow.' ';
7368 7368
 								}
7369 7369
 							} else {
7370 7370
 								$labeltoshow = $obj->{$InfoFieldList[1]};
@@ -7375,9 +7375,9 @@  discard block
 block discarded – undo
7375 7375
 								foreach ($fields_label as $field_toshow) {
7376 7376
 									$translabel = $langs->trans($obj->$field_toshow);
7377 7377
 									if ($translabel != $obj->$field_toshow) {
7378
-										$labeltoshow = dol_trunc($translabel, 18) . ' ';
7378
+										$labeltoshow = dol_trunc($translabel, 18).' ';
7379 7379
 									} else {
7380
-										$labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' ';
7380
+										$labeltoshow = dol_trunc($obj->$field_toshow, 18).' ';
7381 7381
 									}
7382 7382
 								}
7383 7383
 
@@ -7400,7 +7400,7 @@  discard block
 block discarded – undo
7400 7400
 								}
7401 7401
 
7402 7402
 								if (!empty($InfoFieldList[3]) && $parentField) {
7403
-									$parent = $parentName . ':' . $obj->{$parentField};
7403
+									$parent = $parentName.':'.$obj->{$parentField};
7404 7404
 									$isDependList = 1;
7405 7405
 								}
7406 7406
 
@@ -7411,14 +7411,14 @@  discard block
 block discarded – undo
7411 7411
 						}
7412 7412
 						$this->db->free($resql);
7413 7413
 
7414
-						$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7414
+						$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7415 7415
 					} else {
7416
-						print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
7416
+						print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>';
7417 7417
 					}
7418 7418
 				} else {
7419 7419
 					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7420 7420
 					$data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1);
7421
-					$out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7421
+					$out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%');
7422 7422
 				}
7423 7423
 			}
7424 7424
 		} elseif ($type == 'link') {
@@ -7499,7 +7499,7 @@  discard block
 block discarded – undo
7499 7499
 			$out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>';
7500 7500
 		}
7501 7501
 
7502
-		if ($isDependList==1) {
7502
+		if ($isDependList == 1) {
7503 7503
 			$out .= $this->getJSListDependancies('_common');
7504 7504
 		}
7505 7505
 		/* Add comments
@@ -7550,7 +7550,7 @@  discard block
 block discarded – undo
7550 7550
 			$type = 'varchar'; // convert varchar(xx) int varchar
7551 7551
 		}
7552 7552
 		if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
7553
-			$type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select');
7553
+			$type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select');
7554 7554
 		}
7555 7555
 		if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) {
7556 7556
 			$type = 'link';
@@ -7634,7 +7634,7 @@  discard block
 block discarded – undo
7634 7634
 			$value = $this->getLibStatut(3);
7635 7635
 		} elseif ($type == 'date') {
7636 7636
 			if (!empty($value)) {
7637
-				$value = dol_print_date($value, 'day');	// We suppose dates without time are always gmt (storage of course + output)
7637
+				$value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output)
7638 7638
 			} else {
7639 7639
 				$value = '';
7640 7640
 			}
@@ -7672,7 +7672,7 @@  discard block
 block discarded – undo
7672 7672
 				$value = price($value, 0, $langs, 0, 0, -1, $conf->currency);
7673 7673
 			}
7674 7674
 		} elseif ($type == 'select') {
7675
-			$value = isset($param['options'][$value])?$param['options'][$value]:'';
7675
+			$value = isset($param['options'][$value]) ? $param['options'][$value] : '';
7676 7676
 		} elseif ($type == 'sellist') {
7677 7677
 			$param_list = array_keys($param['options']);
7678 7678
 			$InfoFieldList = explode(":", $param_list[0]);
@@ -7732,9 +7732,9 @@  discard block
 block discarded – undo
7732 7732
 									$translabel = $langs->trans($obj->$field_toshow);
7733 7733
 								}
7734 7734
 								if ($translabel != $field_toshow) {
7735
-									$value .= dol_trunc($translabel, 18) . ' ';
7735
+									$value .= dol_trunc($translabel, 18).' ';
7736 7736
 								} else {
7737
-									$value .= $obj->$field_toshow . ' ';
7737
+									$value .= $obj->$field_toshow.' ';
7738 7738
 								}
7739 7739
 							}
7740 7740
 						} else {
@@ -7750,7 +7750,7 @@  discard block
 block discarded – undo
7750 7750
 						}
7751 7751
 					}
7752 7752
 				} else {
7753
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
7753
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7754 7754
 
7755 7755
 					$toprint = array();
7756 7756
 					$obj = $this->db->fetch_object($resql);
@@ -7758,7 +7758,7 @@  discard block
 block discarded – undo
7758 7758
 					$c->fetch($obj->rowid);
7759 7759
 					$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
7760 7760
 					foreach ($ways as $way) {
7761
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
7761
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
7762 7762
 					}
7763 7763
 					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
7764 7764
 				}
@@ -7774,11 +7774,11 @@  discard block
 block discarded – undo
7774 7774
 				$toprint = array();
7775 7775
 				foreach ($value_arr as $keyval => $valueval) {
7776 7776
 					if (!empty($valueval)) {
7777
-						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>';
7777
+						$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>';
7778 7778
 					}
7779 7779
 				}
7780 7780
 				if (!empty($toprint)) {
7781
-					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
7781
+					$value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>';
7782 7782
 				}
7783 7783
 			}
7784 7784
 		} elseif ($type == 'chkbxlst') {
@@ -7833,9 +7833,9 @@  discard block
 block discarded – undo
7833 7833
 										$translabel = $langs->trans($obj->$field_toshow);
7834 7834
 									}
7835 7835
 									if ($translabel != $field_toshow) {
7836
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
7836
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
7837 7837
 									} else {
7838
-										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>';
7838
+										$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>';
7839 7839
 									}
7840 7840
 								}
7841 7841
 							} else {
@@ -7844,15 +7844,15 @@  discard block
 block discarded – undo
7844 7844
 									$translabel = $langs->trans($obj->{$InfoFieldList[1]});
7845 7845
 								}
7846 7846
 								if ($translabel != $obj->{$InfoFieldList[1]}) {
7847
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>';
7847
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>';
7848 7848
 								} else {
7849
-									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>';
7849
+									$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>';
7850 7850
 								}
7851 7851
 							}
7852 7852
 						}
7853 7853
 					}
7854 7854
 				} else {
7855
-					require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
7855
+					require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
7856 7856
 
7857 7857
 					$toprint = array();
7858 7858
 					while ($obj = $this->db->fetch_object($resql)) {
@@ -7861,7 +7861,7 @@  discard block
 block discarded – undo
7861 7861
 							$c->fetch($obj->rowid);
7862 7862
 							$ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text
7863 7863
 							foreach ($ways as $way) {
7864
-								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>';
7864
+								$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>';
7865 7865
 							}
7866 7866
 						}
7867 7867
 					}
@@ -7995,7 +7995,7 @@  discard block
 block discarded – undo
7995 7995
 		global $langs;
7996 7996
 
7997 7997
 		if (!class_exists('Validate')) {
7998
-			require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php';
7998
+			require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php';
7999 7999
 		}
8000 8000
 
8001 8001
 		$this->clearFieldError($fieldKey);
@@ -8209,7 +8209,7 @@  discard block
 block discarded – undo
8209 8209
 				$out .= "\n";
8210 8210
 
8211 8211
 				$nbofextrafieldsshown = 0;
8212
-				$e = 0;	// var to manage the modulo (odd/even)
8212
+				$e = 0; // var to manage the modulo (odd/even)
8213 8213
 
8214 8214
 				$lastseparatorkeyfound = '';
8215 8215
 				$extrafields_collapse_num = '';
@@ -8260,7 +8260,7 @@  discard block
 block discarded – undo
8260 8260
 					}
8261 8261
 
8262 8262
 					$colspan = 0;
8263
-					if (is_array($params) && count($params) > 0 && $display_type=='card') {
8263
+					if (is_array($params) && count($params) > 0 && $display_type == 'card') {
8264 8264
 						if (array_key_exists('cols', $params)) {
8265 8265
 							$colspan = $params['cols'];
8266 8266
 						} elseif (array_key_exists('colspan', $params)) {	// For backward compatibility. Use cols instead now.
@@ -8347,7 +8347,7 @@  discard block
 block discarded – undo
8347 8347
 						$domData .= ' data-targetid="'.$this->id.'"';
8348 8348
 
8349 8349
 						$html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id);
8350
-						if ($display_type=='card') {
8350
+						if ($display_type == 'card') {
8351 8351
 							if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) {
8352 8352
 								$colspan = 0;
8353 8353
 							}
@@ -8458,12 +8458,12 @@  discard block
 block discarded – undo
8458 8458
 								break;
8459 8459
 						}
8460 8460
 
8461
-						$out .= ($display_type=='card' ? '</td>' : '</div>');
8461
+						$out .= ($display_type == 'card' ? '</td>' : '</div>');
8462 8462
 
8463 8463
 						if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) {
8464
-							$out .= ($display_type=='card' ? '</tr>' : '</div>');
8464
+							$out .= ($display_type == 'card' ? '</tr>' : '</div>');
8465 8465
 						} else {
8466
-							$out .= ($display_type=='card' ? '</tr>' : '</div>');
8466
+							$out .= ($display_type == 'card' ? '</tr>' : '</div>');
8467 8467
 						}
8468 8468
 
8469 8469
 						$e++;
@@ -8845,7 +8845,7 @@  discard block
 block discarded – undo
8845 8845
 							if ($val['share']) {
8846 8846
 								if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
8847 8847
 									$return .= '<!-- Show original file (thumb not yet available with shared links) -->';
8848
-									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
8848
+									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
8849 8849
 								} else {
8850 8850
 									$return .= '<!-- Show original file -->';
8851 8851
 									$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?hashp='.urlencode($val['share']).($cache ? '&cache='.urlencode($cache) : '').'" title="'.dol_escape_htmltag($alt).'">';
@@ -8857,7 +8857,7 @@  discard block
 block discarded – undo
8857 8857
 						} else {
8858 8858
 							if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
8859 8859
 								$return .= '<!-- Show thumb -->';
8860
-								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ?' height="'.$maxHeight.'"': '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
8860
+								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').' maxwidth150onsmartphone maxwidth200"'.($maxHeight ? ' height="'.$maxHeight.'"' : '').' src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
8861 8861
 							} else {
8862 8862
 								$return .= '<!-- Show original file -->';
8863 8863
 								$return .= '<img class="photo photowithmargin'.($addphotorefcss ? ' '.$addphotorefcss : '').'" height="'.$maxHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.$this->entity.($cache ? '&cache='.urlencode($cache) : '').'&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
@@ -9266,7 +9266,7 @@  discard block
 block discarded – undo
9266 9266
 						continue;
9267 9267
 					}
9268 9268
 				}
9269
-				$keys_with_alias[] = $alias . '.' . $fieldname;
9269
+				$keys_with_alias[] = $alias.'.'.$fieldname;
9270 9270
 			}
9271 9271
 			return implode(',', $keys_with_alias);
9272 9272
 		} else {
@@ -9382,7 +9382,7 @@  discard block
 block discarded – undo
9382 9382
 		if (!$error) {
9383 9383
 			$sql = "INSERT INTO ".$this->db->prefix().$this->table_element;
9384 9384
 			$sql .= " (".implode(", ", $keys).')';
9385
-			$sql .= " VALUES (".implode(", ", $values).")";		// $values can contains 'abc' or 123
9385
+			$sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123
9386 9386
 
9387 9387
 			$res = $this->db->query($sql);
9388 9388
 			if (!$res) {
@@ -10179,7 +10179,7 @@  discard block
 block discarded – undo
10179 10179
 		// Process
10180 10180
 		foreach ($to_del as $del) {
10181 10181
 			if ($c->fetch($del) > 0) {
10182
-				$result=$c->del_type($this, $type_categ);
10182
+				$result = $c->del_type($this, $type_categ);
10183 10183
 				if ($result < 0) {
10184 10184
 					$error++;
10185 10185
 					$this->error = $c->error;
Please login to merge, or discard this patch.