@@ -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 | |
@@ -638,12 +638,12 @@ discard block |
||
| 638 | 638 | public function getLastEvaluationForUser($fk_user) |
| 639 | 639 | { |
| 640 | 640 | $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."hrm_evaluation "; |
| 641 | - $sql.= "WHERE fk_user=".((int) $fk_user)." "; |
|
| 642 | - $sql.= "ORDER BY date_eval DESC "; |
|
| 643 | - $sql.= "LIMIT 1 "; |
|
| 641 | + $sql .= "WHERE fk_user=".((int) $fk_user)." "; |
|
| 642 | + $sql .= "ORDER BY date_eval DESC "; |
|
| 643 | + $sql .= "LIMIT 1 "; |
|
| 644 | 644 | |
| 645 | 645 | $res = $this->db->query($sql); |
| 646 | - if (!$res) { dol_print_error($this->db);} |
|
| 646 | + if (!$res) { dol_print_error($this->db); } |
|
| 647 | 647 | |
| 648 | 648 | $Tab = $this->db->fetch_object($res); |
| 649 | 649 | |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | if (getDolGlobalString('HRMTEST_EVALUATION_ADDON')) { |
| 951 | 951 | $mybool = false; |
| 952 | 952 | |
| 953 | - $file = getDolGlobalString('HRMTEST_EVALUATION_ADDON') . ".php"; |
|
| 953 | + $file = getDolGlobalString('HRMTEST_EVALUATION_ADDON').".php"; |
|
| 954 | 954 | $classname = $conf->global->HRMTEST_EVALUATION_ADDON; |
| 955 | 955 | |
| 956 | 956 | // 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,15 +29,15 @@ discard block |
||
| 29 | 29 | // Load Dolibarr environment |
| 30 | 30 | require '../main.inc.php'; |
| 31 | 31 | |
| 32 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
| 34 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
| 35 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; |
|
| 36 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_job.lib.php'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/skillrank.class.php'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_job.lib.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/skillrank.class.php'; |
|
| 38 | 38 | |
| 39 | 39 | // Load translation files required by the page |
| 40 | -$langs->loadLangs(array('hrm', 'other', 'products')); // why products? |
|
| 40 | +$langs->loadLangs(array('hrm', 'other', 'products')); // why products? |
|
| 41 | 41 | |
| 42 | 42 | // Get parameters |
| 43 | 43 | $id = GETPOST('id', 'int'); |
@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'jobcard'; // To manage different context of search |
| 49 | 49 | $backtopage = GETPOST('backtopage', 'alpha'); |
| 50 | 50 | $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); |
| 51 | -$lineid = GETPOST('lineid', 'int'); |
|
| 51 | +$lineid = GETPOST('lineid', 'int'); |
|
| 52 | 52 | |
| 53 | 53 | // Initialize technical objects |
| 54 | 54 | $object = new Job($db); |
| 55 | 55 | $extrafields = new ExtraFields($db); |
| 56 | -$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id; |
|
| 56 | +$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; |
|
| 57 | 57 | $hookmanager->initHooks(array('jobcard', 'globalcard')); // Note that conf->hooks_modules contains array |
| 58 | 58 | |
| 59 | 59 | // Fetch optionals attributes and labels |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | $search_all = GETPOST("search_all", 'alpha'); |
| 66 | 66 | $search = array(); |
| 67 | 67 | foreach ($object->fields as $key => $val) { |
| 68 | - if (GETPOST('search_' . $key, 'alpha')) { |
|
| 69 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
| 68 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
| 69 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // Load object |
| 78 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
| 78 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
| 79 | 79 | |
| 80 | 80 | // Permissions |
| 81 | 81 | $permissiontoread = $user->rights->hrm->all->read; |
| 82 | 82 | $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
| 83 | 83 | $permissiontodelete = $user->rights->hrm->all->delete; |
| 84 | -$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/job'; |
|
| 84 | +$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/job'; |
|
| 85 | 85 | |
| 86 | 86 | // Security check (enable the most restrictive one) |
| 87 | 87 | //if ($user->socid > 0) accessforbidden(); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
| 113 | 113 | $backtopage = $backurlforlist; |
| 114 | 114 | } else { |
| 115 | - $backtopage = dol_buildpath('/hrm/job_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__'); |
|
| 115 | + $backtopage = dol_buildpath('/hrm/job_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen |
| 124 | 124 | if ($action != 'confirm_clone') { |
| 125 | - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; |
|
| 125 | + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | // Actions when linking object each other |
| 129 | - include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
| 129 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
| 130 | 130 | |
| 131 | 131 | // Actions when printing a doc from card |
| 132 | - include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; |
|
| 132 | + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; |
|
| 133 | 133 | |
| 134 | 134 | // Action to move up and down lines of object |
| 135 | 135 | //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; |
| 136 | 136 | |
| 137 | 137 | // Action to build doc |
| 138 | - include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; |
|
| 138 | + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; |
|
| 139 | 139 | |
| 140 | 140 | if ($action == 'set_thirdparty' && $permissiontoadd) { |
| 141 | 141 | $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | // Actions to send emails |
| 148 | 148 | $triggersendname = 'HRM_JOB_SENTBYMAIL'; |
| 149 | 149 | $autocopy = 'MAIN_MAIL_AUTOCOPY_JOB_TO'; |
| 150 | - $trackid = 'job' . $object->id; |
|
| 151 | - include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; |
|
| 150 | + $trackid = 'job'.$object->id; |
|
| 151 | + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
|
| 152 | 152 | |
| 153 | 153 | if ($action == 'confirm_clone' && $confirm != 'yes') { |
| 154 | 154 | $action = ''; |
@@ -234,36 +234,36 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | // Part to create |
| 236 | 236 | if ($action == 'create') { |
| 237 | - print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_' . $object->picto); |
|
| 237 | + print load_fiche_titre($langs->trans("NewJobProfile", $langs->transnoentities('Job')), '', 'object_'.$object->picto); |
|
| 238 | 238 | |
| 239 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 240 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 239 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 240 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 241 | 241 | print '<input type="hidden" name="action" value="add">'; |
| 242 | 242 | if ($backtopage) { |
| 243 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 243 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 244 | 244 | } |
| 245 | 245 | if ($backtopageforcancel) { |
| 246 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 246 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | print dol_get_fiche_head(array(), ''); |
| 250 | 250 | |
| 251 | - print '<table class="border centpercent tableforfieldcreate">' . "\n"; |
|
| 251 | + print '<table class="border centpercent tableforfieldcreate">'."\n"; |
|
| 252 | 252 | |
| 253 | 253 | // Common attributes |
| 254 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; |
|
| 254 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; |
|
| 255 | 255 | |
| 256 | 256 | // Other attributes |
| 257 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; |
|
| 257 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; |
|
| 258 | 258 | |
| 259 | - print '</table>' . "\n"; |
|
| 259 | + print '</table>'."\n"; |
|
| 260 | 260 | |
| 261 | 261 | print dol_get_fiche_end(); |
| 262 | 262 | |
| 263 | 263 | print '<div class="center">'; |
| 264 | - print '<input type="submit" class="button" name="add" value="' . dol_escape_htmltag($langs->trans("Create")) . '">'; |
|
| 264 | + print '<input type="submit" class="button" name="add" value="'.dol_escape_htmltag($langs->trans("Create")).'">'; |
|
| 265 | 265 | print ' '; |
| 266 | - print '<input type="' . ($backtopage ? "submit" : "button") . '" class="button button-cancel" name="cancel" value="' . dol_escape_htmltag($langs->trans("Cancel")) . '"' . ($backtopage ? '' : ' onclick="history.go(-1)"') . '>'; // Cancel for create does not post form if we don't know the backtopage |
|
| 266 | + print '<input type="'.($backtopage ? "submit" : "button").'" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'"'.($backtopage ? '' : ' onclick="history.go(-1)"').'>'; // Cancel for create does not post form if we don't know the backtopage |
|
| 267 | 267 | print '</div>'; |
| 268 | 268 | |
| 269 | 269 | print '</form>'; |
@@ -273,35 +273,35 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | // Part to edit record |
| 275 | 275 | if (($id || $ref) && $action == 'edit') { |
| 276 | - print load_fiche_titre($langs->trans("JobProfile"), '', 'object_' . $object->picto); |
|
| 276 | + print load_fiche_titre($langs->trans("JobProfile"), '', 'object_'.$object->picto); |
|
| 277 | 277 | |
| 278 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '">'; |
|
| 279 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 278 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'; |
|
| 279 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 280 | 280 | print '<input type="hidden" name="action" value="update">'; |
| 281 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
| 281 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 282 | 282 | if ($backtopage) { |
| 283 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 283 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 284 | 284 | } |
| 285 | 285 | if ($backtopageforcancel) { |
| 286 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 286 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | print dol_get_fiche_head(); |
| 290 | 290 | |
| 291 | - print '<table class="border centpercent tableforfieldedit">' . "\n"; |
|
| 291 | + print '<table class="border centpercent tableforfieldedit">'."\n"; |
|
| 292 | 292 | |
| 293 | 293 | // Common attributes |
| 294 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; |
|
| 294 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; |
|
| 295 | 295 | |
| 296 | 296 | // Other attributes |
| 297 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; |
|
| 297 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; |
|
| 298 | 298 | |
| 299 | 299 | print '</table>'; |
| 300 | 300 | |
| 301 | 301 | print dol_get_fiche_end(); |
| 302 | 302 | |
| 303 | - print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">'; |
|
| 304 | - print ' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
| 303 | + print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">'; |
|
| 304 | + print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
| 305 | 305 | print '</div>'; |
| 306 | 306 | |
| 307 | 307 | print '</form>'; |
@@ -319,11 +319,11 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | // Confirmation to delete |
| 321 | 321 | if ($action == 'delete') { |
| 322 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 322 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteJob'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 323 | 323 | } |
| 324 | 324 | // Confirmation to delete line |
| 325 | 325 | if ($action == 'deleteline') { |
| 326 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); |
|
| 326 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1); |
|
| 327 | 327 | } |
| 328 | 328 | // Clone confirmation |
| 329 | 329 | if ($action == 'clone') { |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) |
| 350 | 350 | ); |
| 351 | 351 | */ |
| 352 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); |
|
| 352 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | // Call Hook formConfirm |
@@ -367,10 +367,10 @@ discard block |
||
| 367 | 367 | |
| 368 | 368 | // Object card |
| 369 | 369 | // ------------------------------------------------------------ |
| 370 | - $linkback = '<a href="' . dol_buildpath('/hrm/job_list.php', 1) . '?restore_lastsearch_values=1' . (!empty($socid) ? '&socid=' . $socid : '') . '">' . $langs->trans("BackToList") . '</a>'; |
|
| 370 | + $linkback = '<a href="'.dol_buildpath('/hrm/job_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
|
| 371 | 371 | |
| 372 | 372 | $morehtmlref = '<div class="refid">'; |
| 373 | - $morehtmlref.= $object->label; |
|
| 373 | + $morehtmlref .= $object->label; |
|
| 374 | 374 | $morehtmlref .= '</div>'; |
| 375 | 375 | |
| 376 | 376 | |
@@ -386,11 +386,11 @@ discard block |
||
| 386 | 386 | //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field |
| 387 | 387 | //unset($object->fields['fk_project']); // Hide field already shown in banner |
| 388 | 388 | //unset($object->fields['fk_soc']); // Hide field already shown in banner |
| 389 | - $object->fields['label']['visible']=0; // Already in banner |
|
| 390 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
| 389 | + $object->fields['label']['visible'] = 0; // Already in banner |
|
| 390 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
| 391 | 391 | |
| 392 | 392 | // Other attributes. Fields from hook formObjectOptions and Extrafields. |
| 393 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
| 393 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
| 394 | 394 | |
| 395 | 395 | print '</table>'; |
| 396 | 396 | print '</div>'; |
@@ -409,16 +409,16 @@ discard block |
||
| 409 | 409 | // Show object lines |
| 410 | 410 | $result = $object->getLinesArray(); |
| 411 | 411 | |
| 412 | - print ' <form name="addproduct" id="addproduct" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . (($action != 'editline') ? '' : '#line_' . GETPOST('lineid', 'int')) . '" method="POST"> |
|
| 413 | - <input type="hidden" name="token" value="' . newToken() . '"> |
|
| 414 | - <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline') . '"> |
|
| 412 | + print ' <form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST"> |
|
| 413 | + <input type="hidden" name="token" value="' . newToken().'"> |
|
| 414 | + <input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'"> |
|
| 415 | 415 | <input type="hidden" name="mode" value=""> |
| 416 | 416 | <input type="hidden" name="page_y" value=""> |
| 417 | - <input type="hidden" name="id" value="' . $object->id . '"> |
|
| 417 | + <input type="hidden" name="id" value="' . $object->id.'"> |
|
| 418 | 418 | '; |
| 419 | 419 | |
| 420 | 420 | if (!empty($conf->use_javascript_ajax) && $object->status == 0) { |
| 421 | - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; |
|
| 421 | + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | print '<div class="div-table-responsive-no-min">'; |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | // Buttons for actions |
| 456 | 456 | |
| 457 | 457 | if ($action != 'presend' && $action != 'editline') { |
| 458 | - print '<div class="tabsAction">' . "\n"; |
|
| 458 | + print '<div class="tabsAction">'."\n"; |
|
| 459 | 459 | $parameters = array(); |
| 460 | 460 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
| 461 | 461 | if ($reshook < 0) { |
@@ -465,17 +465,17 @@ discard block |
||
| 465 | 465 | if (empty($reshook)) { |
| 466 | 466 | // Back to draft |
| 467 | 467 | if ($object->status == $object::STATUS_VALIDATED) { |
| 468 | - print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=confirm_setdraft&confirm=yes&token=' . newToken(), '', $permissiontoadd); |
|
| 468 | + print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd); |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
| 471 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
| 472 | 472 | |
| 473 | - print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=clone&token=' . newToken(), '', $permissiontoadd); |
|
| 473 | + print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=clone&token='.newToken(), '', $permissiontoadd); |
|
| 474 | 474 | |
| 475 | 475 | // Delete (need delete permission, or if draft, just need create/modify permission) |
| 476 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete); |
|
| 476 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete); |
|
| 477 | 477 | } |
| 478 | - print '</div>' . "\n"; |
|
| 478 | + print '</div>'."\n"; |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | |
@@ -493,12 +493,12 @@ discard block |
||
| 493 | 493 | // Documents |
| 494 | 494 | if ($includedocgeneration) { |
| 495 | 495 | $objref = dol_sanitizeFileName($object->ref); |
| 496 | - $relativepath = $objref . '/' . $objref . '.pdf'; |
|
| 497 | - $filedir = $conf->hrm->dir_output . '/' . $object->element . '/' . $objref; |
|
| 498 | - $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; |
|
| 496 | + $relativepath = $objref.'/'.$objref.'.pdf'; |
|
| 497 | + $filedir = $conf->hrm->dir_output.'/'.$object->element.'/'.$objref; |
|
| 498 | + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; |
|
| 499 | 499 | $genallowed = $user->rights->hrm->job->read; // If you can read, you can build the PDF to read content |
| 500 | 500 | $delallowed = $user->rights->hrm->job->write; // If you can create/edit, you can remove a file on card |
| 501 | - print $formfile->showdocuments('hrm:Job', $object->element . '/' . $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); |
|
| 501 | + print $formfile->showdocuments('hrm:Job', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang); |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | // Show links to link elements |
@@ -513,9 +513,9 @@ discard block |
||
| 513 | 513 | $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/job_agenda.php?id='.$object->id); |
| 514 | 514 | |
| 515 | 515 | // List of actions on element |
| 516 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
| 516 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
| 517 | 517 | $formactions = new FormActions($db); |
| 518 | - $somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 518 | + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 519 | 519 | |
| 520 | 520 | print '</div></div>'; |
| 521 | 521 | } |
@@ -524,9 +524,9 @@ discard block |
||
| 524 | 524 | $modelmail = 'job'; |
| 525 | 525 | $defaulttopic = 'InformationMessage'; |
| 526 | 526 | $diroutput = $conf->hrm->dir_output; |
| 527 | - $trackid = 'job' . $object->id; |
|
| 527 | + $trackid = 'job'.$object->id; |
|
| 528 | 528 | |
| 529 | - include DOL_DOCUMENT_ROOT . '/core/tpl/card_presend.tpl.php'; |
|
| 529 | + include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | // End of page |
@@ -113,8 +113,12 @@ |
||
| 113 | 113 | //if ($user->socid > 0) $socid = $user->socid; |
| 114 | 114 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
| 115 | 115 | //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
| 116 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
| 117 | -if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) accessforbidden(); |
|
| 116 | +if (empty($conf->hrm->enabled)) { |
|
| 117 | + accessforbidden(); |
|
| 118 | +} |
|
| 119 | +if (!$permissiontoread || ($action === 'create' && !$permissiontoadd)) { |
|
| 120 | + accessforbidden(); |
|
| 121 | +} |
|
| 118 | 122 | |
| 119 | 123 | $langs->loadLangs(array("hrm", "other")); |
| 120 | 124 | |
@@ -29,19 +29,19 @@ discard block |
||
| 29 | 29 | // Load Dolibarr environment |
| 30 | 30 | require '../main.inc.php'; |
| 31 | 31 | |
| 32 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php'; |
|
| 33 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; |
|
| 34 | -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; |
|
| 35 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/position.class.php'; |
|
| 36 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/job.class.php'; |
|
| 37 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_position.lib.php'; |
|
| 32 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; |
|
| 33 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
|
| 34 | +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; |
|
| 35 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/position.class.php'; |
|
| 36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/job.class.php'; |
|
| 37 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_position.lib.php'; |
|
| 38 | 38 | //dol_include_once('/hrm/position.php'); |
| 39 | 39 | |
| 40 | 40 | // Get Parameters |
| 41 | -$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... |
|
| 41 | +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... |
|
| 42 | 42 | $backtopage = GETPOST('backtopage', 'alpha'); |
| 43 | 43 | $backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); |
| 44 | -$id = GETPOST('id', 'int'); |
|
| 44 | +$id = GETPOST('id', 'int'); |
|
| 45 | 45 | |
| 46 | 46 | // Initialize technical objects |
| 47 | 47 | $form = new Form($db); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $permissiontoadd = $user->rights->hrm->all->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php |
| 57 | 57 | $permissiontodelete = $user->rights->hrm->all->delete; |
| 58 | 58 | $permissiondellink = $user->rights->hrm->all->write; // Used by the include of actions_dellink.inc.php |
| 59 | -$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1] . '/position'; |
|
| 59 | +$upload_dir = $conf->hrm->multidir_output[isset($object->entity) ? $object->entity : 1].'/position'; |
|
| 60 | 60 | |
| 61 | 61 | // Security check (enable the most restrictive one) |
| 62 | 62 | //if ($user->socid > 0) accessforbidden(); |
@@ -71,10 +71,10 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | |
| 73 | 73 | // Get parameters |
| 74 | -$id = GETPOST('id', 'int'); |
|
| 74 | +$id = GETPOST('id', 'int'); |
|
| 75 | 75 | $fk_job = GETPOST('fk_job', 'int'); |
| 76 | 76 | |
| 77 | -$ref = GETPOST('ref', 'alpha'); |
|
| 77 | +$ref = GETPOST('ref', 'alpha'); |
|
| 78 | 78 | $action = GETPOST('action', 'aZ09'); |
| 79 | 79 | $confirm = GETPOST('confirm', 'alpha'); |
| 80 | 80 | $cancel = GETPOST('cancel', 'aZ09'); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | $extrafields = new ExtraFields($db); |
| 94 | 94 | |
| 95 | -$diroutputmassaction = $conf->hrm->dir_output . '/temp/massgeneration/' . $user->id; |
|
| 95 | +$diroutputmassaction = $conf->hrm->dir_output.'/temp/massgeneration/'.$user->id; |
|
| 96 | 96 | $hookmanager->initHooks(array('positioncard', 'globalcard')); // Note that conf->hooks_modules contains array |
| 97 | 97 | |
| 98 | 98 | // Fetch optionals attributes and labels |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | $search_all = GETPOST("search_all", 'alpha'); |
| 105 | 105 | $search = array(); |
| 106 | 106 | foreach ($object->fields as $key => $val) { |
| 107 | - if (GETPOST('search_' . $key, 'alpha')) { |
|
| 108 | - $search[$key] = GETPOST('search_' . $key, 'alpha'); |
|
| 107 | + if (GETPOST('search_'.$key, 'alpha')) { |
|
| 108 | + $search[$key] = GETPOST('search_'.$key, 'alpha'); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Load object |
| 117 | -include DOL_DOCUMENT_ROOT . '/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
| 117 | +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. |
|
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | /* |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) { |
| 138 | 138 | $backtopage = $backurlforlist; |
| 139 | 139 | } else { |
| 140 | - $backtopage = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . ($id > 0 ? $id : '__ID__'); |
|
| 140 | + $backtopage = dol_buildpath('/hrm/position_card.php', 1).'?id='.($id > 0 ? $id : '__ID__'); |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -145,19 +145,19 @@ discard block |
||
| 145 | 145 | $triggermodname = 'HRM_POSITION_MODIFY'; // Name of trigger action code to execute when we modify record |
| 146 | 146 | |
| 147 | 147 | // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen |
| 148 | - include DOL_DOCUMENT_ROOT . '/core/actions_addupdatedelete.inc.php'; |
|
| 148 | + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; |
|
| 149 | 149 | |
| 150 | 150 | // Actions when linking object each other |
| 151 | - include DOL_DOCUMENT_ROOT . '/core/actions_dellink.inc.php'; |
|
| 151 | + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; |
|
| 152 | 152 | |
| 153 | 153 | // Actions when printing a doc from card |
| 154 | - include DOL_DOCUMENT_ROOT . '/core/actions_printing.inc.php'; |
|
| 154 | + include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; |
|
| 155 | 155 | |
| 156 | 156 | // Action to move up and down lines of object |
| 157 | 157 | //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; |
| 158 | 158 | |
| 159 | 159 | // Action to build doc |
| 160 | - include DOL_DOCUMENT_ROOT . '/core/actions_builddoc.inc.php'; |
|
| 160 | + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; |
|
| 161 | 161 | |
| 162 | 162 | if ($action == 'set_thirdparty' && $permissiontoadd) { |
| 163 | 163 | $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname); |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | // Actions to send emails |
| 170 | 170 | $triggersendname = 'HRM_POSITION_SENTBYMAIL'; |
| 171 | 171 | $autocopy = 'MAIN_MAIL_AUTOCOPY_POSITION_TO'; |
| 172 | - $trackid = 'position' . $object->id; |
|
| 173 | - include DOL_DOCUMENT_ROOT . '/core/actions_sendmails.inc.php'; |
|
| 172 | + $trackid = 'position'.$object->id; |
|
| 173 | + include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | |
@@ -214,36 +214,36 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | // Part to edit record |
| 216 | 216 | if (($id || $ref) && $action == 'edit') { |
| 217 | - print load_fiche_titre($langs->trans("Position"), '', 'object_' . $object->picto); |
|
| 217 | + print load_fiche_titre($langs->trans("Position"), '', 'object_'.$object->picto); |
|
| 218 | 218 | |
| 219 | - print '<form method="POST" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '">'; |
|
| 220 | - print '<input type="hidden" name="token" value="' . newToken() . '">'; |
|
| 219 | + print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">'; |
|
| 220 | + print '<input type="hidden" name="token" value="'.newToken().'">'; |
|
| 221 | 221 | print '<input type="hidden" name="action" value="update">'; |
| 222 | - print '<input type="hidden" name="id" value="' . $object->id . '">'; |
|
| 222 | + print '<input type="hidden" name="id" value="'.$object->id.'">'; |
|
| 223 | 223 | |
| 224 | 224 | if ($backtopage) { |
| 225 | - print '<input type="hidden" name="backtopage" value="' . $backtopage . '">'; |
|
| 225 | + print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; |
|
| 226 | 226 | } |
| 227 | 227 | if ($backtopageforcancel) { |
| 228 | - print '<input type="hidden" name="backtopageforcancel" value="' . $backtopageforcancel . '">'; |
|
| 228 | + print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">'; |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | print dol_get_fiche_head(); |
| 232 | 232 | |
| 233 | - print '<table class="border centpercent tableforfieldedit">' . "\n"; |
|
| 233 | + print '<table class="border centpercent tableforfieldedit">'."\n"; |
|
| 234 | 234 | |
| 235 | 235 | // Common attributes |
| 236 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; |
|
| 236 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; |
|
| 237 | 237 | |
| 238 | 238 | // Other attributes |
| 239 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; |
|
| 239 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; |
|
| 240 | 240 | |
| 241 | 241 | print '</table>'; |
| 242 | 242 | |
| 243 | 243 | print dol_get_fiche_end(); |
| 244 | 244 | |
| 245 | - print '<div class="center"><input type="submit" class="button button-save" name="save" value="' . $langs->trans("Save") . '">'; |
|
| 246 | - print ' <input type="submit" class="button button-cancel" name="cancel" value="' . $langs->trans("Cancel") . '">'; |
|
| 245 | + print '<div class="center"><input type="submit" class="button button-save" name="save" value="'.$langs->trans("Save").'">'; |
|
| 246 | + print ' <input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">'; |
|
| 247 | 247 | print '</div>'; |
| 248 | 248 | |
| 249 | 249 | print '</form>'; |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | |
| 263 | 263 | // Confirmation to delete |
| 264 | 264 | if ($action == 'delete') { |
| 265 | - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeletePosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 265 | + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeletePosition'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | // Call Hook formConfirm |
@@ -297,18 +297,18 @@ discard block |
||
| 297 | 297 | print '<div class="fichecenter">'; |
| 298 | 298 | print '<div class="fichehalfleft">'; |
| 299 | 299 | print '<div class="underbanner clearboth"></div>'; |
| 300 | - print '<table class="border centpercent tableforfield">' . "\n"; |
|
| 300 | + print '<table class="border centpercent tableforfield">'."\n"; |
|
| 301 | 301 | |
| 302 | 302 | // Common attributes |
| 303 | 303 | //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just before this field |
| 304 | 304 | //unset($object->fields['fk_project']); // Hide field already shown in banner |
| 305 | 305 | //unset($object->fields['fk_soc']); // Hide field already shown in banner |
| 306 | - $object->fields['fk_user']['visible']=0; // Already in banner |
|
| 307 | - $object->fields['fk_job']['visible']=0; // Already in banner |
|
| 308 | - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; |
|
| 306 | + $object->fields['fk_user']['visible'] = 0; // Already in banner |
|
| 307 | + $object->fields['fk_job']['visible'] = 0; // Already in banner |
|
| 308 | + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; |
|
| 309 | 309 | |
| 310 | 310 | // Other attributes. Fields from hook formObjectOptions and Extrafields. |
| 311 | - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; |
|
| 311 | + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; |
|
| 312 | 312 | |
| 313 | 313 | print '</table>'; |
| 314 | 314 | print '</div>'; |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook |
| 328 | 328 | |
| 329 | 329 | |
| 330 | - print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=edit&token=' . newToken(), '', $permissiontoadd); |
|
| 330 | + print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd); |
|
| 331 | 331 | |
| 332 | 332 | // Delete (need delete permission, or if draft, just need create/modify permission) |
| 333 | - print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&action=delete&token=' . newToken(), '', $permissiontodelete); |
|
| 333 | + print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete); |
|
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
@@ -368,10 +368,10 @@ discard block |
||
| 368 | 368 | //} |
| 369 | 369 | |
| 370 | 370 | |
| 371 | -print '</table>' . "\n"; |
|
| 372 | -print '</div>' . "\n"; |
|
| 371 | +print '</table>'."\n"; |
|
| 372 | +print '</div>'."\n"; |
|
| 373 | 373 | |
| 374 | -print '</form>' . "\n"; |
|
| 374 | +print '</form>'."\n"; |
|
| 375 | 375 | |
| 376 | 376 | |
| 377 | 377 | if ($action !== 'edit' && $action !== 'create') { |
@@ -389,9 +389,9 @@ discard block |
||
| 389 | 389 | $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/hrm/position_agenda.php?id='.$object->id); |
| 390 | 390 | |
| 391 | 391 | // List of actions on element |
| 392 | - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; |
|
| 392 | + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; |
|
| 393 | 393 | $formactions = new FormActions($db); |
| 394 | - $somethingshown = $formactions->showactions($object, $object->element . '@' . $object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 394 | + $somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter); |
|
| 395 | 395 | |
| 396 | 396 | print '</div></div>'; |
| 397 | 397 | } |
@@ -3647,7 +3647,9 @@ discard block |
||
| 3647 | 3647 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
| 3648 | 3648 | $reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 3649 | 3649 | if ($reshook > 0) { |
| 3650 | - if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype']; |
|
| 3650 | + if (!empty($hookmanager->resArray['targettype'])) { |
|
| 3651 | + $targettype = $hookmanager->resArray['targettype']; |
|
| 3652 | + } |
|
| 3651 | 3653 | } |
| 3652 | 3654 | |
| 3653 | 3655 | $this->db->begin(); |
@@ -3729,10 +3731,18 @@ discard block |
||
| 3729 | 3731 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
| 3730 | 3732 | $reshook = $hookmanager->executeHooks('setLinkedObjectSourceTargetType', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 3731 | 3733 | if ($reshook > 0) { |
| 3732 | - if (!empty($hookmanager->resArray['sourcetype'])) $sourcetype = $hookmanager->resArray['sourcetype']; |
|
| 3733 | - if (!empty($hookmanager->resArray['sourceid'])) $sourceid = $hookmanager->resArray['sourceid']; |
|
| 3734 | - if (!empty($hookmanager->resArray['targettype'])) $targettype = $hookmanager->resArray['targettype']; |
|
| 3735 | - if (!empty($hookmanager->resArray['targetid'])) $targetid = $hookmanager->resArray['targetid']; |
|
| 3734 | + if (!empty($hookmanager->resArray['sourcetype'])) { |
|
| 3735 | + $sourcetype = $hookmanager->resArray['sourcetype']; |
|
| 3736 | + } |
|
| 3737 | + if (!empty($hookmanager->resArray['sourceid'])) { |
|
| 3738 | + $sourceid = $hookmanager->resArray['sourceid']; |
|
| 3739 | + } |
|
| 3740 | + if (!empty($hookmanager->resArray['targettype'])) { |
|
| 3741 | + $targettype = $hookmanager->resArray['targettype']; |
|
| 3742 | + } |
|
| 3743 | + if (!empty($hookmanager->resArray['targetid'])) { |
|
| 3744 | + $targetid = $hookmanager->resArray['targetid']; |
|
| 3745 | + } |
|
| 3736 | 3746 | } |
| 3737 | 3747 | |
| 3738 | 3748 | if (!empty($sourceid) && !empty($sourcetype) && empty($targetid)) { |
@@ -6600,7 +6610,9 @@ discard block |
||
| 6600 | 6610 | $showtime = 1; |
| 6601 | 6611 | |
| 6602 | 6612 | // Do not show current date when field not required (see selectDate() method) |
| 6603 | - if (!$required && $value == '') $value = '-1'; |
|
| 6613 | + if (!$required && $value == '') { |
|
| 6614 | + $value = '-1'; |
|
| 6615 | + } |
|
| 6604 | 6616 | |
| 6605 | 6617 | // TODO Must also support $moreparam |
| 6606 | 6618 | $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1, '', '', '', 1, '', '', 'tzuserrel'); |
@@ -887,16 +887,16 @@ discard block |
||
| 887 | 887 | } |
| 888 | 888 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
| 889 | 889 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
| 890 | - $datas[$key]= '<br><b><u>'. $labelextra . '</u></b>'; |
|
| 890 | + $datas[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
| 891 | 891 | } else { |
| 892 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
| 893 | - $datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 892 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
| 893 | + $datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 894 | 894 | $count++; |
| 895 | 895 | } |
| 896 | 896 | } |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 899 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 900 | 900 | $parameters = array( |
| 901 | 901 | 'tooltipcontentarray' => &$datas, |
| 902 | 902 | 'params' => $params, |
@@ -1387,7 +1387,7 @@ discard block |
||
| 1387 | 1387 | if ($source == 'external' || $source == 'thirdparty') { |
| 1388 | 1388 | $sql .= " AND tc.source = 'external'"; |
| 1389 | 1389 | if ($status >= 0) { |
| 1390 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1390 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1391 | 1391 | } |
| 1392 | 1392 | } |
| 1393 | 1393 | $sql .= " AND tc.active = 1"; |
@@ -1746,8 +1746,8 @@ discard block |
||
| 1746 | 1746 | if ($idtofetch) { |
| 1747 | 1747 | $thirdparty = new Societe($this->db); |
| 1748 | 1748 | $result = $thirdparty->fetch($idtofetch); |
| 1749 | - if ($result<0) { |
|
| 1750 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
| 1749 | + if ($result < 0) { |
|
| 1750 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
| 1751 | 1751 | } |
| 1752 | 1752 | $this->thirdparty = $thirdparty; |
| 1753 | 1753 | |
@@ -1777,7 +1777,7 @@ discard block |
||
| 1777 | 1777 | } |
| 1778 | 1778 | |
| 1779 | 1779 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element; |
| 1780 | - $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1780 | + $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1781 | 1781 | $sql .= " LIMIT 1"; |
| 1782 | 1782 | |
| 1783 | 1783 | $query = $this->db->query($sql); |
@@ -2070,9 +2070,9 @@ discard block |
||
| 2070 | 2070 | if ($trigkey) { |
| 2071 | 2071 | $oldvalue = null; |
| 2072 | 2072 | |
| 2073 | - $sql = "SELECT " . $field; |
|
| 2074 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
| 2075 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
| 2073 | + $sql = "SELECT ".$field; |
|
| 2074 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
| 2075 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
| 2076 | 2076 | |
| 2077 | 2077 | $resql = $this->db->query($sql); |
| 2078 | 2078 | if ($resql) { |
@@ -2202,7 +2202,7 @@ discard block |
||
| 2202 | 2202 | } |
| 2203 | 2203 | $restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc; |
| 2204 | 2204 | $sql = "SELECT MAX(te.".$fieldid.")"; |
| 2205 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
| 2205 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
| 2206 | 2206 | if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { |
| 2207 | 2207 | $tmparray = explode('@', $this->ismultientitymanaged); |
| 2208 | 2208 | $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 |
@@ -2272,7 +2272,7 @@ discard block |
||
| 2272 | 2272 | $this->ref_previous = $row[0]; |
| 2273 | 2273 | |
| 2274 | 2274 | $sql = "SELECT MIN(te.".$fieldid.")"; |
| 2275 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
| 2275 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
| 2276 | 2276 | if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { |
| 2277 | 2277 | $tmparray = explode('@', $this->ismultientitymanaged); |
| 2278 | 2278 | $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 |
@@ -2426,7 +2426,7 @@ discard block |
||
| 2426 | 2426 | // Triggers |
| 2427 | 2427 | if (!$error && !$notrigger) { |
| 2428 | 2428 | // Call triggers |
| 2429 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
| 2429 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
| 2430 | 2430 | if ($result < 0) { |
| 2431 | 2431 | $error++; |
| 2432 | 2432 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2791,7 +2791,7 @@ discard block |
||
| 2791 | 2791 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
| 2792 | 2792 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
| 2793 | 2793 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
| 2794 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2794 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2795 | 2795 | } |
| 2796 | 2796 | $sql .= ' WHERE rowid='.((int) $this->id); |
| 2797 | 2797 | |
@@ -3140,10 +3140,10 @@ discard block |
||
| 3140 | 3140 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
| 3141 | 3141 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3142 | 3142 | if (!$renum) { |
| 3143 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
| 3143 | + $sql .= " AND ".$fieldposition." = 0"; |
|
| 3144 | 3144 | } |
| 3145 | 3145 | if ($renum) { |
| 3146 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
| 3146 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
| 3147 | 3147 | } |
| 3148 | 3148 | |
| 3149 | 3149 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3164,7 +3164,7 @@ discard block |
||
| 3164 | 3164 | if ($fk_parent_line) { |
| 3165 | 3165 | $sql .= ' AND fk_parent_line IS NULL'; |
| 3166 | 3166 | } |
| 3167 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
| 3167 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
| 3168 | 3168 | |
| 3169 | 3169 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
| 3170 | 3170 | $resql = $this->db->query($sql); |
@@ -3215,7 +3215,7 @@ discard block |
||
| 3215 | 3215 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3216 | 3216 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3217 | 3217 | $sql .= ' AND fk_parent_line = '.((int) $id); |
| 3218 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
| 3218 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
| 3219 | 3219 | |
| 3220 | 3220 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
| 3221 | 3221 | $resql = $this->db->query($sql); |
@@ -3298,8 +3298,8 @@ discard block |
||
| 3298 | 3298 | dol_print_error($this->db); |
| 3299 | 3299 | return -1; |
| 3300 | 3300 | } else { |
| 3301 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3302 | - $action=''; |
|
| 3301 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3302 | + $action = ''; |
|
| 3303 | 3303 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
| 3304 | 3304 | return 1; |
| 3305 | 3305 | } |
@@ -3338,7 +3338,7 @@ discard block |
||
| 3338 | 3338 | |
| 3339 | 3339 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3340 | 3340 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3341 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
| 3341 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
| 3342 | 3342 | if ($this->db->query($sql)) { |
| 3343 | 3343 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
| 3344 | 3344 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3369,7 +3369,7 @@ discard block |
||
| 3369 | 3369 | |
| 3370 | 3370 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3371 | 3371 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3372 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
| 3372 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
| 3373 | 3373 | if ($this->db->query($sql)) { |
| 3374 | 3374 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
| 3375 | 3375 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3395,7 +3395,7 @@ discard block |
||
| 3395 | 3395 | $fieldposition = 'position'; |
| 3396 | 3396 | } |
| 3397 | 3397 | |
| 3398 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3398 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3399 | 3399 | $sql .= " WHERE rowid = ".((int) $rowid); |
| 3400 | 3400 | |
| 3401 | 3401 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3423,7 +3423,7 @@ discard block |
||
| 3423 | 3423 | |
| 3424 | 3424 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3425 | 3425 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3426 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
| 3426 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
| 3427 | 3427 | $resql = $this->db->query($sql); |
| 3428 | 3428 | if ($resql) { |
| 3429 | 3429 | $row = $this->db->fetch_row($resql); |
@@ -3541,7 +3541,7 @@ discard block |
||
| 3541 | 3541 | $newsuffix = ''; |
| 3542 | 3542 | } |
| 3543 | 3543 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
| 3544 | - $fieldusermod = "fk_user_mod"; |
|
| 3544 | + $fieldusermod = "fk_user_mod"; |
|
| 3545 | 3545 | } elseif ($this->table_element == 'ecm_files') { |
| 3546 | 3546 | $fieldusermod = "fk_user_m"; |
| 3547 | 3547 | } else { |
@@ -3583,7 +3583,7 @@ discard block |
||
| 3583 | 3583 | $trigger_name = 'EXPENSE_REPORT_MODIFY'; |
| 3584 | 3584 | break; |
| 3585 | 3585 | default: |
| 3586 | - $trigger_name = strtoupper($this->element) . '_MODIFY'; |
|
| 3586 | + $trigger_name = strtoupper($this->element).'_MODIFY'; |
|
| 3587 | 3587 | } |
| 3588 | 3588 | $ret = $this->call_trigger($trigger_name, $user); |
| 3589 | 3589 | if ($ret < 0) { |
@@ -3941,7 +3941,7 @@ discard block |
||
| 3941 | 3941 | // 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. |
| 3942 | 3942 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
| 3943 | 3943 | // Add module part to target type if object has $module property and isn't in core modules. |
| 3944 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3944 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3945 | 3945 | |
| 3946 | 3946 | $parameters = array('targettype'=>$targettype); |
| 3947 | 3947 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3953,19 +3953,19 @@ discard block |
||
| 3953 | 3953 | $this->db->begin(); |
| 3954 | 3954 | $error = 0; |
| 3955 | 3955 | |
| 3956 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
| 3956 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
| 3957 | 3957 | $sql .= "fk_source"; |
| 3958 | 3958 | $sql .= ", sourcetype"; |
| 3959 | 3959 | $sql .= ", fk_target"; |
| 3960 | 3960 | $sql .= ", targettype"; |
| 3961 | 3961 | $sql .= ") VALUES ("; |
| 3962 | 3962 | $sql .= ((int) $origin_id); |
| 3963 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
| 3964 | - $sql .= ", " . ((int) $this->id); |
|
| 3965 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
| 3963 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
| 3964 | + $sql .= ", ".((int) $this->id); |
|
| 3965 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
| 3966 | 3966 | $sql .= ")"; |
| 3967 | 3967 | |
| 3968 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
| 3968 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
| 3969 | 3969 | if ($this->db->query($sql)) { |
| 3970 | 3970 | if (!$notrigger) { |
| 3971 | 3971 | // Call trigger |
@@ -4272,20 +4272,20 @@ discard block |
||
| 4272 | 4272 | $this->db->begin(); |
| 4273 | 4273 | $error = 0; |
| 4274 | 4274 | |
| 4275 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
| 4275 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
| 4276 | 4276 | if ($updatesource) { |
| 4277 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
| 4278 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4279 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
| 4280 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4277 | + $sql .= "fk_source = ".((int) $sourceid); |
|
| 4278 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4279 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
| 4280 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4281 | 4281 | } elseif ($updatetarget) { |
| 4282 | - $sql .= "fk_target = " . ((int) $targetid); |
|
| 4283 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4284 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
| 4285 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4282 | + $sql .= "fk_target = ".((int) $targetid); |
|
| 4283 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
| 4284 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
| 4285 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4286 | 4286 | } |
| 4287 | 4287 | |
| 4288 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
| 4288 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
| 4289 | 4289 | if ($this->db->query($sql)) { |
| 4290 | 4290 | if (!$notrigger) { |
| 4291 | 4291 | // Call trigger |
@@ -4361,25 +4361,25 @@ discard block |
||
| 4361 | 4361 | } |
| 4362 | 4362 | |
| 4363 | 4363 | if (!$error) { |
| 4364 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
| 4364 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
| 4365 | 4365 | $sql .= " WHERE"; |
| 4366 | 4366 | if ($rowid > 0) { |
| 4367 | - $sql .= " rowid = " . ((int) $rowid); |
|
| 4367 | + $sql .= " rowid = ".((int) $rowid); |
|
| 4368 | 4368 | } else { |
| 4369 | 4369 | if ($deletesource) { |
| 4370 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4371 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4370 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4371 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4372 | 4372 | } elseif ($deletetarget) { |
| 4373 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4374 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4373 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
| 4374 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4375 | 4375 | } else { |
| 4376 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
| 4376 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
| 4377 | 4377 | $sql .= " OR"; |
| 4378 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
| 4378 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
| 4379 | 4379 | } |
| 4380 | 4380 | } |
| 4381 | 4381 | |
| 4382 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
| 4382 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
| 4383 | 4383 | if (!$this->db->query($sql)) { |
| 4384 | 4384 | $this->error = $this->db->lasterror(); |
| 4385 | 4385 | $this->errors[] = $this->error; |
@@ -4541,14 +4541,14 @@ discard block |
||
| 4541 | 4541 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
| 4542 | 4542 | } |
| 4543 | 4543 | $sql .= " WHERE rowid = ".((int) $elementId); |
| 4544 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4544 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4545 | 4545 | |
| 4546 | 4546 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
| 4547 | 4547 | $resql = $this->db->query($sql); |
| 4548 | 4548 | if ($resql) { |
| 4549 | 4549 | $error = 0; |
| 4550 | 4550 | |
| 4551 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4551 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4552 | 4552 | |
| 4553 | 4553 | if ($nb_rows_affected > 0) { |
| 4554 | 4554 | if (empty($trigkey)) { |
@@ -4593,7 +4593,7 @@ discard block |
||
| 4593 | 4593 | if ($fieldstatus == 'tosell') { |
| 4594 | 4594 | $this->status = $status; |
| 4595 | 4595 | } elseif ($fieldstatus == 'tobuy') { |
| 4596 | - $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4596 | + $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4597 | 4597 | } else { |
| 4598 | 4598 | $this->statut = $status; |
| 4599 | 4599 | $this->status = $status; |
@@ -4702,7 +4702,7 @@ discard block |
||
| 4702 | 4702 | return -1; |
| 4703 | 4703 | } |
| 4704 | 4704 | |
| 4705 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4705 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4706 | 4706 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
| 4707 | 4707 | $tmparray = array_keys($this->childtables); |
| 4708 | 4708 | if (is_numeric($tmparray[0])) { |
@@ -4715,26 +4715,26 @@ discard block |
||
| 4715 | 4715 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
| 4716 | 4716 | // Check if element can be deleted |
| 4717 | 4717 | $sql = "SELECT COUNT(*) as nb"; |
| 4718 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4718 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4719 | 4719 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4720 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4720 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4721 | 4721 | } |
| 4722 | 4722 | if (!empty($element['fk_element'])) { |
| 4723 | - $sql.= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
| 4723 | + $sql .= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
| 4724 | 4724 | } else { |
| 4725 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4725 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4726 | 4726 | } |
| 4727 | 4727 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4728 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4728 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4729 | 4729 | } |
| 4730 | 4730 | if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) { |
| 4731 | - $sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
| 4731 | + $sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
| 4732 | 4732 | } |
| 4733 | 4733 | if (!empty($entity)) { |
| 4734 | 4734 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4735 | - $sql.= " AND p.entity = ".((int) $entity); |
|
| 4735 | + $sql .= " AND p.entity = ".((int) $entity); |
|
| 4736 | 4736 | } else { |
| 4737 | - $sql.= " AND c.entity = ".((int) $entity); |
|
| 4737 | + $sql .= " AND c.entity = ".((int) $entity); |
|
| 4738 | 4738 | } |
| 4739 | 4739 | } |
| 4740 | 4740 | |
@@ -4748,9 +4748,9 @@ discard block |
||
| 4748 | 4748 | if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) |
| 4749 | 4749 | $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); |
| 4750 | 4750 | } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) |
| 4751 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
| 4751 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
| 4752 | 4752 | } else { // new usage: $element['name']=Translation key |
| 4753 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
| 4753 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
| 4754 | 4754 | } |
| 4755 | 4755 | break; // We found at least one, we stop here |
| 4756 | 4756 | } |
@@ -4809,7 +4809,7 @@ discard block |
||
| 4809 | 4809 | */ |
| 4810 | 4810 | public function getTotalDiscount() |
| 4811 | 4811 | { |
| 4812 | - if (!empty($this->table_element_line) ) { |
|
| 4812 | + if (!empty($this->table_element_line)) { |
|
| 4813 | 4813 | $total_discount = 0.00; |
| 4814 | 4814 | |
| 4815 | 4815 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
@@ -5762,7 +5762,7 @@ discard block |
||
| 5762 | 5762 | $setsharekey = false; |
| 5763 | 5763 | if ($this->element == 'propal' || $this->element == 'proposal') { |
| 5764 | 5764 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
| 5765 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5765 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5766 | 5766 | } |
| 5767 | 5767 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
| 5768 | 5768 | $setsharekey = true; |
@@ -5820,7 +5820,7 @@ discard block |
||
| 5820 | 5820 | $ecmfile->gen_or_uploaded = 'generated'; |
| 5821 | 5821 | $ecmfile->description = ''; // indexed content |
| 5822 | 5822 | $ecmfile->keywords = ''; // keyword content |
| 5823 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5823 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5824 | 5824 | $ecmfile->src_object_id = $this->id; |
| 5825 | 5825 | |
| 5826 | 5826 | $result = $ecmfile->create($user); |
@@ -5872,7 +5872,7 @@ discard block |
||
| 5872 | 5872 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
| 5873 | 5873 | $maxheightmini = $tmparraysize['maxheightmini']; |
| 5874 | 5874 | //$quality = $tmparraysize['quality']; |
| 5875 | - $quality = 50; // For thumbs, we force quality to 50 |
|
| 5875 | + $quality = 50; // For thumbs, we force quality to 50 |
|
| 5876 | 5876 | |
| 5877 | 5877 | // Create small thumbs for company (Ratio is near 16/9) |
| 5878 | 5878 | // Used on logon for example |
@@ -5974,8 +5974,8 @@ discard block |
||
| 5974 | 5974 | // phpcs:enable |
| 5975 | 5975 | global $langs, $conf; |
| 5976 | 5976 | |
| 5977 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
| 5978 | - dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
| 5977 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
| 5978 | + dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
| 5979 | 5979 | exit; |
| 5980 | 5980 | } |
| 5981 | 5981 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6169,7 +6169,7 @@ discard block |
||
| 6169 | 6169 | $savDisableCompute = $conf->disable_compute; |
| 6170 | 6170 | $conf->disable_compute = 1; |
| 6171 | 6171 | |
| 6172 | - $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6172 | + $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6173 | 6173 | |
| 6174 | 6174 | $conf->disable_compute = $savDisableCompute; |
| 6175 | 6175 | |
@@ -6273,9 +6273,9 @@ discard block |
||
| 6273 | 6273 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
| 6274 | 6274 | //var_dump($conf->disable_compute); |
| 6275 | 6275 | if (empty($conf->disable_compute)) { |
| 6276 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6277 | - $objectoffield = $this; // we can use it inside computed formula |
|
| 6278 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6276 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6277 | + $objectoffield = $this; // we can use it inside computed formula |
|
| 6278 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6279 | 6279 | } |
| 6280 | 6280 | } |
| 6281 | 6281 | } |
@@ -6289,7 +6289,7 @@ discard block |
||
| 6289 | 6289 | return 0; |
| 6290 | 6290 | } |
| 6291 | 6291 | } else { |
| 6292 | - $this->errors[]=$this->db->lasterror; |
|
| 6292 | + $this->errors[] = $this->db->lasterror; |
|
| 6293 | 6293 | return -1; |
| 6294 | 6294 | } |
| 6295 | 6295 | } |
@@ -6456,7 +6456,7 @@ discard block |
||
| 6456 | 6456 | // If old value crypted in database is same than submited new value, it means we don't change it, so we don't update. |
| 6457 | 6457 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6458 | 6458 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6459 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6459 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6460 | 6460 | } else { |
| 6461 | 6461 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6462 | 6462 | } |
@@ -6467,7 +6467,7 @@ discard block |
||
| 6467 | 6467 | // If value has changed |
| 6468 | 6468 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6469 | 6469 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6470 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6470 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6471 | 6471 | } else { |
| 6472 | 6472 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6473 | 6473 | } |
@@ -6479,7 +6479,7 @@ discard block |
||
| 6479 | 6479 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
| 6480 | 6480 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
| 6481 | 6481 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
| 6482 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6482 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6483 | 6483 | } else { |
| 6484 | 6484 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6485 | 6485 | } |
@@ -6865,7 +6865,7 @@ discard block |
||
| 6865 | 6865 | 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. |
| 6866 | 6866 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6867 | 6867 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { |
| 6868 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6868 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6869 | 6869 | } else { |
| 6870 | 6870 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 6871 | 6871 | } |
@@ -6885,7 +6885,7 @@ discard block |
||
| 6885 | 6885 | } |
| 6886 | 6886 | } else { |
| 6887 | 6887 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { // dolibarr reversible encryption |
| 6888 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6888 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6889 | 6889 | } else { |
| 6890 | 6890 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 6891 | 6891 | } |
@@ -7135,7 +7135,7 @@ discard block |
||
| 7135 | 7135 | // Special case that force options and type ($type can be integer, varchar, ...) |
| 7136 | 7136 | if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { |
| 7137 | 7137 | $param['options'] = $this->fields[$key]['arrayofkeyval']; |
| 7138 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
| 7138 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7139 | 7139 | } |
| 7140 | 7140 | |
| 7141 | 7141 | $label = $this->fields[$key]['label']; |
@@ -7187,7 +7187,7 @@ discard block |
||
| 7187 | 7187 | |
| 7188 | 7188 | // Add validation state class |
| 7189 | 7189 | if (!empty($validationClass)) { |
| 7190 | - $morecss.= $validationClass; |
|
| 7190 | + $morecss .= $validationClass; |
|
| 7191 | 7191 | } |
| 7192 | 7192 | |
| 7193 | 7193 | if (in_array($type, array('date'))) { |
@@ -7293,7 +7293,7 @@ discard block |
||
| 7293 | 7293 | if (is_array($param['options'])) { |
| 7294 | 7294 | $param_list = array_keys($param['options']); |
| 7295 | 7295 | $InfoFieldList = explode(":", $param_list[0], 5); |
| 7296 | - if (! empty($InfoFieldList[4])) { |
|
| 7296 | + if (!empty($InfoFieldList[4])) { |
|
| 7297 | 7297 | $pos = 0; $parenthesisopen = 0; |
| 7298 | 7298 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
| 7299 | 7299 | if (substr($InfoFieldList[4], $pos, 1) == '(') { |
@@ -7305,7 +7305,7 @@ discard block |
||
| 7305 | 7305 | $pos++; |
| 7306 | 7306 | } |
| 7307 | 7307 | $tmpbefore = substr($InfoFieldList[4], 0, $pos); |
| 7308 | - $tmpafter = substr($InfoFieldList[4], $pos+1); |
|
| 7308 | + $tmpafter = substr($InfoFieldList[4], $pos + 1); |
|
| 7309 | 7309 | //var_dump($InfoFieldList[4].' -> '.$pos); var_dump($tmpafter); |
| 7310 | 7310 | $InfoFieldList[4] = $tmpbefore; |
| 7311 | 7311 | if ($tmpafter !== '') { |
@@ -7353,8 +7353,8 @@ discard block |
||
| 7353 | 7353 | } |
| 7354 | 7354 | |
| 7355 | 7355 | $sqlwhere = ''; |
| 7356 | - $sql = "SELECT " . $keyList; |
|
| 7357 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7356 | + $sql = "SELECT ".$keyList; |
|
| 7357 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
| 7358 | 7358 | if (!empty($InfoFieldList[4])) { |
| 7359 | 7359 | // can use SELECT request |
| 7360 | 7360 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7371,18 +7371,18 @@ discard block |
||
| 7371 | 7371 | // We have to join on extrafield table |
| 7372 | 7372 | $errstr = ''; |
| 7373 | 7373 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7374 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
| 7375 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2]; |
|
| 7376 | - $sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7374 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
| 7375 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]; |
|
| 7376 | + $sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7377 | 7377 | } else { |
| 7378 | - $sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7378 | + $sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7379 | 7379 | } |
| 7380 | 7380 | } else { |
| 7381 | 7381 | $sqlwhere .= ' WHERE 1=1'; |
| 7382 | 7382 | } |
| 7383 | 7383 | // Some tables may have field, some other not. For the moment we disable it. |
| 7384 | 7384 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7385 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7385 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7386 | 7386 | } |
| 7387 | 7387 | $sql .= $sqlwhere; |
| 7388 | 7388 | //print $sql; |
@@ -7394,7 +7394,7 @@ discard block |
||
| 7394 | 7394 | $sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label)); |
| 7395 | 7395 | } |
| 7396 | 7396 | |
| 7397 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
| 7397 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
| 7398 | 7398 | $resql = $this->db->query($sql); |
| 7399 | 7399 | if ($resql) { |
| 7400 | 7400 | $out .= '<option value="0"> </option>'; |
@@ -7410,7 +7410,7 @@ discard block |
||
| 7410 | 7410 | if (count($fields_label) > 1) { |
| 7411 | 7411 | $notrans = true; |
| 7412 | 7412 | foreach ($fields_label as $field_toshow) { |
| 7413 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7413 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7414 | 7414 | } |
| 7415 | 7415 | } else { |
| 7416 | 7416 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7421,12 +7421,12 @@ discard block |
||
| 7421 | 7421 | foreach ($fields_label as $field_toshow) { |
| 7422 | 7422 | $translabel = $langs->trans($obj->$field_toshow); |
| 7423 | 7423 | if ($translabel != $obj->$field_toshow) { |
| 7424 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
| 7424 | + $labeltoshow = dol_trunc($translabel).' '; |
|
| 7425 | 7425 | } else { |
| 7426 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
| 7426 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
| 7427 | 7427 | } |
| 7428 | 7428 | } |
| 7429 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7429 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7430 | 7430 | } else { |
| 7431 | 7431 | if (!$notrans) { |
| 7432 | 7432 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7440,34 +7440,34 @@ discard block |
||
| 7440 | 7440 | $labeltoshow = '(not defined)'; |
| 7441 | 7441 | } |
| 7442 | 7442 | if ($value == $obj->rowid) { |
| 7443 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7443 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7444 | 7444 | } |
| 7445 | 7445 | |
| 7446 | 7446 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7447 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7447 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7448 | 7448 | $isDependList = 1; |
| 7449 | 7449 | } |
| 7450 | 7450 | |
| 7451 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 7451 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 7452 | 7452 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
| 7453 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
| 7454 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 7453 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
| 7454 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 7455 | 7455 | } |
| 7456 | 7456 | |
| 7457 | 7457 | $i++; |
| 7458 | 7458 | } |
| 7459 | 7459 | $this->db->free($resql); |
| 7460 | 7460 | } else { |
| 7461 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7461 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7462 | 7462 | } |
| 7463 | 7463 | } else { |
| 7464 | 7464 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7465 | 7465 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7466 | 7466 | $out .= '<option value="0"> </option>'; |
| 7467 | 7467 | foreach ($data as $data_key => $data_value) { |
| 7468 | - $out .= '<option value="' . $data_key . '"'; |
|
| 7468 | + $out .= '<option value="'.$data_key.'"'; |
|
| 7469 | 7469 | $out .= ($value == $data_key ? ' selected' : ''); |
| 7470 | - $out .= '>' . $data_value . '</option>'; |
|
| 7470 | + $out .= '>'.$data_value.'</option>'; |
|
| 7471 | 7471 | } |
| 7472 | 7472 | } |
| 7473 | 7473 | } |
@@ -7532,8 +7532,8 @@ discard block |
||
| 7532 | 7532 | } |
| 7533 | 7533 | |
| 7534 | 7534 | $sqlwhere = ''; |
| 7535 | - $sql = "SELECT " . $keyList; |
|
| 7536 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7535 | + $sql = "SELECT ".$keyList; |
|
| 7536 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
| 7537 | 7537 | if (!empty($InfoFieldList[4])) { |
| 7538 | 7538 | // can use SELECT request |
| 7539 | 7539 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7549,23 +7549,23 @@ discard block |
||
| 7549 | 7549 | |
| 7550 | 7550 | // We have to join on extrafield table |
| 7551 | 7551 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7552 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
| 7553 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
| 7552 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
| 7553 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
| 7554 | 7554 | } else { |
| 7555 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 7555 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 7556 | 7556 | } |
| 7557 | 7557 | } else { |
| 7558 | 7558 | $sqlwhere .= ' WHERE 1=1'; |
| 7559 | 7559 | } |
| 7560 | 7560 | // Some tables may have field, some other not. For the moment we disable it. |
| 7561 | 7561 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7562 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7562 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7563 | 7563 | } |
| 7564 | 7564 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
| 7565 | 7565 | // print $sql; |
| 7566 | 7566 | |
| 7567 | 7567 | $sql .= $sqlwhere; |
| 7568 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7568 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7569 | 7569 | $resql = $this->db->query($sql); |
| 7570 | 7570 | if ($resql) { |
| 7571 | 7571 | $num = $this->db->num_rows($resql); |
@@ -7583,7 +7583,7 @@ discard block |
||
| 7583 | 7583 | if (count($fields_label) > 1) { |
| 7584 | 7584 | $notrans = true; |
| 7585 | 7585 | foreach ($fields_label as $field_toshow) { |
| 7586 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7586 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7587 | 7587 | } |
| 7588 | 7588 | } else { |
| 7589 | 7589 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7594,9 +7594,9 @@ discard block |
||
| 7594 | 7594 | foreach ($fields_label as $field_toshow) { |
| 7595 | 7595 | $translabel = $langs->trans($obj->$field_toshow); |
| 7596 | 7596 | if ($translabel != $obj->$field_toshow) { |
| 7597 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
| 7597 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
| 7598 | 7598 | } else { |
| 7599 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
| 7599 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
| 7600 | 7600 | } |
| 7601 | 7601 | } |
| 7602 | 7602 | |
@@ -7619,7 +7619,7 @@ discard block |
||
| 7619 | 7619 | } |
| 7620 | 7620 | |
| 7621 | 7621 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7622 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7622 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7623 | 7623 | $isDependList = 1; |
| 7624 | 7624 | } |
| 7625 | 7625 | |
@@ -7630,14 +7630,14 @@ discard block |
||
| 7630 | 7630 | } |
| 7631 | 7631 | $this->db->free($resql); |
| 7632 | 7632 | |
| 7633 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7633 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7634 | 7634 | } else { |
| 7635 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7635 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7636 | 7636 | } |
| 7637 | 7637 | } else { |
| 7638 | 7638 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7639 | 7639 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7640 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7640 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7641 | 7641 | } |
| 7642 | 7642 | } |
| 7643 | 7643 | } elseif ($type == 'link') { |
@@ -7723,7 +7723,7 @@ discard block |
||
| 7723 | 7723 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
| 7724 | 7724 | } |
| 7725 | 7725 | |
| 7726 | - if ($isDependList==1) { |
|
| 7726 | + if ($isDependList == 1) { |
|
| 7727 | 7727 | $out .= $this->getJSListDependancies('_common'); |
| 7728 | 7728 | } |
| 7729 | 7729 | /* Add comments |
@@ -7774,7 +7774,7 @@ discard block |
||
| 7774 | 7774 | $type = 'varchar'; // convert varchar(xx) int varchar |
| 7775 | 7775 | } |
| 7776 | 7776 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
| 7777 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
| 7777 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7778 | 7778 | } |
| 7779 | 7779 | if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) { |
| 7780 | 7780 | $type = 'link'; |
@@ -7859,7 +7859,7 @@ discard block |
||
| 7859 | 7859 | $value = $this->getLibStatut(3); |
| 7860 | 7860 | } elseif ($type == 'date') { |
| 7861 | 7861 | if (!empty($value)) { |
| 7862 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7862 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7863 | 7863 | } else { |
| 7864 | 7864 | $value = ''; |
| 7865 | 7865 | } |
@@ -7897,7 +7897,7 @@ discard block |
||
| 7897 | 7897 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
| 7898 | 7898 | } |
| 7899 | 7899 | } elseif ($type == 'select') { |
| 7900 | - $value = isset($param['options'][$value])?$param['options'][$value]:''; |
|
| 7900 | + $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; |
|
| 7901 | 7901 | } elseif ($type == 'sellist') { |
| 7902 | 7902 | $param_list = array_keys($param['options']); |
| 7903 | 7903 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -7957,9 +7957,9 @@ discard block |
||
| 7957 | 7957 | $translabel = $langs->trans($obj->$field_toshow); |
| 7958 | 7958 | } |
| 7959 | 7959 | if ($translabel != $field_toshow) { |
| 7960 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
| 7960 | + $value .= dol_trunc($translabel, 18).' '; |
|
| 7961 | 7961 | } else { |
| 7962 | - $value .= $obj->$field_toshow . ' '; |
|
| 7962 | + $value .= $obj->$field_toshow.' '; |
|
| 7963 | 7963 | } |
| 7964 | 7964 | } |
| 7965 | 7965 | } else { |
@@ -7975,7 +7975,7 @@ discard block |
||
| 7975 | 7975 | } |
| 7976 | 7976 | } |
| 7977 | 7977 | } else { |
| 7978 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 7978 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 7979 | 7979 | |
| 7980 | 7980 | $toprint = array(); |
| 7981 | 7981 | $obj = $this->db->fetch_object($resql); |
@@ -7983,7 +7983,7 @@ discard block |
||
| 7983 | 7983 | $c->fetch($obj->rowid); |
| 7984 | 7984 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 7985 | 7985 | foreach ($ways as $way) { |
| 7986 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 7986 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 7987 | 7987 | } |
| 7988 | 7988 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
| 7989 | 7989 | } |
@@ -7999,11 +7999,11 @@ discard block |
||
| 7999 | 7999 | $toprint = array(); |
| 8000 | 8000 | foreach ($value_arr as $keyval => $valueval) { |
| 8001 | 8001 | if (!empty($valueval)) { |
| 8002 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
| 8002 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
| 8003 | 8003 | } |
| 8004 | 8004 | } |
| 8005 | 8005 | if (!empty($toprint)) { |
| 8006 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 8006 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 8007 | 8007 | } |
| 8008 | 8008 | } |
| 8009 | 8009 | } elseif ($type == 'chkbxlst') { |
@@ -8058,9 +8058,9 @@ discard block |
||
| 8058 | 8058 | $translabel = $langs->trans($obj->$field_toshow); |
| 8059 | 8059 | } |
| 8060 | 8060 | if ($translabel != $field_toshow) { |
| 8061 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8061 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8062 | 8062 | } else { |
| 8063 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
| 8063 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
| 8064 | 8064 | } |
| 8065 | 8065 | } |
| 8066 | 8066 | } else { |
@@ -8069,15 +8069,15 @@ discard block |
||
| 8069 | 8069 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
| 8070 | 8070 | } |
| 8071 | 8071 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
| 8072 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8072 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8073 | 8073 | } else { |
| 8074 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
| 8074 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
| 8075 | 8075 | } |
| 8076 | 8076 | } |
| 8077 | 8077 | } |
| 8078 | 8078 | } |
| 8079 | 8079 | } else { |
| 8080 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8080 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8081 | 8081 | |
| 8082 | 8082 | $toprint = array(); |
| 8083 | 8083 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -8086,7 +8086,7 @@ discard block |
||
| 8086 | 8086 | $c->fetch($obj->rowid); |
| 8087 | 8087 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8088 | 8088 | foreach ($ways as $way) { |
| 8089 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8089 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8090 | 8090 | } |
| 8091 | 8091 | } |
| 8092 | 8092 | } |
@@ -8233,7 +8233,7 @@ discard block |
||
| 8233 | 8233 | global $langs; |
| 8234 | 8234 | |
| 8235 | 8235 | if (!class_exists('Validate')) { |
| 8236 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
| 8236 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
| 8237 | 8237 | } |
| 8238 | 8238 | |
| 8239 | 8239 | $this->clearFieldError($fieldKey); |
@@ -8447,7 +8447,7 @@ discard block |
||
| 8447 | 8447 | $out .= "\n"; |
| 8448 | 8448 | |
| 8449 | 8449 | $nbofextrafieldsshown = 0; |
| 8450 | - $e = 0; // var to manage the modulo (odd/even) |
|
| 8450 | + $e = 0; // var to manage the modulo (odd/even) |
|
| 8451 | 8451 | |
| 8452 | 8452 | $lastseparatorkeyfound = ''; |
| 8453 | 8453 | $extrafields_collapse_num = ''; |
@@ -8498,7 +8498,7 @@ discard block |
||
| 8498 | 8498 | } |
| 8499 | 8499 | |
| 8500 | 8500 | $colspan = 0; |
| 8501 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
| 8501 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
| 8502 | 8502 | if (array_key_exists('cols', $params)) { |
| 8503 | 8503 | $colspan = $params['cols']; |
| 8504 | 8504 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8585,7 +8585,7 @@ discard block |
||
| 8585 | 8585 | $domData .= ' data-targetid="'.$this->id.'"'; |
| 8586 | 8586 | |
| 8587 | 8587 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
| 8588 | - if ($display_type=='card') { |
|
| 8588 | + if ($display_type == 'card') { |
|
| 8589 | 8589 | if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && ($e % 2) == 0) { |
| 8590 | 8590 | $colspan = 0; |
| 8591 | 8591 | } |
@@ -8696,12 +8696,12 @@ discard block |
||
| 8696 | 8696 | break; |
| 8697 | 8697 | } |
| 8698 | 8698 | |
| 8699 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
| 8699 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
| 8700 | 8700 | |
| 8701 | 8701 | if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && (($e % 2) == 1)) { |
| 8702 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8702 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8703 | 8703 | } else { |
| 8704 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8704 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8705 | 8705 | } |
| 8706 | 8706 | |
| 8707 | 8707 | $e++; |
@@ -9084,7 +9084,7 @@ discard block |
||
| 9084 | 9084 | if ($val['share']) { |
| 9085 | 9085 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
| 9086 | 9086 | $return .= '<!-- Show original file (thumb not yet available with shared links) -->'; |
| 9087 | - $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).'">'; |
|
| 9087 | + $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).'">'; |
|
| 9088 | 9088 | } else { |
| 9089 | 9089 | $return .= '<!-- Show original file -->'; |
| 9090 | 9090 | $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).'">'; |
@@ -9096,7 +9096,7 @@ discard block |
||
| 9096 | 9096 | } else { |
| 9097 | 9097 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
| 9098 | 9098 | $return .= '<!-- Show thumb -->'; |
| 9099 | - $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).'">'; |
|
| 9099 | + $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).'">'; |
|
| 9100 | 9100 | } else { |
| 9101 | 9101 | $return .= '<!-- Show original file -->'; |
| 9102 | 9102 | $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).'">'; |
@@ -9505,7 +9505,7 @@ discard block |
||
| 9505 | 9505 | continue; |
| 9506 | 9506 | } |
| 9507 | 9507 | } |
| 9508 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
| 9508 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
| 9509 | 9509 | } |
| 9510 | 9510 | return implode(',', $keys_with_alias); |
| 9511 | 9511 | } else { |
@@ -9625,7 +9625,7 @@ discard block |
||
| 9625 | 9625 | if (!$error) { |
| 9626 | 9626 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
| 9627 | 9627 | $sql .= " (".implode(", ", $keys).')'; |
| 9628 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9628 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9629 | 9629 | |
| 9630 | 9630 | $res = $this->db->query($sql); |
| 9631 | 9631 | if (!$res) { |
@@ -9910,7 +9910,7 @@ discard block |
||
| 9910 | 9910 | |
| 9911 | 9911 | // Update extrafield |
| 9912 | 9912 | if (!$error) { |
| 9913 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 9913 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 9914 | 9914 | if ($result < 0) { |
| 9915 | 9915 | $error++; |
| 9916 | 9916 | } |
@@ -10118,12 +10118,12 @@ discard block |
||
| 10118 | 10118 | $error++; |
| 10119 | 10119 | } else { |
| 10120 | 10120 | while ($obj = $this->db->fetch_object($resql)) { |
| 10121 | - $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 10121 | + $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 10122 | 10122 | if ($result < 0) { |
| 10123 | 10123 | $error++; |
| 10124 | 10124 | $this->errors[] = $this->error; |
| 10125 | 10125 | } else { |
| 10126 | - $result = $this->delete($user); // @phpstan-ignore-line |
|
| 10126 | + $result = $this->delete($user); // @phpstan-ignore-line |
|
| 10127 | 10127 | if ($result < 0) { |
| 10128 | 10128 | $error++; |
| 10129 | 10129 | $this->errors[] = $this->error; |
@@ -10288,7 +10288,7 @@ discard block |
||
| 10288 | 10288 | ); |
| 10289 | 10289 | foreach ($fields as $key => $value) { |
| 10290 | 10290 | if (array_key_exists($key, $this->fields)) { |
| 10291 | - $this->{$key} = $value; // @phpstan-ignore-line |
|
| 10291 | + $this->{$key} = $value; // @phpstan-ignore-line |
|
| 10292 | 10292 | } |
| 10293 | 10293 | } |
| 10294 | 10294 | |
@@ -10433,7 +10433,7 @@ discard block |
||
| 10433 | 10433 | // Process |
| 10434 | 10434 | foreach ($to_del as $del) { |
| 10435 | 10435 | if ($c->fetch($del) > 0) { |
| 10436 | - $result=$c->del_type($this, $type_categ); |
|
| 10436 | + $result = $c->del_type($this, $type_categ); |
|
| 10437 | 10437 | if ($result < 0) { |
| 10438 | 10438 | $error++; |
| 10439 | 10439 | $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();"> |