@@ -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 | |
@@ -209,36 +209,36 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | // Part to edit record |
| 211 | 211 | if (($id || $ref) && $action == 'edit') { |
| 212 | - print load_fiche_titre($langs->trans("Position"), '', 'object_' . $object->picto); |
|
| 212 | + print load_fiche_titre($langs->trans("Position"), '', 'object_'.$object->picto); |
|
| 213 | 213 | |
| 214 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">'; |
|
| 215 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 214 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'; |
|
| 215 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 216 | 216 | print '<input type="hidden" name="action" value="update">'; |
| 217 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
| 217 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 218 | 218 | |
| 219 | 219 | if ($backtopage) { |
| 220 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 220 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 221 | 221 | } |
| 222 | 222 | if ($backtopageforcancel) { |
| 223 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 223 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | print dol_get_fiche_head(); |
| 227 | 227 | |
| 228 | - print '<table class="border centpercent tableforfieldedit">' . "\n"; |
|
| 228 | + print '<table class="border centpercent tableforfieldedit">'."\n"; |
|
| 229 | 229 | |
| 230 | 230 | // Common attributes |
| 231 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; |
|
| 231 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; |
|
| 232 | 232 | |
| 233 | 233 | // Other attributes |
| 234 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; |
|
| 234 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; |
|
| 235 | 235 | |
| 236 | 236 | print '</table>'; |
| 237 | 237 | |
| 238 | 238 | print dol_get_fiche_end(); |
| 239 | 239 | |
| 240 | - print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">'; |
|
| 241 | - print ' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
| 240 | + print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">'; |
|
| 241 | + print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
| 242 | 242 | print '</div>'; |
| 243 | 243 | |
| 244 | 244 | print '</form>'; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | // Confirmation to delete |
| 259 | 259 | if ($action == 'delete') { |
| 260 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeletePosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 260 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeletePosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | // Call Hook formConfirm |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | // Object card |
| 277 | 277 | // ------------------------------------------------------------ |
| 278 | 278 | // $linkback = '<a href="' . dol_buildpath('/hrm/position.php', 1) . '?restore_lastsearch_values=1' . (!empty($object->fk_job) ? '&fk_job=' . $object->fk_job : '') . '">' . $langs->trans("BackToList") . '</a>'; |
| 279 | - $linkback = '<a href="' . dol_buildpath('/hrm/position_list.php', 1) . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 279 | + $linkback = '<a href="'.dol_buildpath('/hrm/position_list.php', 1).'">'.$langs->trans("BackToList").'</a>'; |
|
| 280 | 280 | |
| 281 | 281 | $morehtmlref = '<div class="refidno">'; |
| 282 | 282 | $u_position = new User(($db)); |
@@ -293,18 +293,18 @@ discard block |
||
| 293 | 293 | print '<div class="fichecenter">'; |
| 294 | 294 | print '<div class="fichehalfleft">'; |
| 295 | 295 | print '<div class="underbanner clearboth"></div>'; |
| 296 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
| 296 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
| 297 | 297 | |
| 298 | 298 | // Common attributes |
| 299 | 299 | //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field |
| 300 | 300 | //unset($object->fields['fk_project']); // Hide field already shown in banner |
| 301 | 301 | //unset($object->fields['fk_soc']); // Hide field already shown in banner |
| 302 | - $object->fields['fk_user']['visible']=0; // Already in banner |
|
| 303 | - $object->fields['fk_job']['visible']=0; // Already in banner |
|
| 304 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
| 302 | + $object->fields['fk_user']['visible'] = 0; // Already in banner |
|
| 303 | + $object->fields['fk_job']['visible'] = 0; // Already in banner |
|
| 304 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
| 305 | 305 | |
| 306 | 306 | // Other attributes. Fields from hook formObjectOptions and Extrafields. |
| 307 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
| 307 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
| 308 | 308 | |
| 309 | 309 | print '</table>'; |
| 310 | 310 | print '</div>'; |
@@ -323,10 +323,10 @@ discard block |
||
| 323 | 323 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
| 324 | 324 | |
| 325 | 325 | |
| 326 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
| 326 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
| 327 | 327 | |
| 328 | 328 | // Delete (need delete permission, or if draft, just need create/modify permission) |
| 329 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete); |
|
| 329 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete); |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
@@ -364,10 +364,10 @@ discard block |
||
| 364 | 364 | //} |
| 365 | 365 | |
| 366 | 366 | |
| 367 | -print '</table>' . "\n"; |
|
| 368 | -print '</div>' . "\n"; |
|
| 367 | +print '</table>'."\n"; |
|
| 368 | +print '</div>'."\n"; |
|
| 369 | 369 | |
| 370 | -print '</form>' . "\n"; |
|
| 370 | +print '</form>'."\n"; |
|
| 371 | 371 | |
| 372 | 372 | |
| 373 | 373 | if ($action !== 'edit' && $action !== 'create') { |
@@ -385,9 +385,9 @@ discard block |
||
| 385 | 385 | $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/position_agenda.php?id='.$object->id); |
| 386 | 386 | |
| 387 | 387 | // List of actions on element |
| 388 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
| 388 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
| 389 | 389 | $formactions = new FormActions($db); |
| 390 | - $somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 390 | + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 391 | 391 | |
| 392 | 392 | print '</div></div>'; |
| 393 | 393 | } |
@@ -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'); |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | $this->lastname = dol_ucwords(dol_strtolower($this->lastname)); |
| 751 | 751 | $this->firstname = dol_ucwords(dol_strtolower($this->firstname)); |
| 752 | 752 | $this->name = dol_ucwords(dol_strtolower($this->name)); |
| 753 | - $this->name_alias = isset($this->name_alias)?dol_ucwords(dol_strtolower($this->name_alias)):''; |
|
| 753 | + $this->name_alias = isset($this->name_alias) ?dol_ucwords(dol_strtolower($this->name_alias)) : ''; |
|
| 754 | 754 | } |
| 755 | 755 | if (!empty($conf->global->MAIN_ALL_TO_UPPER)) { |
| 756 | 756 | $this->lastname = dol_strtoupper($this->lastname); |
@@ -1394,7 +1394,7 @@ discard block |
||
| 1394 | 1394 | if ($source == 'external' || $source == 'thirdparty') { |
| 1395 | 1395 | $sql .= " AND tc.source = 'external'"; |
| 1396 | 1396 | if ($status >= 0) { |
| 1397 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1397 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1398 | 1398 | } |
| 1399 | 1399 | } |
| 1400 | 1400 | $sql .= " AND tc.active=1"; |
@@ -1752,8 +1752,8 @@ discard block |
||
| 1752 | 1752 | if ($idtofetch) { |
| 1753 | 1753 | $thirdparty = new Societe($this->db); |
| 1754 | 1754 | $result = $thirdparty->fetch($idtofetch); |
| 1755 | - if ($result<0) { |
|
| 1756 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
| 1755 | + if ($result < 0) { |
|
| 1756 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
| 1757 | 1757 | } |
| 1758 | 1758 | $this->thirdparty = $thirdparty; |
| 1759 | 1759 | |
@@ -2152,7 +2152,7 @@ discard block |
||
| 2152 | 2152 | } |
| 2153 | 2153 | $restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc; |
| 2154 | 2154 | $sql = "SELECT MAX(te.".$fieldid.")"; |
| 2155 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
| 2155 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
| 2156 | 2156 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
| 2157 | 2157 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
| 2158 | 2158 | } |
@@ -2222,7 +2222,7 @@ discard block |
||
| 2222 | 2222 | $this->ref_previous = $row[0]; |
| 2223 | 2223 | |
| 2224 | 2224 | $sql = "SELECT MIN(te.".$fieldid.")"; |
| 2225 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
| 2225 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
| 2226 | 2226 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
| 2227 | 2227 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
| 2228 | 2228 | } |
@@ -2376,7 +2376,7 @@ discard block |
||
| 2376 | 2376 | // Triggers |
| 2377 | 2377 | if (!$error && !$notrigger) { |
| 2378 | 2378 | // Call triggers |
| 2379 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
| 2379 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
| 2380 | 2380 | if ($result < 0) { |
| 2381 | 2381 | $error++; |
| 2382 | 2382 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2729,7 +2729,7 @@ discard block |
||
| 2729 | 2729 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
| 2730 | 2730 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
| 2731 | 2731 | if (in_array($this->table_element, array('propal', 'commande'))) { |
| 2732 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2732 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2733 | 2733 | } |
| 2734 | 2734 | $sql .= ' WHERE rowid='.((int) $this->id); |
| 2735 | 2735 | |
@@ -3074,10 +3074,10 @@ discard block |
||
| 3074 | 3074 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
| 3075 | 3075 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3076 | 3076 | if (!$renum) { |
| 3077 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
| 3077 | + $sql .= " AND ".$fieldposition." = 0"; |
|
| 3078 | 3078 | } |
| 3079 | 3079 | if ($renum) { |
| 3080 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
| 3080 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
| 3081 | 3081 | } |
| 3082 | 3082 | |
| 3083 | 3083 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3098,7 +3098,7 @@ discard block |
||
| 3098 | 3098 | if ($fk_parent_line) { |
| 3099 | 3099 | $sql .= ' AND fk_parent_line IS NULL'; |
| 3100 | 3100 | } |
| 3101 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
| 3101 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
| 3102 | 3102 | |
| 3103 | 3103 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
| 3104 | 3104 | $resql = $this->db->query($sql); |
@@ -3149,7 +3149,7 @@ discard block |
||
| 3149 | 3149 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3150 | 3150 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3151 | 3151 | $sql .= ' AND fk_parent_line = '.((int) $id); |
| 3152 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
| 3152 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
| 3153 | 3153 | |
| 3154 | 3154 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
| 3155 | 3155 | $resql = $this->db->query($sql); |
@@ -3232,8 +3232,8 @@ discard block |
||
| 3232 | 3232 | dol_print_error($this->db); |
| 3233 | 3233 | return -1; |
| 3234 | 3234 | } else { |
| 3235 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3236 | - $action=''; |
|
| 3235 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3236 | + $action = ''; |
|
| 3237 | 3237 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
| 3238 | 3238 | return 1; |
| 3239 | 3239 | } |
@@ -3272,7 +3272,7 @@ discard block |
||
| 3272 | 3272 | |
| 3273 | 3273 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3274 | 3274 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3275 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
| 3275 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
| 3276 | 3276 | if ($this->db->query($sql)) { |
| 3277 | 3277 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
| 3278 | 3278 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3303,7 +3303,7 @@ discard block |
||
| 3303 | 3303 | |
| 3304 | 3304 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3305 | 3305 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3306 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
| 3306 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
| 3307 | 3307 | if ($this->db->query($sql)) { |
| 3308 | 3308 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
| 3309 | 3309 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3329,7 +3329,7 @@ discard block |
||
| 3329 | 3329 | $fieldposition = 'position'; |
| 3330 | 3330 | } |
| 3331 | 3331 | |
| 3332 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3332 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3333 | 3333 | $sql .= " WHERE rowid = ".((int) $rowid); |
| 3334 | 3334 | |
| 3335 | 3335 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3355,7 +3355,7 @@ discard block |
||
| 3355 | 3355 | |
| 3356 | 3356 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3357 | 3357 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3358 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
| 3358 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
| 3359 | 3359 | $resql = $this->db->query($sql); |
| 3360 | 3360 | if ($resql) { |
| 3361 | 3361 | $row = $this->db->fetch_row($resql); |
@@ -3468,7 +3468,7 @@ discard block |
||
| 3468 | 3468 | $newsuffix = ''; |
| 3469 | 3469 | } |
| 3470 | 3470 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
| 3471 | - $fieldusermod = "fk_user_mod"; |
|
| 3471 | + $fieldusermod = "fk_user_mod"; |
|
| 3472 | 3472 | } elseif ($this->table_element == 'ecm_files') { |
| 3473 | 3473 | $fieldusermod = "fk_user_m"; |
| 3474 | 3474 | } else { |
@@ -3831,7 +3831,7 @@ discard block |
||
| 3831 | 3831 | // 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. |
| 3832 | 3832 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
| 3833 | 3833 | // Add module part to target type if object has $module property and isn't in core modules. |
| 3834 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3834 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3835 | 3835 | |
| 3836 | 3836 | $parameters = array('targettype'=>$targettype); |
| 3837 | 3837 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3843,19 +3843,19 @@ discard block |
||
| 3843 | 3843 | $this->db->begin(); |
| 3844 | 3844 | $error = 0; |
| 3845 | 3845 | |
| 3846 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
| 3846 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
| 3847 | 3847 | $sql .= "fk_source"; |
| 3848 | 3848 | $sql .= ", sourcetype"; |
| 3849 | 3849 | $sql .= ", fk_target"; |
| 3850 | 3850 | $sql .= ", targettype"; |
| 3851 | 3851 | $sql .= ") VALUES ("; |
| 3852 | 3852 | $sql .= ((int) $origin_id); |
| 3853 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
| 3854 | - $sql .= ", " . ((int) $this->id); |
|
| 3855 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
| 3853 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
| 3854 | + $sql .= ", ".((int) $this->id); |
|
| 3855 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
| 3856 | 3856 | $sql .= ")"; |
| 3857 | 3857 | |
| 3858 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
| 3858 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
| 3859 | 3859 | if ($this->db->query($sql)) { |
| 3860 | 3860 | if (!$notrigger) { |
| 3861 | 3861 | // Call trigger |
@@ -4146,20 +4146,20 @@ discard block |
||
| 4146 | 4146 | $this->db->begin(); |
| 4147 | 4147 | $error = 0; |
| 4148 | 4148 | |
| 4149 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
| 4149 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
| 4150 | 4150 | if ($updatesource) { |
| 4151 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
| 4152 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4153 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
| 4154 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4151 | + $sql .= "fk_source = ".((int) $sourceid); |
|
| 4152 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4153 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
| 4154 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4155 | 4155 | } elseif ($updatetarget) { |
| 4156 | - $sql .= "fk_target = " . ((int) $targetid); |
|
| 4157 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4158 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
| 4159 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4156 | + $sql .= "fk_target = ".((int) $targetid); |
|
| 4157 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
| 4158 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
| 4159 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4160 | 4160 | } |
| 4161 | 4161 | |
| 4162 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
| 4162 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
| 4163 | 4163 | if ($this->db->query($sql)) { |
| 4164 | 4164 | if (!$notrigger) { |
| 4165 | 4165 | // Call trigger |
@@ -4235,25 +4235,25 @@ discard block |
||
| 4235 | 4235 | } |
| 4236 | 4236 | |
| 4237 | 4237 | if (!$error) { |
| 4238 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
| 4238 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
| 4239 | 4239 | $sql .= " WHERE"; |
| 4240 | 4240 | if ($rowid > 0) { |
| 4241 | - $sql .= " rowid = " . ((int) $rowid); |
|
| 4241 | + $sql .= " rowid = ".((int) $rowid); |
|
| 4242 | 4242 | } else { |
| 4243 | 4243 | if ($deletesource) { |
| 4244 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4245 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4244 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4245 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4246 | 4246 | } elseif ($deletetarget) { |
| 4247 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4248 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4247 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
| 4248 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4249 | 4249 | } else { |
| 4250 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
| 4250 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
| 4251 | 4251 | $sql .= " OR"; |
| 4252 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
| 4252 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
| 4253 | 4253 | } |
| 4254 | 4254 | } |
| 4255 | 4255 | |
| 4256 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
| 4256 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
| 4257 | 4257 | if (!$this->db->query($sql)) { |
| 4258 | 4258 | $this->error = $this->db->lasterror(); |
| 4259 | 4259 | $this->errors[] = $this->error; |
@@ -4383,14 +4383,14 @@ discard block |
||
| 4383 | 4383 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
| 4384 | 4384 | } |
| 4385 | 4385 | $sql .= " WHERE rowid = ".((int) $elementId); |
| 4386 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4386 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4387 | 4387 | |
| 4388 | 4388 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
| 4389 | 4389 | $resql = $this->db->query($sql); |
| 4390 | 4390 | if ($resql) { |
| 4391 | 4391 | $error = 0; |
| 4392 | 4392 | |
| 4393 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4393 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4394 | 4394 | |
| 4395 | 4395 | if ($nb_rows_affected > 0) { |
| 4396 | 4396 | if (empty($trigkey)) { |
@@ -4555,19 +4555,19 @@ discard block |
||
| 4555 | 4555 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
| 4556 | 4556 | // Check if element can be deleted |
| 4557 | 4557 | $sql = "SELECT COUNT(*) as nb"; |
| 4558 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4558 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4559 | 4559 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4560 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4560 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4561 | 4561 | } |
| 4562 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4562 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4563 | 4563 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4564 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4564 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4565 | 4565 | } |
| 4566 | 4566 | if (!empty($entity)) { |
| 4567 | 4567 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4568 | - $sql.= " AND p.entity = ".((int) $entity); |
|
| 4568 | + $sql .= " AND p.entity = ".((int) $entity); |
|
| 4569 | 4569 | } else { |
| 4570 | - $sql.= " AND c.entity = ".((int) $entity); |
|
| 4570 | + $sql .= " AND c.entity = ".((int) $entity); |
|
| 4571 | 4571 | } |
| 4572 | 4572 | } |
| 4573 | 4573 | $resql = $this->db->query($sql); |
@@ -4580,9 +4580,9 @@ discard block |
||
| 4580 | 4580 | if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) |
| 4581 | 4581 | $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); |
| 4582 | 4582 | } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) |
| 4583 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
| 4583 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
| 4584 | 4584 | } else { // new usage: $element['name']=Translation key |
| 4585 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
| 4585 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
| 4586 | 4586 | } |
| 4587 | 4587 | break; // We found at least one, we stop here |
| 4588 | 4588 | } |
@@ -4641,7 +4641,7 @@ discard block |
||
| 4641 | 4641 | */ |
| 4642 | 4642 | public function getTotalDiscount() |
| 4643 | 4643 | { |
| 4644 | - if (!empty($this->table_element_line) ) { |
|
| 4644 | + if (!empty($this->table_element_line)) { |
|
| 4645 | 4645 | $total_discount = 0.00; |
| 4646 | 4646 | |
| 4647 | 4647 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
@@ -5590,7 +5590,7 @@ discard block |
||
| 5590 | 5590 | $setsharekey = false; |
| 5591 | 5591 | if ($this->element == 'propal' || $this->element == 'proposal') { |
| 5592 | 5592 | if (!isset($conf->global->PROPOSAL_ALLOW_ONLINESIGN) || !empty($conf->global->PROPOSAL_ALLOW_ONLINESIGN)) { |
| 5593 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5593 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5594 | 5594 | } |
| 5595 | 5595 | if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) { |
| 5596 | 5596 | $setsharekey = true; |
@@ -5645,7 +5645,7 @@ discard block |
||
| 5645 | 5645 | $ecmfile->gen_or_uploaded = 'generated'; |
| 5646 | 5646 | $ecmfile->description = ''; // indexed content |
| 5647 | 5647 | $ecmfile->keywords = ''; // keyword content |
| 5648 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5648 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5649 | 5649 | $ecmfile->src_object_id = $this->id; |
| 5650 | 5650 | |
| 5651 | 5651 | $result = $ecmfile->create($user); |
@@ -5772,8 +5772,8 @@ discard block |
||
| 5772 | 5772 | { |
| 5773 | 5773 | // phpcs:enable |
| 5774 | 5774 | global $langs, $conf; |
| 5775 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
| 5776 | - dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
| 5775 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
| 5776 | + dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
| 5777 | 5777 | exit; |
| 5778 | 5778 | } |
| 5779 | 5779 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers. |
@@ -6078,7 +6078,7 @@ discard block |
||
| 6078 | 6078 | return 0; |
| 6079 | 6079 | } |
| 6080 | 6080 | } else { |
| 6081 | - $this->errors[]=$this->db->lasterror; |
|
| 6081 | + $this->errors[] = $this->db->lasterror; |
|
| 6082 | 6082 | return -1; |
| 6083 | 6083 | } |
| 6084 | 6084 | } |
@@ -6868,7 +6868,7 @@ discard block |
||
| 6868 | 6868 | |
| 6869 | 6869 | // Add validation state class |
| 6870 | 6870 | if (!empty($validationClass)) { |
| 6871 | - $morecss.= $validationClass; |
|
| 6871 | + $morecss .= $validationClass; |
|
| 6872 | 6872 | } |
| 6873 | 6873 | |
| 6874 | 6874 | if (in_array($type, array('date'))) { |
@@ -7012,8 +7012,8 @@ discard block |
||
| 7012 | 7012 | } |
| 7013 | 7013 | |
| 7014 | 7014 | $sqlwhere = ''; |
| 7015 | - $sql = "SELECT " . $keyList; |
|
| 7016 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7015 | + $sql = "SELECT ".$keyList; |
|
| 7016 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
| 7017 | 7017 | if (!empty($InfoFieldList[4])) { |
| 7018 | 7018 | // can use SELECT request |
| 7019 | 7019 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7029,24 +7029,24 @@ discard block |
||
| 7029 | 7029 | |
| 7030 | 7030 | //We have to join on extrafield table |
| 7031 | 7031 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7032 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
| 7033 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
| 7032 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
| 7033 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
| 7034 | 7034 | } else { |
| 7035 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 7035 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 7036 | 7036 | } |
| 7037 | 7037 | } else { |
| 7038 | 7038 | $sqlwhere .= ' WHERE 1=1'; |
| 7039 | 7039 | } |
| 7040 | 7040 | // Some tables may have field, some other not. For the moment we disable it. |
| 7041 | 7041 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7042 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7042 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7043 | 7043 | } |
| 7044 | 7044 | $sql .= $sqlwhere; |
| 7045 | 7045 | //print $sql; |
| 7046 | 7046 | |
| 7047 | - $sql .= ' ORDER BY ' . implode(', ', $fields_label); |
|
| 7047 | + $sql .= ' ORDER BY '.implode(', ', $fields_label); |
|
| 7048 | 7048 | |
| 7049 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
| 7049 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
| 7050 | 7050 | $resql = $this->db->query($sql); |
| 7051 | 7051 | if ($resql) { |
| 7052 | 7052 | $out .= '<option value="0"> </option>'; |
@@ -7062,7 +7062,7 @@ discard block |
||
| 7062 | 7062 | if (count($fields_label) > 1) { |
| 7063 | 7063 | $notrans = true; |
| 7064 | 7064 | foreach ($fields_label as $field_toshow) { |
| 7065 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7065 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7066 | 7066 | } |
| 7067 | 7067 | } else { |
| 7068 | 7068 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7073,12 +7073,12 @@ discard block |
||
| 7073 | 7073 | foreach ($fields_label as $field_toshow) { |
| 7074 | 7074 | $translabel = $langs->trans($obj->$field_toshow); |
| 7075 | 7075 | if ($translabel != $obj->$field_toshow) { |
| 7076 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
| 7076 | + $labeltoshow = dol_trunc($translabel).' '; |
|
| 7077 | 7077 | } else { |
| 7078 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
| 7078 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
| 7079 | 7079 | } |
| 7080 | 7080 | } |
| 7081 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7081 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7082 | 7082 | } else { |
| 7083 | 7083 | if (!$notrans) { |
| 7084 | 7084 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7092,34 +7092,34 @@ discard block |
||
| 7092 | 7092 | $labeltoshow = '(not defined)'; |
| 7093 | 7093 | } |
| 7094 | 7094 | if ($value == $obj->rowid) { |
| 7095 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7095 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7096 | 7096 | } |
| 7097 | 7097 | |
| 7098 | 7098 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7099 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7099 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7100 | 7100 | $isDependList = 1; |
| 7101 | 7101 | } |
| 7102 | 7102 | |
| 7103 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 7103 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 7104 | 7104 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
| 7105 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
| 7106 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 7105 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
| 7106 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 7107 | 7107 | } |
| 7108 | 7108 | |
| 7109 | 7109 | $i++; |
| 7110 | 7110 | } |
| 7111 | 7111 | $this->db->free($resql); |
| 7112 | 7112 | } else { |
| 7113 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7113 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7114 | 7114 | } |
| 7115 | 7115 | } else { |
| 7116 | 7116 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7117 | 7117 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7118 | 7118 | $out .= '<option value="0"> </option>'; |
| 7119 | 7119 | foreach ($data as $data_key => $data_value) { |
| 7120 | - $out .= '<option value="' . $data_key . '"'; |
|
| 7120 | + $out .= '<option value="'.$data_key.'"'; |
|
| 7121 | 7121 | $out .= ($value == $data_key ? ' selected' : ''); |
| 7122 | - $out .= '>' . $data_value . '</option>'; |
|
| 7122 | + $out .= '>'.$data_value.'</option>'; |
|
| 7123 | 7123 | } |
| 7124 | 7124 | } |
| 7125 | 7125 | } |
@@ -7184,8 +7184,8 @@ discard block |
||
| 7184 | 7184 | } |
| 7185 | 7185 | |
| 7186 | 7186 | $sqlwhere = ''; |
| 7187 | - $sql = "SELECT " . $keyList; |
|
| 7188 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7187 | + $sql = "SELECT ".$keyList; |
|
| 7188 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
| 7189 | 7189 | if (!empty($InfoFieldList[4])) { |
| 7190 | 7190 | // can use SELECT request |
| 7191 | 7191 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7201,23 +7201,23 @@ discard block |
||
| 7201 | 7201 | |
| 7202 | 7202 | // We have to join on extrafield table |
| 7203 | 7203 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7204 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
| 7205 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
| 7204 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
| 7205 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
| 7206 | 7206 | } else { |
| 7207 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 7207 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 7208 | 7208 | } |
| 7209 | 7209 | } else { |
| 7210 | 7210 | $sqlwhere .= ' WHERE 1=1'; |
| 7211 | 7211 | } |
| 7212 | 7212 | // Some tables may have field, some other not. For the moment we disable it. |
| 7213 | 7213 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7214 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7214 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7215 | 7215 | } |
| 7216 | 7216 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
| 7217 | 7217 | // print $sql; |
| 7218 | 7218 | |
| 7219 | 7219 | $sql .= $sqlwhere; |
| 7220 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7220 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7221 | 7221 | $resql = $this->db->query($sql); |
| 7222 | 7222 | if ($resql) { |
| 7223 | 7223 | $num = $this->db->num_rows($resql); |
@@ -7235,7 +7235,7 @@ discard block |
||
| 7235 | 7235 | if (count($fields_label) > 1) { |
| 7236 | 7236 | $notrans = true; |
| 7237 | 7237 | foreach ($fields_label as $field_toshow) { |
| 7238 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7238 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7239 | 7239 | } |
| 7240 | 7240 | } else { |
| 7241 | 7241 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7246,9 +7246,9 @@ discard block |
||
| 7246 | 7246 | foreach ($fields_label as $field_toshow) { |
| 7247 | 7247 | $translabel = $langs->trans($obj->$field_toshow); |
| 7248 | 7248 | if ($translabel != $obj->$field_toshow) { |
| 7249 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
| 7249 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
| 7250 | 7250 | } else { |
| 7251 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
| 7251 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
| 7252 | 7252 | } |
| 7253 | 7253 | } |
| 7254 | 7254 | |
@@ -7271,7 +7271,7 @@ discard block |
||
| 7271 | 7271 | } |
| 7272 | 7272 | |
| 7273 | 7273 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7274 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7274 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7275 | 7275 | $isDependList = 1; |
| 7276 | 7276 | } |
| 7277 | 7277 | |
@@ -7282,14 +7282,14 @@ discard block |
||
| 7282 | 7282 | } |
| 7283 | 7283 | $this->db->free($resql); |
| 7284 | 7284 | |
| 7285 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7285 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7286 | 7286 | } else { |
| 7287 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7287 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7288 | 7288 | } |
| 7289 | 7289 | } else { |
| 7290 | 7290 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7291 | 7291 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7292 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7292 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7293 | 7293 | } |
| 7294 | 7294 | } |
| 7295 | 7295 | } elseif ($type == 'link') { |
@@ -7369,7 +7369,7 @@ discard block |
||
| 7369 | 7369 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
| 7370 | 7370 | } |
| 7371 | 7371 | |
| 7372 | - if ($isDependList==1) { |
|
| 7372 | + if ($isDependList == 1) { |
|
| 7373 | 7373 | $out .= $this->getJSListDependancies('_common'); |
| 7374 | 7374 | } |
| 7375 | 7375 | /* Add comments |
@@ -7407,7 +7407,7 @@ discard block |
||
| 7407 | 7407 | $form = new Form($this->db); |
| 7408 | 7408 | } |
| 7409 | 7409 | |
| 7410 | - $objectid = $this->id; // Not used ??? |
|
| 7410 | + $objectid = $this->id; // Not used ??? |
|
| 7411 | 7411 | |
| 7412 | 7412 | $label = empty($val['label']) ? '' : $val['label']; |
| 7413 | 7413 | $type = empty($val['type']) ? '' : $val['type']; |
@@ -7502,7 +7502,7 @@ discard block |
||
| 7502 | 7502 | $value = $this->getLibStatut(3); |
| 7503 | 7503 | } elseif ($type == 'date') { |
| 7504 | 7504 | if (!empty($value)) { |
| 7505 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7505 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7506 | 7506 | } else { |
| 7507 | 7507 | $value = ''; |
| 7508 | 7508 | } |
@@ -7540,7 +7540,7 @@ discard block |
||
| 7540 | 7540 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
| 7541 | 7541 | } |
| 7542 | 7542 | } elseif ($type == 'select') { |
| 7543 | - $value = isset($param['options'][$value])?$param['options'][$value]:''; |
|
| 7543 | + $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; |
|
| 7544 | 7544 | } elseif ($type == 'sellist') { |
| 7545 | 7545 | $param_list = array_keys($param['options']); |
| 7546 | 7546 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -7600,9 +7600,9 @@ discard block |
||
| 7600 | 7600 | $translabel = $langs->trans($obj->$field_toshow); |
| 7601 | 7601 | } |
| 7602 | 7602 | if ($translabel != $field_toshow) { |
| 7603 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
| 7603 | + $value .= dol_trunc($translabel, 18).' '; |
|
| 7604 | 7604 | } else { |
| 7605 | - $value .= $obj->$field_toshow . ' '; |
|
| 7605 | + $value .= $obj->$field_toshow.' '; |
|
| 7606 | 7606 | } |
| 7607 | 7607 | } |
| 7608 | 7608 | } else { |
@@ -7618,7 +7618,7 @@ discard block |
||
| 7618 | 7618 | } |
| 7619 | 7619 | } |
| 7620 | 7620 | } else { |
| 7621 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 7621 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 7622 | 7622 | |
| 7623 | 7623 | $toprint = array(); |
| 7624 | 7624 | $obj = $this->db->fetch_object($resql); |
@@ -7626,7 +7626,7 @@ discard block |
||
| 7626 | 7626 | $c->fetch($obj->rowid); |
| 7627 | 7627 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 7628 | 7628 | foreach ($ways as $way) { |
| 7629 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 7629 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 7630 | 7630 | } |
| 7631 | 7631 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
| 7632 | 7632 | } |
@@ -7697,9 +7697,9 @@ discard block |
||
| 7697 | 7697 | $translabel = $langs->trans($obj->$field_toshow); |
| 7698 | 7698 | } |
| 7699 | 7699 | if ($translabel != $field_toshow) { |
| 7700 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 7700 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 7701 | 7701 | } else { |
| 7702 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
| 7702 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
| 7703 | 7703 | } |
| 7704 | 7704 | } |
| 7705 | 7705 | } else { |
@@ -7708,15 +7708,15 @@ discard block |
||
| 7708 | 7708 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
| 7709 | 7709 | } |
| 7710 | 7710 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
| 7711 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 7711 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 7712 | 7712 | } else { |
| 7713 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
| 7713 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
| 7714 | 7714 | } |
| 7715 | 7715 | } |
| 7716 | 7716 | } |
| 7717 | 7717 | } |
| 7718 | 7718 | } else { |
| 7719 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 7719 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 7720 | 7720 | |
| 7721 | 7721 | $toprint = array(); |
| 7722 | 7722 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -7725,7 +7725,7 @@ discard block |
||
| 7725 | 7725 | $c->fetch($obj->rowid); |
| 7726 | 7726 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 7727 | 7727 | foreach ($ways as $way) { |
| 7728 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 7728 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 7729 | 7729 | } |
| 7730 | 7730 | } |
| 7731 | 7731 | } |
@@ -7856,7 +7856,7 @@ discard block |
||
| 7856 | 7856 | { |
| 7857 | 7857 | global $langs; |
| 7858 | 7858 | |
| 7859 | - if (!class_exists('Validate')) { require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; } |
|
| 7859 | + if (!class_exists('Validate')) { require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; } |
|
| 7860 | 7860 | |
| 7861 | 7861 | $this->clearFieldError($fieldKey); |
| 7862 | 7862 | |
@@ -8067,7 +8067,7 @@ discard block |
||
| 8067 | 8067 | |
| 8068 | 8068 | $nbofextrafieldsshown = 0; |
| 8069 | 8069 | $extrafields_collapse_num = ''; |
| 8070 | - $e = 0; // var to manage the modulo (odd/even) |
|
| 8070 | + $e = 0; // var to manage the modulo (odd/even) |
|
| 8071 | 8071 | |
| 8072 | 8072 | foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $label) { |
| 8073 | 8073 | // Show only the key field in params |
@@ -8110,7 +8110,7 @@ discard block |
||
| 8110 | 8110 | } |
| 8111 | 8111 | |
| 8112 | 8112 | $colspan = 0; |
| 8113 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
| 8113 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
| 8114 | 8114 | if (array_key_exists('cols', $params)) { |
| 8115 | 8115 | $colspan = $params['cols']; |
| 8116 | 8116 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8190,7 +8190,7 @@ discard block |
||
| 8190 | 8190 | $domData .= ' data-targetid="'.$this->id.'"'; |
| 8191 | 8191 | |
| 8192 | 8192 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
| 8193 | - if ($display_type=='card') { |
|
| 8193 | + if ($display_type == 'card') { |
|
| 8194 | 8194 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { |
| 8195 | 8195 | $colspan = 0; |
| 8196 | 8196 | } |
@@ -8243,13 +8243,13 @@ discard block |
||
| 8243 | 8243 | $helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]); |
| 8244 | 8244 | |
| 8245 | 8245 | if ($display_type == 'card') { |
| 8246 | - $out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="field_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >'; |
|
| 8246 | + $out .= '<tr '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="field_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id) ? '_'.$this->id : '').'" '.$domData.' >'; |
|
| 8247 | 8247 | if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER) && ($action == 'view' || $action == 'valid' || $action == 'editline' || $action == 'confirm_valid' || $action == 'confirm_cancel')) { |
| 8248 | 8248 | $out .= '<td></td>'; |
| 8249 | 8249 | } |
| 8250 | 8250 | $out .= '<td class="titlefieldcreate wordbreak'; |
| 8251 | 8251 | } elseif ($display_type == 'line') { |
| 8252 | - $out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="fieldline_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id)?'_'.$this->id:'').'" '.$domData.' >'; |
|
| 8252 | + $out .= '<div '.($html_id ? 'id="'.$html_id.'" ' : '').$csstyle.' class="fieldline_options_'.$key.' '.$class.$this->element.'_extras_'.$key.' trextrafields_collapse'.$extrafields_collapse_num.(!empty($this->id) ? '_'.$this->id : '').'" '.$domData.' >'; |
|
| 8253 | 8253 | $out .= '<div style="display: inline-block; padding-right:4px" class="wordbreak'; |
| 8254 | 8254 | } |
| 8255 | 8255 | //$out .= "titlefield"; |
@@ -8301,12 +8301,12 @@ discard block |
||
| 8301 | 8301 | break; |
| 8302 | 8302 | } |
| 8303 | 8303 | |
| 8304 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
| 8304 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
| 8305 | 8305 | |
| 8306 | 8306 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) { |
| 8307 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8307 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8308 | 8308 | } else { |
| 8309 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8309 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8310 | 8310 | } |
| 8311 | 8311 | |
| 8312 | 8312 | $e++; |
@@ -9085,7 +9085,7 @@ discard block |
||
| 9085 | 9085 | if (!empty($alias)) { |
| 9086 | 9086 | $keys_with_alias = array(); |
| 9087 | 9087 | foreach ($keys as $fieldname) { |
| 9088 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
| 9088 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
| 9089 | 9089 | } |
| 9090 | 9090 | return implode(',', $keys_with_alias); |
| 9091 | 9091 | } else { |
@@ -9201,7 +9201,7 @@ discard block |
||
| 9201 | 9201 | if (!$error) { |
| 9202 | 9202 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
| 9203 | 9203 | $sql .= " (".implode(", ", $keys).')'; |
| 9204 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9204 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9205 | 9205 | |
| 9206 | 9206 | $res = $this->db->query($sql); |
| 9207 | 9207 | if (!$res) { |
@@ -9983,7 +9983,7 @@ discard block |
||
| 9983 | 9983 | // Process |
| 9984 | 9984 | foreach ($to_del as $del) { |
| 9985 | 9985 | if ($c->fetch($del) > 0) { |
| 9986 | - $result=$c->del_type($this, $type_categ); |
|
| 9986 | + $result = $c->del_type($this, $type_categ); |
|
| 9987 | 9987 | if ($result < 0) { |
| 9988 | 9988 | $error++; |
| 9989 | 9989 | $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 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
| 61 | 61 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
| 62 | 62 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
| 63 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 63 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 64 | 64 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 65 | 65 | $search_country = GETPOST('search_country', 'alpha'); |
| 66 | 66 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -216,13 +216,13 @@ discard block |
||
| 216 | 216 | $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; |
| 217 | 217 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; |
| 218 | 218 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 219 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 219 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 220 | 220 | } |
| 221 | 221 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = l.fk_code_ventilation"; |
| 222 | 222 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn"; |
| 223 | 223 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
| 224 | 224 | if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
| 225 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
| 225 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
| 226 | 226 | } |
| 227 | 227 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
| 228 | 228 | $sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
| 60 | 60 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
| 61 | 61 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
| 62 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 62 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
| 63 | 63 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
| 64 | 64 | $search_country = GETPOST('search_country', 'alpha'); |
| 65 | 65 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -215,13 +215,13 @@ discard block |
||
| 215 | 215 | $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; |
| 216 | 216 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; |
| 217 | 217 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
| 218 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
| 218 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
| 219 | 219 | } |
| 220 | 220 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; |
| 221 | 221 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; |
| 222 | 222 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
| 223 | 223 | if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
| 224 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
| 224 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
| 225 | 225 | } |
| 226 | 226 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
| 227 | 227 | $sql .= " WHERE fd.fk_code_ventilation > 0"; |
@@ -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 | /* |