Completed
Branch develop (b713ef)
by
unknown
15:54
created
htdocs/hrm/skill_tab.php 1 patch
Spacing   +37 added lines, -37 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 . '/user/class/user.class.php';
36
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php';
37
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php';
38
-require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php';
39
-require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.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.'/user/class/user.class.php';
36
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php';
37
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php';
38
+require_once DOL_DOCUMENT_ROOT.'/hrm/class/skillrank.class.php';
39
+require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skill.lib.php';
40 40
 
41 41
 // Load translation files required by the page
42 42
 $langs->loadLangs(array('hrm', 'other'));
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 $hookmanager->initHooks(array('skilltab', 'globalcard')); // Note that conf->hooks_modules contains array
77 77
 
78 78
 // Load object
79
-include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
79
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
80 80
 $object->loadPersonalConf();
81 81
 
82 82
 // Permissions
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
116 116
 				$backtopage = $backurlforlist;
117 117
 			} else {
118
-				$backtopage = DOL_URL_ROOT.'/hrm/skill_list.php?id=' . ($id > 0 ? $id : '__ID__');
118
+				$backtopage = DOL_URL_ROOT.'/hrm/skill_list.php?id='.($id > 0 ? $id : '__ID__');
119 119
 			}
120 120
 		}
121 121
 	}
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	} elseif ($action == 'saveSkill') {
153 153
 		if (!empty($TNote)) {
154 154
 			foreach ($TNote as $skillId => $rank) {
155
-				$TSkills = $skill->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object=' . ((int) $id) . " AND objecttype='" . $db->escape($objecttype) . "' AND fk_skill = " . ((int) $skillId)));
155
+				$TSkills = $skill->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object='.((int) $id)." AND objecttype='".$db->escape($objecttype)."' AND fk_skill = ".((int) $skillId)));
156 156
 				if (is_array($TSkills) && !empty($TSkills)) {
157 157
 					foreach ($TSkills as $tmpObj) {
158 158
 						$tmpObj->rankorder = $rank;
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 				}
162 162
 			}
163 163
 			setEventMessages($langs->trans("SaveLevelSkill"), null);
164
-			header("Location: " . DOL_URL_ROOT.'/hrm/skill_tab.php?id=' . $id. '&objecttype=job');
164
+			header("Location: ".DOL_URL_ROOT.'/hrm/skill_tab.php?id='.$id.'&objecttype=job');
165 165
 			exit;
166 166
 		}
167 167
 	} elseif ($action == 'confirm_deleteskill' && $confirm == 'yes') {
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 
193 193
 	// view configuration
194 194
 	if ($objecttype == 'job') {
195
-		require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php';
195
+		require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php';
196 196
 		$head = jobPrepareHead($object);
197 197
 		$listLink = dol_buildpath('/hrm/job_list.php', 1);
198 198
 	} elseif ($objecttype == "user") {
199
-		require_once DOL_DOCUMENT_ROOT . "/core/lib/usergroups.lib.php";
199
+		require_once DOL_DOCUMENT_ROOT."/core/lib/usergroups.lib.php";
200 200
 		$object->getRights();
201 201
 		$head = user_prepare_head($object);
202 202
 		$listLink = dol_buildpath('/user/list.php', 1);
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	}*/
213 213
 	// Confirmation to delete line
214 214
 	if ($action == 'ask_deleteskill') {
215
-		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&objecttype=' . $objecttype . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteskill', '', 0, 1);
215
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&objecttype='.$objecttype.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteskill', '', 0, 1);
216 216
 	}
217 217
 	// Clone confirmation
