@@ -139,8 +139,12 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -29,15 +29,15 @@ discard block |
||
| 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'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.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 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/skillrank.class.php'; |
|
| 38 | 38 | |
| 39 | 39 | // Load translation files required by the page |
| 40 | -$langs->loadLangs(array('hrm', 'other', 'products')); // why products? |
|
| 40 | +$langs->loadLangs(array('hrm', 'other', 'products')); // why products? |
|
| 41 | 41 | |
| 42 | 42 | // Get parameters |
| 43 | 43 | $id = GETPOST('id', 'int'); |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search |
| 49 | 49 | $backtopage = GETPOST('backtopage', 'alpha'); |
| 50 | 50 | $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); |
| 51 | -$lineid = GETPOST('lineid', 'int'); |
|
| 51 | +$lineid = GETPOST('lineid', 'int'); |
|
| 52 | 52 | |
| 53 | 53 | // Initialize technical objects |
| 54 | 54 | $object = new Job($db); |
| 55 | 55 | $extrafields = new ExtraFields($db); |
| 56 | -$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id; |
|
| 56 | +$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; |
|
| 57 | 57 | $hookmanager->initHooks(array('jobcard', 'globalcard')); // Note that conf->hooks_modules contains array |
| 58 | 58 | |
| 59 | 59 | // Fetch optionals attributes and labels |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | $search_all = GETPOST("search_all", 'alpha'); |
| 66 | 66 | $search = array(); |
| 67 | 67 | foreach ($object->fields as $key => $val) { |
| 68 | - if (GETPOST('search_' . $key, 'alpha')) { |
|
| 69 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
| 68 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
| 69 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // Load object |
| 78 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
| 78 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
| 79 | 79 | |
| 80 | 80 | // Permissions |
| 81 | 81 | $permissiontoread = $user->rights->hrm->all->read; |
| 82 | 82 | $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
| 83 | 83 | $permissiontodelete = $user->rights->hrm->all->delete; |
| 84 | -$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/job'; |
|
| 84 | +$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/job'; |
|
| 85 | 85 | |
| 86 | 86 | // Security check (enable the most restrictive one) |
| 87 | 87 | //if ($user->socid > 0) accessforbidden(); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
| 113 | 113 | $backtopage = $backurlforlist; |
| 114 | 114 | } else { |
| 115 | - $backtopage = dol_buildpath('/hrm/job_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__'); |
|
| 115 | + $backtopage = dol_buildpath('/hrm/job_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen |
| 124 | 124 | if ($action != 'confirm_clone') { |
| 125 | - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; |
|
| 125 | + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // Actions when linking object each other |
| 129 | - include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
| 129 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
| 130 | 130 | |
| 131 | 131 | // Actions when printing a doc from card |
| 132 | - include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; |
|
| 132 | + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; |
|
| 133 | 133 | |
| 134 | 134 | // Action to move up and down lines of object |
| 135 | 135 | //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; |
| 136 | 136 | |
| 137 | 137 | // Action to build doc |
| 138 | - include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; |
|
| 138 | + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; |
|
| 139 | 139 | |
| 140 | 140 | if ($action == 'set_thirdparty' && $permissiontoadd) { |
| 141 | 141 | $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | // Actions to send emails |
| 148 | 148 | $triggersendname = 'HRM_JOB_SENTBYMAIL'; |
| 149 | 149 | $autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO'; |
| 150 | - $trackid = 'job' . $object->id; |
|
| 151 | - include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; |
|
| 150 | + $trackid = 'job'.$object->id; |
|
| 151 | + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
|
| 152 | 152 | |
| 153 | 153 | if ($action == 'confirm_clone' && $confirm != 'yes') { |
| 154 | 154 | $action = ''; |
@@ -234,36 +234,36 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // Part to create |
| 236 | 236 | if ($action == 'create') { |
| 237 | - print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_' . $object->picto); |
|
| 237 | + print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_'.$object->picto); |
|
| 238 | 238 | |
| 239 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 240 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 239 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 240 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 241 | 241 | print '<input type="hidden" name="action" value="add">'; |
| 242 | 242 | if ($backtopage) { |
| 243 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 243 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 244 | 244 | } |
| 245 | 245 | if ($backtopageforcancel) { |
| 246 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 246 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | print dol_get_fiche_head(array(), ''); |
| 250 | 250 | |
| 251 | - print '<table class="border centpercent tableforfieldcreate">' . "\n"; |
|
| 251 | + print '<table class="border centpercent tableforfieldcreate">'."\n"; |
|
| 252 | 252 | |
| 253 | 253 | // Common attributes |
| 254 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; |
|
| 254 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; |
|
| 255 | 255 | |
| 256 | 256 | // Other attributes |
| 257 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; |
|
| 257 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
|
| 258 | 258 | |
| 259 | - print '</table>' . "\n"; |
|
| 259 | + print '</table>'."\n"; |
|
| 260 | 260 | |
| 261 | 261 | print dol_get_fiche_end(); |
| 262 | 262 | |
| 263 | 263 | print '<div class="center">'; |
| 264 | - print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">'; |
|
| 264 | + print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">'; |
|
| 265 | 265 | print ' '; |
| 266 | - 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 |
|
| 266 | + 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 |
|
| 267 | 267 | print '</div>'; |
| 268 | 268 | |
| 269 | 269 | print '</form>'; |
@@ -273,35 +273,35 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | // Part to edit record |
| 275 | 275 | if (($id || $ref) && $action == 'edit') { |
| 276 | - print load_fiche_titre($langs->trans("JobProfile"), '', 'object_' . $object->picto); |
|
| 276 | + print load_fiche_titre($langs->trans("JobProfile"), '', 'object_'.$object->picto); |
|
| 277 | 277 | |
| 278 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 279 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 278 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 279 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 280 | 280 | print '<input type="hidden" name="action" value="update">'; |
| 281 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
| 281 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 282 | 282 | if ($backtopage) { |
| 283 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 283 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 284 | 284 | } |
| 285 | 285 | if ($backtopageforcancel) { |
| 286 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 286 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | print dol_get_fiche_head(); |
| 290 | 290 | |
| 291 | - print '<table class="border centpercent tableforfieldedit">' . "\n"; |
|
| 291 | + print '<table class="border centpercent tableforfieldedit">'."\n"; |
|
| 292 | 292 | |
| 293 | 293 | // Common attributes |
| 294 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; |
|
| 294 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; |
|
| 295 | 295 | |
| 296 | 296 | // Other attributes |
| 297 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; |
|
| 297 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; |
|
| 298 | 298 | |
| 299 | 299 | print '</table>'; |
| 300 | 300 | |
| 301 | 301 | print dol_get_fiche_end(); |
| 302 | 302 | |
| 303 | - print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">'; |
|
| 304 | - print ' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
| 303 | + print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">'; |
|
| 304 | + print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
| 305 | 305 | print '</div>'; |
| 306 | 306 | |
| 307 | 307 | print '</form>'; |
@@ -319,11 +319,11 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | // Confirmation to delete |
| 321 | 321 | if ($action == 'delete') { |
| 322 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 322 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 323 | 323 | } |
| 324 | 324 | // Confirmation to delete line |
| 325 | 325 | if ($action == 'deleteline') { |
| 326 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); |
|
| 326 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); |
|
| 327 | 327 | } |
| 328 | 328 | // Clone confirmation |
| 329 | 329 | if ($action == 'clone') { |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) |
| 350 | 350 | ); |
| 351 | 351 | */ |
| 352 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); |
|
| 352 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // Call Hook formConfirm |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | // Object card |
| 369 | 369 | // ------------------------------------------------------------ |
| 370 | - $linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 370 | + $linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 371 | 371 | |
| 372 | 372 | $morehtmlref = '<div class="refid">'; |
| 373 | - $morehtmlref.= $object->label; |
|
| 373 | + $morehtmlref .= $object->label; |
|
| 374 | 374 | $morehtmlref .= '</div>'; |
| 375 | 375 | |
| 376 | 376 | |
@@ -386,11 +386,11 @@ discard block |
||
| 386 | 386 | //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field |
| 387 | 387 | //unset($object->fields['fk_project']); // Hide field already shown in banner |
| 388 | 388 | //unset($object->fields['fk_soc']); // Hide field already shown in banner |
| 389 | - $object->fields['label']['visible']=0; // Already in banner |
|
| 390 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
| 389 | + $object->fields['label']['visible'] = 0; // Already in banner |
|
| 390 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
| 391 | 391 | |
| 392 | 392 | // Other attributes. Fields from hook formObjectOptions and Extrafields. |
| 393 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
| 393 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
| 394 | 394 | |
| 395 | 395 | print '</table>'; |
| 396 | 396 | print '</div>'; |
@@ -409,16 +409,16 @@ discard block |
||
| 409 | 409 | // Show object lines |
| 410 | 410 | $result = $object->getLinesArray(); |
| 411 | 411 | |
| 412 | - print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST"> |
|
| 413 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
| 414 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
| 412 | + print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST"> |
|
| 413 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
| 414 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
| 415 | 415 | <input type="hidden" name="mode" value=""> |
| 416 | 416 | <input type="hidden" name="page_y" value=""> |
| 417 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
| 417 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
| 418 | 418 | '; |
| 419 | 419 | |
| 420 | 420 | if (!empty($conf->use_javascript_ajax) && $object->status == 0) { |
| 421 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; |
|
| 421 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | print '<div class="div-table-responsive-no-min">'; |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | // Buttons for actions |
| 456 | 456 | |
| 457 | 457 | if ($action != 'presend' && $action != 'editline') { |
| 458 | - print '<div class="tabsAction">' . "\n"; |
|
| 458 | + print '<div class="tabsAction">'."\n"; |
|
| 459 | 459 | $parameters = array(); |
| 460 | 460 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
| 461 | 461 | if ($reshook < 0) { |
@@ -465,17 +465,17 @@ discard block |
||
| 465 | 465 | if (empty($reshook)) { |
| 466 | 466 | // Back to draft |
| 467 | 467 | if ($object->status == $object::STATUS_VALIDATED) { |
| 468 | - print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd); |
|
| 468 | + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
| 471 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
| 472 | 472 | |
| 473 | - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=clone&token=' . newToken(), '', $permissiontoadd); |
|
| 473 | + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=clone&token='.newToken(), '', $permissiontoadd); |
|
| 474 | 474 | |
| 475 | 475 | // Delete (need delete permission, or if draft, just need create/modify permission) |
| 476 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete); |
|
| 476 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete); |
|
| 477 | 477 | } |
| 478 | - print '</div>' . "\n"; |
|
| 478 | + print '</div>'."\n"; |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
@@ -493,12 +493,12 @@ discard block |
||
| 493 | 493 | // Documents |
| 494 | 494 | if ($includedocgeneration) { |
| 495 | 495 | $objref = dol_sanitizeFileName($object->ref); |
| 496 | - $relativepath = $objref . '/' . $objref . '.pdf'; |
|
| 497 | - $filedir = $conf->hrm->dir_output . '/' . $object->element . '/' . $objref; |
|
| 498 | - $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; |
|
| 496 | + $relativepath = $objref.'/'.$objref.'.pdf'; |
|
| 497 | + $filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref; |
|
| 498 | + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; |
|
| 499 | 499 | $genallowed = $user->rights->hrm->job->read; // If you can read, you can build the PDF to read content |
| 500 | 500 | $delallowed = $user->rights->hrm->job->write; // If you can create/edit, you can remove a file on card |
| 501 | - print $formfile->showdocuments('hrm:Job', $object->element . '/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); |
|
| 501 | + print $formfile->showdocuments('hrm:Job', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | // Show links to link elements |
@@ -513,9 +513,9 @@ discard block |
||
| 513 | 513 | $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/job_agenda.php?id='.$object->id); |
| 514 | 514 | |
| 515 | 515 | // List of actions on element |
| 516 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
| 516 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
| 517 | 517 | $formactions = new FormActions($db); |
| 518 | - $somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 518 | + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 519 | 519 | |
| 520 | 520 | print '</div></div>'; |
| 521 | 521 | } |
@@ -524,9 +524,9 @@ discard block |
||
| 524 | 524 | $modelmail = 'job'; |
| 525 | 525 | $defaulttopic = 'InformationMessage'; |
| 526 | 526 | $diroutput = $conf->hrm->dir_output; |
| 527 | - $trackid = 'job' . $object->id; |
|
| 527 | + $trackid = 'job'.$object->id; |
|
| 528 | 528 | |
| 529 | - include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php'; |
|
| 529 | + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | // End of page |
@@ -113,8 +113,12 @@ |
||
| 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 | |
@@ -29,19 +29,19 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 ' <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 ' <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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -3647,7 +3647,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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'); |
@@ -881,16 +881,16 @@ discard block |
||
| 881 | 881 | } |
| 882 | 882 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
| 883 | 883 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
| 884 | - $datas[$key]= '<br><b><u>'. $labelextra . '</u></b>'; |
|
| 884 | + $datas[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
| 885 | 885 | } else { |
| 886 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
| 887 | - $datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 886 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
| 887 | + $datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 888 | 888 | $count++; |
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | } |
| 892 | 892 | |
| 893 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 893 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 894 | 894 | $parameters = array( |
| 895 | 895 | 'tooltipcontentarray' => &$datas, |
| 896 | 896 | 'params' => $params, |
@@ -1381,7 +1381,7 @@ discard block |
||
| 1381 | 1381 | if ($source == 'external' || $source == 'thirdparty') { |
| 1382 | 1382 | $sql .= " AND tc.source = 'external'"; |
| 1383 | 1383 | if ($status >= 0) { |
| 1384 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1384 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1385 | 1385 | } |
| 1386 | 1386 | } |
| 1387 | 1387 | $sql .= " AND tc.active = 1"; |
@@ -1740,8 +1740,8 @@ discard block |
||
| 1740 | 1740 | if ($idtofetch) { |
| 1741 | 1741 | $thirdparty = new Societe($this->db); |
| 1742 | 1742 | $result = $thirdparty->fetch($idtofetch); |
| 1743 | - if ($result<0) { |
|
| 1744 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
| 1743 | + if ($result < 0) { |
|
| 1744 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
| 1745 | 1745 | } |
| 1746 | 1746 | $this->thirdparty = $thirdparty; |
| 1747 | 1747 | |
@@ -2055,9 +2055,9 @@ discard block |
||
| 2055 | 2055 | if ($trigkey) { |
| 2056 | 2056 | $oldvalue = null; |
| 2057 | 2057 | |
| 2058 | - $sql = "SELECT " . $field; |
|
| 2059 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
| 2060 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
| 2058 | + $sql = "SELECT ".$field; |
|
| 2059 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
| 2060 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
| 2061 | 2061 | |
| 2062 | 2062 | $resql = $this->db->query($sql); |
| 2063 | 2063 | if ($resql) { |
@@ -2187,7 +2187,7 @@ discard block |
||
| 2187 | 2187 | } |
| 2188 | 2188 | $restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc; |
| 2189 | 2189 | $sql = "SELECT MAX(te.".$fieldid.")"; |
| 2190 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
| 2190 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
| 2191 | 2191 | if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { |
| 2192 | 2192 | $tmparray = explode('@', $this->ismultientitymanaged); |
| 2193 | 2193 | $sql .= ", ".$this->db->prefix().$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity |
@@ -2257,7 +2257,7 @@ discard block |
||
| 2257 | 2257 | $this->ref_previous = $row[0]; |
| 2258 | 2258 | |
| 2259 | 2259 | $sql = "SELECT MIN(te.".$fieldid.")"; |
| 2260 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
| 2260 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
| 2261 | 2261 | if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { |
| 2262 | 2262 | $tmparray = explode('@', $this->ismultientitymanaged); |
| 2263 | 2263 | $sql .= ", ".$this->db->prefix().$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity |
@@ -2411,7 +2411,7 @@ discard block |
||
| 2411 | 2411 | // Triggers |
| 2412 | 2412 | if (!$error && !$notrigger) { |
| 2413 | 2413 | // Call triggers |
| 2414 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
| 2414 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
| 2415 | 2415 | if ($result < 0) { |
| 2416 | 2416 | $error++; |
| 2417 | 2417 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2776,7 +2776,7 @@ discard block |
||
| 2776 | 2776 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
| 2777 | 2777 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
| 2778 | 2778 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
| 2779 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2779 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2780 | 2780 | } |
| 2781 | 2781 | $sql .= ' WHERE rowid='.((int) $this->id); |
| 2782 | 2782 | |
@@ -3125,10 +3125,10 @@ discard block |
||
| 3125 | 3125 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
| 3126 | 3126 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3127 | 3127 | if (!$renum) { |
| 3128 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
| 3128 | + $sql .= " AND ".$fieldposition." = 0"; |
|
| 3129 | 3129 | } |
| 3130 | 3130 | if ($renum) { |
| 3131 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
| 3131 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
| 3132 | 3132 | } |
| 3133 | 3133 | |
| 3134 | 3134 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3149,7 +3149,7 @@ discard block |
||
| 3149 | 3149 | if ($fk_parent_line) { |
| 3150 | 3150 | $sql .= ' AND fk_parent_line IS NULL'; |
| 3151 | 3151 | } |
| 3152 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
| 3152 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
| 3153 | 3153 | |
| 3154 | 3154 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
| 3155 | 3155 | $resql = $this->db->query($sql); |
@@ -3200,7 +3200,7 @@ discard block |
||
| 3200 | 3200 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3201 | 3201 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3202 | 3202 | $sql .= ' AND fk_parent_line = '.((int) $id); |
| 3203 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
| 3203 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
| 3204 | 3204 | |
| 3205 | 3205 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
| 3206 | 3206 | $resql = $this->db->query($sql); |
@@ -3283,8 +3283,8 @@ discard block |
||
| 3283 | 3283 | dol_print_error($this->db); |
| 3284 | 3284 | return -1; |
| 3285 | 3285 | } else { |
| 3286 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3287 | - $action=''; |
|
| 3286 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3287 | + $action = ''; |
|
| 3288 | 3288 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
| 3289 | 3289 | return 1; |
| 3290 | 3290 | } |
@@ -3323,7 +3323,7 @@ discard block |
||
| 3323 | 3323 | |
| 3324 | 3324 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3325 | 3325 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3326 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
| 3326 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
| 3327 | 3327 | if ($this->db->query($sql)) { |
| 3328 | 3328 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
| 3329 | 3329 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3354,7 +3354,7 @@ discard block |
||
| 3354 | 3354 | |
| 3355 | 3355 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3356 | 3356 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3357 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
| 3357 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
| 3358 | 3358 | if ($this->db->query($sql)) { |
| 3359 | 3359 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
| 3360 | 3360 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3380,7 +3380,7 @@ discard block |
||
| 3380 | 3380 | $fieldposition = 'position'; |
| 3381 | 3381 | } |
| 3382 | 3382 | |
| 3383 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3383 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3384 | 3384 | $sql .= " WHERE rowid = ".((int) $rowid); |
| 3385 | 3385 | |
| 3386 | 3386 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3408,7 +3408,7 @@ discard block |
||
| 3408 | 3408 | |
| 3409 | 3409 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3410 | 3410 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3411 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
| 3411 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
| 3412 | 3412 | $resql = $this->db->query($sql); |
| 3413 | 3413 | if ($resql) { |
| 3414 | 3414 | $row = $this->db->fetch_row($resql); |
@@ -3526,7 +3526,7 @@ discard block |
||
| 3526 | 3526 | $newsuffix = ''; |
| 3527 | 3527 | } |
| 3528 | 3528 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
| 3529 | - $fieldusermod = "fk_user_mod"; |
|
| 3529 | + $fieldusermod = "fk_user_mod"; |
|
| 3530 | 3530 | } elseif ($this->table_element == 'ecm_files') { |
| 3531 | 3531 | $fieldusermod = "fk_user_m"; |
| 3532 | 3532 | } else { |
@@ -3568,7 +3568,7 @@ discard block |
||
| 3568 | 3568 | $trigger_name = 'EXPENSE_REPORT_MODIFY'; |
| 3569 | 3569 | break; |
| 3570 | 3570 | default: |
| 3571 | - $trigger_name = strtoupper($this->element) . '_MODIFY'; |
|
| 3571 | + $trigger_name = strtoupper($this->element).'_MODIFY'; |
|
| 3572 | 3572 | } |
| 3573 | 3573 | $ret = $this->call_trigger($trigger_name, $user); |
| 3574 | 3574 | if ($ret < 0) { |
@@ -3926,7 +3926,7 @@ discard block |
||
| 3926 | 3926 | // 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. |
| 3927 | 3927 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
| 3928 | 3928 | // Add module part to target type if object has $module property and isn't in core modules. |
| 3929 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3929 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3930 | 3930 | |
| 3931 | 3931 | $parameters = array('targettype'=>$targettype); |
| 3932 | 3932 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3938,19 +3938,19 @@ discard block |
||
| 3938 | 3938 | $this->db->begin(); |
| 3939 | 3939 | $error = 0; |
| 3940 | 3940 | |
| 3941 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
| 3941 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
| 3942 | 3942 | $sql .= "fk_source"; |
| 3943 | 3943 | $sql .= ", sourcetype"; |
| 3944 | 3944 | $sql .= ", fk_target"; |
| 3945 | 3945 | $sql .= ", targettype"; |
| 3946 | 3946 | $sql .= ") VALUES ("; |
| 3947 | 3947 | $sql .= ((int) $origin_id); |
| 3948 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
| 3949 | - $sql .= ", " . ((int) $this->id); |
|
| 3950 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
| 3948 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
| 3949 | + $sql .= ", ".((int) $this->id); |
|
| 3950 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
| 3951 | 3951 | $sql .= ")"; |
| 3952 | 3952 | |
| 3953 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
| 3953 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
| 3954 | 3954 | if ($this->db->query($sql)) { |
| 3955 | 3955 | if (!$notrigger) { |
| 3956 | 3956 | // Call trigger |
@@ -4257,20 +4257,20 @@ discard block |
||
| 4257 | 4257 | $this->db->begin(); |
| 4258 | 4258 | $error = 0; |
| 4259 | 4259 | |
| 4260 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
| 4260 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
| 4261 | 4261 | if ($updatesource) { |
| 4262 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
| 4263 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4264 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
| 4265 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4262 | + $sql .= "fk_source = ".((int) $sourceid); |
|
| 4263 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4264 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
| 4265 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4266 | 4266 | } elseif ($updatetarget) { |
| 4267 | - $sql .= "fk_target = " . ((int) $targetid); |
|
| 4268 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4269 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
| 4270 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4267 | + $sql .= "fk_target = ".((int) $targetid); |
|
| 4268 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
| 4269 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
| 4270 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4271 | 4271 | } |
| 4272 | 4272 | |
| 4273 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
| 4273 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
| 4274 | 4274 | if ($this->db->query($sql)) { |
| 4275 | 4275 | if (!$notrigger) { |
| 4276 | 4276 | // Call trigger |
@@ -4346,25 +4346,25 @@ discard block |
||
| 4346 | 4346 | } |
| 4347 | 4347 | |
| 4348 | 4348 | if (!$error) { |
| 4349 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
| 4349 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
| 4350 | 4350 | $sql .= " WHERE"; |
| 4351 | 4351 | if ($rowid > 0) { |
| 4352 | - $sql .= " rowid = " . ((int) $rowid); |
|
| 4352 | + $sql .= " rowid = ".((int) $rowid); |
|
| 4353 | 4353 | } else { |
| 4354 | 4354 | if ($deletesource) { |
| 4355 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4356 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4355 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4356 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4357 | 4357 | } elseif ($deletetarget) { |
| 4358 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4359 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4358 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
| 4359 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4360 | 4360 | } else { |
| 4361 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
| 4361 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
| 4362 | 4362 | $sql .= " OR"; |
| 4363 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
| 4363 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
| 4364 | 4364 | } |
| 4365 | 4365 | } |
| 4366 | 4366 | |
| 4367 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
| 4367 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
| 4368 | 4368 | if (!$this->db->query($sql)) { |
| 4369 | 4369 | $this->error = $this->db->lasterror(); |
| 4370 | 4370 | $this->errors[] = $this->error; |
@@ -4526,14 +4526,14 @@ discard block |
||
| 4526 | 4526 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
| 4527 | 4527 | } |
| 4528 | 4528 | $sql .= " WHERE rowid = ".((int) $elementId); |
| 4529 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4529 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4530 | 4530 | |
| 4531 | 4531 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
| 4532 | 4532 | $resql = $this->db->query($sql); |
| 4533 | 4533 | if ($resql) { |
| 4534 | 4534 | $error = 0; |
| 4535 | 4535 | |
| 4536 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4536 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4537 | 4537 | |
| 4538 | 4538 | if ($nb_rows_affected > 0) { |
| 4539 | 4539 | if (empty($trigkey)) { |
@@ -4687,7 +4687,7 @@ discard block |
||
| 4687 | 4687 | return -1; |
| 4688 | 4688 | } |
| 4689 | 4689 | |
| 4690 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4690 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4691 | 4691 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
| 4692 | 4692 | $tmparray = array_keys($this->childtables); |
| 4693 | 4693 | if (is_numeric($tmparray[0])) { |
@@ -4700,26 +4700,26 @@ discard block |
||
| 4700 | 4700 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
| 4701 | 4701 | // Check if element can be deleted |
| 4702 | 4702 | $sql = "SELECT COUNT(*) as nb"; |
| 4703 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4703 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4704 | 4704 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4705 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4705 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4706 | 4706 | } |
| 4707 | 4707 | if (!empty($element['fk_element'])) { |
| 4708 | - $sql.= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
| 4708 | + $sql .= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
| 4709 | 4709 | } else { |
| 4710 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4710 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4711 | 4711 | } |
| 4712 | 4712 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4713 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4713 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4714 | 4714 | } |
| 4715 | 4715 | if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) { |
| 4716 | - $sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
| 4716 | + $sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
| 4717 | 4717 | } |
| 4718 | 4718 | if (!empty($entity)) { |
| 4719 | 4719 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4720 | - $sql.= " AND p.entity = ".((int) $entity); |
|
| 4720 | + $sql .= " AND p.entity = ".((int) $entity); |
|
| 4721 | 4721 | } else { |
| 4722 | - $sql.= " AND c.entity = ".((int) $entity); |
|
| 4722 | + $sql .= " AND c.entity = ".((int) $entity); |
|
| 4723 | 4723 | } |
| 4724 | 4724 | } |
| 4725 | 4725 | |
@@ -4733,9 +4733,9 @@ discard block |
||
| 4733 | 4733 | if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) |
| 4734 | 4734 | $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); |
| 4735 | 4735 | } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) |
| 4736 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
| 4736 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
| 4737 | 4737 | } else { // new usage: $element['name']=Translation key |
| 4738 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
| 4738 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
| 4739 | 4739 | } |
| 4740 | 4740 | break; // We found at least one, we stop here |
| 4741 | 4741 | } |
@@ -4794,7 +4794,7 @@ discard block |
||
| 4794 | 4794 | */ |
| 4795 | 4795 | public function getTotalDiscount() |
| 4796 | 4796 | { |
| 4797 | - if (!empty($this->table_element_line) ) { |
|
| 4797 | + if (!empty($this->table_element_line)) { |
|
| 4798 | 4798 | $total_discount = 0.00; |
| 4799 | 4799 | |
| 4800 | 4800 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
@@ -5746,7 +5746,7 @@ discard block |
||
| 5746 | 5746 | $setsharekey = false; |
| 5747 | 5747 | if ($this->element == 'propal' || $this->element == 'proposal') { |
| 5748 | 5748 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
| 5749 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5749 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5750 | 5750 | } |
| 5751 | 5751 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
| 5752 | 5752 | $setsharekey = true; |
@@ -5804,7 +5804,7 @@ discard block |
||
| 5804 | 5804 | $ecmfile->gen_or_uploaded = 'generated'; |
| 5805 | 5805 | $ecmfile->description = ''; // indexed content |
| 5806 | 5806 | $ecmfile->keywords = ''; // keyword content |
| 5807 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5807 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5808 | 5808 | $ecmfile->src_object_id = $this->id; |
| 5809 | 5809 | |
| 5810 | 5810 | $result = $ecmfile->create($user); |
@@ -5856,7 +5856,7 @@ discard block |
||
| 5856 | 5856 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
| 5857 | 5857 | $maxheightmini = $tmparraysize['maxheightmini']; |
| 5858 | 5858 | //$quality = $tmparraysize['quality']; |
| 5859 | - $quality = 50; // For thumbs, we force quality to 50 |
|
| 5859 | + $quality = 50; // For thumbs, we force quality to 50 |
|
| 5860 | 5860 | |
| 5861 | 5861 | // Create small thumbs for company (Ratio is near 16/9) |
| 5862 | 5862 | // Used on logon for example |
@@ -5958,8 +5958,8 @@ discard block |
||
| 5958 | 5958 | // phpcs:enable |
| 5959 | 5959 | global $langs, $conf; |
| 5960 | 5960 | |
| 5961 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
| 5962 | - dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
| 5961 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
| 5962 | + dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
| 5963 | 5963 | exit; |
| 5964 | 5964 | } |
| 5965 | 5965 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6257,9 +6257,9 @@ discard block |
||
| 6257 | 6257 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
| 6258 | 6258 | //var_dump($conf->disable_compute); |
| 6259 | 6259 | if (empty($conf->disable_compute)) { |
| 6260 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6261 | - $objectoffield = $this; // we can use it inside computed formula |
|
| 6262 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6260 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6261 | + $objectoffield = $this; // we can use it inside computed formula |
|
| 6262 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6263 | 6263 | } |
| 6264 | 6264 | } |
| 6265 | 6265 | } |
@@ -6273,7 +6273,7 @@ discard block |
||
| 6273 | 6273 | return 0; |
| 6274 | 6274 | } |
| 6275 | 6275 | } else { |
| 6276 | - $this->errors[]=$this->db->lasterror; |
|
| 6276 | + $this->errors[] = $this->db->lasterror; |
|
| 6277 | 6277 | return -1; |
| 6278 | 6278 | } |
| 6279 | 6279 | } |
@@ -6440,7 +6440,7 @@ discard block |
||
| 6440 | 6440 | // If old value crypted in database is same than submited new value, it means we don't change it, so we don't update. |
| 6441 | 6441 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6442 | 6442 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6443 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6443 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6444 | 6444 | } else { |
| 6445 | 6445 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6446 | 6446 | } |
@@ -6451,7 +6451,7 @@ discard block |
||
| 6451 | 6451 | // If value has changed |
| 6452 | 6452 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6453 | 6453 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6454 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6454 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6455 | 6455 | } else { |
| 6456 | 6456 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6457 | 6457 | } |
@@ -6463,7 +6463,7 @@ discard block |
||
| 6463 | 6463 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
| 6464 | 6464 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
| 6465 | 6465 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
| 6466 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6466 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6467 | 6467 | } else { |
| 6468 | 6468 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6469 | 6469 | } |
@@ -6849,7 +6849,7 @@ discard block |
||
| 6849 | 6849 | if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) { // If old value crypted in database is same than submited new value, it means we don't change it, so we don't update. |
| 6850 | 6850 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6851 | 6851 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { |
| 6852 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6852 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6853 | 6853 | } else { |
| 6854 | 6854 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 6855 | 6855 | } |
@@ -6869,7 +6869,7 @@ discard block |
||
| 6869 | 6869 | } |
| 6870 | 6870 | } else { |
| 6871 | 6871 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { // dolibarr reversible encryption |
| 6872 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6872 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6873 | 6873 | } else { |
| 6874 | 6874 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 6875 | 6875 | } |
@@ -7119,7 +7119,7 @@ discard block |
||
| 7119 | 7119 | // Special case that force options and type ($type can be integer, varchar, ...) |
| 7120 | 7120 | if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { |
| 7121 | 7121 | $param['options'] = $this->fields[$key]['arrayofkeyval']; |
| 7122 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
| 7122 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7123 | 7123 | } |
| 7124 | 7124 | |
| 7125 | 7125 | $label = $this->fields[$key]['label']; |
@@ -7171,7 +7171,7 @@ discard block |
||
| 7171 | 7171 | |
| 7172 | 7172 | // Add validation state class |
| 7173 | 7173 | if (!empty($validationClass)) { |
| 7174 | - $morecss.= $validationClass; |
|
| 7174 | + $morecss .= $validationClass; |
|
| 7175 | 7175 | } |
| 7176 | 7176 | |
| 7177 | 7177 | if (in_array($type, array('date'))) { |
@@ -7277,7 +7277,7 @@ discard block |
||
| 7277 | 7277 | if (is_array($param['options'])) { |
| 7278 | 7278 | $param_list = array_keys($param['options']); |
| 7279 | 7279 | $InfoFieldList = explode(":", $param_list[0], 5); |
| 7280 | - if (! empty($InfoFieldList[4])) { |
|
| 7280 | + if (!empty($InfoFieldList[4])) { |
|
| 7281 | 7281 | $pos = 0; $parenthesisopen = 0; |
| 7282 | 7282 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
| 7283 | 7283 | if (substr($InfoFieldList[4], $pos, 1) == '(') { |
@@ -7289,7 +7289,7 @@ discard block |
||
| 7289 | 7289 | $pos++; |
| 7290 | 7290 | } |
| 7291 | 7291 | $tmpbefore = substr($InfoFieldList[4], 0, $pos); |
| 7292 | - $tmpafter = substr($InfoFieldList[4], $pos+1); |
|
| 7292 | + $tmpafter = substr($InfoFieldList[4], $pos + 1); |
|
| 7293 | 7293 | //var_dump($InfoFieldList[4].' -> '.$pos); var_dump($tmpafter); |
| 7294 | 7294 | $InfoFieldList[4] = $tmpbefore; |
| 7295 | 7295 | if ($tmpafter !== '') { |
@@ -7337,8 +7337,8 @@ discard block |
||
| 7337 | 7337 | } |
| 7338 | 7338 | |
| 7339 | 7339 | $sqlwhere = ''; |
| 7340 | - $sql = "SELECT " . $keyList; |
|
| 7341 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7340 | + $sql = "SELECT ".$keyList; |
|
| 7341 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
| 7342 | 7342 | if (!empty($InfoFieldList[4])) { |
| 7343 | 7343 | // can use SELECT request |
| 7344 | 7344 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7355,18 +7355,18 @@ discard block |
||
| 7355 | 7355 | // We have to join on extrafield table |
| 7356 | 7356 | $errstr = ''; |
| 7357 | 7357 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7358 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
| 7359 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2]; |
|
| 7360 | - $sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7358 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
| 7359 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]; |
|
| 7360 | + $sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7361 | 7361 | } else { |
| 7362 | - $sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7362 | + $sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7363 | 7363 | } |
| 7364 | 7364 | } else { |
| 7365 | 7365 | $sqlwhere .= ' WHERE 1=1'; |
| 7366 | 7366 | } |
| 7367 | 7367 | // Some tables may have field, some other not. For the moment we disable it. |
| 7368 | 7368 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7369 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7369 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7370 | 7370 | } |
| 7371 | 7371 | $sql .= $sqlwhere; |
| 7372 | 7372 | //print $sql; |
@@ -7378,7 +7378,7 @@ discard block |
||
| 7378 | 7378 | $sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label)); |
| 7379 | 7379 | } |
| 7380 | 7380 | |
| 7381 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
| 7381 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
| 7382 | 7382 | $resql = $this->db->query($sql); |
| 7383 | 7383 | if ($resql) { |
| 7384 | 7384 | $out .= '<option value="0"> </option>'; |
@@ -7394,7 +7394,7 @@ discard block |
||
| 7394 | 7394 | if (count($fields_label) > 1) { |
| 7395 | 7395 | $notrans = true; |
| 7396 | 7396 | foreach ($fields_label as $field_toshow) { |
| 7397 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7397 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7398 | 7398 | } |
| 7399 | 7399 | } else { |
| 7400 | 7400 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7405,12 +7405,12 @@ discard block |
||
| 7405 | 7405 | foreach ($fields_label as $field_toshow) { |
| 7406 | 7406 | $translabel = $langs->trans($obj->$field_toshow); |
| 7407 | 7407 | if ($translabel != $obj->$field_toshow) { |
| 7408 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
| 7408 | + $labeltoshow = dol_trunc($translabel).' '; |
|
| 7409 | 7409 | } else { |
| 7410 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
| 7410 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
| 7411 | 7411 | } |
| 7412 | 7412 | } |
| 7413 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7413 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7414 | 7414 | } else { |
| 7415 | 7415 | if (!$notrans) { |
| 7416 | 7416 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7424,34 +7424,34 @@ discard block |
||
| 7424 | 7424 | $labeltoshow = '(not defined)'; |
| 7425 | 7425 | } |
| 7426 | 7426 | if ($value == $obj->rowid) { |
| 7427 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7427 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7428 | 7428 | } |
| 7429 | 7429 | |
| 7430 | 7430 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7431 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7431 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7432 | 7432 | $isDependList = 1; |
| 7433 | 7433 | } |
| 7434 | 7434 | |
| 7435 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 7435 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 7436 | 7436 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
| 7437 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
| 7438 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 7437 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
| 7438 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 7439 | 7439 | } |
| 7440 | 7440 | |
| 7441 | 7441 | $i++; |
| 7442 | 7442 | } |
| 7443 | 7443 | $this->db->free($resql); |
| 7444 | 7444 | } else { |
| 7445 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7445 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7446 | 7446 | } |
| 7447 | 7447 | } else { |
| 7448 | 7448 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7449 | 7449 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7450 | 7450 | $out .= '<option value="0"> </option>'; |
| 7451 | 7451 | foreach ($data as $data_key => $data_value) { |
| 7452 | - $out .= '<option value="' . $data_key . '"'; |
|
| 7452 | + $out .= '<option value="'.$data_key.'"'; |
|
| 7453 | 7453 | $out .= ($value == $data_key ? ' selected' : ''); |
| 7454 | - $out .= '>' . $data_value . '</option>'; |
|
| 7454 | + $out .= '>'.$data_value.'</option>'; |
|
| 7455 | 7455 | } |
| 7456 | 7456 | } |
| 7457 | 7457 | } |
@@ -7516,8 +7516,8 @@ discard block |
||
| 7516 | 7516 | } |
| 7517 | 7517 | |
| 7518 | 7518 | $sqlwhere = ''; |
| 7519 | - $sql = "SELECT " . $keyList; |
|
| 7520 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7519 | + $sql = "SELECT ".$keyList; |
|
| 7520 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
| 7521 | 7521 | if (!empty($InfoFieldList[4])) { |
| 7522 | 7522 | // can use SELECT request |
| 7523 | 7523 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7533,23 +7533,23 @@ discard block |
||
| 7533 | 7533 | |
| 7534 | 7534 | // We have to join on extrafield table |
| 7535 | 7535 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7536 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
| 7537 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
| 7536 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
| 7537 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
| 7538 | 7538 | } else { |
| 7539 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 7539 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 7540 | 7540 | } |
| 7541 | 7541 | } else { |
| 7542 | 7542 | $sqlwhere .= ' WHERE 1=1'; |
| 7543 | 7543 | } |
| 7544 | 7544 | // Some tables may have field, some other not. For the moment we disable it. |
| 7545 | 7545 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7546 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7546 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7547 | 7547 | } |
| 7548 | 7548 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
| 7549 | 7549 | // print $sql; |
| 7550 | 7550 | |
| 7551 | 7551 | $sql .= $sqlwhere; |
| 7552 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7552 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7553 | 7553 | $resql = $this->db->query($sql); |
| 7554 | 7554 | if ($resql) { |
| 7555 | 7555 | $num = $this->db->num_rows($resql); |
@@ -7567,7 +7567,7 @@ discard block |
||
| 7567 | 7567 | if (count($fields_label) > 1) { |
| 7568 | 7568 | $notrans = true; |
| 7569 | 7569 | foreach ($fields_label as $field_toshow) { |
| 7570 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7570 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7571 | 7571 | } |
| 7572 | 7572 | } else { |
| 7573 | 7573 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7578,9 +7578,9 @@ discard block |
||
| 7578 | 7578 | foreach ($fields_label as $field_toshow) { |
| 7579 | 7579 | $translabel = $langs->trans($obj->$field_toshow); |
| 7580 | 7580 | if ($translabel != $obj->$field_toshow) { |
| 7581 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
| 7581 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
| 7582 | 7582 | } else { |
| 7583 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
| 7583 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
| 7584 | 7584 | } |
| 7585 | 7585 | } |
| 7586 | 7586 | |
@@ -7603,7 +7603,7 @@ discard block |
||
| 7603 | 7603 | } |
| 7604 | 7604 | |
| 7605 | 7605 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7606 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7606 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7607 | 7607 | $isDependList = 1; |
| 7608 | 7608 | } |
| 7609 | 7609 | |
@@ -7614,14 +7614,14 @@ discard block |
||
| 7614 | 7614 | } |
| 7615 | 7615 | $this->db->free($resql); |
| 7616 | 7616 | |
| 7617 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7617 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7618 | 7618 | } else { |
| 7619 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7619 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7620 | 7620 | } |
| 7621 | 7621 | } else { |
| 7622 | 7622 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7623 | 7623 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7624 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7624 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7625 | 7625 | } |
| 7626 | 7626 | } |
| 7627 | 7627 | } elseif ($type == 'link') { |
@@ -7707,7 +7707,7 @@ discard block |
||
| 7707 | 7707 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
| 7708 | 7708 | } |
| 7709 | 7709 | |
| 7710 | - if ($isDependList==1) { |
|
| 7710 | + if ($isDependList == 1) { |
|
| 7711 | 7711 | $out .= $this->getJSListDependancies('_common'); |
| 7712 | 7712 | } |
| 7713 | 7713 | /* Add comments |
@@ -7758,7 +7758,7 @@ discard block |
||
| 7758 | 7758 | $type = 'varchar'; // convert varchar(xx) int varchar |
| 7759 | 7759 | } |
| 7760 | 7760 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
| 7761 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
| 7761 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7762 | 7762 | } |
| 7763 | 7763 | if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) { |
| 7764 | 7764 | $type = 'link'; |
@@ -7843,7 +7843,7 @@ discard block |
||
| 7843 | 7843 | $value = $this->getLibStatut(3); |
| 7844 | 7844 | } elseif ($type == 'date') { |
| 7845 | 7845 | if (!empty($value)) { |
| 7846 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7846 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7847 | 7847 | } else { |
| 7848 | 7848 | $value = ''; |
| 7849 | 7849 | } |
@@ -7881,7 +7881,7 @@ discard block |
||
| 7881 | 7881 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
| 7882 | 7882 | } |
| 7883 | 7883 | } elseif ($type == 'select') { |
| 7884 | - $value = isset($param['options'][$value])?$param['options'][$value]:''; |
|
| 7884 | + $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; |
|
| 7885 | 7885 | } elseif ($type == 'sellist') { |
| 7886 | 7886 | $param_list = array_keys($param['options']); |
| 7887 | 7887 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -7941,9 +7941,9 @@ discard block |
||
| 7941 | 7941 | $translabel = $langs->trans($obj->$field_toshow); |
| 7942 | 7942 | } |
| 7943 | 7943 | if ($translabel != $field_toshow) { |
| 7944 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
| 7944 | + $value .= dol_trunc($translabel, 18).' '; |
|
| 7945 | 7945 | } else { |
| 7946 | - $value .= $obj->$field_toshow . ' '; |
|
| 7946 | + $value .= $obj->$field_toshow.' '; |
|
| 7947 | 7947 | } |
| 7948 | 7948 | } |
| 7949 | 7949 | } else { |
@@ -7959,7 +7959,7 @@ discard block |
||
| 7959 | 7959 | } |
| 7960 | 7960 | } |
| 7961 | 7961 | } else { |
| 7962 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 7962 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 7963 | 7963 | |
| 7964 | 7964 | $toprint = array(); |
| 7965 | 7965 | $obj = $this->db->fetch_object($resql); |
@@ -7967,7 +7967,7 @@ discard block |
||
| 7967 | 7967 | $c->fetch($obj->rowid); |
| 7968 | 7968 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 7969 | 7969 | foreach ($ways as $way) { |
| 7970 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 7970 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 7971 | 7971 | } |
| 7972 | 7972 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
| 7973 | 7973 | } |
@@ -7983,11 +7983,11 @@ discard block |
||
| 7983 | 7983 | $toprint = array(); |
| 7984 | 7984 | foreach ($value_arr as $keyval => $valueval) { |
| 7985 | 7985 | if (!empty($valueval)) { |
| 7986 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
| 7986 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
| 7987 | 7987 | } |
| 7988 | 7988 | } |
| 7989 | 7989 | if (!empty($toprint)) { |
| 7990 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 7990 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 7991 | 7991 | } |
| 7992 | 7992 | } |
| 7993 | 7993 | } elseif ($type == 'chkbxlst') { |
@@ -8042,9 +8042,9 @@ discard block |
||
| 8042 | 8042 | $translabel = $langs->trans($obj->$field_toshow); |
| 8043 | 8043 | } |
| 8044 | 8044 | if ($translabel != $field_toshow) { |
| 8045 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8045 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8046 | 8046 | } else { |
| 8047 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
| 8047 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
| 8048 | 8048 | } |
| 8049 | 8049 | } |
| 8050 | 8050 | } else { |
@@ -8053,15 +8053,15 @@ discard block |
||
| 8053 | 8053 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
| 8054 | 8054 | } |
| 8055 | 8055 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
| 8056 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8056 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8057 | 8057 | } else { |
| 8058 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
| 8058 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
| 8059 | 8059 | } |
| 8060 | 8060 | } |
| 8061 | 8061 | } |
| 8062 | 8062 | } |
| 8063 | 8063 | } else { |
| 8064 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8064 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8065 | 8065 | |
| 8066 | 8066 | $toprint = array(); |
| 8067 | 8067 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -8070,7 +8070,7 @@ discard block |
||
| 8070 | 8070 | $c->fetch($obj->rowid); |
| 8071 | 8071 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8072 | 8072 | foreach ($ways as $way) { |
| 8073 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8073 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8074 | 8074 | } |
| 8075 | 8075 | } |
| 8076 | 8076 | } |
@@ -8217,7 +8217,7 @@ discard block |
||
| 8217 | 8217 | global $langs; |
| 8218 | 8218 | |
| 8219 | 8219 | if (!class_exists('Validate')) { |
| 8220 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
| 8220 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
| 8221 | 8221 | } |
| 8222 | 8222 | |
| 8223 | 8223 | $this->clearFieldError($fieldKey); |
@@ -8431,7 +8431,7 @@ discard block |
||
| 8431 | 8431 | $out .= "\n"; |
| 8432 | 8432 | |
| 8433 | 8433 | $nbofextrafieldsshown = 0; |
| 8434 | - $e = 0; // var to manage the modulo (odd/even) |
|
| 8434 | + $e = 0; // var to manage the modulo (odd/even) |
|
| 8435 | 8435 | |
| 8436 | 8436 | $lastseparatorkeyfound = ''; |
| 8437 | 8437 | $extrafields_collapse_num = ''; |
@@ -8482,7 +8482,7 @@ discard block |
||
| 8482 | 8482 | } |
| 8483 | 8483 | |
| 8484 | 8484 | $colspan = 0; |
| 8485 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
| 8485 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
| 8486 | 8486 | if (array_key_exists('cols', $params)) { |
| 8487 | 8487 | $colspan = $params['cols']; |
| 8488 | 8488 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8569,7 +8569,7 @@ discard block |
||
| 8569 | 8569 | $domData .= ' data-targetid="'.$this->id.'"'; |
| 8570 | 8570 | |
| 8571 | 8571 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
| 8572 | - if ($display_type=='card') { |
|
| 8572 | + if ($display_type == 'card') { |
|
| 8573 | 8573 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { |
| 8574 | 8574 | $colspan = 0; |
| 8575 | 8575 | } |
@@ -8680,12 +8680,12 @@ discard block |
||
| 8680 | 8680 | break; |
| 8681 | 8681 | } |
| 8682 | 8682 | |
| 8683 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
| 8683 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
| 8684 | 8684 | |
| 8685 | 8685 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) { |
| 8686 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8686 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8687 | 8687 | } else { |
| 8688 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8688 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8689 | 8689 | } |
| 8690 | 8690 | |
| 8691 | 8691 | $e++; |
@@ -9068,7 +9068,7 @@ discard block |
||
| 9068 | 9068 | if ($val['share']) { |
| 9069 | 9069 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
| 9070 | 9070 | $return .= '<!-- Show original file (thumb not yet available with shared links) -->'; |
| 9071 | - $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).'">'; |
|
| 9071 | + $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).'">'; |
|
| 9072 | 9072 | } else { |
| 9073 | 9073 | $return .= '<!-- Show original file -->'; |
| 9074 | 9074 | $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).'">'; |
@@ -9080,7 +9080,7 @@ discard block |
||
| 9080 | 9080 | } else { |
| 9081 | 9081 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
| 9082 | 9082 | $return .= '<!-- Show thumb -->'; |
| 9083 | - $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).'">'; |
|
| 9083 | + $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).'">'; |
|
| 9084 | 9084 | } else { |
| 9085 | 9085 | $return .= '<!-- Show original file -->'; |
| 9086 | 9086 | $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).'">'; |
@@ -9489,7 +9489,7 @@ discard block |
||
| 9489 | 9489 | continue; |
| 9490 | 9490 | } |
| 9491 | 9491 | } |
| 9492 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
| 9492 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
| 9493 | 9493 | } |
| 9494 | 9494 | return implode(',', $keys_with_alias); |
| 9495 | 9495 | } else { |
@@ -9609,7 +9609,7 @@ discard block |
||
| 9609 | 9609 | if (!$error) { |
| 9610 | 9610 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
| 9611 | 9611 | $sql .= " (".implode(", ", $keys).')'; |
| 9612 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9612 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9613 | 9613 | |
| 9614 | 9614 | $res = $this->db->query($sql); |
| 9615 | 9615 | if (!$res) { |
@@ -9894,7 +9894,7 @@ discard block |
||
| 9894 | 9894 | |
| 9895 | 9895 | // Update extrafield |
| 9896 | 9896 | if (!$error) { |
| 9897 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 9897 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 9898 | 9898 | if ($result < 0) { |
| 9899 | 9899 | $error++; |
| 9900 | 9900 | } |
@@ -10421,7 +10421,7 @@ discard block |
||
| 10421 | 10421 | // Process |
| 10422 | 10422 | foreach ($to_del as $del) { |
| 10423 | 10423 | if ($c->fetch($del) > 0) { |
| 10424 | - $result=$c->del_type($this, $type_categ); |
|
| 10424 | + $result = $c->del_type($this, $type_categ); |
|
| 10425 | 10425 | if ($result < 0) { |
| 10426 | 10426 | $error++; |
| 10427 | 10427 | $this->error = $c->error; |
@@ -91,8 +91,8 @@ |
||
| 91 | 91 | $label_default = getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT'); |
| 92 | 92 | $qty_default = 1; |
| 93 | 93 | |
| 94 | - print '<input type="text" id="label" name="label" class="takepospay" value="' . $label_default . '" style="width:40%;" placeholder="' . $langs->trans('Label') . '">'; |
|
| 95 | - print '<input type="text" id="qty" name="qty" class="takepospay" value="' . $qty_default . '" style="width:10%;" placeholder="' . $langs->trans('Qty') . '">'; |
|
| 94 | + print '<input type="text" id="label" name="label" class="takepospay" value="'.$label_default.'" style="width:40%;" placeholder="'.$langs->trans('Label').'">'; |
|
| 95 | + print '<input type="text" id="qty" name="qty" class="takepospay" value="'.$qty_default.'" style="width:10%;" placeholder="'.$langs->trans('Qty').'">'; |
|
| 96 | 96 | } |
| 97 | 97 | ?> |
| 98 | 98 | <input type="button" class="button takepospay clearboth" value="OK" onclick="Save();"> |
@@ -273,7 +273,7 @@ |
||
| 273 | 273 | print '<tr class="oddeven"><td>'; |
| 274 | 274 | print $langs->trans('PrintWithoutDetailsLabelDefault'); |
| 275 | 275 | print '<td colspan="2">'; |
| 276 | - print '<input type="text" name="TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT" value="' . getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT') . '" />'; |
|
| 276 | + print '<input type="text" name="TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT" value="'.getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT').'" />'; |
|
| 277 | 277 | print "</td></tr>\n"; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -136,8 +136,12 @@ |
||
| 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 | /* |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | // Load Dolibarr environment |
| 30 | 30 | require '../main.inc.php'; |
| 31 | 31 | |
| 32 | -require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
| 34 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
| 35 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php'; |
|
| 36 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skill.lib.php'; |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | // Load translation files required by the page |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $linkback = '<a href="'.DOL_URL_ROOT.'/hrm/skill_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
| 153 | 153 | |
| 154 | 154 | $morehtmlref = '<div class="refid">'; |
| 155 | - $morehtmlref.= $object->label; |
|
| 155 | + $morehtmlref .= $object->label; |
|
| 156 | 156 | $morehtmlref .= '</div>'; |
| 157 | 157 | |
| 158 | 158 | |
@@ -136,8 +136,12 @@ |
||
| 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 | /* |
@@ -136,8 +136,12 @@ |
||
| 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 | /* |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
| 35 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
| 36 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skill.lib.php'; |
|
| 38 | 38 | |
| 39 | 39 | // Load translation files required by the page |
| 40 | 40 | $langs->loadLangs(array('hrm', 'companies', 'other', 'mails')); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $linkback = '<a href="'.DOL_URL_ROOT.'/hrm/skill_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
| 132 | 132 | |
| 133 | 133 | $morehtmlref = '<div class="refid">'; |
| 134 | - $morehtmlref.= $object->label; |
|
| 134 | + $morehtmlref .= $object->label; |
|
| 135 | 135 | $morehtmlref .= '</div>'; |
| 136 | 136 | |
| 137 | 137 | dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref); |
@@ -136,8 +136,12 @@ |
||
| 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 | /* |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | // Load Dolibarr environment |
| 30 | 30 | require '../main.inc.php'; |
| 31 | 31 | |
| 32 | -require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
| 34 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.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.'/contact/class/contact.class.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.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 | 39 | $langs->loadLangs(array('hrm', 'other')); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
| 152 | 152 | |
| 153 | 153 | $morehtmlref = '<div class="refid">'; |
| 154 | - $morehtmlref.= $object->label; |
|
| 154 | + $morehtmlref .= $object->label; |
|
| 155 | 155 | $morehtmlref .= '</div>'; |
| 156 | 156 | |
| 157 | 157 | |