@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | $sql .= ", login = ".($this->login ? "'".$this->db->escape($this->login)."'" : "null"); |
| 788 | 788 | $sql .= ", societe = ".($this->company ? "'".$this->db->escape($this->company)."'" : ($this->societe ? "'".$this->db->escape($this->societe)."'" : "null")); |
| 789 | 789 | if ($this->socid) { |
| 790 | - $sql .= ", fk_soc = ".($this->socid > 0 ? (int) $this->socid : "null"); // Must be modified only when creating from a third-party |
|
| 790 | + $sql .= ", fk_soc = ".($this->socid > 0 ? (int) $this->socid : "null"); // Must be modified only when creating from a third-party |
|
| 791 | 791 | } |
| 792 | 792 | $sql .= ", address = ".($this->address ? "'".$this->db->escape($this->address)."'" : "null"); |
| 793 | 793 | $sql .= ", zip = ".($this->zip ? "'".$this->db->escape($this->zip)."'" : "null"); |
@@ -2269,7 +2269,7 @@ discard block |
||
| 2269 | 2269 | $datas['divopen'] = '<div class="centpercent">'; |
| 2270 | 2270 | $datas['picto'] = img_picto('', $this->picto).' <u class="paddingrightonly">'.$langs->trans("Member").'</u> '.$this->getLibStatut(4); |
| 2271 | 2271 | if (!empty($this->morphy)) { |
| 2272 | - $datas['picto'] .= ' ' . $this->getmorphylib('', 1); |
|
| 2272 | + $datas['picto'] .= ' '.$this->getmorphylib('', 1); |
|
| 2273 | 2273 | } |
| 2274 | 2274 | if (!empty($this->ref)) { |
| 2275 | 2275 | $datas['ref'] = '<br><b>'.$langs->trans('Ref').':</b> '.$this->ref; |
@@ -2289,9 +2289,9 @@ discard block |
||
| 2289 | 2289 | $datas['address'] = '<br><b>'.$langs->trans("Address").':</b> '.dol_format_address($this, 1, ' ', $langs); |
| 2290 | 2290 | // show categories for this record only in ajax to not overload lists |
| 2291 | 2291 | if (isModEnabled('category') && !$nofetch) { |
| 2292 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 2292 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 2293 | 2293 | $form = new Form($this->db); |
| 2294 | - $datas['categories'] = '<br>' . $form->showCategories($this->id, Categorie::TYPE_MEMBER, 1); |
|
| 2294 | + $datas['categories'] = '<br>'.$form->showCategories($this->id, Categorie::TYPE_MEMBER, 1); |
|
| 2295 | 2295 | } |
| 2296 | 2296 | $datas['divclose'] = '</div>'; |
| 2297 | 2297 | |
@@ -2421,7 +2421,7 @@ discard block |
||
| 2421 | 2421 | } |
| 2422 | 2422 | } |
| 2423 | 2423 | global $action; |
| 2424 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 2424 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 2425 | 2425 | $parameters = array('id' => $this->id, 'getnomurl' => &$result); |
| 2426 | 2426 | $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks |
| 2427 | 2427 | if ($reshook > 0) { |
@@ -2730,13 +2730,13 @@ discard block |
||
| 2730 | 2730 | global $conf; |
| 2731 | 2731 | $dn = ''; |
| 2732 | 2732 | if ($mode == 0) { |
| 2733 | - $dn = getDolGlobalString('LDAP_KEY_MEMBERS') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')]."," . getDolGlobalString('LDAP_MEMBER_DN'); |
|
| 2733 | + $dn = getDolGlobalString('LDAP_KEY_MEMBERS')."=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')].",".getDolGlobalString('LDAP_MEMBER_DN'); |
|
| 2734 | 2734 | } |
| 2735 | 2735 | if ($mode == 1) { |
| 2736 | 2736 | $dn = getDolGlobalString('LDAP_MEMBER_DN'); |
| 2737 | 2737 | } |
| 2738 | 2738 | if ($mode == 2) { |
| 2739 | - $dn = getDolGlobalString('LDAP_KEY_MEMBERS') . "=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')]; |
|
| 2739 | + $dn = getDolGlobalString('LDAP_KEY_MEMBERS')."=".$info[getDolGlobalString('LDAP_KEY_MEMBERS')]; |
|
| 2740 | 2740 | } |
| 2741 | 2741 | return $dn; |
| 2742 | 2742 | } |
@@ -477,11 +477,11 @@ discard block |
||
| 477 | 477 | * |
| 478 | 478 | * Note: cond_reglement can not be aliased to cond_reglement!!! |
| 479 | 479 | */ |
| 480 | - private $cond_reglement; // Private to call DolDeprecationHandler |
|
| 480 | + private $cond_reglement; // Private to call DolDeprecationHandler |
|
| 481 | 481 | /** |
| 482 | 482 | * @var int|string Internal to detect deprecated access |
| 483 | 483 | */ |
| 484 | - protected $depr_cond_reglement; // Internal value for deprecation |
|
| 484 | + protected $depr_cond_reglement; // Internal value for deprecation |
|
| 485 | 485 | |
| 486 | 486 | /** |
| 487 | 487 | * @var int Delivery address ID |
@@ -538,12 +538,12 @@ discard block |
||
| 538 | 538 | /** |
| 539 | 539 | * @var float|string Multicurrency total localtax1 |
| 540 | 540 | */ |
| 541 | - public $multicurrency_total_localtax1; // not in database |
|
| 541 | + public $multicurrency_total_localtax1; // not in database |
|
| 542 | 542 | |
| 543 | 543 | /** |
| 544 | 544 | * @var float|string Multicurrency total localtax2 |
| 545 | 545 | */ |
| 546 | - public $multicurrency_total_localtax2; // not in database |
|
| 546 | + public $multicurrency_total_localtax2; // not in database |
|
| 547 | 547 | |
| 548 | 548 | /** |
| 549 | 549 | * @var ?string |
@@ -1028,17 +1028,17 @@ discard block |
||
| 1028 | 1028 | } |
| 1029 | 1029 | $labelextra = $langs->trans((string) $extrafields->attributes[$this->table_element]['label'][$key]); |
| 1030 | 1030 | if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { |
| 1031 | - $data[$key] = '<br><b><u>'. $labelextra . '</u></b>'; |
|
| 1031 | + $data[$key] = '<br><b><u>'.$labelextra.'</u></b>'; |
|
| 1032 | 1032 | } else { |
| 1033 | - $value = (empty($this->array_options['options_' . $key]) ? '' : $this->array_options['options_' . $key]); |
|
| 1034 | - $data[$key] = '<br><b>'. $labelextra . ':</b> ' . $extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 1033 | + $value = (empty($this->array_options['options_'.$key]) ? '' : $this->array_options['options_'.$key]); |
|
| 1034 | + $data[$key] = '<br><b>'.$labelextra.':</b> '.$extrafields->showOutputField($key, $value, '', $this->table_element); |
|
| 1035 | 1035 | $count++; |
| 1036 | 1036 | } |
| 1037 | 1037 | } |
| 1038 | 1038 | $data['closedivextra'] = '</div>'; |
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | - $hookmanager->initHooks(array($this->element . 'dao')); |
|
| 1041 | + $hookmanager->initHooks(array($this->element.'dao')); |
|
| 1042 | 1042 | $parameters = array( |
| 1043 | 1043 | 'tooltipcontentarray' => &$data, |
| 1044 | 1044 | 'params' => $params, |
@@ -1538,7 +1538,7 @@ discard block |
||
| 1538 | 1538 | $sql .= " AND ec.fk_c_type_contact IN (".$this->db->sanitize(implode(',', $arrayoftcids)).")"; |
| 1539 | 1539 | } |
| 1540 | 1540 | if ($status >= 0) { |
| 1541 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople |
|
| 1541 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople |
|
| 1542 | 1542 | } |
| 1543 | 1543 | if ($statusoflink >= 0) { |
| 1544 | 1544 | $sql .= " AND ec.statut = ".((int) $statusoflink); |
@@ -1922,7 +1922,7 @@ discard block |
||
| 1922 | 1922 | } |
| 1923 | 1923 | |
| 1924 | 1924 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element; |
| 1925 | - $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1925 | + $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1926 | 1926 | $sql .= " LIMIT 1"; |
| 1927 | 1927 | |
| 1928 | 1928 | $query = $this->db->query($sql); |
@@ -2241,9 +2241,9 @@ discard block |
||
| 2241 | 2241 | |
| 2242 | 2242 | $oldvalue = null; |
| 2243 | 2243 | if ($trigkey) { |
| 2244 | - $sql = "SELECT " . $field; |
|
| 2245 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
| 2246 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
| 2244 | + $sql = "SELECT ".$field; |
|
| 2245 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
| 2246 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
| 2247 | 2247 | |
| 2248 | 2248 | $resql = $this->db->query($sql); |
| 2249 | 2249 | if ($resql) { |
@@ -2623,7 +2623,7 @@ discard block |
||
| 2623 | 2623 | // Triggers |
| 2624 | 2624 | if (!$error && !$notrigger) { |
| 2625 | 2625 | // Call triggers |
| 2626 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
| 2626 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
| 2627 | 2627 | if ($result < 0) { |
| 2628 | 2628 | $error++; |
| 2629 | 2629 | } //Do also here what you must do to rollback action if trigger fail |
@@ -3001,7 +3001,7 @@ discard block |
||
| 3001 | 3001 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
| 3002 | 3002 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
| 3003 | 3003 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
| 3004 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 3004 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape($deposit_percent)."'"); |
|
| 3005 | 3005 | } |
| 3006 | 3006 | $sql .= ' WHERE rowid='.((int) $this->id); |
| 3007 | 3007 | |
@@ -3349,10 +3349,10 @@ discard block |
||
| 3349 | 3349 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
| 3350 | 3350 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3351 | 3351 | if (!$renum) { |
| 3352 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
| 3352 | + $sql .= " AND ".$fieldposition." = 0"; |
|
| 3353 | 3353 | } |
| 3354 | 3354 | if ($renum) { |
| 3355 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
| 3355 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
| 3356 | 3356 | } |
| 3357 | 3357 | |
| 3358 | 3358 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3373,7 +3373,7 @@ discard block |
||
| 3373 | 3373 | if ($fk_parent_line) { |
| 3374 | 3374 | $sql .= ' AND fk_parent_line IS NULL'; |
| 3375 | 3375 | } |
| 3376 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
| 3376 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
| 3377 | 3377 | |
| 3378 | 3378 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
| 3379 | 3379 | $resql = $this->db->query($sql); |
@@ -3425,7 +3425,7 @@ discard block |
||
| 3425 | 3425 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3426 | 3426 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3427 | 3427 | $sql .= ' AND fk_parent_line = '.((int) $id); |
| 3428 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
| 3428 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
| 3429 | 3429 | |
| 3430 | 3430 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
| 3431 | 3431 | |
@@ -3549,7 +3549,7 @@ discard block |
||
| 3549 | 3549 | |
| 3550 | 3550 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3551 | 3551 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3552 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
| 3552 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
| 3553 | 3553 | if ($this->db->query($sql)) { |
| 3554 | 3554 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
| 3555 | 3555 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3580,7 +3580,7 @@ discard block |
||
| 3580 | 3580 | |
| 3581 | 3581 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3582 | 3582 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3583 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
| 3583 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
| 3584 | 3584 | if ($this->db->query($sql)) { |
| 3585 | 3585 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
| 3586 | 3586 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3606,7 +3606,7 @@ discard block |
||
| 3606 | 3606 | $fieldposition = 'position'; |
| 3607 | 3607 | } |
| 3608 | 3608 | |
| 3609 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3609 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3610 | 3610 | $sql .= " WHERE rowid = ".((int) $rowid); |
| 3611 | 3611 | |
| 3612 | 3612 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3634,7 +3634,7 @@ discard block |
||
| 3634 | 3634 | |
| 3635 | 3635 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3636 | 3636 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3637 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
| 3637 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
| 3638 | 3638 | $resql = $this->db->query($sql); |
| 3639 | 3639 | if ($resql) { |
| 3640 | 3640 | $row = $this->db->fetch_row($resql); |
@@ -3753,7 +3753,7 @@ discard block |
||
| 3753 | 3753 | $newsuffix = ''; |
| 3754 | 3754 | } |
| 3755 | 3755 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
| 3756 | - $fieldusermod = "fk_user_mod"; |
|
| 3756 | + $fieldusermod = "fk_user_mod"; |
|
| 3757 | 3757 | } elseif ($this->table_element == 'ecm_files') { |
| 3758 | 3758 | $fieldusermod = "fk_user_m"; |
| 3759 | 3759 | } else { |
@@ -3795,7 +3795,7 @@ discard block |
||
| 3795 | 3795 | $trigger_name = 'EXPENSE_REPORT_MODIFY'; |
| 3796 | 3796 | break; |
| 3797 | 3797 | default: |
| 3798 | - $trigger_name = strtoupper($this->element) . '_MODIFY'; |
|
| 3798 | + $trigger_name = strtoupper($this->element).'_MODIFY'; |
|
| 3799 | 3799 | } |
| 3800 | 3800 | $ret = $this->call_trigger($trigger_name, $user); |
| 3801 | 3801 | if ($ret < 0) { |
@@ -4093,7 +4093,7 @@ discard block |
||
| 4093 | 4093 | // Situations totals |
| 4094 | 4094 | if (!empty($this->situation_cycle_ref) && !empty($this->situation_counter) && $this->situation_counter > 1 && method_exists($this, 'get_prev_sits')) { // @phan-suppress-current-line PhanUndeclaredProperty |
| 4095 | 4095 | '@phan-var-force Facture $this'; |
| 4096 | - include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded |
|
| 4096 | + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Note: possibly useless as $this is normally already Facture, so the class file should be loaded |
|
| 4097 | 4097 | if ($this->type != Facture::TYPE_CREDIT_NOTE) { // @phpstan-ignore-line |
| 4098 | 4098 | if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) { |
| 4099 | 4099 | $prev_sits = $this->get_prev_sits(); |
@@ -4215,19 +4215,19 @@ discard block |
||
| 4215 | 4215 | $this->db->begin(); |
| 4216 | 4216 | $error = 0; |
| 4217 | 4217 | |
| 4218 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
| 4218 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
| 4219 | 4219 | $sql .= "fk_source"; |
| 4220 | 4220 | $sql .= ", sourcetype"; |
| 4221 | 4221 | $sql .= ", fk_target"; |
| 4222 | 4222 | $sql .= ", targettype"; |
| 4223 | 4223 | $sql .= ") VALUES ("; |
| 4224 | 4224 | $sql .= ((int) $origin_id); |
| 4225 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
| 4226 | - $sql .= ", " . ((int) $this->id); |
|
| 4227 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
| 4225 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
| 4226 | + $sql .= ", ".((int) $this->id); |
|
| 4227 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
| 4228 | 4228 | $sql .= ")"; |
| 4229 | 4229 | |
| 4230 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
| 4230 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
| 4231 | 4231 | if ($this->db->query($sql)) { |
| 4232 | 4232 | if (!$notrigger) { |
| 4233 | 4233 | // Call trigger |
@@ -4480,20 +4480,20 @@ discard block |
||
| 4480 | 4480 | $this->db->begin(); |
| 4481 | 4481 | $error = 0; |
| 4482 | 4482 | |
| 4483 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
| 4483 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
| 4484 | 4484 | if ($updatesource) { |
| 4485 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
| 4486 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4487 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
| 4488 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4485 | + $sql .= "fk_source = ".((int) $sourceid); |
|
| 4486 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4487 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
| 4488 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4489 | 4489 | } elseif ($updatetarget) { |
| 4490 | - $sql .= "fk_target = " . ((int) $targetid); |
|
| 4491 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4492 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
| 4493 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4490 | + $sql .= "fk_target = ".((int) $targetid); |
|
| 4491 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
| 4492 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
| 4493 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4494 | 4494 | } |
| 4495 | 4495 | |
| 4496 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
| 4496 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
| 4497 | 4497 | if ($this->db->query($sql)) { |
| 4498 | 4498 | if (!$notrigger) { |
| 4499 | 4499 | // Call trigger |
@@ -4569,25 +4569,25 @@ discard block |
||
| 4569 | 4569 | } |
| 4570 | 4570 | |
| 4571 | 4571 | if (!$error) { |
| 4572 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
| 4572 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
| 4573 | 4573 | $sql .= " WHERE"; |
| 4574 | 4574 | if ($rowid > 0) { |
| 4575 | - $sql .= " rowid = " . ((int) $rowid); |
|
| 4575 | + $sql .= " rowid = ".((int) $rowid); |
|
| 4576 | 4576 | } else { |
| 4577 | 4577 | if ($deletesource) { |
| 4578 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4579 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4578 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4579 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4580 | 4580 | } elseif ($deletetarget) { |
| 4581 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4582 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4581 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
| 4582 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4583 | 4583 | } else { |
| 4584 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($this->element) . "')"; |
|
| 4584 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($this->element)."')"; |
|
| 4585 | 4585 | $sql .= " OR"; |
| 4586 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($this->element) . "')"; |
|
| 4586 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($this->element)."')"; |
|
| 4587 | 4587 | } |
| 4588 | 4588 | } |
| 4589 | 4589 | |
| 4590 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
| 4590 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
| 4591 | 4591 | if (!$this->db->query($sql)) { |
| 4592 | 4592 | $this->error = $this->db->lasterror(); |
| 4593 | 4593 | $this->errors[] = $this->error; |
@@ -4752,14 +4752,14 @@ discard block |
||
| 4752 | 4752 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
| 4753 | 4753 | } |
| 4754 | 4754 | $sql .= " WHERE rowid = ".((int) $elementId); |
| 4755 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4755 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4756 | 4756 | |
| 4757 | 4757 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
| 4758 | 4758 | $resql = $this->db->query($sql); |
| 4759 | 4759 | if ($resql) { |
| 4760 | 4760 | $error = 0; |
| 4761 | 4761 | |
| 4762 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4762 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4763 | 4763 | |
| 4764 | 4764 | if ($nb_rows_affected > 0) { |
| 4765 | 4765 | if (empty($trigkey)) { |
@@ -4806,7 +4806,7 @@ discard block |
||
| 4806 | 4806 | if ($fieldstatus == 'tosell') { |
| 4807 | 4807 | $this->status = $status; |
| 4808 | 4808 | } elseif ($fieldstatus == 'tobuy') { |
| 4809 | - $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4809 | + $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4810 | 4810 | } else { |
| 4811 | 4811 | $this->status = $status; |
| 4812 | 4812 | } |
@@ -4914,7 +4914,7 @@ discard block |
||
| 4914 | 4914 | return -1; |
| 4915 | 4915 | } |
| 4916 | 4916 | |
| 4917 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4917 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4918 | 4918 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
| 4919 | 4919 | $tmparray = array_keys($this->childtables); |
| 4920 | 4920 | if (is_numeric($tmparray[0])) { |
@@ -6008,7 +6008,7 @@ discard block |
||
| 6008 | 6008 | $setsharekey = false; |
| 6009 | 6009 | if ($this->element == 'propal' || $this->element == 'proposal') { |
| 6010 | 6010 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
| 6011 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 6011 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 6012 | 6012 | } |
| 6013 | 6013 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
| 6014 | 6014 | $setsharekey = true; |
@@ -6068,7 +6068,7 @@ discard block |
||
| 6068 | 6068 | $ecmfile->gen_or_uploaded = 'generated'; |
| 6069 | 6069 | $ecmfile->description = ''; // indexed content |
| 6070 | 6070 | $ecmfile->keywords = ''; // keyword content |
| 6071 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 6071 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 6072 | 6072 | $ecmfile->src_object_id = $this->id; |
| 6073 | 6073 | |
| 6074 | 6074 | $result = $ecmfile->create($user); |
@@ -6120,7 +6120,7 @@ discard block |
||
| 6120 | 6120 | $maxwidthmini = $tmparraysize['maxwidthmini']; |
| 6121 | 6121 | $maxheightmini = $tmparraysize['maxheightmini']; |
| 6122 | 6122 | //$quality = $tmparraysize['quality']; |
| 6123 | - $quality = 50; // For thumbs, we force quality to 50 |
|
| 6123 | + $quality = 50; // For thumbs, we force quality to 50 |
|
| 6124 | 6124 | |
| 6125 | 6125 | // Create small thumbs for company (Ratio is near 16/9) |
| 6126 | 6126 | // Used on logon for example |
@@ -6220,8 +6220,8 @@ discard block |
||
| 6220 | 6220 | // phpcs:enable |
| 6221 | 6221 | global $langs, $conf; |
| 6222 | 6222 | |
| 6223 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
| 6224 | - dol_print_error(null, 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
| 6223 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
| 6224 | + dol_print_error(null, 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
| 6225 | 6225 | exit; |
| 6226 | 6226 | } |
| 6227 | 6227 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6413,7 +6413,7 @@ discard block |
||
| 6413 | 6413 | $savDisableCompute = $conf->disable_compute; |
| 6414 | 6414 | $conf->disable_compute = 1; |
| 6415 | 6415 | |
| 6416 | - $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6416 | + $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6417 | 6417 | |
| 6418 | 6418 | $conf->disable_compute = $savDisableCompute; |
| 6419 | 6419 | |
@@ -6475,7 +6475,7 @@ discard block |
||
| 6475 | 6475 | if (is_array($optionsArray) && count($optionsArray) > 0) { |
| 6476 | 6476 | $sql = "SELECT rowid"; |
| 6477 | 6477 | foreach ($optionsArray as $name => $label) { |
| 6478 | - if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) { |
|
| 6478 | + if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) { |
|
| 6479 | 6479 | $sql .= ", ".$name; |
| 6480 | 6480 | } |
| 6481 | 6481 | // use geo sql fonction to read as text |
@@ -6528,7 +6528,7 @@ discard block |
||
| 6528 | 6528 | **/ |
| 6529 | 6529 | if (is_array($extrafields->attributes[$this->table_element]['label'])) { |
| 6530 | 6530 | foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { |
| 6531 | - $this->array_options['options_' . $key] = null; |
|
| 6531 | + $this->array_options['options_'.$key] = null; |
|
| 6532 | 6532 | } |
| 6533 | 6533 | } |
| 6534 | 6534 | } |
@@ -6540,9 +6540,9 @@ discard block |
||
| 6540 | 6540 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
| 6541 | 6541 | //var_dump($conf->disable_compute); |
| 6542 | 6542 | if (empty($conf->disable_compute)) { |
| 6543 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6544 | - $objectoffield = $this; // we can use it inside computed formula |
|
| 6545 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6543 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6544 | + $objectoffield = $this; // we can use it inside computed formula |
|
| 6545 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6546 | 6546 | } |
| 6547 | 6547 | } |
| 6548 | 6548 | } |
@@ -6723,7 +6723,7 @@ discard block |
||
| 6723 | 6723 | // If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update. |
| 6724 | 6724 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6725 | 6725 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6726 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6726 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6727 | 6727 | } else { |
| 6728 | 6728 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6729 | 6729 | } |
@@ -6734,7 +6734,7 @@ discard block |
||
| 6734 | 6734 | // If value has changed |
| 6735 | 6735 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6736 | 6736 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6737 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6737 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6738 | 6738 | } else { |
| 6739 | 6739 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6740 | 6740 | } |
@@ -6746,7 +6746,7 @@ discard block |
||
| 6746 | 6746 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
| 6747 | 6747 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
| 6748 | 6748 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
| 6749 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6749 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6750 | 6750 | } else { |
| 6751 | 6751 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6752 | 6752 | } |
@@ -7196,7 +7196,7 @@ discard block |
||
| 7196 | 7196 | 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. |
| 7197 | 7197 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 7198 | 7198 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { |
| 7199 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7199 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7200 | 7200 | } else { |
| 7201 | 7201 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 7202 | 7202 | } |
@@ -7216,7 +7216,7 @@ discard block |
||
| 7216 | 7216 | } |
| 7217 | 7217 | } else { |
| 7218 | 7218 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { // dolibarr reversible encryption |
| 7219 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7219 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7220 | 7220 | } else { |
| 7221 | 7221 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 7222 | 7222 | } |
@@ -7804,7 +7804,7 @@ discard block |
||
| 7804 | 7804 | // 7 : sort field |
| 7805 | 7805 | |
| 7806 | 7806 | // If there is filter |
| 7807 | - if (! empty($InfoFieldList[4])) { |
|
| 7807 | + if (!empty($InfoFieldList[4])) { |
|
| 7808 | 7808 | $pos = 0; |
| 7809 | 7809 | $parenthesisopen = 0; |
| 7810 | 7810 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
@@ -7868,8 +7868,8 @@ discard block |
||
| 7868 | 7868 | } |
| 7869 | 7869 | |
| 7870 | 7870 | $sqlwhere = ''; |
| 7871 | - $sql = "SELECT " . $keyList; |
|
| 7872 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7871 | + $sql = "SELECT ".$keyList; |
|
| 7872 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
| 7873 | 7873 | |
| 7874 | 7874 | if (!empty($InfoFieldList[4])) { |
| 7875 | 7875 | // can use SELECT request |
@@ -7887,11 +7887,11 @@ discard block |
||
| 7887 | 7887 | // We have to join on extrafield table |
| 7888 | 7888 | $errstr = ''; |
| 7889 | 7889 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7890 | - $sql .= " as main, " . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . "_extrafields as extra"; |
|
| 7891 | - $sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]); |
|
| 7892 | - $sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7890 | + $sql .= " as main, ".$this->db->sanitize($this->db->prefix().$InfoFieldList[0])."_extrafields as extra"; |
|
| 7891 | + $sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]); |
|
| 7892 | + $sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7893 | 7893 | } else { |
| 7894 | - $sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7894 | + $sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7895 | 7895 | } |
| 7896 | 7896 | } else { |
| 7897 | 7897 | $sqlwhere .= ' WHERE 1=1'; |
@@ -7912,7 +7912,7 @@ discard block |
||
| 7912 | 7912 | |
| 7913 | 7913 | // Some tables may have field, some other not. For the moment we disable it. |
| 7914 | 7914 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7915 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7915 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7916 | 7916 | } |
| 7917 | 7917 | $sql .= $sqlwhere; |
| 7918 | 7918 | |
@@ -7923,7 +7923,7 @@ discard block |
||
| 7923 | 7923 | $sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label)); |
| 7924 | 7924 | } |
| 7925 | 7925 | |
| 7926 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
| 7926 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
| 7927 | 7927 | $resql = $this->db->query($sql); |
| 7928 | 7928 | if ($resql) { |
| 7929 | 7929 | $out .= '<option value="0"> </option>'; |
@@ -7939,7 +7939,7 @@ discard block |
||
| 7939 | 7939 | if (count($fields_label) > 1) { |
| 7940 | 7940 | $notrans = true; |
| 7941 | 7941 | foreach ($fields_label as $field_toshow) { |
| 7942 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 7942 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 7943 | 7943 | } |
| 7944 | 7944 | } else { |
| 7945 | 7945 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -7950,12 +7950,12 @@ discard block |
||
| 7950 | 7950 | foreach ($fields_label as $field_toshow) { |
| 7951 | 7951 | $translabel = $langs->trans($obj->$field_toshow); |
| 7952 | 7952 | if ($translabel != $obj->$field_toshow) { |
| 7953 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
| 7953 | + $labeltoshow = dol_trunc($translabel).' '; |
|
| 7954 | 7954 | } else { |
| 7955 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
| 7955 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
| 7956 | 7956 | } |
| 7957 | 7957 | } |
| 7958 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7958 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7959 | 7959 | } else { |
| 7960 | 7960 | if (!$notrans) { |
| 7961 | 7961 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -7969,34 +7969,34 @@ discard block |
||
| 7969 | 7969 | $labeltoshow = '(not defined)'; |
| 7970 | 7970 | } |
| 7971 | 7971 | if ($value == $obj->rowid) { |
| 7972 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 7972 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 7973 | 7973 | } |
| 7974 | 7974 | |
| 7975 | 7975 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 7976 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 7976 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 7977 | 7977 | $isDependList = 1; |
| 7978 | 7978 | } |
| 7979 | 7979 | |
| 7980 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 7980 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 7981 | 7981 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
| 7982 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
| 7983 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 7982 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
| 7983 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 7984 | 7984 | } |
| 7985 | 7985 | |
| 7986 | 7986 | $i++; |
| 7987 | 7987 | } |
| 7988 | 7988 | $this->db->free($resql); |
| 7989 | 7989 | } else { |
| 7990 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 7990 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 7991 | 7991 | } |
| 7992 | 7992 | } else { |
| 7993 | 7993 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 7994 | 7994 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[$InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 7995 | 7995 | $out .= '<option value="0"> </option>'; |
| 7996 | 7996 | foreach ($data as $data_key => $data_value) { |
| 7997 | - $out .= '<option value="' . $data_key . '"'; |
|
| 7997 | + $out .= '<option value="'.$data_key.'"'; |
|
| 7998 | 7998 | $out .= ($value == $data_key ? ' selected' : ''); |
| 7999 | - $out .= '>' . $data_value . '</option>'; |
|
| 7999 | + $out .= '>'.$data_value.'</option>'; |
|
| 8000 | 8000 | } |
| 8001 | 8001 | } |
| 8002 | 8002 | } |
@@ -8036,7 +8036,7 @@ discard block |
||
| 8036 | 8036 | // 7 : sort field |
| 8037 | 8037 | |
| 8038 | 8038 | // If there is a filter |
| 8039 | - if (! empty($InfoFieldList[4])) { |
|
| 8039 | + if (!empty($InfoFieldList[4])) { |
|
| 8040 | 8040 | $pos = 0; |
| 8041 | 8041 | $parenthesisopen = 0; |
| 8042 | 8042 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
@@ -8102,8 +8102,8 @@ discard block |
||
| 8102 | 8102 | } |
| 8103 | 8103 | |
| 8104 | 8104 | $sqlwhere = ''; |
| 8105 | - $sql = "SELECT " . $keyList; |
|
| 8106 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
| 8105 | + $sql = "SELECT ".$keyList; |
|
| 8106 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
| 8107 | 8107 | |
| 8108 | 8108 | if (!empty($InfoFieldList[4])) { |
| 8109 | 8109 | // can use SELECT request |
@@ -8121,11 +8121,11 @@ discard block |
||
| 8121 | 8121 | // We have to join on extrafield table |
| 8122 | 8122 | $errstr = ''; |
| 8123 | 8123 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 8124 | - $sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra'; |
|
| 8125 | - $sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]); |
|
| 8126 | - $sqlwhere .= " AND " . $InfoFieldList[4]; |
|
| 8124 | + $sql .= ' as main, '.$this->db->sanitize($this->db->prefix().$InfoFieldList[0]).'_extrafields as extra'; |
|
| 8125 | + $sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]); |
|
| 8126 | + $sqlwhere .= " AND ".$InfoFieldList[4]; |
|
| 8127 | 8127 | } else { |
| 8128 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 8128 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 8129 | 8129 | } |
| 8130 | 8130 | } else { |
| 8131 | 8131 | $sqlwhere .= ' WHERE 1=1'; |
@@ -8146,14 +8146,14 @@ discard block |
||
| 8146 | 8146 | |
| 8147 | 8147 | // Some tables may have field, some other not. For the moment we disable it. |
| 8148 | 8148 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 8149 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 8149 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 8150 | 8150 | } |
| 8151 | 8151 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
| 8152 | 8152 | // print $sql; |
| 8153 | 8153 | |
| 8154 | 8154 | $sql .= $sqlwhere; |
| 8155 | 8155 | |
| 8156 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 8156 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 8157 | 8157 | |
| 8158 | 8158 | $resql = $this->db->query($sql); |
| 8159 | 8159 | if ($resql) { |
@@ -8172,7 +8172,7 @@ discard block |
||
| 8172 | 8172 | if (count($fields_label) > 1) { |
| 8173 | 8173 | $notrans = true; |
| 8174 | 8174 | foreach ($fields_label as $field_toshow) { |
| 8175 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 8175 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 8176 | 8176 | } |
| 8177 | 8177 | } else { |
| 8178 | 8178 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -8183,9 +8183,9 @@ discard block |
||
| 8183 | 8183 | foreach ($fields_label as $field_toshow) { |
| 8184 | 8184 | $translabel = $langs->trans($obj->$field_toshow); |
| 8185 | 8185 | if ($translabel != $obj->$field_toshow) { |
| 8186 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
| 8186 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
| 8187 | 8187 | } else { |
| 8188 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
| 8188 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
| 8189 | 8189 | } |
| 8190 | 8190 | } |
| 8191 | 8191 | |
@@ -8208,7 +8208,7 @@ discard block |
||
| 8208 | 8208 | } |
| 8209 | 8209 | |
| 8210 | 8210 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 8211 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 8211 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 8212 | 8212 | $isDependList = 1; |
| 8213 | 8213 | } |
| 8214 | 8214 | |
@@ -8219,14 +8219,14 @@ discard block |
||
| 8219 | 8219 | } |
| 8220 | 8220 | $this->db->free($resql); |
| 8221 | 8221 | |
| 8222 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8222 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8223 | 8223 | } else { |
| 8224 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 8224 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 8225 | 8225 | } |
| 8226 | 8226 | } else { |
| 8227 | 8227 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
| 8228 | 8228 | $data = $form->select_all_categories(Categorie::$MAP_ID_TO_CODE[(int) $InfoFieldList[5]], '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 8229 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8229 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8230 | 8230 | } |
| 8231 | 8231 | } |
| 8232 | 8232 | } elseif ($type == 'link') { |
@@ -8463,7 +8463,7 @@ discard block |
||
| 8463 | 8463 | $value = $this->getLibStatut(3); |
| 8464 | 8464 | } elseif ($type == 'date') { |
| 8465 | 8465 | if (!empty($value)) { |
| 8466 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 8466 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 8467 | 8467 | } else { |
| 8468 | 8468 | $value = ''; |
| 8469 | 8469 | } |
@@ -8564,7 +8564,7 @@ discard block |
||
| 8564 | 8564 | $value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : ''; |
| 8565 | 8565 | if (strpos($value, "|") !== false) { |
| 8566 | 8566 | $value = $langs->trans(explode('|', $value)[0]); |
| 8567 | - } elseif (! is_numeric($value)) { |
|
| 8567 | + } elseif (!is_numeric($value)) { |
|
| 8568 | 8568 | $value = $langs->trans($value); |
| 8569 | 8569 | } |
| 8570 | 8570 | } elseif ($type == 'sellist') { |
@@ -8626,9 +8626,9 @@ discard block |
||
| 8626 | 8626 | $translabel = $langs->trans($obj->$field_toshow); |
| 8627 | 8627 | } |
| 8628 | 8628 | if ($translabel != $field_toshow) { |
| 8629 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
| 8629 | + $value .= dol_trunc($translabel, 18).' '; |
|
| 8630 | 8630 | } else { |
| 8631 | - $value .= $obj->$field_toshow . ' '; |
|
| 8631 | + $value .= $obj->$field_toshow.' '; |
|
| 8632 | 8632 | } |
| 8633 | 8633 | } |
| 8634 | 8634 | } else { |
@@ -8644,7 +8644,7 @@ discard block |
||
| 8644 | 8644 | } |
| 8645 | 8645 | } |
| 8646 | 8646 | } else { |
| 8647 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8647 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8648 | 8648 | |
| 8649 | 8649 | $toprint = array(); |
| 8650 | 8650 | $obj = $this->db->fetch_object($resql); |
@@ -8652,7 +8652,7 @@ discard block |
||
| 8652 | 8652 | $c->fetch($obj->rowid); |
| 8653 | 8653 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8654 | 8654 | foreach ($ways as $way) { |
| 8655 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8655 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8656 | 8656 | } |
| 8657 | 8657 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
| 8658 | 8658 | } |
@@ -8668,11 +8668,11 @@ discard block |
||
| 8668 | 8668 | $toprint = array(); |
| 8669 | 8669 | foreach ($value_arr as $keyval => $valueval) { |
| 8670 | 8670 | if (!empty($valueval)) { |
| 8671 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
| 8671 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
| 8672 | 8672 | } |
| 8673 | 8673 | } |
| 8674 | 8674 | if (!empty($toprint)) { |
| 8675 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 8675 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 8676 | 8676 | } |
| 8677 | 8677 | } |
| 8678 | 8678 | } elseif ($type == 'chkbxlst') { |
@@ -8727,9 +8727,9 @@ discard block |
||
| 8727 | 8727 | $translabel = $langs->trans($obj->$field_toshow); |
| 8728 | 8728 | } |
| 8729 | 8729 | if ($translabel != $field_toshow) { |
| 8730 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8730 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8731 | 8731 | } else { |
| 8732 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
| 8732 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
| 8733 | 8733 | } |
| 8734 | 8734 | } |
| 8735 | 8735 | } else { |
@@ -8738,15 +8738,15 @@ discard block |
||
| 8738 | 8738 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
| 8739 | 8739 | } |
| 8740 | 8740 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
| 8741 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8741 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8742 | 8742 | } else { |
| 8743 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
| 8743 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
| 8744 | 8744 | } |
| 8745 | 8745 | } |
| 8746 | 8746 | } |
| 8747 | 8747 | } |
| 8748 | 8748 | } else { |
| 8749 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8749 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8750 | 8750 | |
| 8751 | 8751 | $toprint = array(); |
| 8752 | 8752 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -8755,7 +8755,7 @@ discard block |
||
| 8755 | 8755 | $c->fetch($obj->rowid); |
| 8756 | 8756 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8757 | 8757 | foreach ($ways as $way) { |
| 8758 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8758 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8759 | 8759 | } |
| 8760 | 8760 | } |
| 8761 | 8761 | } |
@@ -8925,7 +8925,7 @@ discard block |
||
| 8925 | 8925 | global $langs; |
| 8926 | 8926 | |
| 8927 | 8927 | if (!class_exists('Validate')) { |
| 8928 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
| 8928 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
| 8929 | 8929 | } |
| 8930 | 8930 | |
| 8931 | 8931 | $this->clearFieldError($fieldKey); |
@@ -9164,7 +9164,7 @@ discard block |
||
| 9164 | 9164 | $out .= "\n"; |
| 9165 | 9165 | |
| 9166 | 9166 | $nbofextrafieldsshown = 0; |
| 9167 | - $e = 0; // var to manage the modulo (odd/even) |
|
| 9167 | + $e = 0; // var to manage the modulo (odd/even) |
|
| 9168 | 9168 | |
| 9169 | 9169 | $lastseparatorkeyfound = ''; |
| 9170 | 9170 | $extrafields_collapse_num = ''; |
@@ -9202,9 +9202,9 @@ discard block |
||
| 9202 | 9202 | continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
| 9203 | 9203 | } elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) { |
| 9204 | 9204 | // We need to make sure, that the values of hidden extrafields are also part of $_POST. Otherwise, they would be empty after an update of the object. See also getOptionalsFromPost |
| 9205 | - $ef_name = 'options_' . $key; |
|
| 9205 | + $ef_name = 'options_'.$key; |
|
| 9206 | 9206 | $ef_value = $this->array_options[$ef_name]; |
| 9207 | - $out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n"; |
|
| 9207 | + $out .= '<input type="hidden" name="'.$ef_name.'" id="'.$ef_name.'" value="'.$ef_value.'" />'."\n"; |
|
| 9208 | 9208 | continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation |
| 9209 | 9209 | } elseif ($mode == 'view' && empty($visibility)) { |
| 9210 | 9210 | continue; |
@@ -10275,7 +10275,7 @@ discard block |
||
| 10275 | 10275 | continue; |
| 10276 | 10276 | } |
| 10277 | 10277 | } |
| 10278 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
| 10278 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
| 10279 | 10279 | } |
| 10280 | 10280 | return implode(',', $keys_with_alias); |
| 10281 | 10281 | } else { |
@@ -10410,7 +10410,7 @@ discard block |
||
| 10410 | 10410 | if (!$error) { |
| 10411 | 10411 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
| 10412 | 10412 | $sql .= " (".implode(", ", $keys).')'; |
| 10413 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 10413 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 10414 | 10414 | |
| 10415 | 10415 | $res = $this->db->query($sql); |
| 10416 | 10416 | if (!$res) { |
@@ -10713,7 +10713,7 @@ discard block |
||
| 10713 | 10713 | |
| 10714 | 10714 | // Update extrafield |
| 10715 | 10715 | if (!$error) { |
| 10716 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 10716 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 10717 | 10717 | if ($result < 0) { |
| 10718 | 10718 | $error++; |
| 10719 | 10719 | } |
@@ -10915,12 +10915,12 @@ discard block |
||
| 10915 | 10915 | $error++; |
| 10916 | 10916 | } else { |
| 10917 | 10917 | while ($obj = $this->db->fetch_object($resql)) { |
| 10918 | - $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 10918 | + $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 10919 | 10919 | if ($result < 0) { |
| 10920 | 10920 | $error++; |
| 10921 | 10921 | $this->errors[] = $this->error; |
| 10922 | 10922 | } else { |
| 10923 | - $result = $this->delete($user); // @phpstan-ignore-line |
|
| 10923 | + $result = $this->delete($user); // @phpstan-ignore-line |
|
| 10924 | 10924 | if ($result < 0) { |
| 10925 | 10925 | $error++; |
| 10926 | 10926 | $this->errors[] = $this->error; |
@@ -11086,7 +11086,7 @@ discard block |
||
| 11086 | 11086 | ); |
| 11087 | 11087 | foreach ($fields as $key => $value) { |
| 11088 | 11088 | if (array_key_exists($key, $this->fields)) { |
| 11089 | - $this->{$key} = $value; // @phpstan-ignore-line |
|
| 11089 | + $this->{$key} = $value; // @phpstan-ignore-line |
|
| 11090 | 11090 | } |
| 11091 | 11091 | } |
| 11092 | 11092 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | 'table' => 'asset_depreciation_options_economic', |
| 81 | 81 | 'fields' => array( |
| 82 | 82 | 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDepreciationTypeLinear', 1 => 'AssetDepreciationOptionDepreciationTypeDegressive', 2 => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => 1,), |
| 83 | - 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,'enabled_field' => 'economic:depreciation_type:1'), |
|
| 83 | + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'enabled_field' => 'economic:depreciation_type:1'), |
|
| 84 | 84 | 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), |
| 85 | 85 | 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDurationTypeAnnual', 1 => 'AssetDepreciationOptionDurationTypeMonthly'/*, 2=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => 1,), |
| 86 | 86 | 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => 1, 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'computed' => '$object->asset_depreciation_options->getRate("economic")',), |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | 'enabled_field' => 'economic:accelerated_depreciation_option:1', |
| 97 | 97 | 'fields' => array( |
| 98 | 98 | 'depreciation_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDepreciationType', 'enabled' => 1, 'position' => 10, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDepreciationTypeLinear', 1 => 'AssetDepreciationOptionDepreciationTypeDegressive', 2 => 'AssetDepreciationOptionDepreciationTypeExceptional'), 'validate' => 1,), |
| 99 | - 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,'enabled_field' => 'accelerated_depreciation:depreciation_type:1'), |
|
| 99 | + 'degressive_coefficient' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionDegressiveRate', 'enabled' => 1, 'position' => 20, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'enabled_field' => 'accelerated_depreciation:depreciation_type:1'), |
|
| 100 | 100 | 'duration' => array('type' => 'integer', 'label' => 'AssetDepreciationOptionDuration', 'enabled' => 1, 'position' => 30, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'isameasure' => 1, 'validate' => 1,), |
| 101 | 101 | 'duration_type' => array('type' => 'smallint', 'label' => 'AssetDepreciationOptionDurationType', 'enabled' => 1, 'position' => 40, 'notnull' => 1, 'visible' => 1, 'default' => '0', 'arrayofkeyval' => array(0 => 'AssetDepreciationOptionDurationTypeAnnual', 1 => 'AssetDepreciationOptionDurationTypeMonthly'/*, 2=>'AssetDepreciationOptionDurationTypeDaily'*/), 'validate' => 1,), |
| 102 | 102 | 'rate' => array('type' => 'double(24,8)', 'label' => 'AssetDepreciationOptionRate', 'enabled' => 1, 'position' => 50, 'visible' => 3, 'default' => '0', 'isameasure' => 1, 'validate' => 1, 'computed' => '$object->asset_depreciation_options->getRate("accelerated_depreciation")',), |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | continue; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - $html_name = $mode_key . '_' . $field_key; |
|
| 241 | + $html_name = $mode_key.'_'.$field_key; |
|
| 242 | 242 | if ($field_info['type'] == 'duration') { |
| 243 | - if (GETPOST($html_name . 'hour') == '' && GETPOST($html_name . 'min') == '') { |
|
| 243 | + if (GETPOST($html_name.'hour') == '' && GETPOST($html_name.'min') == '') { |
|
| 244 | 244 | continue; // The field was not submitted to be saved |
| 245 | 245 | } |
| 246 | 246 | } else { |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | if (in_array($field_info['type'], array('text', 'html'))) { |
| 263 | 263 | $value = GETPOST($html_name, 'restricthtml'); |
| 264 | 264 | } elseif ($field_info['type'] == 'date') { |
| 265 | - $value = dol_mktime(12, 0, 0, GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year')); // for date without hour, we use gmt |
|
| 265 | + $value = dol_mktime(12, 0, 0, GETPOSTINT($html_name.'month'), GETPOSTINT($html_name.'day'), GETPOSTINT($html_name.'year')); // for date without hour, we use gmt |
|
| 266 | 266 | } elseif ($field_info['type'] == 'datetime') { |
| 267 | - $value = dol_mktime(GETPOSTINT($html_name . 'hour'), GETPOSTINT($html_name . 'min'), GETPOSTINT($html_name . 'sec'), GETPOSTINT($html_name . 'month'), GETPOSTINT($html_name . 'day'), GETPOSTINT($html_name . 'year'), 'tzuserrel'); |
|
| 267 | + $value = dol_mktime(GETPOSTINT($html_name.'hour'), GETPOSTINT($html_name.'min'), GETPOSTINT($html_name.'sec'), GETPOSTINT($html_name.'month'), GETPOSTINT($html_name.'day'), GETPOSTINT($html_name.'year'), 'tzuserrel'); |
|
| 268 | 268 | } elseif ($field_info['type'] == 'duration') { |
| 269 | - $value = 60 * 60 * GETPOSTINT($html_name . 'hour') + 60 * GETPOSTINT($html_name . 'min'); |
|
| 269 | + $value = 60 * 60 * GETPOSTINT($html_name.'hour') + 60 * GETPOSTINT($html_name.'min'); |
|
| 270 | 270 | } elseif (preg_match('/^(integer|price|real|double)/', $field_info['type'])) { |
| 271 | 271 | $value = price2num(GETPOST($html_name, 'alphanohtml')); // To fix decimal separator according to lang setup |
| 272 | 272 | } elseif ($field_info['type'] == 'boolean') { |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | } elseif ($field_info['type'] == 'reference') { |
| 275 | 275 | // todo to check |
| 276 | 276 | $tmparraykey = array(); //array_keys($object->param_list); |
| 277 | - $value = $tmparraykey[GETPOST($html_name)] . ',' . GETPOST($html_name . '2'); |
|
| 277 | + $value = $tmparraykey[GETPOST($html_name)].','.GETPOST($html_name.'2'); |
|
| 278 | 278 | } else { |
| 279 | 279 | if ($field_key == 'lang') { |
| 280 | 280 | $value = GETPOST($html_name, 'aZ09') ? GETPOST($html_name, 'aZ09') : ""; |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | public function fetchDeprecationOptions($asset_id = 0, $asset_model_id = 0) |
| 341 | 341 | { |
| 342 | 342 | global $langs, $hookmanager; |
| 343 | - dol_syslog(__METHOD__ . " asset_id=$asset_id, asset_model_id=$asset_model_id"); |
|
| 343 | + dol_syslog(__METHOD__." asset_id=$asset_id, asset_model_id=$asset_model_id"); |
|
| 344 | 344 | |
| 345 | 345 | $error = 0; |
| 346 | 346 | $this->errors = array(); |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | $error++; |
| 364 | 364 | } |
| 365 | 365 | if ($error) { |
| 366 | - dol_syslog(__METHOD__ . " Error check parameters: " . $this->errorsToString(), LOG_ERR); |
|
| 366 | + dol_syslog(__METHOD__." Error check parameters: ".$this->errorsToString(), LOG_ERR); |
|
| 367 | 367 | return -1; |
| 368 | 368 | } |
| 369 | 369 | |
@@ -372,9 +372,9 @@ discard block |
||
| 372 | 372 | foreach ($this->deprecation_options_fields as $mode_key => $mode_info) { |
| 373 | 373 | $this->setInfosForMode($mode_key, $class_type); |
| 374 | 374 | |
| 375 | - $result = $this->fetchCommon(0, '', " AND " . ($asset_id > 0 ? " fk_asset = " . (int) $asset_id : " fk_asset_model = " . (int) $asset_model_id)); |
|
| 375 | + $result = $this->fetchCommon(0, '', " AND ".($asset_id > 0 ? " fk_asset = ".(int) $asset_id : " fk_asset_model = ".(int) $asset_model_id)); |
|
| 376 | 376 | if ($result < 0) { |
| 377 | - $this->errors = array_merge(array($langs->trans('AssetErrorFetchDepreciationOptionsForMode', $mode_key) . ':'), $this->errors); |
|
| 377 | + $this->errors = array_merge(array($langs->trans('AssetErrorFetchDepreciationOptionsForMode', $mode_key).':'), $this->errors); |
|
| 378 | 378 | $error++; |
| 379 | 379 | } elseif ($result > 0) { |
| 380 | 380 | foreach ($this->fields as $field_key => $field_info) { |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | if ($error) { |
| 399 | - dol_syslog(__METHOD__ . " Error fetch accountancy codes: " . $this->errorsToString(), LOG_ERR); |
|
| 399 | + dol_syslog(__METHOD__." Error fetch accountancy codes: ".$this->errorsToString(), LOG_ERR); |
|
| 400 | 400 | return -1; |
| 401 | 401 | } else { |
| 402 | 402 | $this->deprecation_options = $deprecation_options; |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | public function getGeneralDepreciationInfoForMode($mode) |
| 414 | 414 | { |
| 415 | 415 | global $hookmanager; |
| 416 | - dol_syslog(__METHOD__ . " mode=$mode"); |
|
| 416 | + dol_syslog(__METHOD__." mode=$mode"); |
|
| 417 | 417 | |
| 418 | 418 | $this->errors = array(); |
| 419 | 419 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | public function updateDeprecationOptions($user, $asset_id = 0, $asset_model_id = 0, $notrigger = 0) |
| 452 | 452 | { |
| 453 | 453 | global $langs, $hookmanager; |
| 454 | - dol_syslog(__METHOD__ . " user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger); |
|
| 454 | + dol_syslog(__METHOD__." user_id=".$user->id.", asset_id=".$asset_id.", asset_model_id=".$asset_model_id.", notrigger=".$notrigger); |
|
| 455 | 455 | |
| 456 | 456 | $error = 0; |
| 457 | 457 | $this->errors = array(); |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | $error++; |
| 474 | 474 | } |
| 475 | 475 | if ($error) { |
| 476 | - dol_syslog(__METHOD__ . " Error check parameters: " . $this->errorsToString(), LOG_ERR); |
|
| 476 | + dol_syslog(__METHOD__." Error check parameters: ".$this->errorsToString(), LOG_ERR); |
|
| 477 | 477 | return -1; |
| 478 | 478 | } |
| 479 | 479 | |
@@ -491,11 +491,11 @@ discard block |
||
| 491 | 491 | |
| 492 | 492 | foreach ($this->deprecation_options_fields as $mode_key => $mode_info) { |
| 493 | 493 | // Delete old accountancy codes |
| 494 | - $sql = "DELETE FROM " . MAIN_DB_PREFIX . $mode_info['table']; |
|
| 495 | - $sql .= " WHERE " . ($asset_id > 0 ? " fk_asset = " . (int) $asset_id : " fk_asset_model = " . (int) $asset_model_id); |
|
| 494 | + $sql = "DELETE FROM ".MAIN_DB_PREFIX.$mode_info['table']; |
|
| 495 | + $sql .= " WHERE ".($asset_id > 0 ? " fk_asset = ".(int) $asset_id : " fk_asset_model = ".(int) $asset_model_id); |
|
| 496 | 496 | $resql = $this->db->query($sql); |
| 497 | 497 | if (!$resql) { |
| 498 | - $this->errors[] = $langs->trans('AssetErrorDeleteDepreciationOptionsForMode', $mode_key) . ': ' . $this->db->lasterror(); |
|
| 498 | + $this->errors[] = $langs->trans('AssetErrorDeleteDepreciationOptionsForMode', $mode_key).': '.$this->db->lasterror(); |
|
| 499 | 499 | $error++; |
| 500 | 500 | } |
| 501 | 501 | |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | |
| 512 | 512 | $result = $this->createCommon($user, 1); |
| 513 | 513 | if ($result < 0) { |
| 514 | - $this->errors = array_merge(array($langs->trans('AssetErrorInsertDepreciationOptionsForMode', $mode_key) . ':'), $this->errors); |
|
| 514 | + $this->errors = array_merge(array($langs->trans('AssetErrorInsertDepreciationOptionsForMode', $mode_key).':'), $this->errors); |
|
| 515 | 515 | $error++; |
| 516 | 516 | } |
| 517 | 517 | } |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | |
| 520 | 520 | if (!$error && $this->fk_asset > 0) { |
| 521 | 521 | // Calculation of depreciation lines (reversal and future) |
| 522 | - require_once DOL_DOCUMENT_ROOT . '/asset/class/asset.class.php'; |
|
| 522 | + require_once DOL_DOCUMENT_ROOT.'/asset/class/asset.class.php'; |
|
| 523 | 523 | $asset = new Asset($this->db); |
| 524 | 524 | $result = $asset->fetch($this->fk_asset); |
| 525 | 525 | if ($result > 0) { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | 'fk_user_modif' => array('type' => 'integer:User:user/class/user.class.php', 'label' => 'UserModif', 'enabled' => 1, 'position' => 511, 'notnull' => -1, 'visible' => -2,), |
| 113 | 113 | 'import_key' => array('type' => 'varchar(14)', 'label' => 'ImportId', 'enabled' => 1, 'position' => 512, 'notnull' => -1, 'visible' => -2,), |
| 114 | 114 | 'nb_operators_required' => array('type' => 'integer', 'label' => 'NbOperatorsRequired', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), |
| 115 | - 'thm_operator_estimated' => array('type' => 'double', 'help' => 'THMOperatorEstimatedHelp','label' => 'THMOperatorEstimated', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), |
|
| 115 | + 'thm_operator_estimated' => array('type' => 'double', 'help' => 'THMOperatorEstimatedHelp', 'label' => 'THMOperatorEstimated', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), |
|
| 116 | 116 | 'thm_machine_estimated' => array('type' => 'double', 'help' => 'THMMachineEstimatedHelp', 'label' => 'THMMachineEstimated', 'enabled' => 1, 'position' => 50, 'notnull' => 0, 'visible' => 1, 'css' => 'right', 'csslist' => 'maxwidth75imp'), |
| 117 | 117 | 'status' => array('type' => 'smallint', 'label' => 'Status', 'enabled' => 1, 'position' => 1000, 'default' => '1', 'notnull' => 1, 'visible' => 1, 'index' => 1, 'arrayofkeyval' => array(0 => 'Disabled', 1 => 'Enabled'),), |
| 118 | 118 | ); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | /** |
| 136 | 136 | * @var string type |
| 137 | 137 | */ |
| 138 | - public $type; // HUMAN, MACHINE, ... |
|
| 138 | + public $type; // HUMAN, MACHINE, ... |
|
| 139 | 139 | |
| 140 | 140 | /** |
| 141 | 141 | * @var int User ID |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $id = $this->createCommon($user, $notrigger); |
| 237 | 237 | |
| 238 | 238 | // Usergroups |
| 239 | - $groups = GETPOST('groups', 'array:int'); // FIXME We should not GETPOST but receive array as parameter |
|
| 239 | + $groups = GETPOST('groups', 'array:int'); // FIXME We should not GETPOST but receive array as parameter |
|
| 240 | 240 | if (empty($groups)) { |
| 241 | 241 | $groups = $this->usergroups; // createFromClone |
| 242 | 242 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // Resources |
| 254 | - $resources = GETPOST('resources', 'array:int'); // FIXME We should not GETPOST but receive array as parameter |
|
| 254 | + $resources = GETPOST('resources', 'array:int'); // FIXME We should not GETPOST but receive array as parameter |
|
| 255 | 255 | if (empty($resources)) { |
| 256 | 256 | $resources = $this->resources; // createFromClone |
| 257 | 257 | } |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | if (getDolGlobalString('WORKSTATION_WORKSTATION_ADDON')) { |
| 867 | 867 | $mybool = false; |
| 868 | 868 | |
| 869 | - $file = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON') . ".php"; |
|
| 869 | + $file = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON').".php"; |
|
| 870 | 870 | $classname = getDolGlobalString('WORKSTATION_WORKSTATION_ADDON'); |
| 871 | 871 | |
| 872 | 872 | // Include file with class |