|
@@ -477,11 +477,11 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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
|
} |
|
@@ -7620,7 +7620,7 @@ discard block |
|
|
block discarded – undo |
|
7620
|
7620
|
} elseif (in_array($type, array('real'))) { |
|
7621
|
7621
|
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>'; |
|
7622
|
7622
|
} elseif (preg_match('/varchar/', (string) $type)) { |
|
7623
|
|
- $out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"'.($size > 0 ? ' maxlength="'.$size.'"' : '').' value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($placeholder?' placeholder="'.dolPrintHTMLForAttribute($placeholder).'"':'').($autofocusoncreate ? ' autofocus' : '').'>'; |
|
|
7623
|
+ $out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'"'.($size > 0 ? ' maxlength="'.$size.'"' : '').' value="'.dol_escape_htmltag($value).'"'.($moreparam ? $moreparam : '').($placeholder ? ' placeholder="'.dolPrintHTMLForAttribute($placeholder).'"' : '').($autofocusoncreate ? ' autofocus' : '').'>'; |
|
7624
|
7624
|
} elseif (in_array($type, array('email', 'mail', 'phone', 'url', 'ip'))) { |
|
7625
|
7625
|
$out = '<input type="text" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam ? $moreparam : '').($autofocusoncreate ? ' autofocus' : '').'>'; |
|
7626
|
7626
|
} elseif (preg_match('/^text/', (string) $type)) { |
|
@@ -7804,7 +7804,7 @@ discard block |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 |
|
|
block discarded – undo |
|
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 = ''; |
|
@@ -10271,7 +10271,7 @@ discard block |
|
|
block discarded – undo |
|
10271
|
10271
|
continue; |
|
10272
|
10272
|
} |
|
10273
|
10273
|
} |
|
10274
|
|
- $keys_with_alias[] = $alias . '.' . $fieldname; |
|
|
10274
|
+ $keys_with_alias[] = $alias.'.'.$fieldname; |
|
10275
|
10275
|
} |
|
10276
|
10276
|
return implode(',', $keys_with_alias); |
|
10277
|
10277
|
} else { |
|
@@ -10406,7 +10406,7 @@ discard block |
|
|
block discarded – undo |
|
10406
|
10406
|
if (!$error) { |
|
10407
|
10407
|
$sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
|
10408
|
10408
|
$sql .= " (".implode(", ", $keys).')'; |
|
10409
|
|
- $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
|
10409
|
+ $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
10410
|
10410
|
|
|
10411
|
10411
|
$res = $this->db->query($sql); |
|
10412
|
10412
|
if (!$res) { |
|
@@ -10709,7 +10709,7 @@ discard block |
|
|
block discarded – undo |
|
10709
|
10709
|
|
|
10710
|
10710
|
// Update extrafield |
|
10711
|
10711
|
if (!$error) { |
|
10712
|
|
- $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
|
10712
|
+ $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
10713
|
10713
|
if ($result < 0) { |
|
10714
|
10714
|
$error++; |
|
10715
|
10715
|
} |
|
@@ -10911,12 +10911,12 @@ discard block |
|
|
block discarded – undo |
|
10911
|
10911
|
$error++; |
|
10912
|
10912
|
} else { |
|
10913
|
10913
|
while ($obj = $this->db->fetch_object($resql)) { |
|
10914
|
|
- $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
|
10914
|
+ $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
10915
|
10915
|
if ($result < 0) { |
|
10916
|
10916
|
$error++; |
|
10917
|
10917
|
$this->errors[] = $this->error; |
|
10918
|
10918
|
} else { |
|
10919
|
|
- $result = $this->delete($user); // @phpstan-ignore-line |
|
|
10919
|
+ $result = $this->delete($user); // @phpstan-ignore-line |
|
10920
|
10920
|
if ($result < 0) { |
|
10921
|
10921
|
$error++; |
|
10922
|
10922
|
$this->errors[] = $this->error; |
|
@@ -11082,7 +11082,7 @@ discard block |
|
|
block discarded – undo |
|
11082
|
11082
|
); |
|
11083
|
11083
|
foreach ($fields as $key => $value) { |
|
11084
|
11084
|
if (array_key_exists($key, $this->fields)) { |
|
11085
|
|
- $this->{$key} = $value; // @phpstan-ignore-line |
|
|
11085
|
+ $this->{$key} = $value; // @phpstan-ignore-line |
|
11086
|
11086
|
} |
|
11087
|
11087
|
} |
|
11088
|
11088
|
|