@@ -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'); |
@@ -825,16 +825,16 @@ discard block |
||
825 | 825 | } |
826 | 826 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
827 | 827 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
828 | - $datas[$key]= '<br><b><u>'. $labelextra . '</u></b>'; |
|
828 | + $datas[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
829 | 829 | } else { |
830 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
831 | - $datas[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
830 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
831 | + $datas[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
832 | 832 | $count++; |
833 | 833 | } |
834 | 834 | } |
835 | 835 | } |
836 | 836 | |
837 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
837 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
838 | 838 | $parameters = array( |
839 | 839 | 'tooltipcontentarray' => &$datas, |
840 | 840 | 'params' => $params, |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | if ($source == 'external' || $source == 'thirdparty') { |
1314 | 1314 | $sql .= " AND tc.source = 'external'"; |
1315 | 1315 | if ($status >= 0) { |
1316 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
1316 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
1317 | 1317 | } |
1318 | 1318 | } |
1319 | 1319 | $sql .= " AND tc.active = 1"; |
@@ -1672,8 +1672,8 @@ discard block |
||
1672 | 1672 | if ($idtofetch) { |
1673 | 1673 | $thirdparty = new Societe($this->db); |
1674 | 1674 | $result = $thirdparty->fetch($idtofetch); |
1675 | - if ($result<0) { |
|
1676 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
1675 | + if ($result < 0) { |
|
1676 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
1677 | 1677 | } |
1678 | 1678 | $this->thirdparty = $thirdparty; |
1679 | 1679 | |
@@ -1975,9 +1975,9 @@ discard block |
||
1975 | 1975 | if ($trigkey) { |
1976 | 1976 | $oldvalue = null; |
1977 | 1977 | |
1978 | - $sql = "SELECT " . $field; |
|
1979 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
1980 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
1978 | + $sql = "SELECT ".$field; |
|
1979 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
1980 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
1981 | 1981 | |
1982 | 1982 | $resql = $this->db->query($sql); |
1983 | 1983 | if ($resql) { |
@@ -2106,7 +2106,7 @@ discard block |
||
2106 | 2106 | } |
2107 | 2107 | $restrictiononfksoc = empty($this->restrictiononfksoc) ? 0 : $this->restrictiononfksoc; |
2108 | 2108 | $sql = "SELECT MAX(te.".$fieldid.")"; |
2109 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
2109 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
2110 | 2110 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
2111 | 2111 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
2112 | 2112 | } |
@@ -2180,7 +2180,7 @@ discard block |
||
2180 | 2180 | $this->ref_previous = $row[0]; |
2181 | 2181 | |
2182 | 2182 | $sql = "SELECT MIN(te.".$fieldid.")"; |
2183 | - $sql .= " FROM ".(empty($nodbprefix) ?$this->db->prefix():'').$this->table_element." as te"; |
|
2183 | + $sql .= " FROM ".(empty($nodbprefix) ? $this->db->prefix() : '').$this->table_element." as te"; |
|
2184 | 2184 | if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { |
2185 | 2185 | $sql .= ",".$this->db->prefix()."usergroup_user as ug"; |
2186 | 2186 | } |
@@ -2338,7 +2338,7 @@ discard block |
||
2338 | 2338 | // Triggers |
2339 | 2339 | if (!$error && !$notrigger) { |
2340 | 2340 | // Call triggers |
2341 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
2341 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
2342 | 2342 | if ($result < 0) { |
2343 | 2343 | $error++; |
2344 | 2344 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2703,7 +2703,7 @@ discard block |
||
2703 | 2703 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
2704 | 2704 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
2705 | 2705 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
2706 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
2706 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
2707 | 2707 | } |
2708 | 2708 | $sql .= ' WHERE rowid='.((int) $this->id); |
2709 | 2709 | |
@@ -3053,10 +3053,10 @@ discard block |
||
3053 | 3053 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
3054 | 3054 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3055 | 3055 | if (!$renum) { |
3056 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
3056 | + $sql .= " AND ".$fieldposition." = 0"; |
|
3057 | 3057 | } |
3058 | 3058 | if ($renum) { |
3059 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
3059 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
3060 | 3060 | } |
3061 | 3061 | |
3062 | 3062 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3077,7 +3077,7 @@ discard block |
||
3077 | 3077 | if ($fk_parent_line) { |
3078 | 3078 | $sql .= ' AND fk_parent_line IS NULL'; |
3079 | 3079 | } |
3080 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
3080 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
3081 | 3081 | |
3082 | 3082 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
3083 | 3083 | $resql = $this->db->query($sql); |
@@ -3128,7 +3128,7 @@ discard block |
||
3128 | 3128 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
3129 | 3129 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3130 | 3130 | $sql .= ' AND fk_parent_line = '.((int) $id); |
3131 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
3131 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
3132 | 3132 | |
3133 | 3133 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
3134 | 3134 | $resql = $this->db->query($sql); |
@@ -3211,8 +3211,8 @@ discard block |
||
3211 | 3211 | dol_print_error($this->db); |
3212 | 3212 | return -1; |
3213 | 3213 | } else { |
3214 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
3215 | - $action=''; |
|
3214 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
3215 | + $action = ''; |
|
3216 | 3216 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
3217 | 3217 | return 1; |
3218 | 3218 | } |
@@ -3251,7 +3251,7 @@ discard block |
||
3251 | 3251 | |
3252 | 3252 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
3253 | 3253 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3254 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
3254 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
3255 | 3255 | if ($this->db->query($sql)) { |
3256 | 3256 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
3257 | 3257 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3282,7 +3282,7 @@ discard block |
||
3282 | 3282 | |
3283 | 3283 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
3284 | 3284 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3285 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
3285 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
3286 | 3286 | if ($this->db->query($sql)) { |
3287 | 3287 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
3288 | 3288 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3308,7 +3308,7 @@ discard block |
||
3308 | 3308 | $fieldposition = 'position'; |
3309 | 3309 | } |
3310 | 3310 | |
3311 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
3311 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
3312 | 3312 | $sql .= " WHERE rowid = ".((int) $rowid); |
3313 | 3313 | |
3314 | 3314 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3336,7 +3336,7 @@ discard block |
||
3336 | 3336 | |
3337 | 3337 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
3338 | 3338 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
3339 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
3339 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
3340 | 3340 | $resql = $this->db->query($sql); |
3341 | 3341 | if ($resql) { |
3342 | 3342 | $row = $this->db->fetch_row($resql); |
@@ -3453,7 +3453,7 @@ discard block |
||
3453 | 3453 | $newsuffix = ''; |
3454 | 3454 | } |
3455 | 3455 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
3456 | - $fieldusermod = "fk_user_mod"; |
|
3456 | + $fieldusermod = "fk_user_mod"; |
|
3457 | 3457 | } elseif ($this->table_element == 'ecm_files') { |
3458 | 3458 | $fieldusermod = "fk_user_m"; |
3459 | 3459 | } else { |
@@ -3825,7 +3825,7 @@ discard block |
||
3825 | 3825 | // 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. |
3826 | 3826 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
3827 | 3827 | // Add module part to target type if object has $module property and isn't in core modules. |
3828 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
3828 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
3829 | 3829 | |
3830 | 3830 | $parameters = array('targettype'=>$targettype); |
3831 | 3831 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3837,19 +3837,19 @@ discard block |
||
3837 | 3837 | $this->db->begin(); |
3838 | 3838 | $error = 0; |
3839 | 3839 | |
3840 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
3840 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
3841 | 3841 | $sql .= "fk_source"; |
3842 | 3842 | $sql .= ", sourcetype"; |
3843 | 3843 | $sql .= ", fk_target"; |
3844 | 3844 | $sql .= ", targettype"; |
3845 | 3845 | $sql .= ") VALUES ("; |
3846 | 3846 | $sql .= ((int) $origin_id); |
3847 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
3848 | - $sql .= ", " . ((int) $this->id); |
|
3849 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
3847 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
3848 | + $sql .= ", ".((int) $this->id); |
|
3849 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
3850 | 3850 | $sql .= ")"; |
3851 | 3851 | |
3852 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
3852 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
3853 | 3853 | if ($this->db->query($sql)) { |
3854 | 3854 | if (!$notrigger) { |
3855 | 3855 | // Call trigger |
@@ -4156,20 +4156,20 @@ discard block |
||
4156 | 4156 | $this->db->begin(); |
4157 | 4157 | $error = 0; |
4158 | 4158 | |
4159 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
4159 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
4160 | 4160 | if ($updatesource) { |
4161 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
4162 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
4163 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
4164 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
4161 | + $sql .= "fk_source = ".((int) $sourceid); |
|
4162 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
4163 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
4164 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
4165 | 4165 | } elseif ($updatetarget) { |
4166 | - $sql .= "fk_target = " . ((int) $targetid); |
|
4167 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
4168 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
4169 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
4166 | + $sql .= "fk_target = ".((int) $targetid); |
|
4167 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
4168 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
4169 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
4170 | 4170 | } |
4171 | 4171 | |
4172 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
4172 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
4173 | 4173 | if ($this->db->query($sql)) { |
4174 | 4174 | if (!$notrigger) { |
4175 | 4175 | // Call trigger |
@@ -4245,25 +4245,25 @@ discard block |
||
4245 | 4245 | } |
4246 | 4246 | |
4247 | 4247 | if (!$error) { |
4248 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
4248 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
4249 | 4249 | $sql .= " WHERE"; |
4250 | 4250 | if ($rowid > 0) { |
4251 | - $sql .= " rowid = " . ((int) $rowid); |
|
4251 | + $sql .= " rowid = ".((int) $rowid); |
|
4252 | 4252 | } else { |
4253 | 4253 | if ($deletesource) { |
4254 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
4255 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
4254 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
4255 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
4256 | 4256 | } elseif ($deletetarget) { |
4257 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
4258 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
4257 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
4258 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
4259 | 4259 | } else { |
4260 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
4260 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
4261 | 4261 | $sql .= " OR"; |
4262 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
4262 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
4263 | 4263 | } |
4264 | 4264 | } |
4265 | 4265 | |
4266 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
4266 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
4267 | 4267 | if (!$this->db->query($sql)) { |
4268 | 4268 | $this->error = $this->db->lasterror(); |
4269 | 4269 | $this->errors[] = $this->error; |
@@ -4393,14 +4393,14 @@ discard block |
||
4393 | 4393 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
4394 | 4394 | } |
4395 | 4395 | $sql .= " WHERE rowid = ".((int) $elementId); |
4396 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
4396 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
4397 | 4397 | |
4398 | 4398 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
4399 | 4399 | $resql = $this->db->query($sql); |
4400 | 4400 | if ($resql) { |
4401 | 4401 | $error = 0; |
4402 | 4402 | |
4403 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
4403 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
4404 | 4404 | |
4405 | 4405 | if ($nb_rows_affected > 0) { |
4406 | 4406 | if (empty($trigkey)) { |
@@ -4554,7 +4554,7 @@ discard block |
||
4554 | 4554 | return -1; |
4555 | 4555 | } |
4556 | 4556 | |
4557 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
4557 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
4558 | 4558 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
4559 | 4559 | $tmparray = array_keys($this->childtables); |
4560 | 4560 | if (is_numeric($tmparray[0])) { |
@@ -4567,26 +4567,26 @@ discard block |
||
4567 | 4567 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
4568 | 4568 | // Check if element can be deleted |
4569 | 4569 | $sql = "SELECT COUNT(*) as nb"; |
4570 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
4570 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
4571 | 4571 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4572 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
4572 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
4573 | 4573 | } |
4574 | 4574 | if (!empty($element['fk_element'])) { |
4575 | - $sql.= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
4575 | + $sql .= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
4576 | 4576 | } else { |
4577 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
4577 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
4578 | 4578 | } |
4579 | 4579 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4580 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
4580 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
4581 | 4581 | } |
4582 | 4582 | if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) { |
4583 | - $sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
4583 | + $sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
4584 | 4584 | } |
4585 | 4585 | if (!empty($entity)) { |
4586 | 4586 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
4587 | - $sql.= " AND p.entity = ".((int) $entity); |
|
4587 | + $sql .= " AND p.entity = ".((int) $entity); |
|
4588 | 4588 | } else { |
4589 | - $sql.= " AND c.entity = ".((int) $entity); |
|
4589 | + $sql .= " AND c.entity = ".((int) $entity); |
|
4590 | 4590 | } |
4591 | 4591 | } |
4592 | 4592 | |
@@ -4600,9 +4600,9 @@ discard block |
||
4600 | 4600 | if (is_numeric($element)) { // very old usage array('table1', 'table2', ...) |
4601 | 4601 | $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $table); |
4602 | 4602 | } elseif (is_string($element)) { // old usage array('table1' => 'TranslateKey1', 'table2' => 'TranslateKey2', ...) |
4603 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
4603 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element)); |
|
4604 | 4604 | } else { // new usage: $element['name']=Translation key |
4605 | - $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
4605 | + $this->errors[] = $langs->transnoentitiesnoconv("ErrorRecordHasAtLeastOneChildOfType", method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref, $langs->transnoentitiesnoconv($element['name'])); |
|
4606 | 4606 | } |
4607 | 4607 | break; // We found at least one, we stop here |
4608 | 4608 | } |
@@ -4661,7 +4661,7 @@ discard block |
||
4661 | 4661 | */ |
4662 | 4662 | public function getTotalDiscount() |
4663 | 4663 | { |
4664 | - if (!empty($this->table_element_line) ) { |
|
4664 | + if (!empty($this->table_element_line)) { |
|
4665 | 4665 | $total_discount = 0.00; |
4666 | 4666 | |
4667 | 4667 | $sql = "SELECT subprice as pu_ht, qty, remise_percent, total_ht"; |
@@ -5608,7 +5608,7 @@ discard block |
||
5608 | 5608 | $setsharekey = false; |
5609 | 5609 | if ($this->element == 'propal' || $this->element == 'proposal') { |
5610 | 5610 | if (!isset($conf->global->PROPOSAL_ALLOW_ONLINESIGN) || !empty($conf->global->PROPOSAL_ALLOW_ONLINESIGN)) { |
5611 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
5611 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
5612 | 5612 | } |
5613 | 5613 | if (!empty($conf->global->PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD)) { |
5614 | 5614 | $setsharekey = true; |
@@ -5663,7 +5663,7 @@ discard block |
||
5663 | 5663 | $ecmfile->gen_or_uploaded = 'generated'; |
5664 | 5664 | $ecmfile->description = ''; // indexed content |
5665 | 5665 | $ecmfile->keywords = ''; // keyword content |
5666 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
5666 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
5667 | 5667 | $ecmfile->src_object_id = $this->id; |
5668 | 5668 | |
5669 | 5669 | $result = $ecmfile->create($user); |
@@ -5715,7 +5715,7 @@ discard block |
||
5715 | 5715 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
5716 | 5716 | $maxheightmini = $tmparraysize['maxheightmini']; |
5717 | 5717 | //$quality = $tmparraysize['quality']; |
5718 | - $quality = 50; // For thumbs, we force quality to 50 |
|
5718 | + $quality = 50; // For thumbs, we force quality to 50 |
|
5719 | 5719 | |
5720 | 5720 | // Create small thumbs for company (Ratio is near 16/9) |
5721 | 5721 | // Used on logon for example |
@@ -5816,8 +5816,8 @@ discard block |
||
5816 | 5816 | { |
5817 | 5817 | // phpcs:enable |
5818 | 5818 | global $langs, $conf; |
5819 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
5820 | - dol_print_error('', 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
5819 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
5820 | + dol_print_error('', 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
5821 | 5821 | exit; |
5822 | 5822 | } |
5823 | 5823 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6110,9 +6110,9 @@ discard block |
||
6110 | 6110 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
6111 | 6111 | //var_dump($conf->disable_compute); |
6112 | 6112 | if (empty($conf->disable_compute)) { |
6113 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
6114 | - $objectoffield = $this; // we can use it inside computed formula |
|
6115 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); |
|
6113 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
6114 | + $objectoffield = $this; // we can use it inside computed formula |
|
6115 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); |
|
6116 | 6116 | } |
6117 | 6117 | } |
6118 | 6118 | } |
@@ -6126,7 +6126,7 @@ discard block |
||
6126 | 6126 | return 0; |
6127 | 6127 | } |
6128 | 6128 | } else { |
6129 | - $this->errors[]=$this->db->lasterror; |
|
6129 | + $this->errors[] = $this->db->lasterror; |
|
6130 | 6130 | return -1; |
6131 | 6131 | } |
6132 | 6132 | } |
@@ -6898,7 +6898,7 @@ discard block |
||
6898 | 6898 | // Special case that force options and type ($type can be integer, varchar, ...) |
6899 | 6899 | if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { |
6900 | 6900 | $param['options'] = $this->fields[$key]['arrayofkeyval']; |
6901 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
6901 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
6902 | 6902 | } |
6903 | 6903 | |
6904 | 6904 | $label = $this->fields[$key]['label']; |
@@ -6950,7 +6950,7 @@ discard block |
||
6950 | 6950 | |
6951 | 6951 | // Add validation state class |
6952 | 6952 | if (!empty($validationClass)) { |
6953 | - $morecss.= $validationClass; |
|
6953 | + $morecss .= $validationClass; |
|
6954 | 6954 | } |
6955 | 6955 | |
6956 | 6956 | if (in_array($type, array('date'))) { |
@@ -7094,8 +7094,8 @@ discard block |
||
7094 | 7094 | } |
7095 | 7095 | |
7096 | 7096 | $sqlwhere = ''; |
7097 | - $sql = "SELECT " . $keyList; |
|
7098 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
7097 | + $sql = "SELECT ".$keyList; |
|
7098 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
7099 | 7099 | if (!empty($InfoFieldList[4])) { |
7100 | 7100 | // can use SELECT request |
7101 | 7101 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7111,24 +7111,24 @@ discard block |
||
7111 | 7111 | |
7112 | 7112 | //We have to join on extrafield table |
7113 | 7113 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
7114 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
7115 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
7114 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
7115 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
7116 | 7116 | } else { |
7117 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
7117 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
7118 | 7118 | } |
7119 | 7119 | } else { |
7120 | 7120 | $sqlwhere .= ' WHERE 1=1'; |
7121 | 7121 | } |
7122 | 7122 | // Some tables may have field, some other not. For the moment we disable it. |
7123 | 7123 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
7124 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
7124 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
7125 | 7125 | } |
7126 | 7126 | $sql .= $sqlwhere; |
7127 | 7127 | //print $sql; |
7128 | 7128 | |
7129 | - $sql .= ' ORDER BY ' . implode(', ', $fields_label); |
|
7129 | + $sql .= ' ORDER BY '.implode(', ', $fields_label); |
|
7130 | 7130 | |
7131 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
7131 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
7132 | 7132 | $resql = $this->db->query($sql); |
7133 | 7133 | if ($resql) { |
7134 | 7134 | $out .= '<option value="0"> </option>'; |
@@ -7144,7 +7144,7 @@ discard block |
||
7144 | 7144 | if (count($fields_label) > 1) { |
7145 | 7145 | $notrans = true; |
7146 | 7146 | foreach ($fields_label as $field_toshow) { |
7147 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
7147 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
7148 | 7148 | } |
7149 | 7149 | } else { |
7150 | 7150 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7155,12 +7155,12 @@ discard block |
||
7155 | 7155 | foreach ($fields_label as $field_toshow) { |
7156 | 7156 | $translabel = $langs->trans($obj->$field_toshow); |
7157 | 7157 | if ($translabel != $obj->$field_toshow) { |
7158 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
7158 | + $labeltoshow = dol_trunc($translabel).' '; |
|
7159 | 7159 | } else { |
7160 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
7160 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
7161 | 7161 | } |
7162 | 7162 | } |
7163 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
7163 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
7164 | 7164 | } else { |
7165 | 7165 | if (!$notrans) { |
7166 | 7166 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7174,34 +7174,34 @@ discard block |
||
7174 | 7174 | $labeltoshow = '(not defined)'; |
7175 | 7175 | } |
7176 | 7176 | if ($value == $obj->rowid) { |
7177 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
7177 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
7178 | 7178 | } |
7179 | 7179 | |
7180 | 7180 | if (!empty($InfoFieldList[3]) && $parentField) { |
7181 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
7181 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
7182 | 7182 | $isDependList = 1; |
7183 | 7183 | } |
7184 | 7184 | |
7185 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
7185 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
7186 | 7186 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
7187 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
7188 | - $out .= '>' . $labeltoshow . '</option>'; |
|
7187 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
7188 | + $out .= '>'.$labeltoshow.'</option>'; |
|
7189 | 7189 | } |
7190 | 7190 | |
7191 | 7191 | $i++; |
7192 | 7192 | } |
7193 | 7193 | $this->db->free($resql); |
7194 | 7194 | } else { |
7195 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
7195 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
7196 | 7196 | } |
7197 | 7197 | } else { |
7198 | 7198 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
7199 | 7199 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
7200 | 7200 | $out .= '<option value="0"> </option>'; |
7201 | 7201 | foreach ($data as $data_key => $data_value) { |
7202 | - $out .= '<option value="' . $data_key . '"'; |
|
7202 | + $out .= '<option value="'.$data_key.'"'; |
|
7203 | 7203 | $out .= ($value == $data_key ? ' selected' : ''); |
7204 | - $out .= '>' . $data_value . '</option>'; |
|
7204 | + $out .= '>'.$data_value.'</option>'; |
|
7205 | 7205 | } |
7206 | 7206 | } |
7207 | 7207 | } |
@@ -7266,8 +7266,8 @@ discard block |
||
7266 | 7266 | } |
7267 | 7267 | |
7268 | 7268 | $sqlwhere = ''; |
7269 | - $sql = "SELECT " . $keyList; |
|
7270 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
7269 | + $sql = "SELECT ".$keyList; |
|
7270 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
7271 | 7271 | if (!empty($InfoFieldList[4])) { |
7272 | 7272 | // can use SELECT request |
7273 | 7273 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7283,23 +7283,23 @@ discard block |
||
7283 | 7283 | |
7284 | 7284 | // We have to join on extrafield table |
7285 | 7285 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
7286 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
7287 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
7286 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
7287 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
7288 | 7288 | } else { |
7289 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
7289 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
7290 | 7290 | } |
7291 | 7291 | } else { |
7292 | 7292 | $sqlwhere .= ' WHERE 1=1'; |
7293 | 7293 | } |
7294 | 7294 | // Some tables may have field, some other not. For the moment we disable it. |
7295 | 7295 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
7296 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
7296 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
7297 | 7297 | } |
7298 | 7298 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
7299 | 7299 | // print $sql; |
7300 | 7300 | |
7301 | 7301 | $sql .= $sqlwhere; |
7302 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
7302 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
7303 | 7303 | $resql = $this->db->query($sql); |
7304 | 7304 | if ($resql) { |
7305 | 7305 | $num = $this->db->num_rows($resql); |
@@ -7317,7 +7317,7 @@ discard block |
||
7317 | 7317 | if (count($fields_label) > 1) { |
7318 | 7318 | $notrans = true; |
7319 | 7319 | foreach ($fields_label as $field_toshow) { |
7320 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
7320 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
7321 | 7321 | } |
7322 | 7322 | } else { |
7323 | 7323 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7328,9 +7328,9 @@ discard block |
||
7328 | 7328 | foreach ($fields_label as $field_toshow) { |
7329 | 7329 | $translabel = $langs->trans($obj->$field_toshow); |
7330 | 7330 | if ($translabel != $obj->$field_toshow) { |
7331 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
7331 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
7332 | 7332 | } else { |
7333 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
7333 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
7334 | 7334 | } |
7335 | 7335 | } |
7336 | 7336 | |
@@ -7353,7 +7353,7 @@ discard block |
||
7353 | 7353 | } |
7354 | 7354 | |
7355 | 7355 | if (!empty($InfoFieldList[3]) && $parentField) { |
7356 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
7356 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
7357 | 7357 | $isDependList = 1; |
7358 | 7358 | } |
7359 | 7359 | |
@@ -7364,14 +7364,14 @@ discard block |
||
7364 | 7364 | } |
7365 | 7365 | $this->db->free($resql); |
7366 | 7366 | |
7367 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7367 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7368 | 7368 | } else { |
7369 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
7369 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
7370 | 7370 | } |
7371 | 7371 | } else { |
7372 | 7372 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
7373 | 7373 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
7374 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7374 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
7375 | 7375 | } |
7376 | 7376 | } |
7377 | 7377 | } elseif ($type == 'link') { |
@@ -7452,7 +7452,7 @@ discard block |
||
7452 | 7452 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
7453 | 7453 | } |
7454 | 7454 | |
7455 | - if ($isDependList==1) { |
|
7455 | + if ($isDependList == 1) { |
|
7456 | 7456 | $out .= $this->getJSListDependancies('_common'); |
7457 | 7457 | } |
7458 | 7458 | /* Add comments |
@@ -7503,7 +7503,7 @@ discard block |
||
7503 | 7503 | $type = 'varchar'; // convert varchar(xx) int varchar |
7504 | 7504 | } |
7505 | 7505 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
7506 | - $type = (($this->fields[$key]['type']=='checkbox')?$this->fields[$key]['type']:'select'); |
|
7506 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
7507 | 7507 | } |
7508 | 7508 | if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) { |
7509 | 7509 | $type = 'link'; |
@@ -7587,7 +7587,7 @@ discard block |
||
7587 | 7587 | $value = $this->getLibStatut(3); |
7588 | 7588 | } elseif ($type == 'date') { |
7589 | 7589 | if (!empty($value)) { |
7590 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
7590 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
7591 | 7591 | } else { |
7592 | 7592 | $value = ''; |
7593 | 7593 | } |
@@ -7625,7 +7625,7 @@ discard block |
||
7625 | 7625 | $value = price($value, 0, $langs, 0, 0, -1, $conf->currency); |
7626 | 7626 | } |
7627 | 7627 | } elseif ($type == 'select') { |
7628 | - $value = isset($param['options'][$value])?$param['options'][$value]:''; |
|
7628 | + $value = isset($param['options'][$value]) ? $param['options'][$value] : ''; |
|
7629 | 7629 | } elseif ($type == 'sellist') { |
7630 | 7630 | $param_list = array_keys($param['options']); |
7631 | 7631 | $InfoFieldList = explode(":", $param_list[0]); |
@@ -7685,9 +7685,9 @@ discard block |
||
7685 | 7685 | $translabel = $langs->trans($obj->$field_toshow); |
7686 | 7686 | } |
7687 | 7687 | if ($translabel != $field_toshow) { |
7688 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
7688 | + $value .= dol_trunc($translabel, 18).' '; |
|
7689 | 7689 | } else { |
7690 | - $value .= $obj->$field_toshow . ' '; |
|
7690 | + $value .= $obj->$field_toshow.' '; |
|
7691 | 7691 | } |
7692 | 7692 | } |
7693 | 7693 | } else { |
@@ -7703,7 +7703,7 @@ discard block |
||
7703 | 7703 | } |
7704 | 7704 | } |
7705 | 7705 | } else { |
7706 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
7706 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
7707 | 7707 | |
7708 | 7708 | $toprint = array(); |
7709 | 7709 | $obj = $this->db->fetch_object($resql); |
@@ -7711,7 +7711,7 @@ discard block |
||
7711 | 7711 | $c->fetch($obj->rowid); |
7712 | 7712 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
7713 | 7713 | foreach ($ways as $way) { |
7714 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
7714 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
7715 | 7715 | } |
7716 | 7716 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
7717 | 7717 | } |
@@ -7727,11 +7727,11 @@ discard block |
||
7727 | 7727 | $toprint = array(); |
7728 | 7728 | foreach ($value_arr as $keyval => $valueval) { |
7729 | 7729 | if (!empty($valueval)) { |
7730 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
7730 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
7731 | 7731 | } |
7732 | 7732 | } |
7733 | 7733 | if (!empty($toprint)) { |
7734 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
7734 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
7735 | 7735 | } |
7736 | 7736 | } |
7737 | 7737 | } elseif ($type == 'chkbxlst') { |
@@ -7786,9 +7786,9 @@ discard block |
||
7786 | 7786 | $translabel = $langs->trans($obj->$field_toshow); |
7787 | 7787 | } |
7788 | 7788 | if ($translabel != $field_toshow) { |
7789 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
7789 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
7790 | 7790 | } else { |
7791 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
7791 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
7792 | 7792 | } |
7793 | 7793 | } |
7794 | 7794 | } else { |
@@ -7797,15 +7797,15 @@ discard block |
||
7797 | 7797 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
7798 | 7798 | } |
7799 | 7799 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
7800 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
7800 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
7801 | 7801 | } else { |
7802 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
7802 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
7803 | 7803 | } |
7804 | 7804 | } |
7805 | 7805 | } |
7806 | 7806 | } |
7807 | 7807 | } else { |
7808 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
7808 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
7809 | 7809 | |
7810 | 7810 | $toprint = array(); |
7811 | 7811 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -7814,7 +7814,7 @@ discard block |
||
7814 | 7814 | $c->fetch($obj->rowid); |
7815 | 7815 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
7816 | 7816 | foreach ($ways as $way) { |
7817 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
7817 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
7818 | 7818 | } |
7819 | 7819 | } |
7820 | 7820 | } |
@@ -7948,7 +7948,7 @@ discard block |
||
7948 | 7948 | global $langs; |
7949 | 7949 | |
7950 | 7950 | if (!class_exists('Validate')) { |
7951 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
7951 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
7952 | 7952 | } |
7953 | 7953 | |
7954 | 7954 | $this->clearFieldError($fieldKey); |
@@ -8162,7 +8162,7 @@ discard block |
||
8162 | 8162 | $out .= "\n"; |
8163 | 8163 | |
8164 | 8164 | $nbofextrafieldsshown = 0; |
8165 | - $e = 0; // var to manage the modulo (odd/even) |
|
8165 | + $e = 0; // var to manage the modulo (odd/even) |
|
8166 | 8166 | |
8167 | 8167 | $lastseparatorkeyfound = ''; |
8168 | 8168 | $extrafields_collapse_num = ''; |
@@ -8213,7 +8213,7 @@ discard block |
||
8213 | 8213 | } |
8214 | 8214 | |
8215 | 8215 | $colspan = 0; |
8216 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
8216 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
8217 | 8217 | if (array_key_exists('cols', $params)) { |
8218 | 8218 | $colspan = $params['cols']; |
8219 | 8219 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8300,7 +8300,7 @@ discard block |
||
8300 | 8300 | $domData .= ' data-targetid="'.$this->id.'"'; |
8301 | 8301 | |
8302 | 8302 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
8303 | - if ($display_type=='card') { |
|
8303 | + if ($display_type == 'card') { |
|
8304 | 8304 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { |
8305 | 8305 | $colspan = 0; |
8306 | 8306 | } |
@@ -8411,12 +8411,12 @@ discard block |
||
8411 | 8411 | break; |
8412 | 8412 | } |
8413 | 8413 | |
8414 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
8414 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
8415 | 8415 | |
8416 | 8416 | if (!empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && (($e % 2) == 1)) { |
8417 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
8417 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
8418 | 8418 | } else { |
8419 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
8419 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
8420 | 8420 | } |
8421 | 8421 | |
8422 | 8422 | $e++; |
@@ -8798,7 +8798,7 @@ discard block |
||
8798 | 8798 | if ($val['share']) { |
8799 | 8799 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
8800 | 8800 | $return .= '<!-- Show original file (thumb not yet available with shared links) -->'; |
8801 | - $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).'">'; |
|
8801 | + $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).'">'; |
|
8802 | 8802 | } else { |
8803 | 8803 | $return .= '<!-- Show original file -->'; |
8804 | 8804 | $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).'">'; |
@@ -8810,7 +8810,7 @@ discard block |
||
8810 | 8810 | } else { |
8811 | 8811 | if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) { |
8812 | 8812 | $return .= '<!-- Show thumb -->'; |
8813 | - $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).'">'; |
|
8813 | + $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).'">'; |
|
8814 | 8814 | } else { |
8815 | 8815 | $return .= '<!-- Show original file -->'; |
8816 | 8816 | $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).'">'; |
@@ -9219,7 +9219,7 @@ discard block |
||
9219 | 9219 | continue; |
9220 | 9220 | } |
9221 | 9221 | } |
9222 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
9222 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
9223 | 9223 | } |
9224 | 9224 | return implode(',', $keys_with_alias); |
9225 | 9225 | } else { |
@@ -9335,7 +9335,7 @@ discard block |
||
9335 | 9335 | if (!$error) { |
9336 | 9336 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
9337 | 9337 | $sql .= " (".implode(", ", $keys).')'; |
9338 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
9338 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
9339 | 9339 | |
9340 | 9340 | $res = $this->db->query($sql); |
9341 | 9341 | if (!$res) { |
@@ -10132,7 +10132,7 @@ discard block |
||
10132 | 10132 | // Process |
10133 | 10133 | foreach ($to_del as $del) { |
10134 | 10134 | if ($c->fetch($del) > 0) { |
10135 | - $result=$c->del_type($this, $type_categ); |
|
10135 | + $result = $c->del_type($this, $type_categ); |
|
10136 | 10136 | if ($result < 0) { |
10137 | 10137 | $error++; |
10138 | 10138 | $this->error = $c->error; |
@@ -91,8 +91,8 @@ |
||
91 | 91 | $label_default = getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT'); |
92 | 92 | $qty_default = 1; |
93 | 93 | |
94 | - print '<input type="text" id="label" name="label" class="takepospay" value="' . $label_default . '" style="width:40%;" placeholder="' . $langs->trans('Label') . '">'; |
|
95 | - print '<input type="text" id="qty" name="qty" class="takepospay" value="' . $qty_default . '" style="width:10%;" placeholder="' . $langs->trans('Qty') . '">'; |
|
94 | + print '<input type="text" id="label" name="label" class="takepospay" value="'.$label_default.'" style="width:40%;" placeholder="'.$langs->trans('Label').'">'; |
|
95 | + print '<input type="text" id="qty" name="qty" class="takepospay" value="'.$qty_default.'" style="width:10%;" placeholder="'.$langs->trans('Qty').'">'; |
|
96 | 96 | } |
97 | 97 | ?> |
98 | 98 | <input type="button" class="button takepospay clearboth" value="OK" onclick="Save();"> |
@@ -273,7 +273,7 @@ |
||
273 | 273 | print '<tr class="oddeven"><td>'; |
274 | 274 | print $langs->trans('PrintWithoutDetailsLabelDefault'); |
275 | 275 | print '<td colspan="2">'; |
276 | - print '<input type="text" name="TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT" value="' . getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT') . '" />'; |
|
276 | + print '<input type="text" name="TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT" value="'.getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT').'" />'; |
|
277 | 277 | print "</td></tr>\n"; |
278 | 278 | } |
279 | 279 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
61 | 61 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
62 | 62 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
63 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
63 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
64 | 64 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
65 | 65 | $search_country = GETPOST('search_country', 'alpha'); |
66 | 66 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn_det as l"; |
217 | 217 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = l.fk_product"; |
218 | 218 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
219 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
219 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
220 | 220 | } |
221 | 221 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = l.fk_code_ventilation"; |
222 | 222 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture_fourn as f ON f.rowid = l.fk_facture_fourn"; |
223 | 223 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
224 | 224 | if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
225 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
225 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
226 | 226 | } |
227 | 227 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
228 | 228 | $sql .= " WHERE f.rowid = l.fk_facture_fourn and f.fk_statut >= 1 AND l.fk_code_ventilation <> 0 "; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $search_date_endday = GETPOST('search_date_endday', 'int'); |
60 | 60 | $search_date_endmonth = GETPOST('search_date_endmonth', 'int'); |
61 | 61 | $search_date_endyear = GETPOST('search_date_endyear', 'int'); |
62 | -$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
62 | +$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver |
|
63 | 63 | $search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear); |
64 | 64 | $search_country = GETPOST('search_country', 'alpha'); |
65 | 65 | $search_tvaintra = GETPOST('search_tvaintra', 'alpha'); |
@@ -215,13 +215,13 @@ discard block |
||
215 | 215 | $sql .= " FROM ".MAIN_DB_PREFIX."facturedet as fd"; |
216 | 216 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = fd.fk_product"; |
217 | 217 | if (!empty($conf->global->MAIN_PRODUCT_PERENTITY_SHARED)) { |
218 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = " . ((int) $conf->entity); |
|
218 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_perentity as ppe ON ppe.fk_product = p.rowid AND ppe.entity = ".((int) $conf->entity); |
|
219 | 219 | } |
220 | 220 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_account as aa ON aa.rowid = fd.fk_code_ventilation"; |
221 | 221 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."facture as f ON f.rowid = fd.fk_facture"; |
222 | 222 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = f.fk_soc"; |
223 | 223 | if (!empty($conf->global->MAIN_COMPANY_PERENTITY_SHARED)) { |
224 | - $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = " . ((int) $conf->entity); |
|
224 | + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_perentity as spe ON spe.fk_soc = s.rowid AND spe.entity = ".((int) $conf->entity); |
|
225 | 225 | } |
226 | 226 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as co ON co.rowid = s.fk_pays "; |
227 | 227 | $sql .= " WHERE fd.fk_code_ventilation > 0"; |
@@ -136,8 +136,12 @@ |
||
136 | 136 | //if ($user->socid > 0) $socid = $user->socid; |
137 | 137 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
138 | 138 | //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
139 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
140 | -if (!$permissiontoread) accessforbidden(); |
|
139 | +if (empty($conf->hrm->enabled)) { |
|
140 | + accessforbidden(); |
|
141 | +} |
|
142 | +if (!$permissiontoread) { |
|
143 | + accessforbidden(); |
|
144 | +} |
|
141 | 145 | |
142 | 146 | |
143 | 147 | /* |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | // Load Dolibarr environment |
30 | 30 | require '../main.inc.php'; |
31 | 31 | |
32 | -require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; |
|
33 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php'; |
|
34 | -require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php'; |
|
35 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php'; |
|
36 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php'; |
|
32 | +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; |
|
33 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; |
|
34 | +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; |
|
35 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php'; |
|
36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skill.lib.php'; |
|
37 | 37 | |
38 | 38 | |
39 | 39 | // Load translation files required by the page |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $linkback = '<a href="'.DOL_URL_ROOT.'/hrm/skill_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
153 | 153 | |
154 | 154 | $morehtmlref = '<div class="refid">'; |
155 | - $morehtmlref.= $object->label; |
|
155 | + $morehtmlref .= $object->label; |
|
156 | 156 | $morehtmlref .= '</div>'; |
157 | 157 | |
158 | 158 |
@@ -136,8 +136,12 @@ |
||
136 | 136 | //if ($user->socid > 0) $socid = $user->socid; |
137 | 137 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
138 | 138 | //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
139 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
140 | -if (!$permissiontoread) accessforbidden(); |
|
139 | +if (empty($conf->hrm->enabled)) { |
|
140 | + accessforbidden(); |
|
141 | +} |
|
142 | +if (!$permissiontoread) { |
|
143 | + accessforbidden(); |
|
144 | +} |
|
141 | 145 | |
142 | 146 | |
143 | 147 | /* |
@@ -188,13 +188,19 @@ |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | // Security check (enable the most restrictive one) |
191 | -if ($user->socid > 0) accessforbidden(); |
|
191 | +if ($user->socid > 0) { |
|
192 | + accessforbidden(); |
|
193 | +} |
|
192 | 194 | //if ($user->socid > 0) accessforbidden(); |
193 | 195 | //$socid = 0; if ($user->socid > 0) $socid = $user->socid; |
194 | 196 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
195 | 197 | //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
196 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
197 | -if (!$permissiontoread) accessforbidden(); |
|
198 | +if (empty($conf->hrm->enabled)) { |
|
199 | + accessforbidden(); |
|
200 | +} |
|
201 | +if (!$permissiontoread) { |
|
202 | + accessforbidden(); |
|
203 | +} |
|
198 | 204 | |
199 | 205 | |
200 | 206 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | // Default sort order (if not yet defined by previous GETPOST) |
84 | 84 | if (!$sortfield) { |
85 | - reset($object->fields); // Reset is required to avoid key() to return null. |
|
85 | + reset($object->fields); // Reset is required to avoid key() to return null. |
|
86 | 86 | $sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition. |
87 | 87 | } |
88 | 88 | if (!$sortorder) { |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | } |
272 | 272 | } else { |
273 | 273 | if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') { |
274 | - $columnName=preg_replace('/(_dtstart|_dtend)$/', '', $key); |
|
274 | + $columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key); |
|
275 | 275 | if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) { |
276 | 276 | if (preg_match('/_dtstart$/', $key)) { |
277 | 277 | $sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'"; |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | } elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('id', 'rowid', 'ref', 'status')) && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) { |
566 | 566 | $cssforfield .= ($cssforfield ? ' ' : '').'right'; |
567 | 567 | } |
568 | - $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
568 | + $cssforfield = preg_replace('/small\s*/', '', $cssforfield); // the 'small' css must not be used for the title label |
|
569 | 569 | if (!empty($arrayfields['t.'.$key]['checked'])) { |
570 | 570 | print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''), 0, (empty($val['helplist']) ? '' : $val['helplist']))."\n"; |
571 | 571 | $totalarray['nbfield']++; |
@@ -136,8 +136,12 @@ |
||
136 | 136 | //if ($user->socid > 0) $socid = $user->socid; |
137 | 137 | //$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); |
138 | 138 | //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); |
139 | -if (empty($conf->hrm->enabled)) accessforbidden(); |
|
140 | -if (!$permissiontoread) accessforbidden(); |
|
139 | +if (empty($conf->hrm->enabled)) { |
|
140 | + accessforbidden(); |
|
141 | +} |
|
142 | +if (!$permissiontoread) { |
|
143 | + accessforbidden(); |
|
144 | +} |
|
141 | 145 | |
142 | 146 | |
143 | 147 | /* |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
34 | 34 | require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; |
35 | 35 | require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; |
36 | -require_once DOL_DOCUMENT_ROOT . '/hrm/class/skill.class.php'; |
|
37 | -require_once DOL_DOCUMENT_ROOT . '/hrm/lib/hrm_skill.lib.php'; |
|
36 | +require_once DOL_DOCUMENT_ROOT.'/hrm/class/skill.class.php'; |
|
37 | +require_once DOL_DOCUMENT_ROOT.'/hrm/lib/hrm_skill.lib.php'; |
|
38 | 38 | |
39 | 39 | // Load translation files required by the page |
40 | 40 | $langs->loadLangs(array('hrm', 'companies', 'other', 'mails')); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $linkback = '<a href="'.DOL_URL_ROOT.'/hrm/skill_list.php?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>'; |
132 | 132 | |
133 | 133 | $morehtmlref = '<div class="refid">'; |
134 | - $morehtmlref.= $object->label; |
|
134 | + $morehtmlref .= $object->label; |
|
135 | 135 | $morehtmlref .= '</div>'; |
136 | 136 | |
137 | 137 | dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'rowid', $morehtmlref); |