@@ -894,17 +894,17 @@ discard block |
||
| 894 | 894 | } |
| 895 | 895 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
| 896 | 896 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
| 897 | - $data[$key]= '<br><b><u>'. $labelextra . '</u></b>'; |
|
| 897 | + $data[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
| 898 | 898 | } else { |
| 899 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
| 900 | - $data[$key]= '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 899 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
| 900 | + $data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 901 | 901 | $count++; |
| 902 | 902 | } |
| 903 | 903 | } |
| 904 | 904 | $data['closedivextra'] = '</div>'; |
| 905 | 905 | } |
| 906 | 906 | |
| 907 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 907 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 908 | 908 | $parameters = array( |
| 909 | 909 | 'tooltipcontentarray' => &$data, |
| 910 | 910 | 'params' => $params, |
@@ -1395,7 +1395,7 @@ discard block |
||
| 1395 | 1395 | if ($source == 'external' || $source == 'thirdparty') { |
| 1396 | 1396 | $sql .= " AND tc.source = 'external'"; |
| 1397 | 1397 | if ($status >= 0) { |
| 1398 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1398 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_socpeople |
|
| 1399 | 1399 | } |
| 1400 | 1400 | } |
| 1401 | 1401 | $sql .= " AND tc.active = 1"; |
@@ -1752,8 +1752,8 @@ discard block |
||
| 1752 | 1752 | if ($idtofetch) { |
| 1753 | 1753 | $thirdparty = new Societe($this->db); |
| 1754 | 1754 | $result = $thirdparty->fetch($idtofetch); |
| 1755 | - if ($result<0) { |
|
| 1756 | - $this->errors=array_merge($this->errors, $thirdparty->errors); |
|
| 1755 | + if ($result < 0) { |
|
| 1756 | + $this->errors = array_merge($this->errors, $thirdparty->errors); |
|
| 1757 | 1757 | } |
| 1758 | 1758 | $this->thirdparty = $thirdparty; |
| 1759 | 1759 | |
@@ -1783,7 +1783,7 @@ discard block |
||
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | 1785 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element; |
| 1786 | - $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1786 | + $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1787 | 1787 | $sql .= " LIMIT 1"; |
| 1788 | 1788 | |
| 1789 | 1789 | $query = $this->db->query($sql); |
@@ -2076,9 +2076,9 @@ discard block |
||
| 2076 | 2076 | if ($trigkey) { |
| 2077 | 2077 | $oldvalue = null; |
| 2078 | 2078 | |
| 2079 | - $sql = "SELECT " . $field; |
|
| 2080 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
| 2081 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
| 2079 | + $sql = "SELECT ".$field; |
|
| 2080 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
| 2081 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
| 2082 | 2082 | |
| 2083 | 2083 | $resql = $this->db->query($sql); |
| 2084 | 2084 | if ($resql) { |
@@ -2431,7 +2431,7 @@ discard block |
||
| 2431 | 2431 | // Triggers |
| 2432 | 2432 | if (!$error && !$notrigger) { |
| 2433 | 2433 | // Call triggers |
| 2434 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
| 2434 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
| 2435 | 2435 | if ($result < 0) { |
| 2436 | 2436 | $error++; |
| 2437 | 2437 | } //Do also here what you must do to rollback action if trigger fail |
@@ -2797,7 +2797,7 @@ discard block |
||
| 2797 | 2797 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
| 2798 | 2798 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
| 2799 | 2799 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
| 2800 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2800 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 2801 | 2801 | } |
| 2802 | 2802 | $sql .= ' WHERE rowid='.((int) $this->id); |
| 2803 | 2803 | |
@@ -3145,10 +3145,10 @@ discard block |
||
| 3145 | 3145 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
| 3146 | 3146 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3147 | 3147 | if (!$renum) { |
| 3148 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
| 3148 | + $sql .= " AND ".$fieldposition." = 0"; |
|
| 3149 | 3149 | } |
| 3150 | 3150 | if ($renum) { |
| 3151 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
| 3151 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
| 3152 | 3152 | } |
| 3153 | 3153 | |
| 3154 | 3154 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3169,7 +3169,7 @@ discard block |
||
| 3169 | 3169 | if ($fk_parent_line) { |
| 3170 | 3170 | $sql .= ' AND fk_parent_line IS NULL'; |
| 3171 | 3171 | } |
| 3172 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
| 3172 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
| 3173 | 3173 | |
| 3174 | 3174 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
| 3175 | 3175 | $resql = $this->db->query($sql); |
@@ -3220,7 +3220,7 @@ discard block |
||
| 3220 | 3220 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3221 | 3221 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3222 | 3222 | $sql .= ' AND fk_parent_line = '.((int) $id); |
| 3223 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
| 3223 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
| 3224 | 3224 | |
| 3225 | 3225 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
| 3226 | 3226 | $resql = $this->db->query($sql); |
@@ -3303,8 +3303,8 @@ discard block |
||
| 3303 | 3303 | dol_print_error($this->db); |
| 3304 | 3304 | return -1; |
| 3305 | 3305 | } else { |
| 3306 | - $parameters=array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3307 | - $action=''; |
|
| 3306 | + $parameters = array('rowid'=>$rowid, 'rang'=>$rang, 'fieldposition' => $fieldposition); |
|
| 3307 | + $action = ''; |
|
| 3308 | 3308 | $reshook = $hookmanager->executeHooks('afterRankOfLineUpdate', $parameters, $this, $action); |
| 3309 | 3309 | return 1; |
| 3310 | 3310 | } |
@@ -3343,7 +3343,7 @@ discard block |
||
| 3343 | 3343 | |
| 3344 | 3344 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3345 | 3345 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3346 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
| 3346 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
| 3347 | 3347 | if ($this->db->query($sql)) { |
| 3348 | 3348 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
| 3349 | 3349 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3374,7 +3374,7 @@ discard block |
||
| 3374 | 3374 | |
| 3375 | 3375 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3376 | 3376 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3377 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
| 3377 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
| 3378 | 3378 | if ($this->db->query($sql)) { |
| 3379 | 3379 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
| 3380 | 3380 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3400,7 +3400,7 @@ discard block |
||
| 3400 | 3400 | $fieldposition = 'position'; |
| 3401 | 3401 | } |
| 3402 | 3402 | |
| 3403 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3403 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3404 | 3404 | $sql .= " WHERE rowid = ".((int) $rowid); |
| 3405 | 3405 | |
| 3406 | 3406 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3428,7 +3428,7 @@ discard block |
||
| 3428 | 3428 | |
| 3429 | 3429 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3430 | 3430 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3431 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
| 3431 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
| 3432 | 3432 | $resql = $this->db->query($sql); |
| 3433 | 3433 | if ($resql) { |
| 3434 | 3434 | $row = $this->db->fetch_row($resql); |
@@ -3546,7 +3546,7 @@ discard block |
||
| 3546 | 3546 | $newsuffix = ''; |
| 3547 | 3547 | } |
| 3548 | 3548 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
| 3549 | - $fieldusermod = "fk_user_mod"; |
|
| 3549 | + $fieldusermod = "fk_user_mod"; |
|
| 3550 | 3550 | } elseif ($this->table_element == 'ecm_files') { |
| 3551 | 3551 | $fieldusermod = "fk_user_m"; |
| 3552 | 3552 | } else { |
@@ -3588,7 +3588,7 @@ discard block |
||
| 3588 | 3588 | $trigger_name = 'EXPENSE_REPORT_MODIFY'; |
| 3589 | 3589 | break; |
| 3590 | 3590 | default: |
| 3591 | - $trigger_name = strtoupper($this->element) . '_MODIFY'; |
|
| 3591 | + $trigger_name = strtoupper($this->element).'_MODIFY'; |
|
| 3592 | 3592 | } |
| 3593 | 3593 | $ret = $this->call_trigger($trigger_name, $user); |
| 3594 | 3594 | if ($ret < 0) { |
@@ -3946,7 +3946,7 @@ discard block |
||
| 3946 | 3946 | // 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. |
| 3947 | 3947 | $coremodule = array('knowledgemanagement', 'partnership', 'workstation', 'ticket', 'recruitment', 'eventorganization', 'asset'); |
| 3948 | 3948 | // Add module part to target type if object has $module property and isn't in core modules. |
| 3949 | - $targettype = ((!empty($this->module) && ! in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3949 | + $targettype = ((!empty($this->module) && !in_array($this->module, $coremodule)) ? $this->module.'_' : '').$this->element; |
|
| 3950 | 3950 | |
| 3951 | 3951 | $parameters = array('targettype'=>$targettype); |
| 3952 | 3952 | // Hook for explicitly set the targettype if it must be differtent than $this->element |
@@ -3960,19 +3960,19 @@ discard block |
||
| 3960 | 3960 | $this->db->begin(); |
| 3961 | 3961 | $error = 0; |
| 3962 | 3962 | |
| 3963 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
| 3963 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
| 3964 | 3964 | $sql .= "fk_source"; |
| 3965 | 3965 | $sql .= ", sourcetype"; |
| 3966 | 3966 | $sql .= ", fk_target"; |
| 3967 | 3967 | $sql .= ", targettype"; |
| 3968 | 3968 | $sql .= ") VALUES ("; |
| 3969 | 3969 | $sql .= ((int) $origin_id); |
| 3970 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
| 3971 | - $sql .= ", " . ((int) $this->id); |
|
| 3972 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
| 3970 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
| 3971 | + $sql .= ", ".((int) $this->id); |
|
| 3972 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
| 3973 | 3973 | $sql .= ")"; |
| 3974 | 3974 | |
| 3975 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
| 3975 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
| 3976 | 3976 | if ($this->db->query($sql)) { |
| 3977 | 3977 | if (!$notrigger) { |
| 3978 | 3978 | // Call trigger |
@@ -4287,20 +4287,20 @@ discard block |
||
| 4287 | 4287 | $this->db->begin(); |
| 4288 | 4288 | $error = 0; |
| 4289 | 4289 | |
| 4290 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
| 4290 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
| 4291 | 4291 | if ($updatesource) { |
| 4292 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
| 4293 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4294 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
| 4295 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4292 | + $sql .= "fk_source = ".((int) $sourceid); |
|
| 4293 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4294 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
| 4295 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4296 | 4296 | } elseif ($updatetarget) { |
| 4297 | - $sql .= "fk_target = " . ((int) $targetid); |
|
| 4298 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4299 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
| 4300 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4297 | + $sql .= "fk_target = ".((int) $targetid); |
|
| 4298 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
| 4299 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
| 4300 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4301 | 4301 | } |
| 4302 | 4302 | |
| 4303 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
| 4303 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
| 4304 | 4304 | if ($this->db->query($sql)) { |
| 4305 | 4305 | if (!$notrigger) { |
| 4306 | 4306 | // Call trigger |
@@ -4376,25 +4376,25 @@ discard block |
||
| 4376 | 4376 | } |
| 4377 | 4377 | |
| 4378 | 4378 | if (!$error) { |
| 4379 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
| 4379 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
| 4380 | 4380 | $sql .= " WHERE"; |
| 4381 | 4381 | if ($rowid > 0) { |
| 4382 | - $sql .= " rowid = " . ((int) $rowid); |
|
| 4382 | + $sql .= " rowid = ".((int) $rowid); |
|
| 4383 | 4383 | } else { |
| 4384 | 4384 | if ($deletesource) { |
| 4385 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4386 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4385 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4386 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4387 | 4387 | } elseif ($deletetarget) { |
| 4388 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4389 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4388 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
| 4389 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4390 | 4390 | } else { |
| 4391 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
| 4391 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
| 4392 | 4392 | $sql .= " OR"; |
| 4393 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
| 4393 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
| 4394 | 4394 | } |
| 4395 | 4395 | } |
| 4396 | 4396 | |
| 4397 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
| 4397 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
| 4398 | 4398 | if (!$this->db->query($sql)) { |
| 4399 | 4399 | $this->error = $this->db->lasterror(); |
| 4400 | 4400 | $this->errors[] = $this->error; |
@@ -4559,14 +4559,14 @@ discard block |
||
| 4559 | 4559 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
| 4560 | 4560 | } |
| 4561 | 4561 | $sql .= " WHERE rowid = ".((int) $elementId); |
| 4562 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4562 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4563 | 4563 | |
| 4564 | 4564 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
| 4565 | 4565 | $resql = $this->db->query($sql); |
| 4566 | 4566 | if ($resql) { |
| 4567 | 4567 | $error = 0; |
| 4568 | 4568 | |
| 4569 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4569 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4570 | 4570 | |
| 4571 | 4571 | if ($nb_rows_affected > 0) { |
| 4572 | 4572 | if (empty($trigkey)) { |
@@ -4611,7 +4611,7 @@ discard block |
||
| 4611 | 4611 | if ($fieldstatus == 'tosell') { |
| 4612 | 4612 | $this->status = $status; |
| 4613 | 4613 | } elseif ($fieldstatus == 'tobuy') { |
| 4614 | - $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4614 | + $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4615 | 4615 | } else { |
| 4616 | 4616 | $this->statut = $status; |
| 4617 | 4617 | $this->status = $status; |
@@ -4720,7 +4720,7 @@ discard block |
||
| 4720 | 4720 | return -1; |
| 4721 | 4721 | } |
| 4722 | 4722 | |
| 4723 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4723 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4724 | 4724 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
| 4725 | 4725 | $tmparray = array_keys($this->childtables); |
| 4726 | 4726 | if (is_numeric($tmparray[0])) { |
@@ -4733,26 +4733,26 @@ discard block |
||
| 4733 | 4733 | //print $id.'-'.$table.'-'.$elementname.'<br>'; |
| 4734 | 4734 | // Check if element can be deleted |
| 4735 | 4735 | $sql = "SELECT COUNT(*) as nb"; |
| 4736 | - $sql.= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4736 | + $sql .= " FROM ".$this->db->prefix().$table." as c"; |
|
| 4737 | 4737 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4738 | - $sql.= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4738 | + $sql .= ", ".$this->db->prefix().$element['parent']." as p"; |
|
| 4739 | 4739 | } |
| 4740 | 4740 | if (!empty($element['fk_element'])) { |
| 4741 | - $sql.= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
| 4741 | + $sql .= " WHERE c.".$element['fk_element']." = ".((int) $id); |
|
| 4742 | 4742 | } else { |
| 4743 | - $sql.= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4743 | + $sql .= " WHERE c.".$this->fk_element." = ".((int) $id); |
|
| 4744 | 4744 | } |
| 4745 | 4745 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4746 | - $sql.= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4746 | + $sql .= " AND c.".$element['parentkey']." = p.rowid"; |
|
| 4747 | 4747 | } |
| 4748 | 4748 | if (!empty($element['parent']) && !empty($element['parenttypefield']) && !empty($element['parenttypevalue'])) { |
| 4749 | - $sql.= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
| 4749 | + $sql .= " AND c.".$element['parenttypefield']." = '".$this->db->escape($element['parenttypevalue'])."'"; |
|
| 4750 | 4750 | } |
| 4751 | 4751 | if (!empty($entity)) { |
| 4752 | 4752 | if (!empty($element['parent']) && !empty($element['parentkey'])) { |
| 4753 | - $sql.= " AND p.entity = ".((int) $entity); |
|
| 4753 | + $sql .= " AND p.entity = ".((int) $entity); |
|
| 4754 | 4754 | } else { |
| 4755 | - $sql.= " AND c.entity = ".((int) $entity); |
|
| 4755 | + $sql .= " AND c.entity = ".((int) $entity); |
|
| 4756 | 4756 | } |
| 4757 | 4757 | } |
| 4758 | 4758 | |
@@ -5787,7 +5787,7 @@ discard block |
||
| 5787 | 5787 | $setsharekey = false; |
| 5788 | 5788 | if ($this->element == 'propal' || $this->element == 'proposal') { |
| 5789 | 5789 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
| 5790 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5790 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 5791 | 5791 | } |
| 5792 | 5792 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
| 5793 | 5793 | $setsharekey = true; |
@@ -5845,7 +5845,7 @@ discard block |
||
| 5845 | 5845 | $ecmfile->gen_or_uploaded = 'generated'; |
| 5846 | 5846 | $ecmfile->description = ''; // indexed content |
| 5847 | 5847 | $ecmfile->keywords = ''; // keyword content |
| 5848 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5848 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 5849 | 5849 | $ecmfile->src_object_id = $this->id; |
| 5850 | 5850 | |
| 5851 | 5851 | $result = $ecmfile->create($user); |
@@ -5897,7 +5897,7 @@ discard block |
||
| 5897 | 5897 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
| 5898 | 5898 | $maxheightmini = $tmparraysize['maxheightmini']; |
| 5899 | 5899 | //$quality = $tmparraysize['quality']; |
| 5900 | - $quality = 50; // For thumbs, we force quality to 50 |
|
| 5900 | + $quality = 50; // For thumbs, we force quality to 50 |
|
| 5901 | 5901 | |
| 5902 | 5902 | // Create small thumbs for company (Ratio is near 16/9) |
| 5903 | 5903 | // Used on logon for example |
@@ -5999,8 +5999,8 @@ discard block |
||
| 5999 | 5999 | // phpcs:enable |
| 6000 | 6000 | global $langs, $conf; |
| 6001 | 6001 | |
| 6002 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
| 6003 | - dol_print_error(null, 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
| 6002 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
| 6003 | + dol_print_error(null, 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
| 6004 | 6004 | exit; |
| 6005 | 6005 | } |
| 6006 | 6006 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6194,7 +6194,7 @@ discard block |
||
| 6194 | 6194 | $savDisableCompute = $conf->disable_compute; |
| 6195 | 6195 | $conf->disable_compute = 1; |
| 6196 | 6196 | |
| 6197 | - $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6197 | + $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6198 | 6198 | |
| 6199 | 6199 | $conf->disable_compute = $savDisableCompute; |
| 6200 | 6200 | |
@@ -6298,9 +6298,9 @@ discard block |
||
| 6298 | 6298 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
| 6299 | 6299 | //var_dump($conf->disable_compute); |
| 6300 | 6300 | if (empty($conf->disable_compute)) { |
| 6301 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6302 | - $objectoffield = $this; // we can use it inside computed formula |
|
| 6303 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6301 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6302 | + $objectoffield = $this; // we can use it inside computed formula |
|
| 6303 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6304 | 6304 | } |
| 6305 | 6305 | } |
| 6306 | 6306 | } |
@@ -6314,7 +6314,7 @@ discard block |
||
| 6314 | 6314 | return 0; |
| 6315 | 6315 | } |
| 6316 | 6316 | } else { |
| 6317 | - $this->errors[]=$this->db->lasterror; |
|
| 6317 | + $this->errors[] = $this->db->lasterror; |
|
| 6318 | 6318 | return -1; |
| 6319 | 6319 | } |
| 6320 | 6320 | } |
@@ -6481,7 +6481,7 @@ discard block |
||
| 6481 | 6481 | // If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update. |
| 6482 | 6482 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6483 | 6483 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6484 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6484 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6485 | 6485 | } else { |
| 6486 | 6486 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6487 | 6487 | } |
@@ -6492,7 +6492,7 @@ discard block |
||
| 6492 | 6492 | // If value has changed |
| 6493 | 6493 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6494 | 6494 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6495 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6495 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6496 | 6496 | } else { |
| 6497 | 6497 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6498 | 6498 | } |
@@ -6504,7 +6504,7 @@ discard block |
||
| 6504 | 6504 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
| 6505 | 6505 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
| 6506 | 6506 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
| 6507 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6507 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6508 | 6508 | } else { |
| 6509 | 6509 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6510 | 6510 | } |
@@ -6905,7 +6905,7 @@ discard block |
||
| 6905 | 6905 | if (isset($this->oldcopy->array_options["options_".$key]) && $this->array_options["options_".$key] == $this->oldcopy->array_options["options_".$key]) { // If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update. |
| 6906 | 6906 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6907 | 6907 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { |
| 6908 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6908 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6909 | 6909 | } else { |
| 6910 | 6910 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 6911 | 6911 | } |
@@ -6925,7 +6925,7 @@ discard block |
||
| 6925 | 6925 | } |
| 6926 | 6926 | } else { |
| 6927 | 6927 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { // dolibarr reversible encryption |
| 6928 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6928 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 6929 | 6929 | } else { |
| 6930 | 6930 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 6931 | 6931 | } |
@@ -7183,7 +7183,7 @@ discard block |
||
| 7183 | 7183 | // Special case that force options and type ($type can be integer, varchar, ...) |
| 7184 | 7184 | if (!empty($this->fields[$key]['arrayofkeyval']) && is_array($this->fields[$key]['arrayofkeyval'])) { |
| 7185 | 7185 | $param['options'] = $this->fields[$key]['arrayofkeyval']; |
| 7186 | - $type = (($this->fields[$key]['type']=='checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7186 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7187 | 7187 | } |
| 7188 | 7188 | |
| 7189 | 7189 | $label = $this->fields[$key]['label']; |
@@ -7235,7 +7235,7 @@ discard block |
||
| 7235 | 7235 | |
| 7236 | 7236 | // Add validation state class |
| 7237 | 7237 | if (!empty($validationClass)) { |
| 7238 | - $morecss.= $validationClass; |
|
| 7238 | + $morecss .= $validationClass; |
|
| 7239 | 7239 | } |
| 7240 | 7240 | |
| 7241 | 7241 | if (in_array($type, array('date'))) { |
@@ -7343,7 +7343,7 @@ discard block |
||
| 7343 | 7343 | if (is_array($param['options'])) { |
| 7344 | 7344 | $param_list = array_keys($param['options']); |
| 7345 | 7345 | $InfoFieldList = explode(":", $param_list[0], 5); |
| 7346 | - if (! empty($InfoFieldList[4])) { |
|
| 7346 | + if (!empty($InfoFieldList[4])) { |
|
| 7347 | 7347 | $pos = 0; |
| 7348 | 7348 | $parenthesisopen = 0; |
| 7349 | 7349 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
@@ -7356,7 +7356,7 @@ discard block |
||
| 7356 | 7356 | $pos++; |
| 7357 | 7357 | } |
| 7358 | 7358 | $tmpbefore = substr($InfoFieldList[4], 0, $pos); |
| 7359 | - $tmpafter = substr($InfoFieldList[4], $pos+1); |
|
| 7359 | + $tmpafter = substr($InfoFieldList[4], $pos + 1); |
|
| 7360 | 7360 | //var_dump($InfoFieldList[4].' -> '.$pos); var_dump($tmpafter); |
| 7361 | 7361 | $InfoFieldList[4] = $tmpbefore; |
| 7362 | 7362 | if ($tmpafter !== '') { |
@@ -7404,8 +7404,8 @@ discard block |
||
| 7404 | 7404 | } |
| 7405 | 7405 | |
| 7406 | 7406 | $sqlwhere = ''; |
| 7407 | - $sql = "SELECT " . $keyList; |
|
| 7408 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7407 | + $sql = "SELECT ".$keyList; |
|
| 7408 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
| 7409 | 7409 | if (!empty($InfoFieldList[4])) { |
| 7410 | 7410 | // can use SELECT request |
| 7411 | 7411 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7422,18 +7422,18 @@ discard block |
||
| 7422 | 7422 | // We have to join on extrafield table |
| 7423 | 7423 | $errstr = ''; |
| 7424 | 7424 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7425 | - $sql .= " as main, " . $this->db->prefix() . $InfoFieldList[0] . "_extrafields as extra"; |
|
| 7426 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2]; |
|
| 7427 | - $sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7425 | + $sql .= " as main, ".$this->db->prefix().$InfoFieldList[0]."_extrafields as extra"; |
|
| 7426 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]; |
|
| 7427 | + $sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7428 | 7428 | } else { |
| 7429 | - $sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7429 | + $sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7430 | 7430 | } |
| 7431 | 7431 | } else { |
| 7432 | 7432 | $sqlwhere .= ' WHERE 1=1'; |
| 7433 | 7433 | } |
| 7434 | 7434 | // Some tables may have field, some other not. For the moment we disable it. |
| 7435 | 7435 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7436 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7436 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7437 | 7437 | } |
| 7438 | 7438 | $sql .= $sqlwhere; |
| 7439 | 7439 | //print $sql; |
@@ -7445,7 +7445,7 @@ discard block |
||
| 7445 | 7445 | $sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label)); |
| 7446 | 7446 | } |
| 7447 | 7447 | |
| 7448 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
| 7448 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
| 7449 | 7449 | $resql = $this->db->query($sql); |
| 7450 | 7450 | if ($resql) { |
| 7451 | 7451 | $out .= '<option value="0"> </option>'; |
@@ -7461,7 +7461,7 @@ discard block |
||
| 7461 | 7461 | if (count($fields_label) > 1) { |
| 7462 | 7462 | $notrans = true; |
| 7463 | 7463 | foreach ($fields_label as $field_toshow) { |
| 7464 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7464 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7465 | 7465 | } |
| 7466 | 7466 | } else { |
| 7467 | 7467 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7472,12 +7472,12 @@ discard block |
||
| 7472 | 7472 | foreach ($fields_label as $field_toshow) { |
| 7473 | 7473 | $translabel = $langs->trans($obj->$field_toshow); |
| 7474 | 7474 | if ($translabel != $obj->$field_toshow) { |
| 7475 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
| 7475 | + $labeltoshow = dol_trunc($translabel).' '; |
|
| 7476 | 7476 | } else { |
| 7477 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
| 7477 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
| 7478 | 7478 | } |
| 7479 | 7479 | } |
| 7480 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7480 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7481 | 7481 | } else { |
| 7482 | 7482 | if (!$notrans) { |
| 7483 | 7483 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7491,34 +7491,34 @@ discard block |
||
| 7491 | 7491 | $labeltoshow = '(not defined)'; |
| 7492 | 7492 | } |
| 7493 | 7493 | if ($value == $obj->rowid) { |
| 7494 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7494 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7495 | 7495 | } |
| 7496 | 7496 | |
| 7497 | 7497 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7498 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7498 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7499 | 7499 | $isDependList = 1; |
| 7500 | 7500 | } |
| 7501 | 7501 | |
| 7502 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 7502 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 7503 | 7503 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
| 7504 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
| 7505 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 7504 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
| 7505 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 7506 | 7506 | } |
| 7507 | 7507 | |
| 7508 | 7508 | $i++; |
| 7509 | 7509 | } |
| 7510 | 7510 | $this->db->free($resql); |
| 7511 | 7511 | } else { |
| 7512 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7512 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7513 | 7513 | } |
| 7514 | 7514 | } else { |
| 7515 | 7515 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7516 | 7516 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7517 | 7517 | $out .= '<option value="0"> </option>'; |
| 7518 | 7518 | foreach ($data as $data_key => $data_value) { |
| 7519 | - $out .= '<option value="' . $data_key . '"'; |
|
| 7519 | + $out .= '<option value="'.$data_key.'"'; |
|
| 7520 | 7520 | $out .= ($value == $data_key ? ' selected' : ''); |
| 7521 | - $out .= '>' . $data_value . '</option>'; |
|
| 7521 | + $out .= '>'.$data_value.'</option>'; |
|
| 7522 | 7522 | } |
| 7523 | 7523 | } |
| 7524 | 7524 | } |
@@ -7583,8 +7583,8 @@ discard block |
||
| 7583 | 7583 | } |
| 7584 | 7584 | |
| 7585 | 7585 | $sqlwhere = ''; |
| 7586 | - $sql = "SELECT " . $keyList; |
|
| 7587 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7586 | + $sql = "SELECT ".$keyList; |
|
| 7587 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
| 7588 | 7588 | if (!empty($InfoFieldList[4])) { |
| 7589 | 7589 | // can use SELECT request |
| 7590 | 7590 | if (strpos($InfoFieldList[4], '$SEL$') !== false) { |
@@ -7600,23 +7600,23 @@ discard block |
||
| 7600 | 7600 | |
| 7601 | 7601 | // We have to join on extrafield table |
| 7602 | 7602 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7603 | - $sql .= ' as main, ' . $this->db->prefix() . $InfoFieldList[0] . '_extrafields as extra'; |
|
| 7604 | - $sqlwhere .= " WHERE extra.fk_object=main." . $InfoFieldList[2] . " AND " . $InfoFieldList[4]; |
|
| 7603 | + $sql .= ' as main, '.$this->db->prefix().$InfoFieldList[0].'_extrafields as extra'; |
|
| 7604 | + $sqlwhere .= " WHERE extra.fk_object=main.".$InfoFieldList[2]." AND ".$InfoFieldList[4]; |
|
| 7605 | 7605 | } else { |
| 7606 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 7606 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 7607 | 7607 | } |
| 7608 | 7608 | } else { |
| 7609 | 7609 | $sqlwhere .= ' WHERE 1=1'; |
| 7610 | 7610 | } |
| 7611 | 7611 | // Some tables may have field, some other not. For the moment we disable it. |
| 7612 | 7612 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7613 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7613 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7614 | 7614 | } |
| 7615 | 7615 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
| 7616 | 7616 | // print $sql; |
| 7617 | 7617 | |
| 7618 | 7618 | $sql .= $sqlwhere; |
| 7619 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7619 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 7620 | 7620 | $resql = $this->db->query($sql); |
| 7621 | 7621 | if ($resql) { |
| 7622 | 7622 | $num = $this->db->num_rows($resql); |
@@ -7634,7 +7634,7 @@ discard block |
||
| 7634 | 7634 | if (count($fields_label) > 1) { |
| 7635 | 7635 | $notrans = true; |
| 7636 | 7636 | foreach ($fields_label as $field_toshow) { |
| 7637 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7637 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7638 | 7638 | } |
| 7639 | 7639 | } else { |
| 7640 | 7640 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7645,9 +7645,9 @@ discard block |
||
| 7645 | 7645 | foreach ($fields_label as $field_toshow) { |
| 7646 | 7646 | $translabel = $langs->trans($obj->$field_toshow); |
| 7647 | 7647 | if ($translabel != $obj->$field_toshow) { |
| 7648 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
| 7648 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
| 7649 | 7649 | } else { |
| 7650 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
| 7650 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
| 7651 | 7651 | } |
| 7652 | 7652 | } |
| 7653 | 7653 | |
@@ -7670,7 +7670,7 @@ discard block |
||
| 7670 | 7670 | } |
| 7671 | 7671 | |
| 7672 | 7672 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7673 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7673 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7674 | 7674 | $isDependList = 1; |
| 7675 | 7675 | } |
| 7676 | 7676 | |
@@ -7681,14 +7681,14 @@ discard block |
||
| 7681 | 7681 | } |
| 7682 | 7682 | $this->db->free($resql); |
| 7683 | 7683 | |
| 7684 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7684 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7685 | 7685 | } else { |
| 7686 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7686 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7687 | 7687 | } |
| 7688 | 7688 | } else { |
| 7689 | 7689 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7690 | 7690 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7691 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7691 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, $morecss, 0, '100%'); |
|
| 7692 | 7692 | } |
| 7693 | 7693 | } |
| 7694 | 7694 | } elseif ($type == 'link') { |
@@ -7777,7 +7777,7 @@ discard block |
||
| 7777 | 7777 | $out = '<input type="hidden" value="'.$value.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"/>'; |
| 7778 | 7778 | } |
| 7779 | 7779 | |
| 7780 | - if ($isDependList==1) { |
|
| 7780 | + if ($isDependList == 1) { |
|
| 7781 | 7781 | $out .= $this->getJSListDependancies('_common'); |
| 7782 | 7782 | } |
| 7783 | 7783 | /* Add comments |
@@ -7828,7 +7828,7 @@ discard block |
||
| 7828 | 7828 | $type = 'varchar'; // convert varchar(xx) int varchar |
| 7829 | 7829 | } |
| 7830 | 7830 | if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { |
| 7831 | - $type = (($this->fields[$key]['type']=='checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7831 | + $type = (($this->fields[$key]['type'] == 'checkbox') ? $this->fields[$key]['type'] : 'select'); |
|
| 7832 | 7832 | } |
| 7833 | 7833 | if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) { |
| 7834 | 7834 | $type = 'link'; |
@@ -7913,7 +7913,7 @@ discard block |
||
| 7913 | 7913 | $value = $this->getLibStatut(3); |
| 7914 | 7914 | } elseif ($type == 'date') { |
| 7915 | 7915 | if (!empty($value)) { |
| 7916 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7916 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 7917 | 7917 | } else { |
| 7918 | 7918 | $value = ''; |
| 7919 | 7919 | } |
@@ -8011,9 +8011,9 @@ discard block |
||
| 8011 | 8011 | $translabel = $langs->trans($obj->$field_toshow); |
| 8012 | 8012 | } |
| 8013 | 8013 | if ($translabel != $field_toshow) { |
| 8014 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
| 8014 | + $value .= dol_trunc($translabel, 18).' '; |
|
| 8015 | 8015 | } else { |
| 8016 | - $value .= $obj->$field_toshow . ' '; |
|
| 8016 | + $value .= $obj->$field_toshow.' '; |
|
| 8017 | 8017 | } |
| 8018 | 8018 | } |
| 8019 | 8019 | } else { |
@@ -8029,7 +8029,7 @@ discard block |
||
| 8029 | 8029 | } |
| 8030 | 8030 | } |
| 8031 | 8031 | } else { |
| 8032 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8032 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8033 | 8033 | |
| 8034 | 8034 | $toprint = array(); |
| 8035 | 8035 | $obj = $this->db->fetch_object($resql); |
@@ -8037,7 +8037,7 @@ discard block |
||
| 8037 | 8037 | $c->fetch($obj->rowid); |
| 8038 | 8038 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8039 | 8039 | foreach ($ways as $way) { |
| 8040 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8040 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8041 | 8041 | } |
| 8042 | 8042 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
| 8043 | 8043 | } |
@@ -8053,11 +8053,11 @@ discard block |
||
| 8053 | 8053 | $toprint = array(); |
| 8054 | 8054 | foreach ($value_arr as $keyval => $valueval) { |
| 8055 | 8055 | if (!empty($valueval)) { |
| 8056 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
| 8056 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
| 8057 | 8057 | } |
| 8058 | 8058 | } |
| 8059 | 8059 | if (!empty($toprint)) { |
| 8060 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 8060 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 8061 | 8061 | } |
| 8062 | 8062 | } |
| 8063 | 8063 | } elseif ($type == 'chkbxlst') { |
@@ -8112,9 +8112,9 @@ discard block |
||
| 8112 | 8112 | $translabel = $langs->trans($obj->$field_toshow); |
| 8113 | 8113 | } |
| 8114 | 8114 | if ($translabel != $field_toshow) { |
| 8115 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8115 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8116 | 8116 | } else { |
| 8117 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
| 8117 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
| 8118 | 8118 | } |
| 8119 | 8119 | } |
| 8120 | 8120 | } else { |
@@ -8123,15 +8123,15 @@ discard block |
||
| 8123 | 8123 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
| 8124 | 8124 | } |
| 8125 | 8125 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
| 8126 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8126 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8127 | 8127 | } else { |
| 8128 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
| 8128 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
| 8129 | 8129 | } |
| 8130 | 8130 | } |
| 8131 | 8131 | } |
| 8132 | 8132 | } |
| 8133 | 8133 | } else { |
| 8134 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8134 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8135 | 8135 | |
| 8136 | 8136 | $toprint = array(); |
| 8137 | 8137 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -8140,7 +8140,7 @@ discard block |
||
| 8140 | 8140 | $c->fetch($obj->rowid); |
| 8141 | 8141 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8142 | 8142 | foreach ($ways as $way) { |
| 8143 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8143 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8144 | 8144 | } |
| 8145 | 8145 | } |
| 8146 | 8146 | } |
@@ -8287,7 +8287,7 @@ discard block |
||
| 8287 | 8287 | global $langs; |
| 8288 | 8288 | |
| 8289 | 8289 | if (!class_exists('Validate')) { |
| 8290 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
| 8290 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
| 8291 | 8291 | } |
| 8292 | 8292 | |
| 8293 | 8293 | $this->clearFieldError($fieldKey); |
@@ -8519,7 +8519,7 @@ discard block |
||
| 8519 | 8519 | $out .= "\n"; |
| 8520 | 8520 | |
| 8521 | 8521 | $nbofextrafieldsshown = 0; |
| 8522 | - $e = 0; // var to manage the modulo (odd/even) |
|
| 8522 | + $e = 0; // var to manage the modulo (odd/even) |
|
| 8523 | 8523 | |
| 8524 | 8524 | $lastseparatorkeyfound = ''; |
| 8525 | 8525 | $extrafields_collapse_num = ''; |
@@ -8570,7 +8570,7 @@ discard block |
||
| 8570 | 8570 | } |
| 8571 | 8571 | |
| 8572 | 8572 | $colspan = 0; |
| 8573 | - if (is_array($params) && count($params) > 0 && $display_type=='card') { |
|
| 8573 | + if (is_array($params) && count($params) > 0 && $display_type == 'card') { |
|
| 8574 | 8574 | if (array_key_exists('cols', $params)) { |
| 8575 | 8575 | $colspan = $params['cols']; |
| 8576 | 8576 | } elseif (array_key_exists('colspan', $params)) { // For backward compatibility. Use cols instead now. |
@@ -8657,7 +8657,7 @@ discard block |
||
| 8657 | 8657 | $domData .= ' data-targetid="'.$this->id.'"'; |
| 8658 | 8658 | |
| 8659 | 8659 | $html_id = (empty($this->id) ? '' : 'extrarow-'.$this->element.'_'.$key.'_'.$this->id); |
| 8660 | - if ($display_type=='card') { |
|
| 8660 | + if ($display_type == 'card') { |
|
| 8661 | 8661 | if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && ($e % 2) == 0) { |
| 8662 | 8662 | $colspan = 0; |
| 8663 | 8663 | } |
@@ -8768,12 +8768,12 @@ discard block |
||
| 8768 | 8768 | break; |
| 8769 | 8769 | } |
| 8770 | 8770 | |
| 8771 | - $out .= ($display_type=='card' ? '</td>' : '</div>'); |
|
| 8771 | + $out .= ($display_type == 'card' ? '</td>' : '</div>'); |
|
| 8772 | 8772 | |
| 8773 | 8773 | if (getDolGlobalString('MAIN_EXTRAFIELDS_USE_TWO_COLUMS') && (($e % 2) == 1)) { |
| 8774 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8774 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8775 | 8775 | } else { |
| 8776 | - $out .= ($display_type=='card' ? '</tr>' : '</div>'); |
|
| 8776 | + $out .= ($display_type == 'card' ? '</tr>' : '</div>'); |
|
| 8777 | 8777 | } |
| 8778 | 8778 | |
| 8779 | 8779 | $e++; |
@@ -9577,7 +9577,7 @@ discard block |
||
| 9577 | 9577 | continue; |
| 9578 | 9578 | } |
| 9579 | 9579 | } |
| 9580 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
| 9580 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
| 9581 | 9581 | } |
| 9582 | 9582 | return implode(',', $keys_with_alias); |
| 9583 | 9583 | } else { |
@@ -9697,7 +9697,7 @@ discard block |
||
| 9697 | 9697 | if (!$error) { |
| 9698 | 9698 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
| 9699 | 9699 | $sql .= " (".implode(", ", $keys).')'; |
| 9700 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9700 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 9701 | 9701 | |
| 9702 | 9702 | $res = $this->db->query($sql); |
| 9703 | 9703 | if (!$res) { |
@@ -9982,7 +9982,7 @@ discard block |
||
| 9982 | 9982 | |
| 9983 | 9983 | // Update extrafield |
| 9984 | 9984 | if (!$error) { |
| 9985 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 9985 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 9986 | 9986 | if ($result < 0) { |
| 9987 | 9987 | $error++; |
| 9988 | 9988 | } |
@@ -10190,12 +10190,12 @@ discard block |
||
| 10190 | 10190 | $error++; |
| 10191 | 10191 | } else { |
| 10192 | 10192 | while ($obj = $this->db->fetch_object($resql)) { |
| 10193 | - $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 10193 | + $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 10194 | 10194 | if ($result < 0) { |
| 10195 | 10195 | $error++; |
| 10196 | 10196 | $this->errors[] = $this->error; |
| 10197 | 10197 | } else { |
| 10198 | - $result = $this->delete($user); // @phpstan-ignore-line |
|
| 10198 | + $result = $this->delete($user); // @phpstan-ignore-line |
|
| 10199 | 10199 | if ($result < 0) { |
| 10200 | 10200 | $error++; |
| 10201 | 10201 | $this->errors[] = $this->error; |
@@ -10358,7 +10358,7 @@ discard block |
||
| 10358 | 10358 | ); |
| 10359 | 10359 | foreach ($fields as $key => $value) { |
| 10360 | 10360 | if (array_key_exists($key, $this->fields)) { |
| 10361 | - $this->{$key} = $value; // @phpstan-ignore-line |
|
| 10361 | + $this->{$key} = $value; // @phpstan-ignore-line |
|
| 10362 | 10362 | } |
| 10363 | 10363 | } |
| 10364 | 10364 | |
@@ -10503,7 +10503,7 @@ discard block |
||
| 10503 | 10503 | // Process |
| 10504 | 10504 | foreach ($to_del as $del) { |
| 10505 | 10505 | if ($c->fetch($del) > 0) { |
| 10506 | - $result=$c->del_type($this, $type_categ); |
|
| 10506 | + $result = $c->del_type($this, $type_categ); |
|
| 10507 | 10507 | if ($result < 0) { |
| 10508 | 10508 | $error++; |
| 10509 | 10509 | $this->error = $c->error; |
@@ -82,9 +82,9 @@ discard block |
||
| 82 | 82 | $more = array(); |
| 83 | 83 | $i = 0; |
| 84 | 84 | foreach ($conf->file->dol_document_root as $dir) { |
| 85 | - $newdir = $dir . getDolGlobalString('MAIN_FORCELANGDIR'); // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX' |
|
| 85 | + $newdir = $dir.getDolGlobalString('MAIN_FORCELANGDIR'); // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX' |
|
| 86 | 86 | if (!in_array($newdir, $this->dir)) { |
| 87 | - $more['module_' . $i] = $newdir; |
|
| 87 | + $more['module_'.$i] = $newdir; |
|
| 88 | 88 | $i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir. |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -114,13 +114,13 @@ discard block |
||
| 114 | 114 | if (isset($longforshort[strtolower($langpart[0])]) && !in_array($codetouse, $longforshortexcep)) { |
| 115 | 115 | $srclang = $longforshort[strtolower($langpart[0])]; |
| 116 | 116 | } elseif (!is_numeric($langpart[1])) { // Second part YY may be a numeric with some Chrome browser |
| 117 | - $srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[1]); |
|
| 117 | + $srclang = strtolower($langpart[0])."_".strtoupper($langpart[1]); |
|
| 118 | 118 | $longforlong = array('no_nb' => 'nb_NO'); |
| 119 | 119 | if (isset($longforlong[strtolower($srclang)])) { |
| 120 | 120 | $srclang = $longforlong[strtolower($srclang)]; |
| 121 | 121 | } |
| 122 | 122 | } else { |
| 123 | - $srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[0]); |
|
| 123 | + $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); |
|
| 124 | 124 | } |
| 125 | 125 | } else { // If it's for a codetouse that is a short code xx |
| 126 | 126 | // Array to convert short lang code into long code. |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | if (isset($longforshort[strtolower($langpart[0])])) { |
| 134 | 134 | $srclang = $longforshort[strtolower($langpart[0])]; |
| 135 | 135 | } elseif (!empty($langpart[0])) { |
| 136 | - $srclang = strtolower($langpart[0]) . "_" . strtoupper($langpart[0]); |
|
| 136 | + $srclang = strtolower($langpart[0])."_".strtoupper($langpart[0]); |
|
| 137 | 137 | } else { |
| 138 | 138 | $srclang = 'en_US'; |
| 139 | 139 | } |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | // Check parameters |
| 213 | 213 | if (empty($domain)) { |
| 214 | - dol_print_error(null, get_class($this) . "::Load ErrorWrongParameters"); |
|
| 214 | + dol_print_error(null, get_class($this)."::Load ErrorWrongParameters"); |
|
| 215 | 215 | return -1; |
| 216 | 216 | } |
| 217 | 217 | if ($this->defaultlang === 'none_NONE') { |
@@ -257,17 +257,17 @@ discard block |
||
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | if (empty($langofdir)) { // This may occurs when load is called without setting the language and without providing a value for forcelangdir |
| 260 | - dol_syslog("Error: " . get_class($this) . "::load was called for domain=" . $domain . " but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING); |
|
| 260 | + dol_syslog("Error: ".get_class($this)."::load was called for domain=".$domain." but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING); |
|
| 261 | 261 | return -1; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | foreach ($this->dir as $searchdir) { |
| 265 | 265 | // Directory of translation files |
| 266 | - $file_lang = $searchdir . ($modulename ? '/' . $modulename : '') . "/langs/" . $langofdir . "/" . $newdomain . ".lang"; |
|
| 266 | + $file_lang = $searchdir.($modulename ? '/'.$modulename : '')."/langs/".$langofdir."/".$newdomain.".lang"; |
|
| 267 | 267 | $file_lang_osencoded = dol_osencode($file_lang); |
| 268 | 268 | |
| 269 | 269 | //$filelangexists = is_file($file_lang_osencoded); |
| 270 | - $filelangexists = @is_file($file_lang_osencoded); // avoid [php:warn] |
|
| 270 | + $filelangexists = @is_file($file_lang_osencoded); // avoid [php:warn] |
|
| 271 | 271 | |
| 272 | 272 | //dol_syslog(get_class($this).'::Load Try to read for alt='.$alt.' langofdir='.$langofdir.' domain='.$domain.' newdomain='.$newdomain.' modulename='.$modulename.' file_lang='.$file_lang." => filelangexists=".$filelangexists); |
| 273 | 273 | //print 'Try to read for alt='.$alt.' langofdir='.$langofdir.' domain='.$domain.' newdomain='.$newdomain.' modulename='.$modulename.' this->_tab_loaded[newdomain]='.$this->_tab_loaded[$newdomain].' file_lang='.$file_lang." => filelangexists=".$filelangexists."\n"; |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $usecachekey = ''; |
| 281 | 281 | // Using a memcached server |
| 282 | 282 | if (isModEnabled('memcached') && getDolGlobalString('MEMCACHED_SERVER')) { |
| 283 | - $usecachekey = $newdomain . '_' . $langofdir . '_' . md5($file_lang); // Should not contains special chars |
|
| 283 | + $usecachekey = $newdomain.'_'.$langofdir.'_'.md5($file_lang); // Should not contains special chars |
|
| 284 | 284 | } elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) { |
| 285 | 285 | // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) |
| 286 | 286 | $usecachekey = $newdomain; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | //dol_syslog('Translate::Load we will cache result into usecachekey '.$usecachekey); |
| 291 | 291 | //global $aaa; $aaa+=1; |
| 292 | 292 | //print $aaa." ".$usecachekey."\n"; |
| 293 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; |
|
| 293 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; |
|
| 294 | 294 | $tmparray = dol_getcache($usecachekey); |
| 295 | 295 | if (is_array($tmparray) && count($tmparray)) { |
| 296 | 296 | $this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added. |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | if ($usecachekey && count($tabtranslatedomain)) { |
| 350 | 350 | $ressetcache = dol_setcache($usecachekey, $tabtranslatedomain); |
| 351 | 351 | if ($ressetcache < 0) { |
| 352 | - $error = 'Failed to set cache for usecachekey=' . $usecachekey . ' result=' . $ressetcache; |
|
| 352 | + $error = 'Failed to set cache for usecachekey='.$usecachekey.' result='.$ressetcache; |
|
| 353 | 353 | dol_syslog($error, LOG_ERR); |
| 354 | 354 | } |
| 355 | 355 | } |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | if ($alt == 0) { |
| 367 | 367 | // This function MUST NOT contains call to syslog |
| 368 | 368 | //dol_syslog("Translate::Load loading alternate translation file (to complete ".$this->defaultlang."/".$newdomain.".lang file)", LOG_DEBUG); |
| 369 | - $langofdir = strtolower($langarray[0]) . '_' . strtoupper($langarray[0]); |
|
| 369 | + $langofdir = strtolower($langarray[0]).'_'.strtoupper($langarray[0]); |
|
| 370 | 370 | if ($langofdir == 'el_EL') { |
| 371 | 371 | $langofdir = 'el_GR'; // main parent for el_CY is not 'el_EL' but 'el_GR' |
| 372 | 372 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | // This part is deprecated and replaced with table llx_overwrite_trans |
| 399 | 399 | // Kept for backward compatibility. |
| 400 | 400 | if (empty($loadfromfileonly)) { |
| 401 | - $overwritekey = 'MAIN_OVERWRITE_TRANS_' . $this->defaultlang; |
|
| 401 | + $overwritekey = 'MAIN_OVERWRITE_TRANS_'.$this->defaultlang; |
|
| 402 | 402 | if (!empty($conf->global->$overwritekey)) { // Overwrite translation with key1:newstring1,key2:newstring2 |
| 403 | 403 | // Overwrite translation with param MAIN_OVERWRITE_TRANS_xx_XX |
| 404 | 404 | $tmparray = explode(',', getDolGlobalString($overwritekey)); |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | $langofdir = $this->defaultlang; |
| 462 | 462 | |
| 463 | 463 | if (empty($langofdir)) { // This may occurs when load is called without setting the language and without providing a value for forcelangdir |
| 464 | - dol_syslog("Error: " . get_class($this) . "::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING); |
|
| 464 | + dol_syslog("Error: ".get_class($this)."::loadFromDatabase was called but language was not set yet with langs->setDefaultLang(). Nothing will be loaded.", LOG_WARNING); |
|
| 465 | 465 | return -1; |
| 466 | 466 | } |
| 467 | 467 | |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $usecachekey = ''; |
| 473 | 473 | // Using a memcached server |
| 474 | 474 | if (isModEnabled('memcached') && getDolGlobalString('MEMCACHED_SERVER')) { |
| 475 | - $usecachekey = $newdomain . '_' . $langofdir; // Should not contains special chars |
|
| 475 | + $usecachekey = $newdomain.'_'.$langofdir; // Should not contains special chars |
|
| 476 | 476 | } elseif (getDolGlobalInt('MAIN_OPTIMIZE_SPEED') & 0x02) { |
| 477 | 477 | // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) |
| 478 | 478 | $usecachekey = $newdomain; |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | //dol_syslog('Translate::Load we will cache result into usecachekey '.$usecachekey); |
| 483 | 483 | //global $aaa; $aaa+=1; |
| 484 | 484 | //print $aaa." ".$usecachekey."\n"; |
| 485 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/memory.lib.php'; |
|
| 485 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; |
|
| 486 | 486 | $tmparray = dol_getcache($usecachekey); |
| 487 | 487 | if (is_array($tmparray) && count($tmparray)) { |
| 488 | 488 | $this->tab_translate += $tmparray; // Faster than array_merge($tmparray,$this->tab_translate). Note: If a value already exists into tab_translate, value into tmparaay is not added. |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | if ($usecachekey && count($tabtranslatedomain)) { |
| 536 | 536 | $ressetcache = dol_setcache($usecachekey, $tabtranslatedomain); |
| 537 | 537 | if ($ressetcache < 0) { |
| 538 | - $error = 'Failed to set cache for usecachekey=' . $usecachekey . ' result=' . $ressetcache; |
|
| 538 | + $error = 'Failed to set cache for usecachekey='.$usecachekey.' result='.$ressetcache; |
|
| 539 | 539 | dol_syslog($error, LOG_ERR); |
| 540 | 540 | } |
| 541 | 541 | } |
@@ -635,12 +635,12 @@ discard block |
||
| 635 | 635 | $str = $this->tab_translate[$key]; |
| 636 | 636 | |
| 637 | 637 | // Make some string replacement after translation |
| 638 | - $replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang; |
|
| 638 | + $replacekey = 'MAIN_REPLACE_TRANS_'.$this->defaultlang; |
|
| 639 | 639 | if (!empty($conf->global->$replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 |
| 640 | 640 | $tmparray = explode(';', getDolGlobalString($replacekey)); |
| 641 | 641 | foreach ($tmparray as $tmp) { |
| 642 | 642 | $tmparray2 = explode(':', $tmp); |
| 643 | - $str = preg_replace('/' . preg_quote($tmparray2[0]) . '/', $tmparray2[1], $str); |
|
| 643 | + $str = preg_replace('/'.preg_quote($tmparray2[0]).'/', $tmparray2[1], $str); |
|
| 644 | 644 | } |
| 645 | 645 | } |
| 646 | 646 | |
@@ -729,12 +729,12 @@ discard block |
||
| 729 | 729 | $str = $this->tab_translate[$key]; |
| 730 | 730 | |
| 731 | 731 | // Make some string replacement after translation |
| 732 | - $replacekey = 'MAIN_REPLACE_TRANS_' . $this->defaultlang; |
|
| 732 | + $replacekey = 'MAIN_REPLACE_TRANS_'.$this->defaultlang; |
|
| 733 | 733 | if (!empty($conf->global->$replacekey)) { // Replacement translation variable with string1:newstring1;string2:newstring2 |
| 734 | 734 | $tmparray = explode(';', getDolGlobalString($replacekey)); |
| 735 | 735 | foreach ($tmparray as $tmp) { |
| 736 | 736 | $tmparray2 = explode(':', $tmp); |
| 737 | - $str = preg_replace('/' . preg_quote($tmparray2[0]) . '/', $tmparray2[1], $str); |
|
| 737 | + $str = preg_replace('/'.preg_quote($tmparray2[0]).'/', $tmparray2[1], $str); |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | $this->load("languages"); |
| 832 | 832 | |
| 833 | 833 | // We scan directory langs to detect available languages |
| 834 | - $handle = opendir($langdir . "/langs"); |
|
| 834 | + $handle = opendir($langdir."/langs"); |
|
| 835 | 835 | $langs_available = array(); |
| 836 | 836 | while ($dir = trim(readdir($handle))) { |
| 837 | 837 | $regs = array(); |
@@ -881,9 +881,9 @@ discard block |
||
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | if ($usecode == 1 || getDolGlobalString('MAIN_SHOW_LANGUAGE_CODE')) { |
| 884 | - $langs_available[$dir] = $dir . ': ' . dol_trunc($this->trans('Language_' . $dir), $maxlength); |
|
| 884 | + $langs_available[$dir] = $dir.': '.dol_trunc($this->trans('Language_'.$dir), $maxlength); |
|
| 885 | 885 | } else { |
| 886 | - $langs_available[$dir] = $this->trans('Language_' . $dir); |
|
| 886 | + $langs_available[$dir] = $this->trans('Language_'.$dir); |
|
| 887 | 887 | } |
| 888 | 888 | if ($mainlangonly) { |
| 889 | 889 | $langs_available[$dir] = str_replace(' (United States)', '', $langs_available[$dir]); |
@@ -907,14 +907,14 @@ discard block |
||
| 907 | 907 | // phpcs:enable |
| 908 | 908 | // Test si fichier dans repertoire de la langue |
| 909 | 909 | foreach ($this->dir as $searchdir) { |
| 910 | - if (is_readable(dol_osencode($searchdir . "/langs/" . $this->defaultlang . "/" . $filename))) { |
|
| 910 | + if (is_readable(dol_osencode($searchdir."/langs/".$this->defaultlang."/".$filename))) { |
|
| 911 | 911 | return true; |
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | if ($searchalt) { |
| 915 | 915 | // Test si fichier dans repertoire de la langue alternative |
| 916 | 916 | if ($this->defaultlang != "en_US") { |
| 917 | - $filenamealt = $searchdir . "/langs/en_US/" . $filename; |
|
| 917 | + $filenamealt = $searchdir."/langs/en_US/".$filename; |
|
| 918 | 918 | } |
| 919 | 919 | //else $filenamealt = $searchdir."/langs/fr_FR/".$filename; |
| 920 | 920 | if (is_readable(dol_osencode($filenamealt))) { |
@@ -955,8 +955,8 @@ discard block |
||
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | $fonc = 'numberwords'; |
| 958 | - if (file_exists($newdir . '/functions_' . $fonc . '.lib.php')) { |
|
| 959 | - include_once $newdir . '/functions_' . $fonc . '.lib.php'; |
|
| 958 | + if (file_exists($newdir.'/functions_'.$fonc.'.lib.php')) { |
|
| 959 | + include_once $newdir.'/functions_'.$fonc.'.lib.php'; |
|
| 960 | 960 | if (function_exists('numberwords_getLabelFromNumber')) { |
| 961 | 961 | $newnumber = numberwords_getLabelFromNumber($this, $number, $isamount); |
| 962 | 962 | break; |
@@ -1009,13 +1009,13 @@ discard block |
||
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | // Not found in loaded language file nor in cache. So we will take the label into database. |
| 1012 | - $sql = "SELECT " . $fieldlabel . " as label"; |
|
| 1013 | - $sql .= " FROM " . $db->prefix() . $tablename; |
|
| 1014 | - $sql .= " WHERE " . $fieldkey . " = '" . $db->escape($keyforselect ? $keyforselect : $key) . "'"; |
|
| 1012 | + $sql = "SELECT ".$fieldlabel." as label"; |
|
| 1013 | + $sql .= " FROM ".$db->prefix().$tablename; |
|
| 1014 | + $sql .= " WHERE ".$fieldkey." = '".$db->escape($keyforselect ? $keyforselect : $key)."'"; |
|
| 1015 | 1015 | if ($filteronentity) { |
| 1016 | - $sql .= " AND entity IN (" . getEntity($tablename) . ')'; |
|
| 1016 | + $sql .= " AND entity IN (".getEntity($tablename).')'; |
|
| 1017 | 1017 | } |
| 1018 | - dol_syslog(get_class($this) . '::getLabelFromKey', LOG_DEBUG); |
|
| 1018 | + dol_syslog(get_class($this).'::getLabelFromKey', LOG_DEBUG); |
|
| 1019 | 1019 | $resql = $db->query($sql); |
| 1020 | 1020 | if ($resql) { |
| 1021 | 1021 | $obj = $db->fetch_object($resql); |
@@ -1048,9 +1048,9 @@ discard block |
||
| 1048 | 1048 | $symbol = $this->getCurrencySymbol($currency_code); |
| 1049 | 1049 | |
| 1050 | 1050 | if (in_array($currency_code, array('USD'))) { |
| 1051 | - return $symbol . $amount; |
|
| 1051 | + return $symbol.$amount; |
|
| 1052 | 1052 | } else { |
| 1053 | - return $amount . $symbol; |
|
| 1053 | + return $amount.$symbol; |
|
| 1054 | 1054 | } |
| 1055 | 1055 | } |
| 1056 | 1056 | |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | |
| 1072 | 1072 | if (isset($this->cache_currencies[$currency_code]) && !empty($this->cache_currencies[$currency_code]['unicode']) && is_array($this->cache_currencies[$currency_code]['unicode'])) { |
| 1073 | 1073 | foreach ($this->cache_currencies[$currency_code]['unicode'] as $unicode) { |
| 1074 | - $currency_sign .= mb_convert_encoding("&#" . $unicode . ";", "UTF-8", 'HTML-ENTITIES'); |
|
| 1074 | + $currency_sign .= mb_convert_encoding("&#".$unicode.";", "UTF-8", 'HTML-ENTITIES'); |
|
| 1075 | 1075 | } |
| 1076 | 1076 | } |
| 1077 | 1077 | } |
@@ -1097,14 +1097,14 @@ discard block |
||
| 1097 | 1097 | } |
| 1098 | 1098 | |
| 1099 | 1099 | $sql = "SELECT code_iso, label, unicode"; |
| 1100 | - $sql .= " FROM " . $db->prefix() . "c_currencies"; |
|
| 1100 | + $sql .= " FROM ".$db->prefix()."c_currencies"; |
|
| 1101 | 1101 | $sql .= " WHERE active = 1"; |
| 1102 | 1102 | if (!empty($currency_code)) { |
| 1103 | - $sql .= " AND code_iso = '" . $db->escape($currency_code) . "'"; |
|
| 1103 | + $sql .= " AND code_iso = '".$db->escape($currency_code)."'"; |
|
| 1104 | 1104 | } |
| 1105 | 1105 | //$sql.= " ORDER BY code_iso ASC"; // Not required, a sort is done later |
| 1106 | 1106 | |
| 1107 | - dol_syslog(get_class($this) . '::loadCacheCurrencies', LOG_DEBUG); |
|
| 1107 | + dol_syslog(get_class($this).'::loadCacheCurrencies', LOG_DEBUG); |
|
| 1108 | 1108 | $resql = $db->query($sql); |
| 1109 | 1109 | if ($resql) { |
| 1110 | 1110 | $this->load("dict"); |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | $obj = $db->fetch_object($resql); |
| 1122 | 1122 | if ($obj) { |
| 1123 | 1123 | // If a translation exists, we use it lese we use the default label |
| 1124 | - $this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $this->trans("Currency" . $obj->code_iso) != "Currency" . $obj->code_iso ? $this->trans("Currency" . $obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
| 1124 | + $this->cache_currencies[$obj->code_iso]['label'] = ($obj->code_iso && $this->trans("Currency".$obj->code_iso) != "Currency".$obj->code_iso ? $this->trans("Currency".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); |
|
| 1125 | 1125 | $this->cache_currencies[$obj->code_iso]['unicode'] = (array) json_decode((empty($obj->unicode) ? '' : $obj->unicode), true); |
| 1126 | 1126 | $label[$obj->code_iso] = $this->cache_currencies[$obj->code_iso]['label']; |
| 1127 | 1127 | } |
@@ -1155,8 +1155,8 @@ discard block |
||
| 1155 | 1155 | $substitutionarray = array(); |
| 1156 | 1156 | |
| 1157 | 1157 | foreach ($this->tab_translate as $code => $label) { |
| 1158 | - $substitutionarray['lang_' . $code] = $label; |
|
| 1159 | - $substitutionarray['__(' . $code . ')__'] = $label; |
|
| 1158 | + $substitutionarray['lang_'.$code] = $label; |
|
| 1159 | + $substitutionarray['__('.$code.')__'] = $label; |
|
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | 1162 | return $substitutionarray; |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | |
| 84 | 84 | // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context |
| 85 | 85 | $object = new BookKeeping($db); |
| 86 | -$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array |
|
| 86 | +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array |
|
| 87 | 87 | |
| 88 | 88 | $formaccounting = new FormAccounting($db); |
| 89 | 89 | $formother = new FormOther($db); |
@@ -161,15 +161,15 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | if (!empty($search_date_start)) { |
| 163 | 163 | $filter['t.doc_date>='] = $search_date_start; |
| 164 | - $param .= '&date_startmonth=' . GETPOST('date_startmonth', 'int') . '&date_startday=' . GETPOST('date_startday', 'int') . '&date_startyear=' . GETPOST('date_startyear', 'int'); |
|
| 164 | + $param .= '&date_startmonth='.GETPOST('date_startmonth', 'int').'&date_startday='.GETPOST('date_startday', 'int').'&date_startyear='.GETPOST('date_startyear', 'int'); |
|
| 165 | 165 | } |
| 166 | 166 | if (!empty($search_date_end)) { |
| 167 | 167 | $filter['t.doc_date<='] = $search_date_end; |
| 168 | - $param .= '&date_endmonth=' . GETPOST('date_endmonth', 'int') . '&date_endday=' . GETPOST('date_endday', 'int') . '&date_endyear=' . GETPOST('date_endyear', 'int'); |
|
| 168 | + $param .= '&date_endmonth='.GETPOST('date_endmonth', 'int').'&date_endday='.GETPOST('date_endday', 'int').'&date_endyear='.GETPOST('date_endyear', 'int'); |
|
| 169 | 169 | } |
| 170 | 170 | if (!empty($search_doc_date)) { |
| 171 | 171 | $filter['t.doc_date'] = $search_doc_date; |
| 172 | - $param .= '&doc_datemonth=' . GETPOST('doc_datemonth', 'int') . '&doc_dateday=' . GETPOST('doc_dateday', 'int') . '&doc_dateyear=' . GETPOST('doc_dateyear', 'int'); |
|
| 172 | + $param .= '&doc_datemonth='.GETPOST('doc_datemonth', 'int').'&doc_dateday='.GETPOST('doc_dateday', 'int').'&doc_dateyear='.GETPOST('doc_dateyear', 'int'); |
|
| 173 | 173 | } |
| 174 | 174 | if (!empty($search_accountancy_code_start)) { |
| 175 | 175 | if ($type == 'sub') { |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } else { |
| 178 | 178 | $filter['t.numero_compte>='] = $search_accountancy_code_start; |
| 179 | 179 | } |
| 180 | - $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); |
|
| 180 | + $param .= '&search_accountancy_code_start='.urlencode($search_accountancy_code_start); |
|
| 181 | 181 | } |
| 182 | 182 | if (!empty($search_accountancy_code_end)) { |
| 183 | 183 | if ($type == 'sub') { |
@@ -185,12 +185,12 @@ discard block |
||
| 185 | 185 | } else { |
| 186 | 186 | $filter['t.numero_compte<='] = $search_accountancy_code_end; |
| 187 | 187 | } |
| 188 | - $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); |
|
| 188 | + $param .= '&search_accountancy_code_end='.urlencode($search_accountancy_code_end); |
|
| 189 | 189 | } |
| 190 | 190 | if (!empty($search_ledger_code)) { |
| 191 | 191 | $filter['t.code_journal'] = $search_ledger_code; |
| 192 | 192 | foreach ($search_ledger_code as $code) { |
| 193 | - $param .= '&search_ledger_code[]=' . urlencode($code); |
|
| 193 | + $param .= '&search_ledger_code[]='.urlencode($code); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | if (!empty($search_not_reconciled)) { |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | // param with type of list |
| 202 | 202 | $url_param = substr($param, 1); // remove first "&" |
| 203 | 203 | if (!empty($type)) { |
| 204 | - $param = '&type=' . $type . $param; |
|
| 204 | + $param = '&type='.$type.$param; |
|
| 205 | 205 | } |
| 206 | 206 | } |
| 207 | 207 | |
@@ -223,11 +223,11 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | foreach ($object->lines as $line) { |
| 225 | 225 | if ($type == 'sub') { |
| 226 | - print '"' . length_accounta($line->subledger_account) . '"' . $sep; |
|
| 227 | - print '"' . $line->subledger_label . '"' . $sep; |
|
| 226 | + print '"'.length_accounta($line->subledger_account).'"'.$sep; |
|
| 227 | + print '"'.$line->subledger_label.'"'.$sep; |
|
| 228 | 228 | } else { |
| 229 | - print '"' . length_accountg($line->numero_compte) . '"' . $sep; |
|
| 230 | - print '"' . $object->get_compte_desc($line->numero_compte) . '"' . $sep; |
|
| 229 | + print '"'.length_accountg($line->numero_compte).'"'.$sep; |
|
| 230 | + print '"'.$object->get_compte_desc($line->numero_compte).'"'.$sep; |
|
| 231 | 231 | } |
| 232 | 232 | print '"'.price($line->debit).'"'.$sep; |
| 233 | 233 | print '"'.price($line->credit).'"'.$sep; |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | $newcardbutton = empty($hookmanager->resPrint) ? '' : $hookmanager->resPrint; |
| 303 | 303 | |
| 304 | 304 | if (empty($reshook)) { |
| 305 | - $newcardbutton = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' (' . getDolGlobalString('ACCOUNTING_EXPORT_FORMAT').')" />'; |
|
| 305 | + $newcardbutton = '<input type="button" id="exportcsvbutton" name="exportcsvbutton" class="butAction" value="'.$langs->trans("Export").' ('.getDolGlobalString('ACCOUNTING_EXPORT_FORMAT').')" />'; |
|
| 306 | 306 | |
| 307 | 307 | print '<script type="text/javascript"> |
| 308 | 308 | jQuery(document).ready(function() { |
@@ -317,11 +317,11 @@ discard block |
||
| 317 | 317 | </script>'; |
| 318 | 318 | |
| 319 | 319 | if ($type == 'sub') { |
| 320 | - $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly')); |
|
| 321 | - $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); |
|
| 320 | + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/balance.php?'.$url_param, '', 1, array('morecss' => 'marginleftonly')); |
|
| 321 | + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/balance.php?type=sub&'.$url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); |
|
| 322 | 322 | } else { |
| 323 | - $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?' . $url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); |
|
| 324 | - $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT . '/accountancy/bookkeeping/balance.php?type=sub&' . $url_param, '', 1, array('morecss' => 'marginleftonly')); |
|
| 323 | + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/balance.php?'.$url_param, '', 1, array('morecss' => 'marginleftonly btnTitleSelected')); |
|
| 324 | + $newcardbutton .= dolGetButtonTitle($langs->trans('AccountBalance')." - ".$langs->trans('GroupBySubAccountAccounting'), '', 'fa fa-align-left vmirror paddingleft imgforviewmode', DOL_URL_ROOT.'/accountancy/bookkeeping/balance.php?type=sub&'.$url_param, '', 1, array('morecss' => 'marginleftonly')); |
|
| 325 | 325 | } |
| 326 | 326 | $newcardbutton .= dolGetButtonTitleSeparator(); |
| 327 | 327 | $newcardbutton .= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/card.php?action=create'); |
@@ -465,9 +465,9 @@ discard block |
||
| 465 | 465 | // without time and class limits (Class 6 and 7 accounts ???) and does not take into account the "a-nouveau" journal. |
| 466 | 466 | if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) { |
| 467 | 467 | $sql = "SELECT t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance"; |
| 468 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as t"; |
|
| 469 | - $sql .= " WHERE t.entity = " . $conf->entity; // Never do sharing into accounting features |
|
| 470 | - $sql .= " AND t.doc_date < '" . $db->idate($search_date_start) . "'"; |
|
| 468 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as t"; |
|
| 469 | + $sql .= " WHERE t.entity = ".$conf->entity; // Never do sharing into accounting features |
|
| 470 | + $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."'"; |
|
| 471 | 471 | $sql .= " GROUP BY t.numero_compte"; |
| 472 | 472 | |
| 473 | 473 | $resql = $db->query($sql); |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $opening_balances = array(); |
| 476 | 476 | for ($i = 0; $i < $nrows; $i++) { |
| 477 | 477 | $arr = $resql->fetch_array(); |
| 478 | - $opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance']; |
|
| 478 | + $opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance']; |
|
| 479 | 479 | } |
| 480 | 480 | } |
| 481 | 481 | |
@@ -507,9 +507,9 @@ discard block |
||
| 507 | 507 | //var_dump($accounting_account); |
| 508 | 508 | //var_dump($accountingaccountstatic); |
| 509 | 509 | if (empty($accountingaccountstatic->label) && $accountingaccountstatic->id > 0) { |
| 510 | - $link = '<a class="editfielda reposition" href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=update&token=' . newToken() . '&id=' . $accountingaccountstatic->id . '">' . img_edit() . '</a>'; |
|
| 510 | + $link = '<a class="editfielda reposition" href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=update&token='.newToken().'&id='.$accountingaccountstatic->id.'">'.img_edit().'</a>'; |
|
| 511 | 511 | } elseif ($accounting_account == 'NotDefined') { |
| 512 | - $link = '<a href="' . DOL_URL_ROOT . '/accountancy/admin/card.php?action=create&token=' . newToken() . '&accountingaccount=' . length_accountg($line->numero_compte) . '">' . img_edit_add() . '</a>'; |
|
| 512 | + $link = '<a href="'.DOL_URL_ROOT.'/accountancy/admin/card.php?action=create&token='.newToken().'&accountingaccount='.length_accountg($line->numero_compte).'">'.img_edit_add().'</a>'; |
|
| 513 | 513 | } elseif (empty($tmparrayforrootaccount['label'])) { |
| 514 | 514 | // $tmparrayforrootaccount['label'] not defined = the account has not parent with a parent. |
| 515 | 515 | // This is useless, we should not create a new account when an account has no parent, we must edit it to fix its parent. |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | // Show first line of a break |
| 548 | 548 | print '<tr class="trforbreak">'; |
| 549 | - print '<td colspan="'.($colspan+1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>'; |
|
| 549 | + print '<td colspan="'.($colspan + 1).'" style="font-weight:bold; border-bottom: 1pt solid black;">'.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').'</td>'; |
|
| 550 | 550 | print '</tr>'; |
| 551 | 551 | |
| 552 | 552 | $displayed_account = $root_account_number; |
@@ -585,22 +585,22 @@ discard block |
||
| 585 | 585 | $urlzoom = ''; |
| 586 | 586 | if ($type == 'sub') { |
| 587 | 587 | if ($line->subledger_account) { |
| 588 | - $urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start=' . urlencode($line->subledger_account) . '&search_accountancy_code_end=' . urlencode($line->subledger_account); |
|
| 588 | + $urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?type=sub&search_accountancy_code_start='.urlencode($line->subledger_account).'&search_accountancy_code_end='.urlencode($line->subledger_account); |
|
| 589 | 589 | if (GETPOSTISSET('date_startmonth')) { |
| 590 | - $urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int'); |
|
| 590 | + $urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int'); |
|
| 591 | 591 | } |
| 592 | 592 | if (GETPOSTISSET('date_endmonth')) { |
| 593 | - $urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int'); |
|
| 593 | + $urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int'); |
|
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | } else { |
| 597 | 597 | if ($line->numero_compte) { |
| 598 | - $urlzoom = DOL_URL_ROOT . '/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start=' . urlencode($line->numero_compte) . '&search_accountancy_code_end=' . urlencode($line->numero_compte); |
|
| 598 | + $urlzoom = DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?search_accountancy_code_start='.urlencode($line->numero_compte).'&search_accountancy_code_end='.urlencode($line->numero_compte); |
|
| 599 | 599 | if (GETPOSTISSET('date_startmonth')) { |
| 600 | - $urlzoom .= '&search_date_startmonth=' . GETPOST('date_startmonth', 'int') . '&search_date_startday=' . GETPOST('date_startday', 'int') . '&search_date_startyear=' . GETPOST('date_startyear', 'int'); |
|
| 600 | + $urlzoom .= '&search_date_startmonth='.GETPOST('date_startmonth', 'int').'&search_date_startday='.GETPOST('date_startday', 'int').'&search_date_startyear='.GETPOST('date_startyear', 'int'); |
|
| 601 | 601 | } |
| 602 | 602 | if (GETPOSTISSET('date_endmonth')) { |
| 603 | - $urlzoom .= '&search_date_endmonth=' . GETPOST('date_endmonth', 'int') . '&search_date_endday=' . GETPOST('date_endday', 'int') . '&search_date_endyear=' . GETPOST('date_endyear', 'int'); |
|
| 603 | + $urlzoom .= '&search_date_endmonth='.GETPOST('date_endmonth', 'int').'&search_date_endday='.GETPOST('date_endday', 'int').'&search_date_endyear='.GETPOST('date_endyear', 'int'); |
|
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | print '<td class="right nowraponall amount">'.price(price2num($sous_total_debit, 'MT')).'</td>'; |
| 644 | 644 | print '<td class="right nowraponall amount">'.price(price2num($sous_total_credit, 'MT')).'</td>'; |
| 645 | 645 | if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) { |
| 646 | - print '<td class="right nowraponall amount">' . price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')) . '</td>'; |
|
| 646 | + print '<td class="right nowraponall amount">'.price(price2num($sous_total_opening_balance + $sous_total_debit - $sous_total_credit, 'MT')).'</td>'; |
|
| 647 | 647 | } else { |
| 648 | - print '<td class="right nowraponall amount">' . price(price2num($sous_total_debit - $sous_total_credit, 'MT')) . '</td>'; |
|
| 648 | + print '<td class="right nowraponall amount">'.price(price2num($sous_total_debit - $sous_total_credit, 'MT')).'</td>'; |
|
| 649 | 649 | } |
| 650 | 650 | // Action column |
| 651 | 651 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
@@ -666,9 +666,9 @@ discard block |
||
| 666 | 666 | print '<td class="right nowraponall amount">'.price(price2num($total_debit, 'MT')).'</td>'; |
| 667 | 667 | print '<td class="right nowraponall amount">'.price(price2num($total_credit, 'MT')).'</td>'; |
| 668 | 668 | if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) { |
| 669 | - print '<td class="right nowraponall amount">' . price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')) . '</td>'; |
|
| 669 | + print '<td class="right nowraponall amount">'.price(price2num($total_opening_balance + $total_debit - $total_credit, 'MT')).'</td>'; |
|
| 670 | 670 | } else { |
| 671 | - print '<td class="right nowraponall amount">' . price(price2num($total_debit - $total_credit, 'MT')) . '</td>'; |
|
| 671 | + print '<td class="right nowraponall amount">'.price(price2num($total_debit - $total_credit, 'MT')).'</td>'; |
|
| 672 | 672 | } |
| 673 | 673 | // Action column |
| 674 | 674 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
| 683 | 683 | print "<td></td>\n"; |
| 684 | 684 | } |
| 685 | - print '<td class="right">' . $langs->trans("AccountingResult") . ':</td>'; |
|
| 685 | + print '<td class="right">'.$langs->trans("AccountingResult").':</td>'; |
|
| 686 | 686 | if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) { |
| 687 | 687 | print '<td></td>'; |
| 688 | 688 | } |
@@ -695,8 +695,8 @@ discard block |
||
| 695 | 695 | $accountingResultCredit = price(price2num($accountingResult, 'MT')); |
| 696 | 696 | $accountingResultClassCSS = ' green'; |
| 697 | 697 | } |
| 698 | - print '<td class="right nowraponall amount' . $accountingResultClassCSS . '">' . $accountingResultDebit . '</td>'; |
|
| 699 | - print '<td class="right nowraponall amount' . $accountingResultClassCSS . '">' . $accountingResultCredit . '</td>'; |
|
| 698 | + print '<td class="right nowraponall amount'.$accountingResultClassCSS.'">'.$accountingResultDebit.'</td>'; |
|
| 699 | + print '<td class="right nowraponall amount'.$accountingResultClassCSS.'">'.$accountingResultCredit.'</td>'; |
|
| 700 | 700 | |
| 701 | 701 | print '<td></td>'; |
| 702 | 702 | if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | if (empty($this->piece_num)) { |
| 373 | 373 | $sqlnum = "SELECT MAX(piece_num)+1 as maxpiecenum"; |
| 374 | 374 | $sqlnum .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
| 375 | - $sqlnum .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 375 | + $sqlnum .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 376 | 376 | |
| 377 | 377 | $resqlnum = $this->db->query($sqlnum); |
| 378 | 378 | if ($resqlnum) { |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); |
| 555 | 555 | |
| 556 | 556 | global $action; |
| 557 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 557 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 558 | 558 | $parameters = array('id'=>$this->id, 'getnomurl' => &$result); |
| 559 | 559 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 560 | 560 | if ($reshook > 0) { |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | $sql .= " t.date_validated as date_validation"; |
| 803 | 803 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.$mode.' as t'; |
| 804 | 804 | $sql .= ' WHERE 1 = 1'; |
| 805 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 805 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 806 | 806 | if (null !== $ref) { |
| 807 | 807 | $sql .= " AND t.rowid = ".((int) $ref); |
| 808 | 808 | } else { |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | } |
| 954 | 954 | } |
| 955 | 955 | $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
| 956 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 956 | + $sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 957 | 957 | if (count($sqlwhere) > 0) { |
| 958 | 958 | $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); |
| 959 | 959 | } |
@@ -1120,7 +1120,7 @@ discard block |
||
| 1120 | 1120 | } |
| 1121 | 1121 | } |
| 1122 | 1122 | } |
| 1123 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1123 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1124 | 1124 | if ($showAlreadyExportMovements == 0) { |
| 1125 | 1125 | $sql .= " AND t.date_export IS NULL"; |
| 1126 | 1126 | } |
@@ -1246,7 +1246,7 @@ discard block |
||
| 1246 | 1246 | } |
| 1247 | 1247 | } |
| 1248 | 1248 | } |
| 1249 | - $sql .= ' WHERE entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1249 | + $sql .= ' WHERE entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1250 | 1250 | if (count($sqlwhere) > 0) { |
| 1251 | 1251 | $sql .= " AND ".implode(" ".$filtermode." ", $sqlwhere); |
| 1252 | 1252 | } |
@@ -1624,7 +1624,7 @@ discard block |
||
| 1624 | 1624 | if (!empty($journal)) { |
| 1625 | 1625 | $sql .= " AND code_journal = '".$this->db->escape($journal)."'"; |
| 1626 | 1626 | } |
| 1627 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1627 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1628 | 1628 | // Exclusion of validated entries at the time of deletion |
| 1629 | 1629 | $sql .= " AND date_validated IS NULL"; |
| 1630 | 1630 | $sql .= $sql_filter; |
@@ -1669,8 +1669,8 @@ discard block |
||
| 1669 | 1669 | $sql = "DELETE"; |
| 1670 | 1670 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
| 1671 | 1671 | $sql .= " WHERE piece_num = ".(int) $piecenum; |
| 1672 | - $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
| 1673 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1672 | + $sql .= " AND date_validated IS NULL"; // For security, exclusion of validated entries at the time of deletion |
|
| 1673 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1674 | 1674 | $sql .= $sql_filter; |
| 1675 | 1675 | |
| 1676 | 1676 | $resql = $this->db->query($sql); |
@@ -1793,7 +1793,7 @@ discard block |
||
| 1793 | 1793 | } |
| 1794 | 1794 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
| 1795 | 1795 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
| 1796 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1796 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1797 | 1797 | |
| 1798 | 1798 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 1799 | 1799 | $result = $this->db->query($sql); |
@@ -1832,7 +1832,7 @@ discard block |
||
| 1832 | 1832 | global $conf; |
| 1833 | 1833 | |
| 1834 | 1834 | $sql = "SELECT MAX(piece_num)+1 as max FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
| 1835 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1835 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1836 | 1836 | |
| 1837 | 1837 | dol_syslog(get_class($this)."::getNextNumMvt", LOG_DEBUG); |
| 1838 | 1838 | |
@@ -1876,7 +1876,7 @@ discard block |
||
| 1876 | 1876 | } |
| 1877 | 1877 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element.$mode; |
| 1878 | 1878 | $sql .= " WHERE piece_num = ".((int) $piecenum); |
| 1879 | - $sql .= " AND entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1879 | + $sql .= " AND entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1880 | 1880 | |
| 1881 | 1881 | dol_syslog(__METHOD__, LOG_DEBUG); |
| 1882 | 1882 | $result = $this->db->query($sql); |
@@ -1941,7 +1941,7 @@ discard block |
||
| 1941 | 1941 | $sql .= " montant as amount, sens, fk_user_author, import_key, code_journal, piece_num,"; |
| 1942 | 1942 | $sql .= " date_validated as date_validation"; |
| 1943 | 1943 | $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; |
| 1944 | - $sql .= " WHERE entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1944 | + $sql .= " WHERE entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 1945 | 1945 | |
| 1946 | 1946 | dol_syslog(get_class($this)."::export_bookkeeping", LOG_DEBUG); |
| 1947 | 1947 | |
@@ -2018,7 +2018,7 @@ discard block |
||
| 2018 | 2018 | |
| 2019 | 2019 | if (!$error) { |
| 2020 | 2020 | // Delete if there is an empty line |
| 2021 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0"; |
|
| 2021 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity)." AND numero_compte IS NULL AND debit = 0 AND credit = 0"; |
|
| 2022 | 2022 | $resql = $this->db->query($sql); |
| 2023 | 2023 | if (!$resql) { |
| 2024 | 2024 | $error++; |
@@ -2036,7 +2036,7 @@ discard block |
||
| 2036 | 2036 | $sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,'; |
| 2037 | 2037 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
| 2038 | 2038 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.((int) $next_piecenum).", '".$this->db->idate($now)."'"; |
| 2039 | - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = ' .((int) $conf->entity); |
|
| 2039 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND numero_compte IS NOT NULL AND entity = '.((int) $conf->entity); |
|
| 2040 | 2040 | $sql .= $sql_filter; |
| 2041 | 2041 | $resql = $this->db->query($sql); |
| 2042 | 2042 | if (!$resql) { |
@@ -2047,7 +2047,7 @@ discard block |
||
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | 2049 | if (!$error) { |
| 2050 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
| 2050 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
| 2051 | 2051 | $resql = $this->db->query($sql); |
| 2052 | 2052 | if (!$resql) { |
| 2053 | 2053 | $error++; |
@@ -2057,7 +2057,7 @@ discard block |
||
| 2057 | 2057 | } |
| 2058 | 2058 | } elseif ($direction == 1) { |
| 2059 | 2059 | if (!$error) { |
| 2060 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
| 2060 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
| 2061 | 2061 | $resql = $this->db->query($sql); |
| 2062 | 2062 | if (!$resql) { |
| 2063 | 2063 | $error++; |
@@ -2075,7 +2075,7 @@ discard block |
||
| 2075 | 2075 | $sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,'; |
| 2076 | 2076 | $sql .= ' numero_compte, label_compte, label_operation, debit, credit,'; |
| 2077 | 2077 | $sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num'; |
| 2078 | - $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
| 2078 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
| 2079 | 2079 | $sql .= $sql_filter; |
| 2080 | 2080 | $resql = $this->db->query($sql); |
| 2081 | 2081 | if (!$resql) { |
@@ -2086,7 +2086,7 @@ discard block |
||
| 2086 | 2086 | } |
| 2087 | 2087 | |
| 2088 | 2088 | if (!$error) { |
| 2089 | - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = ' .((int) $conf->entity); |
|
| 2089 | + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.$this->table_element.'_tmp WHERE piece_num = '.((int) $piece_num).' AND entity = '.((int) $conf->entity); |
|
| 2090 | 2090 | $sql .= $sql_filter; |
| 2091 | 2091 | $resql = $this->db->query($sql); |
| 2092 | 2092 | if (!$resql) { |
@@ -2143,7 +2143,7 @@ discard block |
||
| 2143 | 2143 | $sql .= " AND aa.active = 1"; |
| 2144 | 2144 | $sql .= " INNER JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version"; |
| 2145 | 2145 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
| 2146 | - $sql .= " AND ab.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2146 | + $sql .= " AND ab.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2147 | 2147 | $sql .= " ORDER BY account_number ASC"; |
| 2148 | 2148 | |
| 2149 | 2149 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
@@ -2207,7 +2207,7 @@ discard block |
||
| 2207 | 2207 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as parent ON aa.account_parent = parent.rowid AND parent.active = 1"; |
| 2208 | 2208 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_account as root ON parent.account_parent = root.rowid AND root.active = 1"; |
| 2209 | 2209 | $sql .= " WHERE aa.account_number = '".$this->db->escape($account)."'"; |
| 2210 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2210 | + $sql .= " AND aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2211 | 2211 | |
| 2212 | 2212 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
| 2213 | 2213 | $resql = $this->db->query($sql); |
@@ -2247,7 +2247,7 @@ discard block |
||
| 2247 | 2247 | $sql .= " AND asy.rowid = ".((int) $pcgver); |
| 2248 | 2248 | $sql .= " AND aa.active = 1"; |
| 2249 | 2249 | $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as cat ON aa.fk_accounting_category = cat.rowid"; |
| 2250 | - $sql .= " WHERE aa.entity = " . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2250 | + $sql .= " WHERE aa.entity = ".((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2251 | 2251 | |
| 2252 | 2252 | dol_syslog(get_class($this)."::select_account", LOG_DEBUG); |
| 2253 | 2253 | $resql = $this->db->query($sql); |
@@ -2280,7 +2280,7 @@ discard block |
||
| 2280 | 2280 | global $conf; |
| 2281 | 2281 | |
| 2282 | 2282 | $alias = trim($alias); |
| 2283 | - $alias = !empty($alias) && strpos($alias, '.') < 0 ? $alias . "." : $alias; |
|
| 2283 | + $alias = !empty($alias) && strpos($alias, '.') < 0 ? $alias."." : $alias; |
|
| 2284 | 2284 | |
| 2285 | 2285 | if (!isset(self::$can_modify_bookkeeping_sql_cached[$alias]) || $force) { |
| 2286 | 2286 | $result = $this->loadFiscalPeriods($force, 'active'); |
@@ -2291,10 +2291,10 @@ discard block |
||
| 2291 | 2291 | $sql_list = array(); |
| 2292 | 2292 | if (!empty($conf->cache['active_fiscal_period_cached']) && is_array($conf->cache['active_fiscal_period_cached'])) { |
| 2293 | 2293 | foreach ($conf->cache['active_fiscal_period_cached'] as $fiscal_period) { |
| 2294 | - $sql_list[] = "('" . $this->db->idate($fiscal_period['date_start']) . "' <= {$alias}doc_date AND {$alias}doc_date <= '" . $this->db->idate($fiscal_period['date_end']) . "')"; |
|
| 2294 | + $sql_list[] = "('".$this->db->idate($fiscal_period['date_start'])."' <= {$alias}doc_date AND {$alias}doc_date <= '".$this->db->idate($fiscal_period['date_end'])."')"; |
|
| 2295 | 2295 | } |
| 2296 | 2296 | } |
| 2297 | - self::$can_modify_bookkeeping_sql_cached[$alias] = !empty($sql_list) ? ' AND (' . implode(' OR ', $sql_list) . ')' : ''; |
|
| 2297 | + self::$can_modify_bookkeeping_sql_cached[$alias] = !empty($sql_list) ? ' AND ('.implode(' OR ', $sql_list).')' : ''; |
|
| 2298 | 2298 | } |
| 2299 | 2299 | |
| 2300 | 2300 | return self::$can_modify_bookkeeping_sql_cached[$alias]; |
@@ -2414,8 +2414,8 @@ discard block |
||
| 2414 | 2414 | if ($mode == 'active') { |
| 2415 | 2415 | if (!isset($conf->cache['active_fiscal_period_cached']) || $force) { |
| 2416 | 2416 | $sql = "SELECT date_start, date_end"; |
| 2417 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
| 2418 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
| 2417 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
| 2418 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
| 2419 | 2419 | $sql .= " AND statut = 0"; |
| 2420 | 2420 | |
| 2421 | 2421 | $resql = $this->db->query($sql); |
@@ -2437,8 +2437,8 @@ discard block |
||
| 2437 | 2437 | if ($mode == 'closed') { |
| 2438 | 2438 | if (!isset($conf->cache['closed_fiscal_period_cached']) || $force) { |
| 2439 | 2439 | $sql = "SELECT date_start, date_end"; |
| 2440 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
| 2441 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
| 2440 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
| 2441 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
| 2442 | 2442 | $sql .= " AND statut = 1"; |
| 2443 | 2443 | |
| 2444 | 2444 | $resql = $this->db->query($sql); |
@@ -2473,10 +2473,10 @@ discard block |
||
| 2473 | 2473 | $list = array(); |
| 2474 | 2474 | |
| 2475 | 2475 | $sql = "SELECT rowid, label, date_start, date_end, statut"; |
| 2476 | - $sql .= " FROM " . $this->db->prefix() . "accounting_fiscalyear"; |
|
| 2477 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
| 2476 | + $sql .= " FROM ".$this->db->prefix()."accounting_fiscalyear"; |
|
| 2477 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
| 2478 | 2478 | if (!empty($filter)) { |
| 2479 | - $sql .= " AND (" . $filter . ')'; |
|
| 2479 | + $sql .= " AND (".$filter.')'; |
|
| 2480 | 2480 | } |
| 2481 | 2481 | $sql .= $this->db->order('date_start', 'ASC'); |
| 2482 | 2482 | |
@@ -2513,13 +2513,13 @@ discard block |
||
| 2513 | 2513 | |
| 2514 | 2514 | $sql = "SELECT YEAR(b.doc_date) as year"; |
| 2515 | 2515 | for ($i = 1; $i <= 12; $i++) { |
| 2516 | - $sql .= ", SUM(" . $this->db->ifsql("MONTH(b.doc_date)=" . $i, "1", "0") . ") AS month" . $i; |
|
| 2516 | + $sql .= ", SUM(".$this->db->ifsql("MONTH(b.doc_date)=".$i, "1", "0").") AS month".$i; |
|
| 2517 | 2517 | } |
| 2518 | 2518 | $sql .= ", COUNT(b.rowid) as total"; |
| 2519 | - $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_bookkeeping as b"; |
|
| 2520 | - $sql .= " WHERE b.doc_date >= '" . $this->db->idate($date_start) . "'"; |
|
| 2521 | - $sql .= " AND b.doc_date <= '" . $this->db->idate($date_end) . "'"; |
|
| 2522 | - $sql .= " AND b.entity IN (" . getEntity('bookkeeping', 0) . ")"; // We don't share object for accountancy |
|
| 2519 | + $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b"; |
|
| 2520 | + $sql .= " WHERE b.doc_date >= '".$this->db->idate($date_start)."'"; |
|
| 2521 | + $sql .= " AND b.doc_date <= '".$this->db->idate($date_end)."'"; |
|
| 2522 | + $sql .= " AND b.entity IN (".getEntity('bookkeeping', 0).")"; // We don't share object for accountancy |
|
| 2523 | 2523 | |
| 2524 | 2524 | // Get count for each month into the fiscal period |
| 2525 | 2525 | if (getDolGlobalString("ACCOUNTANCY_DISABLE_CLOSURE_LINE_BY_LINE")) { |
@@ -2549,7 +2549,7 @@ discard block |
||
| 2549 | 2549 | 'total' => (int) $obj->total, |
| 2550 | 2550 | ); |
| 2551 | 2551 | for ($i = 1; $i <= 12; $i++) { |
| 2552 | - $year_list['count'][$i] = (int) $obj->{'month' . $i}; |
|
| 2552 | + $year_list['count'][$i] = (int) $obj->{'month'.$i}; |
|
| 2553 | 2553 | } |
| 2554 | 2554 | |
| 2555 | 2555 | $list[] = $year_list; |
@@ -2577,11 +2577,11 @@ discard block |
||
| 2577 | 2577 | $now = dol_now(); |
| 2578 | 2578 | |
| 2579 | 2579 | // Specify as export : update field date_validated on selected month/year |
| 2580 | - $sql = " UPDATE " . MAIN_DB_PREFIX . "accounting_bookkeeping"; |
|
| 2581 | - $sql .= " SET date_validated = '" . $this->db->idate($now) . "'"; |
|
| 2582 | - $sql .= " WHERE entity = " . ((int) $conf->entity); |
|
| 2583 | - $sql .= " AND DATE(doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
| 2584 | - $sql .= " AND DATE(doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
| 2580 | + $sql = " UPDATE ".MAIN_DB_PREFIX."accounting_bookkeeping"; |
|
| 2581 | + $sql .= " SET date_validated = '".$this->db->idate($now)."'"; |
|
| 2582 | + $sql .= " WHERE entity = ".((int) $conf->entity); |
|
| 2583 | + $sql .= " AND DATE(doc_date) >= '".$this->db->idate($date_start)."'"; |
|
| 2584 | + $sql .= " AND DATE(doc_date) <= '".$this->db->idate($date_end)."'"; |
|
| 2585 | 2585 | $sql .= " AND date_validated IS NULL"; |
| 2586 | 2586 | |
| 2587 | 2587 | dol_syslog(__METHOD__, LOG_DEBUG); |
@@ -2613,27 +2613,27 @@ discard block |
||
| 2613 | 2613 | $accounting_groups_used_for_income_statement = array_filter(array_map('trim', explode(',', getDolGlobalString('ACCOUNTING_CLOSURE_ACCOUNTING_GROUPS_USED_FOR_INCOME_STATEMENT'))), 'strlen'); |
| 2614 | 2614 | |
| 2615 | 2615 | foreach ($accounting_groups_used_for_income_statement as $item) { |
| 2616 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
| 2616 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
| 2617 | 2617 | } |
| 2618 | 2618 | |
| 2619 | 2619 | $sql = 'SELECT'; |
| 2620 | 2620 | $sql .= " t.numero_compte,"; |
| 2621 | 2621 | $sql .= " aa.pcg_type,"; |
| 2622 | 2622 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as accounting_result"; |
| 2623 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
| 2624 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
| 2625 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2626 | - $sql .= " AND aa.entity = " . ((int) $conf->entity); |
|
| 2627 | - $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM ' . MAIN_DB_PREFIX . 'accounting_system WHERE rowid = ' . ((int) getDolGlobalInt('CHARTOFACCOUNTS')) . ')'; |
|
| 2628 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
| 2629 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
| 2630 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
| 2623 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
| 2624 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
| 2625 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2626 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
| 2627 | + $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
|
| 2628 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
| 2629 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
| 2630 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
| 2631 | 2631 | $sql .= ' GROUP BY t.numero_compte, aa.pcg_type'; |
| 2632 | 2632 | |
| 2633 | 2633 | $resql = $this->db->query($sql); |
| 2634 | 2634 | if (!$resql) { |
| 2635 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
| 2636 | - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); |
|
| 2635 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
| 2636 | + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); |
|
| 2637 | 2637 | } else { |
| 2638 | 2638 | while ($obj = $this->db->fetch_object($resql)) { |
| 2639 | 2639 | $income_statement_amount += $obj->accounting_result; |
@@ -2672,7 +2672,7 @@ discard block |
||
| 2672 | 2672 | return -1; |
| 2673 | 2673 | } elseif (empty($fiscal_period->id)) { |
| 2674 | 2674 | $langs->loadLangs(array('errors', 'compta')); |
| 2675 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
| 2675 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
| 2676 | 2676 | return -1; |
| 2677 | 2677 | } |
| 2678 | 2678 | |
@@ -2691,7 +2691,7 @@ discard block |
||
| 2691 | 2691 | return -1; |
| 2692 | 2692 | } elseif (empty($new_fiscal_period->id)) { |
| 2693 | 2693 | $langs->loadLangs(array('errors', 'compta')); |
| 2694 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
| 2694 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
| 2695 | 2695 | return -1; |
| 2696 | 2696 | } |
| 2697 | 2697 | |
@@ -2711,7 +2711,7 @@ discard block |
||
| 2711 | 2711 | $journal_id = max(0, getDolGlobalString('ACCOUNTING_CLOSURE_DEFAULT_JOURNAL')); |
| 2712 | 2712 | if (empty($journal_id)) { |
| 2713 | 2713 | $langs->loadLangs(array('errors', 'accountancy')); |
| 2714 | - $this->errors[] = $langs->trans('ErrorBadParameters') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
| 2714 | + $this->errors[] = $langs->trans('ErrorBadParameters').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
| 2715 | 2715 | $error++; |
| 2716 | 2716 | } |
| 2717 | 2717 | |
@@ -2725,7 +2725,7 @@ discard block |
||
| 2725 | 2725 | $error++; |
| 2726 | 2726 | } elseif ($result == 0) { |
| 2727 | 2727 | $langs->loadLangs(array('errors', 'accountancy')); |
| 2728 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('Codejournal') . ' (' . $langs->trans('AccountingJournalType9') . ')'; |
|
| 2728 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('Codejournal').' ('.$langs->trans('AccountingJournalType9').')'; |
|
| 2729 | 2729 | $error++; |
| 2730 | 2730 | } |
| 2731 | 2731 | } |
@@ -2737,7 +2737,7 @@ discard block |
||
| 2737 | 2737 | $pcg_type_filter = array(); |
| 2738 | 2738 | $tmp = array_merge($accounting_groups_used_for_balance_sheet_account, $accounting_groups_used_for_income_statement); |
| 2739 | 2739 | foreach ($tmp as $item) { |
| 2740 | - $pcg_type_filter[] = "'" . $this->db->escape($item) . "'"; |
|
| 2740 | + $pcg_type_filter[] = "'".$this->db->escape($item)."'"; |
|
| 2741 | 2741 | } |
| 2742 | 2742 | |
| 2743 | 2743 | $sql = 'SELECT'; |
@@ -2749,14 +2749,14 @@ discard block |
||
| 2749 | 2749 | } |
| 2750 | 2750 | $sql .= " aa.pcg_type,"; |
| 2751 | 2751 | $sql .= " (SUM(t.credit) - SUM(t.debit)) as opening_balance"; |
| 2752 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
| 2753 | - $sql .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
| 2754 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2755 | - $sql .= " AND aa.entity = ". ((int) $conf->entity); |
|
| 2752 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
| 2753 | + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'accounting_account as aa ON aa.account_number = t.numero_compte'; |
|
| 2754 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2755 | + $sql .= " AND aa.entity = ".((int) $conf->entity); |
|
| 2756 | 2756 | $sql .= ' AND aa.fk_pcg_version IN (SELECT pcg_version FROM '.MAIN_DB_PREFIX.'accounting_system WHERE rowid = '.((int) getDolGlobalInt('CHARTOFACCOUNTS')).')'; |
| 2757 | - $sql .= ' AND aa.pcg_type IN (' . $this->db->sanitize(implode(',', $pcg_type_filter), 1) . ')'; |
|
| 2758 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
| 2759 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
| 2757 | + $sql .= ' AND aa.pcg_type IN ('.$this->db->sanitize(implode(',', $pcg_type_filter), 1).')'; |
|
| 2758 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
| 2759 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
| 2760 | 2760 | $sql .= ' GROUP BY t.numero_compte, t.label_compte, aa.pcg_type'; |
| 2761 | 2761 | if ($separate_auxiliary_account) { |
| 2762 | 2762 | $sql .= ' ,t.subledger_account, t.subledger_label'; |
@@ -2765,8 +2765,8 @@ discard block |
||
| 2765 | 2765 | |
| 2766 | 2766 | $resql = $this->db->query($sql); |
| 2767 | 2767 | if (!$resql) { |
| 2768 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
| 2769 | - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); |
|
| 2768 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
| 2769 | + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); |
|
| 2770 | 2770 | |
| 2771 | 2771 | $error++; |
| 2772 | 2772 | } else { |
@@ -2908,7 +2908,7 @@ discard block |
||
| 2908 | 2908 | return -1; |
| 2909 | 2909 | } elseif (empty($fiscal_period->id)) { |
| 2910 | 2910 | $langs->loadLangs(array('errors', 'compta')); |
| 2911 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $fiscal_period_id . ')'; |
|
| 2911 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$fiscal_period_id.')'; |
|
| 2912 | 2912 | return -1; |
| 2913 | 2913 | } |
| 2914 | 2914 | |
@@ -2927,7 +2927,7 @@ discard block |
||
| 2927 | 2927 | return -1; |
| 2928 | 2928 | } elseif (empty($new_fiscal_period->id)) { |
| 2929 | 2929 | $langs->loadLangs(array('errors', 'compta')); |
| 2930 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('FiscalPeriod') . ' (' . $new_fiscal_period_id . ')'; |
|
| 2930 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('FiscalPeriod').' ('.$new_fiscal_period_id.')'; |
|
| 2931 | 2931 | return -1; |
| 2932 | 2932 | } |
| 2933 | 2933 | |
@@ -2947,7 +2947,7 @@ discard block |
||
| 2947 | 2947 | return -1; |
| 2948 | 2948 | } elseif ($result == 0) { |
| 2949 | 2949 | $langs->loadLangs(array('errors', 'accountancy')); |
| 2950 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('InventoryJournal'); |
|
| 2950 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('InventoryJournal'); |
|
| 2951 | 2951 | return -1; |
| 2952 | 2952 | } |
| 2953 | 2953 | |
@@ -2955,18 +2955,18 @@ discard block |
||
| 2955 | 2955 | $this->db->begin(); |
| 2956 | 2956 | |
| 2957 | 2957 | $sql = 'SELECT t.rowid'; |
| 2958 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
| 2959 | - $sql .= ' WHERE t.entity = ' . ((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2960 | - $sql .= " AND code_journal = '" . $this->db->escape($inventory_journal->code) . "'"; |
|
| 2961 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($date_start) . "'"; |
|
| 2962 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($date_end) . "'"; |
|
| 2963 | - $sql .= " AND DATE(t.doc_date) >= '" . $this->db->idate($fiscal_period->date_start) . "'"; |
|
| 2964 | - $sql .= " AND DATE(t.doc_date) <= '" . $this->db->idate($fiscal_period->date_end) . "'"; |
|
| 2958 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
| 2959 | + $sql .= ' WHERE t.entity = '.((int) $conf->entity); // Do not use getEntity for accounting features |
|
| 2960 | + $sql .= " AND code_journal = '".$this->db->escape($inventory_journal->code)."'"; |
|
| 2961 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($date_start)."'"; |
|
| 2962 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($date_end)."'"; |
|
| 2963 | + $sql .= " AND DATE(t.doc_date) >= '".$this->db->idate($fiscal_period->date_start)."'"; |
|
| 2964 | + $sql .= " AND DATE(t.doc_date) <= '".$this->db->idate($fiscal_period->date_end)."'"; |
|
| 2965 | 2965 | |
| 2966 | 2966 | $resql = $this->db->query($sql); |
| 2967 | 2967 | if (!$resql) { |
| 2968 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
| 2969 | - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); |
|
| 2968 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
| 2969 | + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); |
|
| 2970 | 2970 | |
| 2971 | 2971 | $error++; |
| 2972 | 2972 | } else { |
@@ -2981,7 +2981,7 @@ discard block |
||
| 2981 | 2981 | break; |
| 2982 | 2982 | } elseif ($result == 0) { |
| 2983 | 2983 | $langs->loadLangs(array('errors', 'accountancy')); |
| 2984 | - $this->errors[] = $langs->trans('ErrorRecordNotFound') . ' - ' . $langs->trans('LineId') . ': ' . $obj->rowid; |
|
| 2984 | + $this->errors[] = $langs->trans('ErrorRecordNotFound').' - '.$langs->trans('LineId').': '.$obj->rowid; |
|
| 2985 | 2985 | $error++; |
| 2986 | 2986 | break; |
| 2987 | 2987 | } |
@@ -26,7 +26,7 @@ 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'; |
|
| 29 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; |
|
| 30 | 30 | //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; |
| 31 | 31 | //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; |
| 32 | 32 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. |
| 104 | 104 | */ |
| 105 | - public $fields=array( |
|
| 105 | + public $fields = array( |
|
| 106 | 106 | 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'index'=>1, 'css'=>'left', 'comment'=>"Id"), |
| 107 | 107 | //'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"), |
| 108 | 108 | 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,), |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | // Clear fields |
| 270 | 270 | if (property_exists($object, 'ref')) { |
| 271 | - $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_" . $object->ref : $this->fields['ref']['default']; |
|
| 271 | + $object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default']; |
|
| 272 | 272 | } |
| 273 | 273 | if (property_exists($object, 'label')) { |
| 274 | - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf") . " " . $object->label : $this->fields['label']['default']; |
|
| 274 | + $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; |
|
| 275 | 275 | } |
| 276 | 276 | if (property_exists($object, 'status')) { |
| 277 | 277 | $object->status = self::STATUS_DRAFT; |
@@ -383,9 +383,9 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | $sql = 'SELECT '; |
| 385 | 385 | $sql .= $this->getFieldList('t'); |
| 386 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
| 386 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
| 387 | 387 | if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { |
| 388 | - $sql .= ' WHERE t.entity IN (' . getEntity($this->element) . ')'; |
|
| 388 | + $sql .= ' WHERE t.entity IN ('.getEntity($this->element).')'; |
|
| 389 | 389 | } else { |
| 390 | 390 | $sql .= ' WHERE 1 = 1'; |
| 391 | 391 | } |
@@ -394,15 +394,15 @@ discard block |
||
| 394 | 394 | if (count($filter) > 0) { |
| 395 | 395 | foreach ($filter as $key => $value) { |
| 396 | 396 | if ($key == 't.rowid') { |
| 397 | - $sqlwhere[] = $key . '=' . $value; |
|
| 397 | + $sqlwhere[] = $key.'='.$value; |
|
| 398 | 398 | } elseif ($key == 'customsql') { |
| 399 | 399 | $sqlwhere[] = $value; |
| 400 | 400 | } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { |
| 401 | - $sqlwhere[] = $key . ' = \'' . $this->db->idate($value) . '\''; |
|
| 401 | + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; |
|
| 402 | 402 | } elseif (strpos($value, '%') === false) { |
| 403 | - $sqlwhere[] = $key . ' IN (' . $this->db->sanitize($this->db->escape($value)) . ')'; |
|
| 403 | + $sqlwhere[] = $key.' IN ('.$this->db->sanitize($this->db->escape($value)).')'; |
|
| 404 | 404 | } else { |
| 405 | - $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; |
|
| 405 | + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; |
|
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | } |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | $sql .= $this->db->order($sortfield, $sortorder); |
| 415 | 415 | } |
| 416 | 416 | if (!empty($limit)) { |
| 417 | - $sql .= ' ' . $this->db->plimit($limit, $offset); |
|
| 417 | + $sql .= ' '.$this->db->plimit($limit, $offset); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | $resql = $this->db->query($sql); |
@@ -435,8 +435,8 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | return $records; |
| 437 | 437 | } else { |
| 438 | - $this->errors[] = 'Error ' . $this->db->lasterror(); |
|
| 439 | - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); |
|
| 438 | + $this->errors[] = 'Error '.$this->db->lasterror(); |
|
| 439 | + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); |
|
| 440 | 440 | |
| 441 | 441 | return -1; |
| 442 | 442 | } |
@@ -497,13 +497,13 @@ discard block |
||
| 497 | 497 | { |
| 498 | 498 | global $conf, $langs; |
| 499 | 499 | |
| 500 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 500 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 501 | 501 | |
| 502 | 502 | $error = 0; |
| 503 | 503 | |
| 504 | 504 | // Protection |
| 505 | 505 | if ($this->status == self::STATUS_VALIDATED) { |
| 506 | - dol_syslog(get_class($this) . "::validate action abandoned: already validated", LOG_WARNING); |
|
| 506 | + dol_syslog(get_class($this)."::validate action abandoned: already validated", LOG_WARNING); |
|
| 507 | 507 | return 0; |
| 508 | 508 | } |
| 509 | 509 | |
@@ -529,18 +529,18 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | if (!empty($num)) { |
| 531 | 531 | // Validate |
| 532 | - $sql = "UPDATE " . MAIN_DB_PREFIX . $this->table_element; |
|
| 533 | - $sql .= " SET ref = '" . $this->db->escape($num) . "',"; |
|
| 534 | - $sql .= " status = " . self::STATUS_VALIDATED; |
|
| 532 | + $sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element; |
|
| 533 | + $sql .= " SET ref = '".$this->db->escape($num)."',"; |
|
| 534 | + $sql .= " status = ".self::STATUS_VALIDATED; |
|
| 535 | 535 | if (!empty($this->fields['date_validation'])) { |
| 536 | - $sql .= ", date_validation = '" . $this->db->idate($now) . "'"; |
|
| 536 | + $sql .= ", date_validation = '".$this->db->idate($now)."'"; |
|
| 537 | 537 | } |
| 538 | 538 | if (!empty($this->fields['fk_user_valid'])) { |
| 539 | - $sql .= ", fk_user_valid = " . ((int) $user->id); |
|
| 539 | + $sql .= ", fk_user_valid = ".((int) $user->id); |
|
| 540 | 540 | } |
| 541 | - $sql .= " WHERE rowid = " . ((int) $this->id); |
|
| 541 | + $sql .= " WHERE rowid = ".((int) $this->id); |
|
| 542 | 542 | |
| 543 | - dol_syslog(get_class($this) . "::validate()", LOG_DEBUG); |
|
| 543 | + dol_syslog(get_class($this)."::validate()", LOG_DEBUG); |
|
| 544 | 544 | $resql = $this->db->query($sql); |
| 545 | 545 | if (!$resql) { |
| 546 | 546 | dol_print_error($this->db); |
@@ -564,8 +564,8 @@ discard block |
||
| 564 | 564 | // Rename directory if dir was a temporary ref |
| 565 | 565 | if (preg_match('/^[\(]?PROV/i', $this->ref)) { |
| 566 | 566 | // Now we rename also files into index |
| 567 | - $sql = 'UPDATE ' . MAIN_DB_PREFIX . "ecm_files set filename = CONCAT('" . $this->db->escape($this->newref) . "', SUBSTR(filename, " . (strlen($this->ref) + 1) . ")), filepath = 'position/" . $this->db->escape($this->newref) . "'"; |
|
| 568 | - $sql .= " WHERE filename LIKE '" . $this->db->escape($this->ref) . "%' AND filepath = 'position/" . $this->db->escape($this->ref) . "' and entity = " . $conf->entity; |
|
| 567 | + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'position/".$this->db->escape($this->newref)."'"; |
|
| 568 | + $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'position/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; |
|
| 569 | 569 | $resql = $this->db->query($sql); |
| 570 | 570 | if (!$resql) { |
| 571 | 571 | $error++; |
@@ -582,20 +582,20 @@ discard block |
||
| 582 | 582 | // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments |
| 583 | 583 | $oldref = dol_sanitizeFileName($this->ref); |
| 584 | 584 | $newref = dol_sanitizeFileName($num); |
| 585 | - $dirsource = $conf->hrm->dir_output . '/position/' . $oldref; |
|
| 586 | - $dirdest = $conf->hrm->dir_output . '/position/' . $newref; |
|
| 585 | + $dirsource = $conf->hrm->dir_output.'/position/'.$oldref; |
|
| 586 | + $dirdest = $conf->hrm->dir_output.'/position/'.$newref; |
|
| 587 | 587 | if (!$error && file_exists($dirsource)) { |
| 588 | - dol_syslog(get_class($this) . "::validate() rename dir " . $dirsource . " into " . $dirdest); |
|
| 588 | + dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest); |
|
| 589 | 589 | |
| 590 | 590 | if (@rename($dirsource, $dirdest)) { |
| 591 | 591 | dol_syslog("Rename ok"); |
| 592 | 592 | // Rename docs starting with $oldref with $newref |
| 593 | - $listoffiles = dol_dir_list($conf->hrm->dir_output . '/position/' . $newref, 'files', 1, '^' . preg_quote($oldref, '/')); |
|
| 593 | + $listoffiles = dol_dir_list($conf->hrm->dir_output.'/position/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); |
|
| 594 | 594 | foreach ($listoffiles as $fileentry) { |
| 595 | 595 | $dirsource = $fileentry['name']; |
| 596 | - $dirdest = preg_replace('/^' . preg_quote($oldref, '/') . '/', $newref, $dirsource); |
|
| 597 | - $dirsource = $fileentry['path'] . '/' . $dirsource; |
|
| 598 | - $dirdest = $fileentry['path'] . '/' . $dirdest; |
|
| 596 | + $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); |
|
| 597 | + $dirsource = $fileentry['path'].'/'.$dirsource; |
|
| 598 | + $dirdest = $fileentry['path'].'/'.$dirdest; |
|
| 599 | 599 | @rename($dirsource, $dirdest); |
| 600 | 600 | } |
| 601 | 601 | } |
@@ -711,14 +711,14 @@ discard block |
||
| 711 | 711 | |
| 712 | 712 | $result = ''; |
| 713 | 713 | |
| 714 | - $label = img_picto('', $this->picto) . ' <u>' . $langs->trans("Position") . '</u>'; |
|
| 714 | + $label = img_picto('', $this->picto).' <u>'.$langs->trans("Position").'</u>'; |
|
| 715 | 715 | if (isset($this->status)) { |
| 716 | - $label .= ' ' . $this->getLibStatut(5); |
|
| 716 | + $label .= ' '.$this->getLibStatut(5); |
|
| 717 | 717 | } |
| 718 | 718 | $label .= '<br>'; |
| 719 | - $label .= '<b>' . $langs->trans('Ref') . ':</b> ' . $this->ref; |
|
| 719 | + $label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref; |
|
| 720 | 720 | |
| 721 | - $url = dol_buildpath('/hrm/position_card.php', 1) . '?id=' . $this->id; |
|
| 721 | + $url = dol_buildpath('/hrm/position_card.php', 1).'?id='.$this->id; |
|
| 722 | 722 | |
| 723 | 723 | if ($option != 'nolink') { |
| 724 | 724 | // Add param to save lastsearch_values or not |
@@ -735,20 +735,20 @@ discard block |
||
| 735 | 735 | if (empty($notooltip)) { |
| 736 | 736 | if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) { |
| 737 | 737 | $label = $langs->trans("ShowPosition"); |
| 738 | - $linkclose .= ' alt="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 738 | + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; |
|
| 739 | 739 | } |
| 740 | - $linkclose .= ' title="' . dol_escape_htmltag($label, 1) . '"'; |
|
| 741 | - $linkclose .= ' class="classfortooltip' . ($morecss ? ' ' . $morecss : '') . '"'; |
|
| 740 | + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; |
|
| 741 | + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; |
|
| 742 | 742 | } else { |
| 743 | - $linkclose = ($morecss ? ' class="' . $morecss . '"' : ''); |
|
| 743 | + $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | if ($option == 'nolink') { |
| 747 | 747 | $linkstart = '<span'; |
| 748 | 748 | } else { |
| 749 | - $linkstart = '<a href="' . $url . '"'; |
|
| 749 | + $linkstart = '<a href="'.$url.'"'; |
|
| 750 | 750 | } |
| 751 | - $linkstart .= $linkclose . '>'; |
|
| 751 | + $linkstart .= $linkclose.'>'; |
|
| 752 | 752 | if ($option == 'nolink') { |
| 753 | 753 | $linkend = '</span>'; |
| 754 | 754 | } else { |
@@ -759,29 +759,29 @@ discard block |
||
| 759 | 759 | |
| 760 | 760 | if (empty($this->showphoto_on_popup)) { |
| 761 | 761 | if ($withpicto) { |
| 762 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 762 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 763 | 763 | } |
| 764 | 764 | } else { |
| 765 | 765 | if ($withpicto) { |
| 766 | - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; |
|
| 766 | + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; |
|
| 767 | 767 | |
| 768 | 768 | list($class, $module) = explode('@', $this->picto); |
| 769 | - $upload_dir = $conf->$module->multidir_output[$conf->entity] . "/$class/" . dol_sanitizeFileName($this->ref); |
|
| 769 | + $upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref); |
|
| 770 | 770 | $filearray = dol_dir_list($upload_dir, "files"); |
| 771 | 771 | $filename = $filearray[0]['name']; |
| 772 | 772 | if (!empty($filename)) { |
| 773 | 773 | $pospoint = strpos($filearray[0]['name'], '.'); |
| 774 | 774 | |
| 775 | - $pathtophoto = $class . '/' . $this->ref . '/thumbs/' . substr($filename, 0, $pospoint) . '_mini' . substr($filename, $pospoint); |
|
| 776 | - if (!getDolGlobalString(strtoupper($module . '_' . $class) . '_FORMATLISTPHOTOSASUSERS')) { |
|
| 777 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo' . $module . '" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div></div>'; |
|
| 775 | + $pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint); |
|
| 776 | + if (!getDolGlobalString(strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS')) { |
|
| 777 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>'; |
|
| 778 | 778 | } else { |
| 779 | - $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $module . '&entity=' . $conf->entity . '&file=' . urlencode($pathtophoto) . '"></div>'; |
|
| 779 | + $result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>'; |
|
| 780 | 780 | } |
| 781 | 781 | |
| 782 | 782 | $result .= '</div>'; |
| 783 | 783 | } else { |
| 784 | - $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="' . (($withpicto != 2) ? 'paddingright ' : '') . 'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 784 | + $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); |
|
| 785 | 785 | } |
| 786 | 786 | } |
| 787 | 787 | } |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled'); |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | - $statusType = 'status' . $status; |
|
| 847 | + $statusType = 'status'.$status; |
|
| 848 | 848 | //if ($status == self::STATUS_VALIDATED) $statusType = 'status1'; |
| 849 | 849 | if ($status == self::STATUS_CANCELED) { |
| 850 | 850 | $statusType = 'status6'; |
@@ -932,8 +932,8 @@ discard block |
||
| 932 | 932 | { |
| 933 | 933 | $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; |
| 934 | 934 | $sql .= ' fk_user_creat, fk_user_modif'; |
| 935 | - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; |
|
| 936 | - $sql .= ' WHERE t.rowid = ' . ((int) $id); |
|
| 935 | + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; |
|
| 936 | + $sql .= ' WHERE t.rowid = '.((int) $id); |
|
| 937 | 937 | $result = $this->db->query($sql); |
| 938 | 938 | if ($result) { |
| 939 | 939 | if ($this->db->num_rows($result)) { |
@@ -978,7 +978,7 @@ discard block |
||
| 978 | 978 | $this->lines = array(); |
| 979 | 979 | |
| 980 | 980 | $objectline = new PositionLine($this->db); |
| 981 | - $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = ' . $this->id)); |
|
| 981 | + $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql' => 'fk_position = '.$this->id)); |
|
| 982 | 982 | |
| 983 | 983 | if (is_numeric($result)) { |
| 984 | 984 | $this->error = $objectline->error; |
@@ -1007,20 +1007,20 @@ discard block |
||
| 1007 | 1007 | if (getDolGlobalString('hrm_POSITION_ADDON')) { |
| 1008 | 1008 | $mybool = false; |
| 1009 | 1009 | |
| 1010 | - $file = getDolGlobalString('hrm_POSITION_ADDON') . ".php"; |
|
| 1010 | + $file = getDolGlobalString('hrm_POSITION_ADDON').".php"; |
|
| 1011 | 1011 | $classname = getDolGlobalString('hrm_POSITION_ADDON'); |
| 1012 | 1012 | |
| 1013 | 1013 | // Include file with class |
| 1014 | 1014 | $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); |
| 1015 | 1015 | foreach ($dirmodels as $reldir) { |
| 1016 | - $dir = dol_buildpath($reldir . "core/modules/hrm/"); |
|
| 1016 | + $dir = dol_buildpath($reldir."core/modules/hrm/"); |
|
| 1017 | 1017 | |
| 1018 | 1018 | // Load file with numbering class (if found) |
| 1019 | - $mybool |= @include_once $dir . $file; |
|
| 1019 | + $mybool |= @include_once $dir.$file; |
|
| 1020 | 1020 | } |
| 1021 | 1021 | |
| 1022 | 1022 | if ($mybool === false) { |
| 1023 | - dol_print_error(null, "Failed to include file " . $file); |
|
| 1023 | + dol_print_error(null, "Failed to include file ".$file); |
|
| 1024 | 1024 | return ''; |
| 1025 | 1025 | } |
| 1026 | 1026 | |
@@ -1036,7 +1036,7 @@ discard block |
||
| 1036 | 1036 | return ""; |
| 1037 | 1037 | } |
| 1038 | 1038 | } else { |
| 1039 | - print $langs->trans("Error") . " " . $langs->trans("ClassNotFound") . ' ' . $classname; |
|
| 1039 | + print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname; |
|
| 1040 | 1040 | return ""; |
| 1041 | 1041 | } |
| 1042 | 1042 | } else { |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | { |
| 1056 | 1056 | $TPosition = array(); |
| 1057 | 1057 | |
| 1058 | - $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user=' . $userid)); |
|
| 1058 | + $TPosition = $this->fetchAll('ASC', 't.rowid', 0, 0, array('customsql' => 'fk_user='.$userid)); |
|
| 1059 | 1059 | |
| 1060 | 1060 | return $TPosition; |
| 1061 | 1061 | } |
@@ -1169,7 +1169,7 @@ discard block |
||
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | |
| 1172 | -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobjectline.class.php'; |
|
| 1172 | +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; |
|
| 1173 | 1173 | |
| 1174 | 1174 | /** |
| 1175 | 1175 | * Class PositionLine. You can also remove this and generate a CRUD class for lines objects. |
@@ -44,11 +44,11 @@ |
||
| 44 | 44 | // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. |
| 45 | 45 | |
| 46 | 46 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
| 47 | -$langs->load("main"); // To load language file for default language |
|
| 47 | +$langs->load("main"); // To load language file for default language |
|
| 48 | 48 | @set_time_limit(0); |
| 49 | 49 | |
| 50 | 50 | // Load user and its permissions |
| 51 | -$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
| 51 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
| 52 | 52 | if (!$result > 0) { |
| 53 | 53 | dol_print_error(null, $user->error); |
| 54 | 54 | exit; |
@@ -44,11 +44,11 @@ |
||
| 44 | 44 | // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. |
| 45 | 45 | |
| 46 | 46 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
| 47 | -$langs->load("main"); // To load language file for default language |
|
| 47 | +$langs->load("main"); // To load language file for default language |
|
| 48 | 48 | @set_time_limit(0); |
| 49 | 49 | |
| 50 | 50 | // Load user and its permissions |
| 51 | -$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
| 51 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
| 52 | 52 | if (!$result > 0) { |
| 53 | 53 | dol_print_error(null, $user->error); |
| 54 | 54 | exit; |
@@ -44,11 +44,11 @@ |
||
| 44 | 44 | // After this $db, $mysoc, $langs and $conf->entity are defined. Opened handler to database will be closed at end of file. |
| 45 | 45 | |
| 46 | 46 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
| 47 | -$langs->load("main"); // To load language file for default language |
|
| 47 | +$langs->load("main"); // To load language file for default language |
|
| 48 | 48 | @set_time_limit(0); |
| 49 | 49 | |
| 50 | 50 | // Load user and its permissions |
| 51 | -$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
| 51 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
| 52 | 52 | if (!$result > 0) { |
| 53 | 53 | dol_print_error(null, $user->error); |
| 54 | 54 | exit; |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | global $db, $conf, $langs; |
| 47 | 47 | |
| 48 | 48 | //$langs->setDefaultLang('en_US'); // To change default language of $langs |
| 49 | -$langs->load("main"); // To load language file for default language |
|
| 49 | +$langs->load("main"); // To load language file for default language |
|
| 50 | 50 | @set_time_limit(0); |
| 51 | 51 | |
| 52 | 52 | // Load user and its permissions |
| 53 | -$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
| 53 | +$result = $user->fetch('', 'admin'); // Load user for login 'admin'. Comment line to run as anonymous user. |
|
| 54 | 54 | if (!$result > 0) { |
| 55 | 55 | dol_print_error(null, $user->error); |
| 56 | 56 | exit; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | //$obj->initAsSpecimen(); |
| 71 | 71 | |
| 72 | 72 | $obj->ref = 'ABCDE'; |
| 73 | -$obj->socid = 4; // Put id of third party (rowid in llx_societe table) |
|
| 73 | +$obj->socid = 4; // Put id of third party (rowid in llx_societe table) |
|
| 74 | 74 | $obj->date = dol_now(); |
| 75 | 75 | $obj->note_public = 'A public comment'; |
| 76 | 76 | $obj->note_private = 'A private comment'; |