@@ -51,7 +51,7 @@ |
||
| 51 | 51 | $result = getURLContent('https://sourceforge.net/projects/dolibarr/rss'); |
| 52 | 52 | //var_dump($result['content']); |
| 53 | 53 | if (function_exists('simplexml_load_string')) { |
| 54 | - $sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); |
|
| 54 | + $sfurl = simplexml_load_string($result['content'], 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET); |
|
| 55 | 55 | } else { |
| 56 | 56 | setEventMessages($langs->trans("ErrorPHPDoesNotSupport", "xml"), null, 'errors'); |
| 57 | 57 | } |
@@ -165,13 +165,13 @@ |
||
| 165 | 165 | } |
| 166 | 166 | } |
| 167 | 167 | if (GETPOST('target') == 'remote') { |
| 168 | - $xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only. Same is used into api_setup.class.php. |
|
| 168 | + $xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only. Same is used into api_setup.class.php. |
|
| 169 | 169 | |
| 170 | 170 | // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) |
| 171 | 171 | if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { |
| 172 | 172 | $xmlfile = $xmlarray['content']; |
| 173 | 173 | //print "xmlfilestart".$xmlfile."xmlfileend"; |
| 174 | - $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA|LIBXML_NONET); |
|
| 174 | + $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET); |
|
| 175 | 175 | } else { |
| 176 | 176 | $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg']; |
| 177 | 177 | setEventMessages($errormsg, null, 'errors'); |
@@ -152,7 +152,7 @@ |
||
| 152 | 152 | while ($i < $num) { |
| 153 | 153 | $objp = $db->fetch_object($resql); |
| 154 | 154 | $listofoppstatus[$objp->rowid] = $objp->percent; |
| 155 | - $listofopplabel[$objp->rowid] = $objp->label; // default label if translation from "OppStatus".code not found. |
|
| 155 | + $listofopplabel[$objp->rowid] = $objp->label; // default label if translation from "OppStatus".code not found. |
|
| 156 | 156 | $listofoppcode[$objp->rowid] = $objp->code; |
| 157 | 157 | switch ($objp->code) { |
| 158 | 158 | case 'PROSP': |
@@ -81,9 +81,9 @@ |
||
| 81 | 81 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
| 82 | 82 | require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
| 83 | 83 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
| 84 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php'; |
|
| 85 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php'; |
|
| 86 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; |
|
| 84 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php'; |
|
| 85 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php'; |
|
| 86 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; |
|
| 87 | 87 | |
| 88 | 88 | // Load translation files required by the page |
| 89 | 89 | $langs->loadLangs(array("hrm", "companies", "other", "mails")); |
@@ -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 | /* |
@@ -240,7 +240,9 @@ discard block |
||
| 240 | 240 | $line->fk_rank = 0; |
| 241 | 241 | |
| 242 | 242 | $res = $line->create($user, $notrigger); |
| 243 | - if ($res > 0) $this->lines[] = $line; |
|
| 243 | + if ($res > 0) { |
|
| 244 | + $this->lines[] = $line; |
|
| 245 | + } |
|
| 244 | 246 | } |
| 245 | 247 | } |
| 246 | 248 | } |
@@ -637,8 +639,9 @@ discard block |
||
| 637 | 639 | |
| 638 | 640 | $Tab = $this->db->fetch_object($res); |
| 639 | 641 | |
| 640 | - if (empty($Tab)) return null; |
|
| 641 | - else { |
|
| 642 | + if (empty($Tab)) { |
|
| 643 | + return null; |
|
| 644 | + } else { |
|
| 642 | 645 | $evaluation = new Evaluation($this->db); |
| 643 | 646 | $evaluation->fetch($Tab->rowid); |
| 644 | 647 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | 28 | // Put here all includes required by your class file |
| 29 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; |
|
| 30 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/evaluationdet.class.php'; |
|
| 29 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 30 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/evaluationdet.class.php'; |
|
| 31 | 31 | //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
| 32 | 32 | //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
| 33 | 33 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
| 106 | 106 | */ |
| 107 | - public $fields=array( |
|
| 107 | + public $fields = array( |
|
| 108 | 108 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
| 109 | 109 | 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), |
| 110 | 110 | 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'showoncombobox'=>'2',), |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if (!$user->hasRight('hrm', 'evaluation', 'readall')) { |
| 197 | - $this->fields['fk_user']['type'].= ':rowid IN('.$this->db->sanitize(implode(", ", $user->getAllChildIds(1))).')'; |
|
| 197 | + $this->fields['fk_user']['type'] .= ':rowid IN('.$this->db->sanitize(implode(", ", $user->getAllChildIds(1))).')'; |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | $this->date_eval = dol_now(); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | $resultcreate = $this->createCommon($user, $notrigger); |
| 231 | 231 | |
| 232 | 232 | if ($resultcreate > 0) { |
| 233 | - require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php'; |
|
| 233 | + require_once DOL_DOCUMENT_ROOT.'/hrm/class/skillrank.class.php'; |
|
| 234 | 234 | $skillRank = new SkillRank($this->db); |
| 235 | 235 | $TRequiredRanks = $skillRank->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_object='.$this->fk_job." AND objecttype='job'")); |
| 236 | 236 | |
@@ -632,12 +632,12 @@ discard block |
||
| 632 | 632 | public function getLastEvaluationForUser($fk_user) |
| 633 | 633 | { |
| 634 | 634 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."hrm_evaluation "; |
| 635 | - $sql.= "WHERE fk_user=".((int) $fk_user)." "; |
|
| 636 | - $sql.= "ORDER BY date_eval DESC "; |
|
| 637 | - $sql.= "LIMIT 1 "; |
|
| 635 | + $sql .= "WHERE fk_user=".((int) $fk_user)." "; |
|
| 636 | + $sql .= "ORDER BY date_eval DESC "; |
|
| 637 | + $sql .= "LIMIT 1 "; |
|
| 638 | 638 | |
| 639 | 639 | $res = $this->db->query($sql); |
| 640 | - if (!$res) { dol_print_error($this->db);} |
|
| 640 | + if (!$res) { dol_print_error($this->db); } |
|
| 641 | 641 | |
| 642 | 642 | $Tab = $this->db->fetch_object($res); |
| 643 | 643 | |
@@ -949,7 +949,7 @@ discard block |
||
| 949 | 949 | if (!empty($conf->global->HRMTEST_EVALUATION_ADDON)) { |
| 950 | 950 | $mybool = false; |
| 951 | 951 | |
| 952 | - $file = getDolGlobalString('HRMTEST_EVALUATION_ADDON') . ".php"; |
|
| 952 | + $file = getDolGlobalString('HRMTEST_EVALUATION_ADDON').".php"; |
|
| 953 | 953 | $classname = $conf->global->HRMTEST_EVALUATION_ADDON; |
| 954 | 954 | |
| 955 | 955 | // Include file with class |
@@ -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,14 +29,14 @@ 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'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php'; |
|
| 37 | 37 | |
| 38 | 38 | // Load translation files required by the page |
| 39 | -$langs->loadLangs(array('hrm', 'other', 'products')); // why products? |
|
| 39 | +$langs->loadLangs(array('hrm', 'other', 'products')); // why products? |
|
| 40 | 40 | |
| 41 | 41 | // Get parameters |
| 42 | 42 | $id = GETPOST('id', 'int'); |
@@ -47,12 +47,12 @@ discard block |
||
| 47 | 47 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search |
| 48 | 48 | $backtopage = GETPOST('backtopage', 'alpha'); |
| 49 | 49 | $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); |
| 50 | -$lineid = GETPOST('lineid', 'int'); |
|
| 50 | +$lineid = GETPOST('lineid', 'int'); |
|
| 51 | 51 | |
| 52 | 52 | // Initialize technical objects |
| 53 | 53 | $object = new Job($db); |
| 54 | 54 | $extrafields = new ExtraFields($db); |
| 55 | -$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id; |
|
| 55 | +$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; |
|
| 56 | 56 | $hookmanager->initHooks(array('jobcard', 'globalcard')); // Note that conf->hooks_modules contains array |
| 57 | 57 | |
| 58 | 58 | // Fetch optionals attributes and labels |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $search_all = GETPOST("search_all", 'alpha'); |
| 65 | 65 | $search = array(); |
| 66 | 66 | foreach ($object->fields as $key => $val) { |
| 67 | - if (GETPOST('search_' . $key, 'alpha')) { |
|
| 68 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
| 67 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
| 68 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | // Load object |
| 77 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
| 77 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
| 78 | 78 | |
| 79 | 79 | // Permissions |
| 80 | 80 | $permissiontoread = $user->rights->hrm->all->read; |
| 81 | 81 | $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
| 82 | 82 | $permissiontodelete = $user->rights->hrm->all->delete; |
| 83 | -$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/job'; |
|
| 83 | +$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/job'; |
|
| 84 | 84 | |
| 85 | 85 | // Security check (enable the most restrictive one) |
| 86 | 86 | //if ($user->socid > 0) accessforbidden(); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
| 112 | 112 | $backtopage = $backurlforlist; |
| 113 | 113 | } else { |
| 114 | - $backtopage = dol_buildpath('/hrm/job_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__'); |
|
| 114 | + $backtopage = dol_buildpath('/hrm/job_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); |
|
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -120,19 +120,19 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | |
| 122 | 122 | // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen |
| 123 | - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; |
|
| 123 | + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; |
|
| 124 | 124 | |
| 125 | 125 | // Actions when linking object each other |
| 126 | - include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
| 126 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
| 127 | 127 | |
| 128 | 128 | // Actions when printing a doc from card |
| 129 | - include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; |
|
| 129 | + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; |
|
| 130 | 130 | |
| 131 | 131 | // Action to move up and down lines of object |
| 132 | 132 | //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; |
| 133 | 133 | |
| 134 | 134 | // Action to build doc |
| 135 | - include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; |
|
| 135 | + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; |
|
| 136 | 136 | |
| 137 | 137 | if ($action == 'set_thirdparty' && $permissiontoadd) { |
| 138 | 138 | $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | // Actions to send emails |
| 145 | 145 | $triggersendname = 'HRM_JOB_SENTBYMAIL'; |
| 146 | 146 | $autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO'; |
| 147 | - $trackid = 'job' . $object->id; |
|
| 148 | - include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; |
|
| 147 | + $trackid = 'job'.$object->id; |
|
| 148 | + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -181,36 +181,36 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | // Part to create |
| 183 | 183 | if ($action == 'create') { |
| 184 | - print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_' . $object->picto); |
|
| 184 | + print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_'.$object->picto); |
|
| 185 | 185 | |
| 186 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 187 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 186 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 187 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 188 | 188 | print '<input type="hidden" name="action" value="add">'; |
| 189 | 189 | if ($backtopage) { |
| 190 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 190 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 191 | 191 | } |
| 192 | 192 | if ($backtopageforcancel) { |
| 193 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 193 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | print dol_get_fiche_head(array(), ''); |
| 197 | 197 | |
| 198 | - print '<table class="border centpercent tableforfieldcreate">' . "\n"; |
|
| 198 | + print '<table class="border centpercent tableforfieldcreate">'."\n"; |
|
| 199 | 199 | |
| 200 | 200 | // Common attributes |
| 201 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; |
|
| 201 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; |
|
| 202 | 202 | |
| 203 | 203 | // Other attributes |
| 204 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; |
|
| 204 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
|
| 205 | 205 | |
| 206 | - print '</table>' . "\n"; |
|
| 206 | + print '</table>'."\n"; |
|
| 207 | 207 | |
| 208 | 208 | print dol_get_fiche_end(); |
| 209 | 209 | |
| 210 | 210 | print '<div class="center">'; |
| 211 | - print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">'; |
|
| 211 | + print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">'; |
|
| 212 | 212 | print ' '; |
| 213 | - print '<input type="' . ($backtopage ? "submit" : "button") . '" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '"' . ($backtopage ? '' : ' onclick="history.go(-1)"') . '>'; // Cancel for create does not post form if we don't know the backtopage |
|
| 213 | + print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage |
|
| 214 | 214 | print '</div>'; |
| 215 | 215 | |
| 216 | 216 | print '</form>'; |
@@ -220,35 +220,35 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // Part to edit record |
| 222 | 222 | if (($id || $ref) && $action == 'edit') { |
| 223 | - print load_fiche_titre($langs->trans("JobProfile"), '', 'object_' . $object->picto); |
|
| 223 | + print load_fiche_titre($langs->trans("JobProfile"), '', 'object_'.$object->picto); |
|
| 224 | 224 | |
| 225 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 226 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 225 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 226 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 227 | 227 | print '<input type="hidden" name="action" value="update">'; |
| 228 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
| 228 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 229 | 229 | if ($backtopage) { |
| 230 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 230 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 231 | 231 | } |
| 232 | 232 | if ($backtopageforcancel) { |
| 233 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 233 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | print dol_get_fiche_head(); |
| 237 | 237 | |
| 238 | - print '<table class="border centpercent tableforfieldedit">' . "\n"; |
|
| 238 | + print '<table class="border centpercent tableforfieldedit">'."\n"; |
|
| 239 | 239 | |
| 240 | 240 | // Common attributes |
| 241 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; |
|
| 241 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; |
|
| 242 | 242 | |
| 243 | 243 | // Other attributes |
| 244 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; |
|
| 244 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; |
|
| 245 | 245 | |
| 246 | 246 | print '</table>'; |
| 247 | 247 | |
| 248 | 248 | print dol_get_fiche_end(); |
| 249 | 249 | |
| 250 | - print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">'; |
|
| 251 | - print ' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
| 250 | + print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">'; |
|
| 251 | + print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
| 252 | 252 | print '</div>'; |
| 253 | 253 | |
| 254 | 254 | print '</form>'; |
@@ -266,17 +266,17 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | // Confirmation to delete |
| 268 | 268 | if ($action == 'delete') { |
| 269 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 269 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 270 | 270 | } |
| 271 | 271 | // Confirmation to delete line |
| 272 | 272 | if ($action == 'deleteline') { |
| 273 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); |
|
| 273 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); |
|
| 274 | 274 | } |
| 275 | 275 | // Clone confirmation |
| 276 | 276 | if ($action == 'clone') { |
| 277 | 277 | // Create an array for form |
| 278 | 278 | $formquestion = array(); |
| 279 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); |
|
| 279 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | // Confirmation of action xxxx |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) |
| 293 | 293 | ); |
| 294 | 294 | */ |
| 295 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); |
|
| 295 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | // Call Hook formConfirm |
@@ -310,10 +310,10 @@ discard block |
||
| 310 | 310 | |
| 311 | 311 | // Object card |
| 312 | 312 | // ------------------------------------------------------------ |
| 313 | - $linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 313 | + $linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 314 | 314 | |
| 315 | 315 | $morehtmlref = '<div class="refid">'; |
| 316 | - $morehtmlref.= $object->label; |
|
| 316 | + $morehtmlref .= $object->label; |
|
| 317 | 317 | $morehtmlref .= '</div>'; |
| 318 | 318 | |
| 319 | 319 | |
@@ -329,11 +329,11 @@ discard block |
||
| 329 | 329 | //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field |
| 330 | 330 | //unset($object->fields['fk_project']); // Hide field already shown in banner |
| 331 | 331 | //unset($object->fields['fk_soc']); // Hide field already shown in banner |
| 332 | - $object->fields['label']['visible']=0; // Already in banner |
|
| 333 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
| 332 | + $object->fields['label']['visible'] = 0; // Already in banner |
|
| 333 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
| 334 | 334 | |
| 335 | 335 | // Other attributes. Fields from hook formObjectOptions and Extrafields. |
| 336 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
| 336 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
| 337 | 337 | |
| 338 | 338 | print '</table>'; |
| 339 | 339 | print '</div>'; |
@@ -352,16 +352,16 @@ discard block |
||
| 352 | 352 | // Show object lines |
| 353 | 353 | $result = $object->getLinesArray(); |
| 354 | 354 | |
| 355 | - print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST"> |
|
| 356 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
| 357 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
| 355 | + print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST"> |
|
| 356 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
| 357 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
| 358 | 358 | <input type="hidden" name="mode" value=""> |
| 359 | 359 | <input type="hidden" name="page_y" value=""> |
| 360 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
| 360 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
| 361 | 361 | '; |
| 362 | 362 | |
| 363 | 363 | if (!empty($conf->use_javascript_ajax) && $object->status == 0) { |
| 364 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; |
|
| 364 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | print '<div class="div-table-responsive-no-min">'; |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | // Buttons for actions |
| 399 | 399 | |
| 400 | 400 | if ($action != 'presend' && $action != 'editline') { |
| 401 | - print '<div class="tabsAction">' . "\n"; |
|
| 401 | + print '<div class="tabsAction">'."\n"; |
|
| 402 | 402 | $parameters = array(); |
| 403 | 403 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
| 404 | 404 | if ($reshook < 0) { |
@@ -408,15 +408,15 @@ discard block |
||
| 408 | 408 | if (empty($reshook)) { |
| 409 | 409 | // Back to draft |
| 410 | 410 | if ($object->status == $object::STATUS_VALIDATED) { |
| 411 | - print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd); |
|
| 411 | + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
| 414 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
| 415 | 415 | |
| 416 | 416 | // Delete (need delete permission, or if draft, just need create/modify permission) |
| 417 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete); |
|
| 417 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete); |
|
| 418 | 418 | } |
| 419 | - print '</div>' . "\n"; |
|
| 419 | + print '</div>'."\n"; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | |
@@ -434,12 +434,12 @@ discard block |
||
| 434 | 434 | // Documents |
| 435 | 435 | if ($includedocgeneration) { |
| 436 | 436 | $objref = dol_sanitizeFileName($object->ref); |
| 437 | - $relativepath = $objref . '/' . $objref . '.pdf'; |
|
| 438 | - $filedir = $conf->hrm->dir_output . '/' . $object->element . '/' . $objref; |
|
| 439 | - $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; |
|
| 437 | + $relativepath = $objref.'/'.$objref.'.pdf'; |
|
| 438 | + $filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref; |
|
| 439 | + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; |
|
| 440 | 440 | $genallowed = $user->rights->hrm->job->read; // If you can read, you can build the PDF to read content |
| 441 | 441 | $delallowed = $user->rights->hrm->job->write; // If you can create/edit, you can remove a file on card |
| 442 | - print $formfile->showdocuments('hrm:Job', $object->element . '/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); |
|
| 442 | + print $formfile->showdocuments('hrm:Job', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | // Show links to link elements |
@@ -454,9 +454,9 @@ discard block |
||
| 454 | 454 | $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/job_agenda.php?id='.$object->id); |
| 455 | 455 | |
| 456 | 456 | // List of actions on element |
| 457 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
| 457 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
| 458 | 458 | $formactions = new FormActions($db); |
| 459 | - $somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 459 | + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 460 | 460 | |
| 461 | 461 | print '</div></div>'; |
| 462 | 462 | } |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | $modelmail = 'job'; |
| 466 | 466 | $defaulttopic = 'InformationMessage'; |
| 467 | 467 | $diroutput = $conf->hrm->dir_output; |
| 468 | - $trackid = 'job' . $object->id; |
|
| 468 | + $trackid = 'job'.$object->id; |
|
| 469 | 469 | |
| 470 | - include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php'; |
|
| 470 | + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | // End of page |
@@ -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'); |
@@ -841,16 +841,16 @@ discard block |
||
| 841 | 841 | } |
| 842 | 842 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
| 843 | 843 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
| 844 | - $datas[$key]= '<br><b><u>'. $labelextra . '</u></b>'; |
|
| 844 | + $datas[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
| 845 | 845 | } else { |
| 846 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
| 847 | - $datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 846 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
| 847 | + $datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 848 | 848 | $count++; |
| 849 | 849 | } |
| 850 | 850 | } |
| 851 | 851 | } |
| 852 | 852 | |
| 853 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 853 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 854 | 854 | $parameters = array( |
| 855 | 855 | 'tooltipcontentarray' => &$datas, |
| 856 | 856 | 'params' => $params, |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | if ($source == 'external' || $source == 'thirdparty') { |
| 1342 | 1342 | $sql .= " AND tc.source = 'external'"; |
| 1343 | 1343 | if ($status >= 0) { |
| 1344 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1344 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1345 | 1345 | } |
| 1346 | 1346 | } |
| 1347 | 1347 | $sql .= " AND tc.active = 1"; |
@@ -1700,8 +1700,8 @@ discard block |
||
| 1700 | 1700 | if ($idtofetch) { |
| 1701 | 1701 | $thirdparty = new Societe($this->db); |
| 1702 | 1702 | $result = $thirdparty->fetch($idtofetch); |
| 1703 | - if ($result<0) { |
|
| 1704 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
| 1703 | + if ($result < 0) { |
|
| 1704 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
| 1705 | 1705 | } |
| 1706 | 1706 | $this->thirdparty = $thirdparty; |
| 1707 | 1707 | |
@@ -2003,9 +2003,9 @@ discard block |
||
| 2003 | 2003 | if ($trigkey) { |
| 2004 | 2004 | $oldvalue = null; |
| 2005 | 2005 | |
| 2006 | - $sql = "SELECT " . $field; |
|
| 2007 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
| 2008 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
| 2006 | + $sql = "SELECT ".$field; |
|
| 2007 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
| 2008 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
| 2009 | 2009 | |
| 2010 | 2010 | $resql = $this->db->query($sql); |
| 2011 | 2011 | if ($resql) { |
@@ -2135,7 +2135,7 @@ discard block |
||
| 2135 | 2135 | } |
| 2136 | 2136 | $restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc; |
| 2137 | 2137 | $sql = "SELECT MAX(te.".$fieldid.")"; |
| 2138 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
| 2138 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
| 2139 | 2139 | if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { |
| 2140 | 2140 | $tmparray = explode('@', $this->ismultientitymanaged); |
| 2141 | 2141 | $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 |
@@ -2205,7 +2205,7 @@ discard block |
||
| 2205 | 2205 | $this->ref_previous = $row[0]; |
| 2206 | 2206 | |
| 2207 | 2207 | $sql = "SELECT MIN(te.".$fieldid.")"; |
| 2208 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
| 2208 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
| 2209 | 2209 | if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { |
| 2210 | 2210 | $tmparray = explode('@', $this->ismultientitymanaged); |
| 2211 | 2211 | $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 |
@@ -2359,7 +2359,7 @@ discard block |
||
| 2359 | 2359 | // Triggers |
| 2360 | 2360 | if (!$error && !$notrigger) { |
| 2361 | 2361 | // Call triggers |
| 2362 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
| 2362 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
| 2363 | 2363 | if ($result < 0) { |
| 2364 | 2364 | $error++; |
| 2365 | 2365 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2724,7 +2724,7 @@ discard block |
||
| 2724 | 2724 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
| 2725 | 2725 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
| 2726 | 2726 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
| 2727 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2727 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2728 | 2728 | } |
| 2729 | 2729 | $sql .= ' WHERE rowid='.((int) $this->id); |
| 2730 | 2730 | |
@@ -3073,10 +3073,10 @@ discard block |
||
| 3073 | 3073 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
| 3074 | 3074 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3075 | 3075 | if (!$renum) { |
| 3076 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
| 3076 | + $sql .= " AND ".$fieldposition." = 0"; |
|
| 3077 | 3077 | } |
| 3078 | 3078 | if ($renum) { |
| 3079 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
| 3079 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
| 3080 | 3080 | } |
| 3081 | 3081 | |
| 3082 | 3082 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3097,7 +3097,7 @@ discard block |
||
| 3097 | 3097 | if ($fk_parent_line) { |
| 3098 | 3098 | $sql .= ' AND fk_parent_line IS NULL'; |
| 3099 | 3099 | } |
| 3100 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
| 3100 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
| 3101 | 3101 | |
| 3102 | 3102 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
| 3103 | 3103 | $resql = $this->db->query($sql); |
@@ -3148,7 +3148,7 @@ discard block |
||
| 3148 | 3148 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3149 | 3149 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3150 | 3150 | $sql .= ' AND fk_parent_line = '.((int) $id); |
| 3151 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
| 3151 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
| 3152 | 3152 | |
| 3153 | 3153 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
| 3154 | 3154 | $resql = $this->db->query($sql); |
@@ -3231,8 +3231,8 @@ discard block |
||
| 3231 | 3231 | dol_print_error($this->db); |
| 3232 | 3232 | return -1; |
| 3233 | 3233 | } else { |
| 3234 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3235 | - $action=''; |
|
| 3234 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3235 | + $action = ''; |
|
| 3236 | 3236 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
| 3237 | 3237 | return 1; |
| 3238 | 3238 | } |
@@ -3271,7 +3271,7 @@ discard block |
||
| 3271 | 3271 | |
| 3272 | 3272 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3273 | 3273 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3274 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
| 3274 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
| 3275 | 3275 | if ($this->db->query($sql)) { |
| 3276 | 3276 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
| 3277 | 3277 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3302,7 +3302,7 @@ discard block |
||
| 3302 | 3302 | |
| 3303 | 3303 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3304 | 3304 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3305 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
| 3305 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
| 3306 | 3306 | if ($this->db->query($sql)) { |
| 3307 | 3307 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
| 3308 | 3308 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3328,7 +3328,7 @@ discard block |
||
| 3328 | 3328 | $fieldposition = 'position'; |
| 3329 | 3329 | } |
| 3330 | 3330 | |
| 3331 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3331 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3332 | 3332 | $sql .= " WHERE rowid = ".((int) $rowid); |
| 3333 | 3333 | |
| 3334 | 3334 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3356,7 +3356,7 @@ discard block |
||
| 3356 | 3356 | |
| 3357 | 3357 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3358 | 3358 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3359 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
| 3359 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
| 3360 | 3360 | $resql = $this->db->query($sql); |
| 3361 | 3361 | if ($resql) { |
| 3362 | 3362 | $row = $this->db->fetch_row($resql); |
@@ -3473,7 +3473,7 @@ discard block |
||
| 3473 | 3473 | $newsuffix = ''; |
| 3474 | 3474 | } |
| 3475 | 3475 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
| 3476 | - $fieldusermod = "fk_user_mod"; |
|
| 3476 | + $fieldusermod = "fk_user_mod"; |
|
| 3477 | 3477 | } elseif ($this->table_element == 'ecm_files') { |
| 3478 | 3478 | $fieldusermod = "fk_user_m"; |
| 3479 | 3479 | } else { |
@@ -3845,7 +3845,7 @@ discard block |
||
| 3845 | 3845 | // 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. |
| 3846 | 3846 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
| 3847 | 3847 | // Add module part to target type if object has $module property and isn't in core modules. |
| 3848 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3848 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3849 | 3849 | |
| 3850 | 3850 | $parameters = array('targettype'=>$targettype); |
| 3851 | 3851 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3857,19 +3857,19 @@ discard block |
||
| 3857 | 3857 | $this->db->begin(); |
| 3858 | 3858 | $error = 0; |
| 3859 | 3859 | |
| 3860 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
| 3860 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
| 3861 | 3861 | $sql .= "fk_source"; |
| 3862 | 3862 | $sql .= ", sourcetype"; |
| 3863 | 3863 | $sql .= ", fk_target"; |
| 3864 | 3864 | $sql .= ", targettype"; |
| 3865 | 3865 | $sql .= ") VALUES ("; |
| 3866 | 3866 | $sql .= ((int) $origin_id); |
| 3867 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
| 3868 | - $sql .= ", " . ((int) $this->id); |
|
| 3869 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
| 3867 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
| 3868 | + $sql .= ", ".((int) $this->id); |
|
| 3869 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
| 3870 | 3870 | $sql .= ")"; |
| 3871 | 3871 | |
| 3872 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
| 3872 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
| 3873 | 3873 | if ($this->db->query($sql)) { |
| 3874 | 3874 | if (!$notrigger) { |
| 3875 | 3875 | // Call trigger |
@@ -4176,20 +4176,20 @@ discard block |
||
| 4176 | 4176 | $this->db->begin(); |
| 4177 | 4177 | $error = 0; |
| 4178 | 4178 | |
| 4179 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
| 4179 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
| 4180 | 4180 | if ($updatesource) { |
| 4181 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
| 4182 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4183 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
| 4184 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4181 | + $sql .= "fk_source = ".((int) $sourceid); |
|
| 4182 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4183 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
| 4184 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4185 | 4185 | } elseif ($updatetarget) { |
| 4186 | - $sql .= "fk_target = " . ((int) $targetid); |
|
| 4187 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4188 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
| 4189 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4186 | + $sql .= "fk_target = ".((int) $targetid); |
|
| 4187 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
| 4188 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
| 4189 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4190 | 4190 | } |
| 4191 | 4191 | |
| 4192 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
| 4192 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
| 4193 | 4193 | if ($this->db->query($sql)) { |
| 4194 | 4194 | if (!$notrigger) { |
| 4195 | 4195 | // Call trigger |
@@ -4265,25 +4265,25 @@ discard block |
||
| 4265 | 4265 | } |
| 4266 | 4266 | |
| 4267 | 4267 | if (!$error) { |
| 4268 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
| 4268 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
| 4269 | 4269 | $sql .= " WHERE"; |
| 4270 | 4270 | if ($rowid > 0) { |
| 4271 | - $sql .= " rowid = " . ((int) $rowid); |
|
| 4271 | + $sql .= " rowid = ".((int) $rowid); |
|
| 4272 | 4272 | } else { |
| 4273 | 4273 | if ($deletesource) { |
| 4274 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4275 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4274 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4275 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4276 | 4276 | } elseif ($deletetarget) { |
| 4277 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4278 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4277 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
| 4278 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4279 | 4279 | } else { |
| 4280 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
| 4280 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
| 4281 | 4281 | $sql .= " OR"; |
| 4282 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
| 4282 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
| 4283 | 4283 | } |
| 4284 | 4284 | } |
| 4285 | 4285 | |
| 4286 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
| 4286 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
| 4287 | 4287 | if (!$this->db->query($sql)) { |
| 4288 | 4288 | $this->error = $this->db->lasterror(); |
| 4289 | 4289 | $this->errors[] = $this->error; |
@@ -4445,14 +4445,14 @@ discard block |
||
| 4445 | 4445 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
| 4446 | 4446 | } |
| 4447 | 4447 | $sql .= " WHERE rowid = ".((int) $elementId); |
| 4448 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4448 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4449 | 4449 | |
| 4450 | 4450 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
| 4451 | 4451 | $resql = $this->db->query($sql); |
| 4452 | 4452 | if ($resql) { |
| 4453 | 4453 | $error = 0; |
| 4454 | 4454 | |
| 4455 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4455 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4456 | 4456 | |
| 4457 | 4457 | if ($nb_rows_affected > 0) { |
| 4458 | 4458 | if (empty($trigkey)) { |
@@ -4606,7 +4606,7 @@ discard block |
||
| 4606 | 4606 | return -1; |
| 4607 | 4607 | } |
| 4608 | 4608 | |
| 4609 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4609 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4610 | 4610 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
| 4611 | 4611 | $tmparray = array_keys($this->childtables); |
| 4612 | 4612 | if (is_numeric($tmparray[0])) { |
@@ -4619,26 +4619,26 @@ discard block |
||
| 4619 | 4619 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
| 4620 | 4620 | // Check if element can be deleted |
| 4621 | 4621 | $sql = "SELECT COUNT(*) as nb"; |
| 4622 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4622 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4623 | 4623 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4624 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4624 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4625 | 4625 | } |
| 4626 | 4626 | if (!empty($element['fk_element'])) { |
| 4627 | - $sql.= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
| 4627 | + $sql .= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
| 4628 | 4628 | } else { |
| 4629 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4629 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4630 | 4630 | } |
| 4631 | 4631 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4632 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4632 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4633 | 4633 | } |
| 4634 | 4634 | if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) { |
| 4635 | - $sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
| 4635 | + $sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
| 4636 | 4636 | } |
| 4637 | 4637 | if (!empty($entity)) { |
| 4638 | 4638 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4639 | - $sql.= " AND p.entity = ".((int) $entity); |
|
| 4639 | + $sql .= " AND p.entity = ".((int) $entity); |
|
| 4640 | 4640 | } else { |
| 4641 | - $sql.= " AND c.entity = ".((int) $entity); |
|
| 4641 | + $sql .= " AND c.entity = ".((int) $entity); |
|
| 4642 | 4642 | } |
| 4643 | 4643 | } |
| 4644 | 4644 | |
@@ -4652,9 +4652,9 @@ discard block |
||
| 4652 | 4652 | if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) |
| 4653 | 4653 | $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); |
| 4654 | 4654 | } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) |
| 4655 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
| 4655 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
| 4656 | 4656 | } else { // new usage: $element['name']=Translation key |
| 4657 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
| 4657 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
| 4658 | 4658 | } |
| 4659 | 4659 | break; // We found at least one, we stop here |
| 4660 | 4660 | } |
@@ -4713,7 +4713,7 @@ discard block |
||
| 4713 | 4713 | */ |
| 4714 | 4714 | public function getTotalDiscount() |
| 4715 | 4715 | { |
| 4716 | - if (!empty($this->table_element_line) ) { |
|
| 4716 | + if (!empty($this->table_element_line)) { |
|
| 4717 | 4717 | $total_discount = 0.00; |
| 4718 | 4718 | |
| 4719 | 4719 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
@@ -5665,7 +5665,7 @@ discard block |
||
| 5665 | 5665 | $setsharekey = false; |
| 5666 | 5666 | if ($this->element == 'propal' || $this->element == 'proposal') { |
| 5667 | 5667 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
| 5668 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5668 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5669 | 5669 | } |
| 5670 | 5670 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
| 5671 | 5671 | $setsharekey = true; |
@@ -5723,7 +5723,7 @@ discard block |
||
| 5723 | 5723 | $ecmfile->gen_or_uploaded = 'generated'; |
| 5724 | 5724 | $ecmfile->description = ''; // indexed content |
| 5725 | 5725 | $ecmfile->keywords = ''; // keyword content |
| 5726 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5726 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5727 | 5727 | $ecmfile->src_object_id = $this->id; |
| 5728 | 5728 | |
| 5729 | 5729 | $result = $ecmfile->create($user); |
@@ -5775,7 +5775,7 @@ discard block |
||
| 5775 | 5775 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
| 5776 | 5776 | $maxheightmini = $tmparraysize['maxheightmini']; |
| 5777 | 5777 | //$quality = $tmparraysize['quality']; |
| 5778 | - $quality = 50; // For thumbs, we force quality to 50 |
|
| 5778 | + $quality = 50; // For thumbs, we force quality to 50 |
|
| 5779 | 5779 | |
| 5780 | 5780 | // Create small thumbs for company (Ratio is near 16/9) |
| 5781 | 5781 | // Used on logon for example |
@@ -5877,8 +5877,8 @@ discard block |
||
| 5877 | 5877 | // phpcs:enable |
| 5878 | 5878 | global $langs, $conf; |
| 5879 | 5879 | |
| 5880 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
| 5881 | - dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
| 5880 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
| 5881 | + dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
| 5882 | 5882 | exit; |
| 5883 | 5883 | } |
| 5884 | 5884 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6176,9 +6176,9 @@ discard block |
||
| 6176 | 6176 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
| 6177 | 6177 | //var_dump($conf->disable_compute); |
| 6178 | 6178 | if (empty($conf->disable_compute)) { |
| 6179 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6180 | - $objectoffield = $this; // we can use it inside computed formula |
|
| 6181 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6179 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6180 | + $objectoffield = $this; // we can use it inside computed formula |
|
| 6181 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6182 | 6182 | } |
| 6183 | 6183 | } |
| 6184 | 6184 | } |
@@ -6192,7 +6192,7 @@ discard block |
||
| 6192 | 6192 | return 0; |
| 6193 | 6193 | } |
| 6194 | 6194 | } else { |
| 6195 | - $this->errors[]=$this->db->lasterror; |
|
| 6195 | + $this->errors[] = $this->db->lasterror; |
|
| 6196 | 6196 | return -1; |
| 6197 | 6197 | } |
| 6198 | 6198 | } |
@@ -6359,7 +6359,7 @@ discard block |
||
| 6359 | 6359 | // If old value crypted in database is same than submited new value, it means we don't change it, so we don't update. |
| 6360 | 6360 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6361 | 6361 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6362 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6362 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6363 | 6363 | } else { |
| 6364 | 6364 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6365 | 6365 | } |
@@ -6370,7 +6370,7 @@ discard block |
||
| 6370 | 6370 | // If value has changed |
| 6371 | 6371 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6372 | 6372 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6373 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6373 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6374 | 6374 | } else { |
| 6375 | 6375 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6376 | 6376 | } |
@@ -6382,7 +6382,7 @@ discard block |
||
| 6382 | 6382 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
| 6383 | 6383 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
| 6384 | 6384 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
| 6385 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6385 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6386 | 6386 | } else { |
| 6387 | 6387 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6388 | 6388 | } |
@@ -6768,7 +6768,7 @@ discard block |
||
| 6768 | 6768 | 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. |
| 6769 | 6769 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6770 | 6770 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { |
| 6771 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6771 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6772 | 6772 | } else { |
| 6773 | 6773 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 6774 | 6774 | } |
@@ -6788,7 +6788,7 @@ discard block |
||
| 6788 | 6788 | } |
| 6789 | 6789 | } else { |
| 6790 | 6790 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { // dolibarr reversible encryption |
| 6791 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6791 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6792 | 6792 | } else { |
| 6793 | 6793 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 6794 | 6794 | } |
@@ -7037,7 +7037,7 @@ discard block |
||
| 7037 | 7037 | // Special case that force options and type ($type can be integer, varchar, ...) |
| 7038 | 7038 | if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { |
| 7039 | 7039 | $param['options'] = $this->fields[$key]['arrayofkeyval']; |
| 7040 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
| 7040 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7041 | 7041 | } |
| 7042 | 7042 | |
| 7043 | 7043 | $label = $this->fields[$key]['label']; |
@@ -7089,7 +7089,7 @@ discard block |
||
| 7089 | 7089 | |
| 7090 | 7090 | // Add validation state class |
| 7091 | 7091 | if (!empty($validationClass)) { |
| 7092 | - $morecss.= $validationClass; |
|
| 7092 | + $morecss .= $validationClass; |
|
| 7093 | 7093 | } |
| 7094 | 7094 | |
| 7095 | 7095 | if (in_array($type, array('date'))) { |
@@ -7235,8 +7235,8 @@ discard block |
||
| 7235 | 7235 | } |
| 7236 | 7236 | |
| 7237 | 7237 | $sqlwhere = ''; |
| 7238 | - $sql = "SELECT " . $keyList; |
|
| 7239 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7238 | + $sql = "SELECT ".$keyList; |
|
| 7239 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
| 7240 | 7240 | if (!empty($InfoFieldList[4])) { |
| 7241 | 7241 | // can use SELECT request |
| 7242 | 7242 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7252,17 +7252,17 @@ discard block |
||
| 7252 | 7252 | |
| 7253 | 7253 | //We have to join on extrafield table |
| 7254 | 7254 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7255 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
| 7256 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
| 7255 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
| 7256 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
| 7257 | 7257 | } else { |
| 7258 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 7258 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 7259 | 7259 | } |
| 7260 | 7260 | } else { |
| 7261 | 7261 | $sqlwhere .= ' WHERE 1=1'; |
| 7262 | 7262 | } |
| 7263 | 7263 | // Some tables may have field, some other not. For the moment we disable it. |
| 7264 | 7264 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7265 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7265 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7266 | 7266 | } |
| 7267 | 7267 | $sql .= $sqlwhere; |
| 7268 | 7268 | //print $sql; |
@@ -7274,7 +7274,7 @@ discard block |
||
| 7274 | 7274 | $sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label)); |
| 7275 | 7275 | } |
| 7276 | 7276 | |
| 7277 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
| 7277 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
| 7278 | 7278 | $resql = $this->db->query($sql); |
| 7279 | 7279 | if ($resql) { |
| 7280 | 7280 | $out .= '<option value="0"> </option>'; |
@@ -7290,7 +7290,7 @@ discard block |
||
| 7290 | 7290 | if (count($fields_label) > 1) { |
| 7291 | 7291 | $notrans = true; |
| 7292 | 7292 | foreach ($fields_label as $field_toshow) { |
| 7293 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7293 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7294 | 7294 | } |
| 7295 | 7295 | } else { |
| 7296 | 7296 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7301,12 +7301,12 @@ discard block |
||
| 7301 | 7301 | foreach ($fields_label as $field_toshow) { |
| 7302 | 7302 | $translabel = $langs->trans($obj->$field_toshow); |
| 7303 | 7303 | if ($translabel != $obj->$field_toshow) { |
| 7304 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
| 7304 | + $labeltoshow = dol_trunc($translabel).' '; |
|
| 7305 | 7305 | } else { |
| 7306 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
| 7306 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
| 7307 | 7307 | } |
| 7308 | 7308 | } |
| 7309 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7309 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7310 | 7310 | } else { |
| 7311 | 7311 | if (!$notrans) { |
| 7312 | 7312 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7320,34 +7320,34 @@ discard block |
||
| 7320 | 7320 | $labeltoshow = '(not defined)'; |
| 7321 | 7321 | } |
| 7322 | 7322 | if ($value == $obj->rowid) { |
| 7323 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7323 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7324 | 7324 | } |
| 7325 | 7325 | |
| 7326 | 7326 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7327 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7327 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7328 | 7328 | $isDependList = 1; |
| 7329 | 7329 | } |
| 7330 | 7330 | |
| 7331 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 7331 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 7332 | 7332 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
| 7333 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
| 7334 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 7333 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
| 7334 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 7335 | 7335 | } |
| 7336 | 7336 | |
| 7337 | 7337 | $i++; |
| 7338 | 7338 | } |
| 7339 | 7339 | $this->db->free($resql); |
| 7340 | 7340 | } else { |
| 7341 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7341 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7342 | 7342 | } |
| 7343 | 7343 | } else { |
| 7344 | 7344 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7345 | 7345 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7346 | 7346 | $out .= '<option value="0"> </option>'; |
| 7347 | 7347 | foreach ($data as $data_key => $data_value) { |
| 7348 | - $out .= '<option value="' . $data_key . '"'; |
|
| 7348 | + $out .= '<option value="'.$data_key.'"'; |
|
| 7349 | 7349 | $out .= ($value == $data_key ? ' selected' : ''); |
| 7350 | - $out .= '>' . $data_value . '</option>'; |
|
| 7350 | + $out .= '>'.$data_value.'</option>'; |
|
| 7351 | 7351 | } |
| 7352 | 7352 | } |
| 7353 | 7353 | } |
@@ -7412,8 +7412,8 @@ discard block |
||
| 7412 | 7412 | } |
| 7413 | 7413 | |
| 7414 | 7414 | $sqlwhere = ''; |
| 7415 | - $sql = "SELECT " . $keyList; |
|
| 7416 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7415 | + $sql = "SELECT ".$keyList; |
|
| 7416 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
| 7417 | 7417 | if (!empty($InfoFieldList[4])) { |
| 7418 | 7418 | // can use SELECT request |
| 7419 | 7419 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7429,23 +7429,23 @@ discard block |
||
| 7429 | 7429 | |
| 7430 | 7430 | // We have to join on extrafield table |
| 7431 | 7431 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7432 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
| 7433 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
| 7432 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
| 7433 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
| 7434 | 7434 | } else { |
| 7435 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 7435 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 7436 | 7436 | } |
| 7437 | 7437 | } else { |
| 7438 | 7438 | $sqlwhere .= ' WHERE 1=1'; |
| 7439 | 7439 | } |
| 7440 | 7440 | // Some tables may have field, some other not. For the moment we disable it. |
| 7441 | 7441 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7442 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7442 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7443 | 7443 | } |
| 7444 | 7444 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
| 7445 | 7445 | // print $sql; |
| 7446 | 7446 | |
| 7447 | 7447 | $sql .= $sqlwhere; |
| 7448 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7448 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7449 | 7449 | $resql = $this->db->query($sql); |
| 7450 | 7450 | if ($resql) { |
| 7451 | 7451 | $num = $this->db->num_rows($resql); |
@@ -7463,7 +7463,7 @@ discard block |
||
| 7463 | 7463 | if (count($fields_label) > 1) { |
| 7464 | 7464 | $notrans = true; |
| 7465 | 7465 | foreach ($fields_label as $field_toshow) { |
| 7466 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7466 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7467 | 7467 | } |
| 7468 | 7468 | } else { |
| 7469 | 7469 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7474,9 +7474,9 @@ discard block |
||
| 7474 | 7474 | foreach ($fields_label as $field_toshow) { |
| 7475 | 7475 | $translabel = $langs->trans($obj->$field_toshow); |
| 7476 | 7476 | if ($translabel != $obj->$field_toshow) { |
| 7477 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
| 7477 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
| 7478 | 7478 | } else { |
| 7479 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
| 7479 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
| 7480 | 7480 | } |
| 7481 | 7481 | } |
| 7482 | 7482 | |
@@ -7499,7 +7499,7 @@ discard block |
||
| 7499 | 7499 | } |
| 7500 | 7500 | |
| 7501 | 7501 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7502 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7502 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7503 | 7503 | $isDependList = 1; |
| 7504 | 7504 | } |
| 7505 | 7505 | |
@@ -7510,14 +7510,14 @@ discard block |
||
| 7510 | 7510 | } |
| 7511 | 7511 | $this->db->free($resql); |
| 7512 | 7512 | |
| 7513 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7513 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7514 | 7514 | } else { |
| 7515 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7515 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7516 | 7516 | } |
| 7517 | 7517 | } else { |
| 7518 | 7518 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7519 | 7519 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7520 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7520 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7521 | 7521 | } |
| 7522 | 7522 | } |
| 7523 | 7523 | } elseif ($type == 'link') { |
@@ -7598,7 +7598,7 @@ discard block |
||
| 7598 | 7598 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
| 7599 | 7599 | } |
| 7600 | 7600 | |
| 7601 | - if ($isDependList==1) { |
|
| 7601 | + if ($isDependList == 1) { |
|
| 7602 | 7602 | $out .= $this->getJSListDependancies('_common'); |
| 7603 | 7603 | } |
| 7604 | 7604 | /* Add comments |
@@ -7649,7 +7649,7 @@ discard block |
||
| 7649 | 7649 | $type = 'varchar'; // convert varchar(xx) int varchar |
| 7650 | 7650 | } |
| 7651 | 7651 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
| 7652 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
| 7652 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7653 | 7653 | } |
| 7654 | 7654 | if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) { |
| 7655 | 7655 | $type = 'link'; |
@@ -7734,7 +7734,7 @@ discard block |
||
| 7734 | 7734 | $value = $this->getLibStatut(3); |
| 7735 | 7735 | } elseif ($type == 'date') { |
| 7736 | 7736 | if (!empty($value)) { |
| 7737 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7737 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7738 | 7738 | } else { |
| 7739 | 7739 | $value = ''; |
| 7740 | 7740 | } |
@@ -7772,7 +7772,7 @@ discard block |
||
| 7772 | 7772 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
| 7773 | 7773 | } |
| 7774 | 7774 | } elseif ($type == 'select') { |
| 7775 | - $value = isset($param['options'][$value])?$param['options'][$value]:''; |
|
| 7775 | + $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; |
|
| 7776 | 7776 | } elseif ($type == 'sellist') { |
| 7777 | 7777 | $param_list = array_keys($param['options']); |
| 7778 | 7778 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -7832,9 +7832,9 @@ discard block |
||
| 7832 | 7832 | $translabel = $langs->trans($obj->$field_toshow); |
| 7833 | 7833 | } |
| 7834 | 7834 | if ($translabel != $field_toshow) { |
| 7835 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
| 7835 | + $value .= dol_trunc($translabel, 18).' '; |
|
| 7836 | 7836 | } else { |
| 7837 | - $value .= $obj->$field_toshow . ' '; |
|
| 7837 | + $value .= $obj->$field_toshow.' '; |
|
| 7838 | 7838 | } |
| 7839 | 7839 | } |
| 7840 | 7840 | } else { |
@@ -7850,7 +7850,7 @@ discard block |
||
| 7850 | 7850 | } |
| 7851 | 7851 | } |
| 7852 | 7852 | } else { |
| 7853 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 7853 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 7854 | 7854 | |
| 7855 | 7855 | $toprint = array(); |
| 7856 | 7856 | $obj = $this->db->fetch_object($resql); |
@@ -7858,7 +7858,7 @@ discard block |
||
| 7858 | 7858 | $c->fetch($obj->rowid); |
| 7859 | 7859 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 7860 | 7860 | foreach ($ways as $way) { |
| 7861 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 7861 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 7862 | 7862 | } |
| 7863 | 7863 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
| 7864 | 7864 | } |
@@ -7874,11 +7874,11 @@ discard block |
||
| 7874 | 7874 | $toprint = array(); |
| 7875 | 7875 | foreach ($value_arr as $keyval => $valueval) { |
| 7876 | 7876 | if (!empty($valueval)) { |
| 7877 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
| 7877 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
| 7878 | 7878 | } |
| 7879 | 7879 | } |
| 7880 | 7880 | if (!empty($toprint)) { |
| 7881 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 7881 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 7882 | 7882 | } |
| 7883 | 7883 | } |
| 7884 | 7884 | } elseif ($type == 'chkbxlst') { |
@@ -7933,9 +7933,9 @@ discard block |
||
| 7933 | 7933 | $translabel = $langs->trans($obj->$field_toshow); |
| 7934 | 7934 | } |
| 7935 | 7935 | if ($translabel != $field_toshow) { |
| 7936 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 7936 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 7937 | 7937 | } else { |
| 7938 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
| 7938 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
| 7939 | 7939 | } |
| 7940 | 7940 | } |
| 7941 | 7941 | } else { |
@@ -7944,15 +7944,15 @@ discard block |
||
| 7944 | 7944 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
| 7945 | 7945 | } |
| 7946 | 7946 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
| 7947 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 7947 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 7948 | 7948 | } else { |
| 7949 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
| 7949 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
| 7950 | 7950 | } |
| 7951 | 7951 | } |
| 7952 | 7952 | } |
| 7953 | 7953 | } |
| 7954 | 7954 | } else { |
| 7955 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 7955 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 7956 | 7956 | |
| 7957 | 7957 | $toprint = array(); |
| 7958 | 7958 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -7961,7 +7961,7 @@ discard block |
||
| 7961 | 7961 | $c->fetch($obj->rowid); |
| 7962 | 7962 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 7963 | 7963 | foreach ($ways as $way) { |
| 7964 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 7964 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 7965 | 7965 | } |
| 7966 | 7966 | } |
| 7967 | 7967 | } |
@@ -8108,7 +8108,7 @@ discard block |
||
| 8108 | 8108 | global $langs; |
| 8109 | 8109 | |
| 8110 | 8110 | if (!class_exists('Validate')) { |
| 8111 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
| 8111 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
| 8112 | 8112 | } |
| 8113 | 8113 | |
| 8114 | 8114 | $this->clearFieldError($fieldKey); |
@@ -8322,7 +8322,7 @@ discard block |
||
| 8322 | 8322 | $out .= "\n"; |
| 8323 | 8323 | |
| 8324 | 8324 | $nbofextrafieldsshown = 0; |
| 8325 | - $e = 0; // var to manage the modulo (odd/even) |
|
| 8325 | + $e = 0; // var to manage the modulo (odd/even) |
|
| 8326 | 8326 | |
| 8327 | 8327 | $lastseparatorkeyfound = ''; |
| 8328 | 8328 | $extrafields_collapse_num = ''; |
@@ -8373,7 +8373,7 @@ discard block |
||
| 8373 | 8373 | } |
| 8374 | 8374 | |
| 8375 | 8375 | $colspan = 0; |
| 8376 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
| 8376 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
| 8377 | 8377 | if (array_key_exists('cols', $params)) { |
| 8378 | 8378 | $colspan = $params['cols']; |
| 8379 | 8379 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8460,7 +8460,7 @@ discard block |
||
| 8460 | 8460 | $domData .= ' data-targetid="'.$this->id.'"'; |
| 8461 | 8461 | |
| 8462 | 8462 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
| 8463 | - if ($display_type=='card') { |
|
| 8463 | + if ($display_type == 'card') { |
|
| 8464 | 8464 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { |
| 8465 | 8465 | $colspan = 0; |
| 8466 | 8466 | } |
@@ -8571,12 +8571,12 @@ discard block |
||
| 8571 | 8571 | break; |
| 8572 | 8572 | } |
| 8573 | 8573 | |
| 8574 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
| 8574 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
| 8575 | 8575 | |
| 8576 | 8576 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) { |
| 8577 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8577 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8578 | 8578 | } else { |
| 8579 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8579 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8580 | 8580 | } |
| 8581 | 8581 | |
| 8582 | 8582 | $e++; |
@@ -8959,7 +8959,7 @@ discard block |
||
| 8959 | 8959 | if ($val['share']) { |
| 8960 | 8960 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
| 8961 | 8961 | $return .= '<!-- Show original file (thumb not yet available with shared links) -->'; |
| 8962 | - $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).'">'; |
|
| 8962 | + $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).'">'; |
|
| 8963 | 8963 | } else { |
| 8964 | 8964 | $return .= '<!-- Show original file -->'; |
| 8965 | 8965 | $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).'">'; |
@@ -8971,7 +8971,7 @@ discard block |
||
| 8971 | 8971 | } else { |
| 8972 | 8972 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
| 8973 | 8973 | $return .= '<!-- Show thumb -->'; |
| 8974 | - $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).'">'; |
|
| 8974 | + $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).'">'; |
|
| 8975 | 8975 | } else { |
| 8976 | 8976 | $return .= '<!-- Show original file -->'; |
| 8977 | 8977 | $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).'">'; |
@@ -9380,7 +9380,7 @@ discard block |
||
| 9380 | 9380 | continue; |
| 9381 | 9381 | } |
| 9382 | 9382 | } |
| 9383 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
| 9383 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
| 9384 | 9384 | } |
| 9385 | 9385 | return implode(',', $keys_with_alias); |
| 9386 | 9386 | } else { |
@@ -9496,7 +9496,7 @@ discard block |
||
| 9496 | 9496 | if (!$error) { |
| 9497 | 9497 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
| 9498 | 9498 | $sql .= " (".implode(", ", $keys).')'; |
| 9499 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9499 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9500 | 9500 | |
| 9501 | 9501 | $res = $this->db->query($sql); |
| 9502 | 9502 | if (!$res) { |
@@ -9766,7 +9766,7 @@ discard block |
||
| 9766 | 9766 | |
| 9767 | 9767 | // Update extrafield |
| 9768 | 9768 | if (!$error) { |
| 9769 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 9769 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 9770 | 9770 | if ($result < 0) { |
| 9771 | 9771 | $error++; |
| 9772 | 9772 | } |
@@ -10294,7 +10294,7 @@ discard block |
||
| 10294 | 10294 | // Process |
| 10295 | 10295 | foreach ($to_del as $del) { |
| 10296 | 10296 | if ($c->fetch($del) > 0) { |
| 10297 | - $result=$c->del_type($this, $type_categ); |
|
| 10297 | + $result = $c->del_type($this, $type_categ); |
|
| 10298 | 10298 | if ($result < 0) { |
| 10299 | 10299 | $error++; |
| 10300 | 10300 | $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();"> |