218 218
 	/*if ($action == 'clone') {
@@ -237,15 +237,15 @@  discard block
 block discarded – undo
237 237
 	// Object card
238 238
 	// ------------------------------------------------------------
239 239
 	if ($objecttype == 'job') {
240
-		$linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
240
+		$linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
241 241
 
242 242
 		$morehtmlref = '<div class="refid">';
243
-		$morehtmlref.= $object->label;
243
+		$morehtmlref .= $object->label;
244 244
 		$morehtmlref .= '</div>';
245 245
 
246 246
 		dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref);
247 247
 	} else {
248
-		$linkback = '<a href="' . $listLink . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>';
248
+		$linkback = '<a href="'.$listLink.'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
249 249
 
250 250
 		$morehtmlref = '<a href="'.DOL_URL_ROOT.'/user/vcard.php?id='.$object->id.'&output=file&file='.urlencode(dol_sanitizeFileName($object->getFullName($langs).'.vcf')).'" class="refid" rel="noopener">';
251 251
 		$morehtmlref .= img_picto($langs->trans("Download").' '.$langs->trans("VCard"), 'vcard.png', 'class="valignmiddle marginleftonly paddingrightonly"');
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	$TAllSkills = $static_skill->fetchAll();
263 263
 
264 264
 	// Array format for multiselectarray function
265
-	$TAllSkillsFormatted=array();
265
+	$TAllSkillsFormatted = array();
266 266
 	if (!empty($TAllSkills)) {
267 267
 		foreach ($TAllSkills as $k=>$v) {
268 268
 			$TAllSkillsFormatted[$k] = $v->label;
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
 		//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
291 291
 		//unset($object->fields['fk_project']);				// Hide field already shown in banner
292 292
 		//unset($object->fields['fk_soc']);					// Hide field already shown in banner
293
-		$object->fields['label']['visible']=0; // Already in banner
294
-		include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
293
+		$object->fields['label']['visible'] = 0; // Already in banner
294
+		include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
295 295
 
296 296
 		// Other attributes. Fields from hook formObjectOptions and Extrafields.
297
-		include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
297
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
298 298
 	} else {
299 299
 		// Login
300 300
 		print '<tr><td class="titlefield">'.$langs->trans("Login").'</td>';
@@ -317,9 +317,9 @@  discard block
 block discarded – undo
317 317
 		}
318 318
 		print '</tr>'."\n";
319 319
 
320
-		$object->fields['label']['visible']=0; // Already in banner
321
-		$object->fields['firstname']['visible']=0; // Already in banner
322
-		$object->fields['lastname']['visible']=0; // Already in banner
320
+		$object->fields['label']['visible'] = 0; // Already in banner
321
+		$object->fields['firstname']['visible'] = 0; // Already in banner
322
+		$object->fields['lastname']['visible'] = 0; // Already in banner
323 323
 		//include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php';
324 324
 
325 325
 		// Ref employee
@@ -359,19 +359,19 @@  discard block
 block discarded – undo
359 359
 
360 360
 	if ($objecttype != 'user' && $permissiontoadd) {
361 361
 		// form pour ajouter des compétences
362
-		print '<form name="addSkill" method="post" action="' . $_SERVER['PHP_SELF'] . '">';
363
-		print '<input type="hidden" name="objecttype" value="' . $objecttype . '">';
364
-		print '<input type="hidden" name="id" value="' . $id . '">';
362
+		print '<form name="addSkill" method="post" action="'.$_SERVER['PHP_SELF'].'">';
363
+		print '<input type="hidden" name="objecttype" value="'.$objecttype.'">';
364
+		print '<input type="hidden" name="id" value="'.$id.'">';
365 365
 		print '<input type="hidden" name="action" value="addSkill">';
366 366
 		print '<input type="hidden" name="token" value="'.newToken().'">';
367 367
 		print '<div class="div-table-responsive-no-min">';
368 368
 		print '<table id="tablelines" class="noborder noshadow" width="100%">';
369
-		print '<tr><td style="width:90%">' . $langs->trans('AddSkill') . '</td><td style="width:10%"></td></tr>';
369
+		print '<tr><td style="width:90%">'.$langs->trans('AddSkill').'</td><td style="width:10%"></td></tr>';
370 370
 		print '<tr>';
371 371
 		print '<td>';
372 372
 		print img_picto('', 'shapes', 'class="pictofixedwidth"');
373
-		print $form->multiselectarray('fk_skill', array_diff_key($TAllSkillsFormatted, $TAlreadyUsedSkill), array(), 0, 0, 'widthcentpercentminusx') . '</td>';
374
-		print '<td><input class="button reposition" type="submit" value="' . $langs->trans('Add') . '"></td>';
373
+		print $form->multiselectarray('fk_skill', array_diff_key($TAllSkillsFormatted, $TAlreadyUsedSkill), array(), 0, 0, 'widthcentpercentminusx').'</td>';
374
+		print '<td><input class="button reposition" type="submit" value="'.$langs->trans('Add').'"></td>';
375 375
 		print '</tr>';
376 376
 		print '</table>';
377 377
 		print '</div>';
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 	print '<div class="clearboth"></div>';
383 383
 
384 384
 	if ($objecttype != 'user' && $permissiontoadd) {
385
-		print '<form name="saveSkill" method="post" action="' . $_SERVER['PHP_SELF'] . '">';
386
-		print '<input type="hidden" name="objecttype" value="' . $objecttype . '">';
387
-		print '<input type="hidden" name="id" value="' . $id . '">';
385
+		print '<form name="saveSkill" method="post" action="'.$_SERVER['PHP_SELF'].'">';
386
+		print '<input type="hidden" name="objecttype" value="'.$objecttype.'">';
387
+		print '<input type="hidden" name="id" value="'.$id.'">';
388 388
 		print '<input type="hidden" name="token" value="'.newToken().'">';
389 389
 		print '<input type="hidden" name="action" value="saveSkill">';
390 390
 	}
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	}
402 402
 	print '</tr>';
403 403
 	if (!is_array($TSkillsJob) || empty($TSkillsJob)) {
404
-		print '<tr><td><span class="opacitymedium">' . $langs->trans("NoRecordFound") . '</span></td></tr>';
404
+		print '<tr><td><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
405 405
 	} else {
406 406
 		$sk = new Skill($db);
407 407
 		foreach ($TSkillsJob as $skillElement) {
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 			if ($objecttype != 'user' && $permissiontoadd) {
421 421
 				print '<td class="linecoledit"></td>';
422 422
 				print '<td class="linecoldelete">';
423
-				print '<a class="reposition" href="' . $_SERVER["PHP_SELF"] . '?id=' . $skillElement->fk_object . '&amp;objecttype=' . $objecttype . '&amp;action=ask_deleteskill&amp;lineid=' . $skillElement->id . '">';
423
+				print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?id='.$skillElement->fk_object.'&amp;objecttype='.$objecttype.'&amp;action=ask_deleteskill&amp;lineid='.$skillElement->id.'">';
424 424
 				print img_delete();
425 425
 				print '</a>';
426 426
 			}
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 	}
431 431
 
432 432
 	print '</table>';
433
-	if ($objecttype != 'user' && $permissiontoadd) print '<td><input class="button pull-right" type="submit" value="' . $langs->trans('SaveRank') . '"></td>';
433
+	if ($objecttype != 'user' && $permissiontoadd) print '<td><input class="button pull-right" type="submit" value="'.$langs->trans('SaveRank').'"></td>';
434 434
 	print '</div>';
435 435
 	if ($objecttype != 'user' && $permissiontoadd) print '</form>';
436 436
 
Please login to merge, or discard this patch.