@@ -213,10 +213,10 @@ discard block |
||
| 213 | 213 | print '</tr></table>'; |
| 214 | 214 | print '</td>'; |
| 215 | 215 | |
| 216 | - $cssview = !empty($extrafields->attributes[$object->table_element]['cssview'][$tmpkeyextra]) ? ($extrafields->attributes[$object->table_element]['cssview'][$tmpkeyextra] . ' ') : ''; |
|
| 216 | + $cssview = !empty($extrafields->attributes[$object->table_element]['cssview'][$tmpkeyextra]) ? ($extrafields->attributes[$object->table_element]['cssview'][$tmpkeyextra].' ') : ''; |
|
| 217 | 217 | $html_id = !empty($object->id) ? $object->element.'_extras_'.$tmpkeyextra.'_'.$object->id : ''; |
| 218 | 218 | |
| 219 | - print '<td id="' . $html_id . '" class="valuefield ' . $cssview . $object->element . '_extras_' . $tmpkeyextra . ' wordbreakimp"' . (!empty($cols) ? ' colspan="' . $cols . '"' : '') . '>'; |
|
| 219 | + print '<td id="'.$html_id.'" class="valuefield '.$cssview.$object->element.'_extras_'.$tmpkeyextra.' wordbreakimp"'.(!empty($cols) ? ' colspan="'.$cols.'"' : '').'>'; |
|
| 220 | 220 | |
| 221 | 221 | // Convert date into timestamp format |
| 222 | 222 | if (in_array($extrafields->attributes[$object->table_element]['type'][$tmpkeyextra], array('date'))) { |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | if ($object->table_element == 'societe') { |
| 245 | 245 | $fieldid = 'socid'; |
| 246 | 246 | } |
| 247 | - print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"] . '?' . $fieldid . '=' . $object->id . '" method="post" name="formextra">'; |
|
| 247 | + print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'?'.$fieldid.'='.$object->id.'" method="post" name="formextra">'; |
|
| 248 | 248 | print '<input type="hidden" name="action" value="update_extras">'; |
| 249 | 249 | print '<input type="hidden" name="attribute" value="'.$tmpkeyextra.'">'; |
| 250 | 250 | print '<input type="hidden" name="token" value="'.newToken().'">'; |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | * @param mixed $v Feature information of a product. |
| 646 | 646 | * @return bool |
| 647 | 647 | */ |
| 648 | - static function ($v) { |
|
| 648 | + static function($v) { |
|
| 649 | 649 | return !empty($v); |
| 650 | 650 | } |
| 651 | 651 | ); |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | if ($forced_refvar === false) { |
| 854 | - $newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR', '_') . $prodattrval->ref; |
|
| 854 | + $newproduct->ref .= getDolGlobalString('PRODUIT_ATTRIBUTES_SEPARATOR', '_').$prodattrval->ref; |
|
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | //The first one should not contain a linebreak |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | $productCombinationLevel->fk_price_level = $i; |
| 876 | 876 | $productCombinationLevel->variation_price = $price_impact[$i]; |
| 877 | 877 | |
| 878 | - $productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i] ; |
|
| 878 | + $productCombinationLevel->variation_price_percentage = (bool) $price_var_percent[$i]; |
|
| 879 | 879 | |
| 880 | 880 | $newcomb->combination_price_levels[$i] = $productCombinationLevel; |
| 881 | 881 | } |
@@ -989,8 +989,8 @@ discard block |
||
| 989 | 989 | $variation_price = $combinationObject->variation_price; |
| 990 | 990 | |
| 991 | 991 | if (getDolGlobalInt('PRODUIT_MULTIPRICES') && getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT') > 1) { |
| 992 | - $variation_price_percentage = [ ]; |
|
| 993 | - $variation_price = [ ]; |
|
| 992 | + $variation_price_percentage = []; |
|
| 993 | + $variation_price = []; |
|
| 994 | 994 | |
| 995 | 995 | foreach ($combinationObject->combination_price_levels as $productCombinationLevel) { |
| 996 | 996 | $variation_price_percentage[$productCombinationLevel->fk_price_level] = $productCombinationLevel->variation_price_percentage; |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | $tmpinvoice->total_ht = $obj->total_ht; |
| 210 | 210 | $tmpinvoice->total_tva = $obj->total_tva; |
| 211 | 211 | $tmpinvoice->total_ttc = $obj->total_ttc; |
| 212 | - $tmpinvoice->statut = $obj->status; // deprecated |
|
| 212 | + $tmpinvoice->statut = $obj->status; // deprecated |
|
| 213 | 213 | $tmpinvoice->status = $obj->status; |
| 214 | - $tmpinvoice->paye = $obj->paye; // deprecated |
|
| 214 | + $tmpinvoice->paye = $obj->paye; // deprecated |
|
| 215 | 215 | $tmpinvoice->paid = $obj->paye; |
| 216 | 216 | $tmpinvoice->date_lim_reglement = $db->jdate($obj->datelimite); |
| 217 | 217 | $tmpinvoice->type = $obj->type; |
@@ -361,9 +361,9 @@ discard block |
||
| 361 | 361 | $facstatic->total_ht = $obj->total_ht; |
| 362 | 362 | $facstatic->total_tva = $obj->total_tva; |
| 363 | 363 | $facstatic->total_ttc = $obj->total_ttc; |
| 364 | - $facstatic->statut = $obj->status; // deprecated |
|
| 364 | + $facstatic->statut = $obj->status; // deprecated |
|
| 365 | 365 | $facstatic->status = $obj->status; |
| 366 | - $facstatic->paye = $obj->paye; // deprecated |
|
| 366 | + $facstatic->paye = $obj->paye; // deprecated |
|
| 367 | 367 | $facstatic->paid = $obj->paye; |
| 368 | 368 | $facstatic->type = $obj->type; |
| 369 | 369 | $facstatic->ref_supplier = $obj->ref_supplier; |
@@ -470,11 +470,11 @@ discard block |
||
| 470 | 470 | * |
| 471 | 471 | * Note: cond_reglement can not be aliased to cond_reglement!!! |
| 472 | 472 | */ |
| 473 | - private $cond_reglement; // Private to call DolDeprecationHandler |
|
| 473 | + private $cond_reglement; // Private to call DolDeprecationHandler |
|
| 474 | 474 | /** |
| 475 | 475 | * @var int|string Internal to detect deprecated access |
| 476 | 476 | */ |
| 477 | - protected $depr_cond_reglement; // Internal value for deprecation |
|
| 477 | + protected $depr_cond_reglement; // Internal value for deprecation |
|
| 478 | 478 | |
| 479 | 479 | /** |
| 480 | 480 | * @var int Delivery address ID |
@@ -526,12 +526,12 @@ discard block |
||
| 526 | 526 | /** |
| 527 | 527 | * @var float|string Multicurrency total localtax1 |
| 528 | 528 | */ |
| 529 | - public $multicurrency_total_localtax1; // not in database |
|
| 529 | + public $multicurrency_total_localtax1; // not in database |
|
| 530 | 530 | |
| 531 | 531 | /** |
| 532 | 532 | * @var float|string Multicurrency total localtax2 |
| 533 | 533 | */ |
| 534 | - public $multicurrency_total_localtax2; // not in database |
|
| 534 | + public $multicurrency_total_localtax2; // not in database |
|
| 535 | 535 | |
| 536 | 536 | /** |
| 537 | 537 | * @var float Multicurrency total amount including taxes (TTC = "Toutes Taxes Comprises" in French) |
@@ -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, |
@@ -1258,8 +1258,8 @@ discard block |
||
| 1258 | 1258 | |
| 1259 | 1259 | if ($this->restrictiononfksoc && property_exists($this, 'socid') && !empty($this->socid) && !$user->hasRight('societe', 'client', 'voir')) { |
| 1260 | 1260 | $sql_allowed_contacts = 'SELECT COUNT(*) as cnt FROM '.$this->db->prefix().'societe_commerciaux as sc'; |
| 1261 | - $sql_allowed_contacts.= ' WHERE sc.fk_soc = '.(int) $this->socid; |
|
| 1262 | - $sql_allowed_contacts.= ' AND sc.fk_user = '.(int) $user->id; |
|
| 1261 | + $sql_allowed_contacts .= ' WHERE sc.fk_soc = '.(int) $this->socid; |
|
| 1262 | + $sql_allowed_contacts .= ' AND sc.fk_user = '.(int) $user->id; |
|
| 1263 | 1263 | |
| 1264 | 1264 | $resql_allowed_contacts = $this->db->query($sql_allowed_contacts); |
| 1265 | 1265 | |
@@ -1558,7 +1558,7 @@ discard block |
||
| 1558 | 1558 | $sql .= " AND ec.fk_c_type_contact IN (".$this->db->sanitize(implode(',', $arrayoftcids)).")"; |
| 1559 | 1559 | } |
| 1560 | 1560 | if ($status >= 0) { |
| 1561 | - $sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople |
|
| 1561 | + $sql .= " AND t.statut = ".((int) $status); // t is llx_user or llx_socpeople |
|
| 1562 | 1562 | } |
| 1563 | 1563 | if ($statusoflink >= 0) { |
| 1564 | 1564 | $sql .= " AND ec.statut = ".((int) $statusoflink); |
@@ -1947,7 +1947,7 @@ discard block |
||
| 1947 | 1947 | } |
| 1948 | 1948 | |
| 1949 | 1949 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element; |
| 1950 | - $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1950 | + $sql .= " WHERE ".$this->table_ref_field." LIKE '".$this->db->escape($ref)."'"; // no escapeforlike here |
|
| 1951 | 1951 | $sql .= " LIMIT 1"; |
| 1952 | 1952 | |
| 1953 | 1953 | $query = $this->db->query($sql); |
@@ -2266,9 +2266,9 @@ discard block |
||
| 2266 | 2266 | |
| 2267 | 2267 | $oldvalue = null; |
| 2268 | 2268 | if ($trigkey) { |
| 2269 | - $sql = "SELECT " . $field; |
|
| 2270 | - $sql .= " FROM " . MAIN_DB_PREFIX . $table; |
|
| 2271 | - $sql .= " WHERE " . $id_field . " = " . ((int) $id); |
|
| 2269 | + $sql = "SELECT ".$field; |
|
| 2270 | + $sql .= " FROM ".MAIN_DB_PREFIX.$table; |
|
| 2271 | + $sql .= " WHERE ".$id_field." = ".((int) $id); |
|
| 2272 | 2272 | |
| 2273 | 2273 | $resql = $this->db->query($sql); |
| 2274 | 2274 | if ($resql) { |
@@ -2648,7 +2648,7 @@ discard block |
||
| 2648 | 2648 | // Triggers |
| 2649 | 2649 | if (!$error && !$notrigger) { |
| 2650 | 2650 | // Call triggers |
| 2651 | - $result = $this->call_trigger(strtoupper($this->element) . '_MODIFY', $user); |
|
| 2651 | + $result = $this->call_trigger(strtoupper($this->element).'_MODIFY', $user); |
|
| 2652 | 2652 | if ($result < 0) { |
| 2653 | 2653 | $error++; |
| 2654 | 2654 | } //Do also here what you must do to rollback action if trigger fail |
@@ -3060,7 +3060,7 @@ discard block |
||
| 3060 | 3060 | $sql = 'UPDATE '.$this->db->prefix().$this->table_element; |
| 3061 | 3061 | $sql .= " SET ".$fieldname." = ".(($id > 0 || $id == '0') ? ((int) $id) : 'NULL'); |
| 3062 | 3062 | if (in_array($this->table_element, array('propal', 'commande', 'societe'))) { |
| 3063 | - $sql .= " , deposit_percent = " . (empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'"); |
|
| 3063 | + $sql .= " , deposit_percent = ".(empty($deposit_percent) ? 'NULL' : "'".$this->db->escape((string) $deposit_percent)."'"); |
|
| 3064 | 3064 | } |
| 3065 | 3065 | $sql .= ' WHERE rowid='.((int) $this->id); |
| 3066 | 3066 | |
@@ -3408,10 +3408,10 @@ discard block |
||
| 3408 | 3408 | $sql = "SELECT count(rowid) FROM ".$this->db->prefix().$this->table_element_line; |
| 3409 | 3409 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3410 | 3410 | if (!$renum) { |
| 3411 | - $sql .= " AND " . $fieldposition . " = 0"; |
|
| 3411 | + $sql .= " AND ".$fieldposition." = 0"; |
|
| 3412 | 3412 | } |
| 3413 | 3413 | if ($renum) { |
| 3414 | - $sql .= " AND " . $fieldposition . " <> 0"; |
|
| 3414 | + $sql .= " AND ".$fieldposition." <> 0"; |
|
| 3415 | 3415 | } |
| 3416 | 3416 | |
| 3417 | 3417 | dol_syslog(get_class($this)."::line_order", LOG_DEBUG); |
@@ -3432,7 +3432,7 @@ discard block |
||
| 3432 | 3432 | if ($fk_parent_line) { |
| 3433 | 3433 | $sql .= ' AND fk_parent_line IS NULL'; |
| 3434 | 3434 | } |
| 3435 | - $sql .= " ORDER BY " . $fieldposition . " ASC, rowid " . $rowidorder; |
|
| 3435 | + $sql .= " ORDER BY ".$fieldposition." ASC, rowid ".$rowidorder; |
|
| 3436 | 3436 | |
| 3437 | 3437 | dol_syslog(get_class($this)."::line_order search all parent lines", LOG_DEBUG); |
| 3438 | 3438 | $resql = $this->db->query($sql); |
@@ -3486,7 +3486,7 @@ discard block |
||
| 3486 | 3486 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3487 | 3487 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3488 | 3488 | $sql .= ' AND fk_parent_line = '.((int) $id); |
| 3489 | - $sql .= " ORDER BY " . $fieldposition . " ASC"; |
|
| 3489 | + $sql .= " ORDER BY ".$fieldposition." ASC"; |
|
| 3490 | 3490 | |
| 3491 | 3491 | dol_syslog(get_class($this)."::getChildrenOfLine search children lines for line ".$id, LOG_DEBUG); |
| 3492 | 3492 | |
@@ -3610,7 +3610,7 @@ discard block |
||
| 3610 | 3610 | |
| 3611 | 3611 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3612 | 3612 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3613 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang - 1)); |
|
| 3613 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang - 1)); |
|
| 3614 | 3614 | if ($this->db->query($sql)) { |
| 3615 | 3615 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang - 1)); |
| 3616 | 3616 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3641,7 +3641,7 @@ discard block |
||
| 3641 | 3641 | |
| 3642 | 3642 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) $rang); |
| 3643 | 3643 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3644 | - $sql .= " AND " . $fieldposition . " = " . ((int) ($rang + 1)); |
|
| 3644 | + $sql .= " AND ".$fieldposition." = ".((int) ($rang + 1)); |
|
| 3645 | 3645 | if ($this->db->query($sql)) { |
| 3646 | 3646 | $sql = "UPDATE ".$this->db->prefix().$this->table_element_line." SET ".$fieldposition." = ".((int) ($rang + 1)); |
| 3647 | 3647 | $sql .= ' WHERE rowid = '.((int) $rowid); |
@@ -3667,7 +3667,7 @@ discard block |
||
| 3667 | 3667 | $fieldposition = 'position'; |
| 3668 | 3668 | } |
| 3669 | 3669 | |
| 3670 | - $sql = "SELECT " . $fieldposition . " FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3670 | + $sql = "SELECT ".$fieldposition." FROM ".$this->db->prefix().$this->table_element_line; |
|
| 3671 | 3671 | $sql .= " WHERE rowid = ".((int) $rowid); |
| 3672 | 3672 | |
| 3673 | 3673 | dol_syslog(get_class($this)."::getRangOfLine", LOG_DEBUG); |
@@ -3695,7 +3695,7 @@ discard block |
||
| 3695 | 3695 | |
| 3696 | 3696 | $sql = "SELECT rowid FROM ".$this->db->prefix().$this->table_element_line; |
| 3697 | 3697 | $sql .= " WHERE ".$this->fk_element." = ".((int) $this->id); |
| 3698 | - $sql .= " AND " . $fieldposition . " = ".((int) $rang); |
|
| 3698 | + $sql .= " AND ".$fieldposition." = ".((int) $rang); |
|
| 3699 | 3699 | $resql = $this->db->query($sql); |
| 3700 | 3700 | if ($resql) { |
| 3701 | 3701 | $row = $this->db->fetch_row($resql); |
@@ -3814,7 +3814,7 @@ discard block |
||
| 3814 | 3814 | $newsuffix = ''; |
| 3815 | 3815 | } |
| 3816 | 3816 | if (in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { |
| 3817 | - $fieldusermod = "fk_user_mod"; |
|
| 3817 | + $fieldusermod = "fk_user_mod"; |
|
| 3818 | 3818 | } elseif ($this->table_element == 'ecm_files') { |
| 3819 | 3819 | $fieldusermod = "fk_user_m"; |
| 3820 | 3820 | } else { |
@@ -3856,7 +3856,7 @@ discard block |
||
| 3856 | 3856 | $trigger_name = 'EXPENSE_REPORT_MODIFY'; |
| 3857 | 3857 | break; |
| 3858 | 3858 | default: |
| 3859 | - $trigger_name = strtoupper($this->element) . '_MODIFY'; |
|
| 3859 | + $trigger_name = strtoupper($this->element).'_MODIFY'; |
|
| 3860 | 3860 | } |
| 3861 | 3861 | $ret = $this->call_trigger($trigger_name, $user); |
| 3862 | 3862 | if ($ret < 0) { |
@@ -4154,7 +4154,7 @@ discard block |
||
| 4154 | 4154 | // Situations totals |
| 4155 | 4155 | 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 |
| 4156 | 4156 | '@phan-var-force Facture $this'; |
| 4157 | - 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 |
|
| 4157 | + 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 |
|
| 4158 | 4158 | if ($this->type != Facture::TYPE_CREDIT_NOTE) { // @phpstan-ignore-line |
| 4159 | 4159 | if (getDolGlobalInt('INVOICE_USE_SITUATION') != 2) { |
| 4160 | 4160 | $prev_sits = $this->get_prev_sits(); |
@@ -4280,19 +4280,19 @@ discard block |
||
| 4280 | 4280 | $this->db->begin(); |
| 4281 | 4281 | $error = 0; |
| 4282 | 4282 | |
| 4283 | - $sql = "INSERT INTO " . $this->db->prefix() . "element_element ("; |
|
| 4283 | + $sql = "INSERT INTO ".$this->db->prefix()."element_element ("; |
|
| 4284 | 4284 | $sql .= "fk_source"; |
| 4285 | 4285 | $sql .= ", sourcetype"; |
| 4286 | 4286 | $sql .= ", fk_target"; |
| 4287 | 4287 | $sql .= ", targettype"; |
| 4288 | 4288 | $sql .= ") VALUES ("; |
| 4289 | 4289 | $sql .= ((int) $origin_id); |
| 4290 | - $sql .= ", '" . $this->db->escape($origin) . "'"; |
|
| 4291 | - $sql .= ", " . ((int) $this->id); |
|
| 4292 | - $sql .= ", '" . $this->db->escape($targettype) . "'"; |
|
| 4290 | + $sql .= ", '".$this->db->escape($origin)."'"; |
|
| 4291 | + $sql .= ", ".((int) $this->id); |
|
| 4292 | + $sql .= ", '".$this->db->escape($targettype)."'"; |
|
| 4293 | 4293 | $sql .= ")"; |
| 4294 | 4294 | |
| 4295 | - dol_syslog(get_class($this) . "::add_object_linked", LOG_DEBUG); |
|
| 4295 | + dol_syslog(get_class($this)."::add_object_linked", LOG_DEBUG); |
|
| 4296 | 4296 | if ($this->db->query($sql)) { |
| 4297 | 4297 | if (!$notrigger) { |
| 4298 | 4298 | // Call trigger |
@@ -4547,20 +4547,20 @@ discard block |
||
| 4547 | 4547 | $this->db->begin(); |
| 4548 | 4548 | $error = 0; |
| 4549 | 4549 | |
| 4550 | - $sql = "UPDATE " . $this->db->prefix() . "element_element SET "; |
|
| 4550 | + $sql = "UPDATE ".$this->db->prefix()."element_element SET "; |
|
| 4551 | 4551 | if ($updatesource) { |
| 4552 | - $sql .= "fk_source = " . ((int) $sourceid); |
|
| 4553 | - $sql .= ", sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4554 | - $sql .= " WHERE fk_target = " . ((int) $this->id); |
|
| 4555 | - $sql .= " AND targettype = '" . $this->db->escape($this->element) . "'"; |
|
| 4552 | + $sql .= "fk_source = ".((int) $sourceid); |
|
| 4553 | + $sql .= ", sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4554 | + $sql .= " WHERE fk_target = ".((int) $this->id); |
|
| 4555 | + $sql .= " AND targettype = '".$this->db->escape($this->element)."'"; |
|
| 4556 | 4556 | } elseif ($updatetarget) { |
| 4557 | - $sql .= "fk_target = " . ((int) $targetid); |
|
| 4558 | - $sql .= ", targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4559 | - $sql .= " WHERE fk_source = " . ((int) $this->id); |
|
| 4560 | - $sql .= " AND sourcetype = '" . $this->db->escape($this->element) . "'"; |
|
| 4557 | + $sql .= "fk_target = ".((int) $targetid); |
|
| 4558 | + $sql .= ", targettype = '".$this->db->escape($targettype)."'"; |
|
| 4559 | + $sql .= " WHERE fk_source = ".((int) $this->id); |
|
| 4560 | + $sql .= " AND sourcetype = '".$this->db->escape($this->element)."'"; |
|
| 4561 | 4561 | } |
| 4562 | 4562 | |
| 4563 | - dol_syslog(get_class($this) . "::updateObjectLinked", LOG_DEBUG); |
|
| 4563 | + dol_syslog(get_class($this)."::updateObjectLinked", LOG_DEBUG); |
|
| 4564 | 4564 | if ($this->db->query($sql)) { |
| 4565 | 4565 | if (!$notrigger) { |
| 4566 | 4566 | // Call trigger |
@@ -4637,25 +4637,25 @@ discard block |
||
| 4637 | 4637 | } |
| 4638 | 4638 | |
| 4639 | 4639 | if (!$error) { |
| 4640 | - $sql = "DELETE FROM " . $this->db->prefix() . "element_element"; |
|
| 4640 | + $sql = "DELETE FROM ".$this->db->prefix()."element_element"; |
|
| 4641 | 4641 | $sql .= " WHERE"; |
| 4642 | 4642 | if ($rowid > 0) { |
| 4643 | - $sql .= " rowid = " . ((int) $rowid); |
|
| 4643 | + $sql .= " rowid = ".((int) $rowid); |
|
| 4644 | 4644 | } else { |
| 4645 | 4645 | if ($deletesource) { |
| 4646 | - $sql .= " fk_source = " . ((int) $sourceid) . " AND sourcetype = '" . $this->db->escape($sourcetype) . "'"; |
|
| 4647 | - $sql .= " AND fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "'"; |
|
| 4646 | + $sql .= " fk_source = ".((int) $sourceid)." AND sourcetype = '".$this->db->escape($sourcetype)."'"; |
|
| 4647 | + $sql .= " AND fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."'"; |
|
| 4648 | 4648 | } elseif ($deletetarget) { |
| 4649 | - $sql .= " fk_target = " . ((int) $targetid) . " AND targettype = '" . $this->db->escape($targettype) . "'"; |
|
| 4650 | - $sql .= " AND fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "'"; |
|
| 4649 | + $sql .= " fk_target = ".((int) $targetid)." AND targettype = '".$this->db->escape($targettype)."'"; |
|
| 4650 | + $sql .= " AND fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."'"; |
|
| 4651 | 4651 | } else { |
| 4652 | - $sql .= " (fk_source = " . ((int) $this->id) . " AND sourcetype = '" . $this->db->escape($element) . "')"; |
|
| 4652 | + $sql .= " (fk_source = ".((int) $this->id)." AND sourcetype = '".$this->db->escape($element)."')"; |
|
| 4653 | 4653 | $sql .= " OR"; |
| 4654 | - $sql .= " (fk_target = " . ((int) $this->id) . " AND targettype = '" . $this->db->escape($element) . "')"; |
|
| 4654 | + $sql .= " (fk_target = ".((int) $this->id)." AND targettype = '".$this->db->escape($element)."')"; |
|
| 4655 | 4655 | } |
| 4656 | 4656 | } |
| 4657 | 4657 | |
| 4658 | - dol_syslog(get_class($this) . "::deleteObjectLinked", LOG_DEBUG); |
|
| 4658 | + dol_syslog(get_class($this)."::deleteObjectLinked", LOG_DEBUG); |
|
| 4659 | 4659 | if (!$this->db->query($sql)) { |
| 4660 | 4660 | $this->error = $this->db->lasterror(); |
| 4661 | 4661 | $this->errors[] = $this->error; |
@@ -4820,14 +4820,14 @@ discard block |
||
| 4820 | 4820 | $sql .= ", date_validation = '".$this->db->idate(dol_now())."'"; |
| 4821 | 4821 | } |
| 4822 | 4822 | $sql .= " WHERE rowid = ".((int) $elementId); |
| 4823 | - $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4823 | + $sql .= " AND ".$fieldstatus." <> ".((int) $status); // We avoid update if status already correct |
|
| 4824 | 4824 | |
| 4825 | 4825 | dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); |
| 4826 | 4826 | $resql = $this->db->query($sql); |
| 4827 | 4827 | if ($resql) { |
| 4828 | 4828 | $error = 0; |
| 4829 | 4829 | |
| 4830 | - $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4830 | + $nb_rows_affected = $this->db->affected_rows($resql); // should be 1 or 0 if status was already correct |
|
| 4831 | 4831 | |
| 4832 | 4832 | if ($nb_rows_affected > 0) { |
| 4833 | 4833 | if (empty($trigkey)) { |
@@ -4874,9 +4874,9 @@ discard block |
||
| 4874 | 4874 | if ($fieldstatus == 'tosell') { |
| 4875 | 4875 | $this->status = $status; |
| 4876 | 4876 | } elseif ($fieldstatus == 'tobuy') { |
| 4877 | - $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4877 | + $this->status_buy = $status; // @phpstan-ignore-line |
|
| 4878 | 4878 | } elseif ($fieldstatus == 'tobatch') { |
| 4879 | - $this->status_batch = $status; // @phpstan-ignore-line |
|
| 4879 | + $this->status_batch = $status; // @phpstan-ignore-line |
|
| 4880 | 4880 | } else { |
| 4881 | 4881 | $this->status = $status; |
| 4882 | 4882 | } |
@@ -4984,7 +4984,7 @@ discard block |
||
| 4984 | 4984 | return -1; |
| 4985 | 4985 | } |
| 4986 | 4986 | |
| 4987 | - $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4987 | + $arraytoscan = $this->childtables; // array('tablename'=>array('fk_element'=>'parentfield'), ...) or array('tablename'=>array('parent'=>table_parent, 'parentkey'=>'nameoffieldforparentfkkey'), ...) |
|
| 4988 | 4988 | // For backward compatibility, we check if array is old format array('tablename1', 'tablename2', ...) |
| 4989 | 4989 | $tmparray = array_keys($this->childtables); |
| 4990 | 4990 | if (is_numeric($tmparray[0])) { |
@@ -6033,7 +6033,7 @@ discard block |
||
| 6033 | 6033 | } else { |
| 6034 | 6034 | // TODO: Try to set type above again |
| 6035 | 6035 | '@phan-var-force ModeleBarCode|ModeleExports|ModeleImports|ModelePDFAsset|ModelePDFContract|ModelePDFDeliveryOrder|ModelePDFEvaluation|ModelePDFFactures|ModelePDFFicheinter|ModelePDFMo|ModelePDFMovement|ModelePDFProduct|ModelePDFProjects|ModelePDFPropales|ModelePDFRecruitmentJobPosition|ModelePDFStock|ModelePDFStockTransfer|ModelePDFSupplierProposal|ModelePDFSuppliersInvoices|ModelePDFSuppliersOrders|ModelePDFSuppliersPayments|ModelePDFTask|ModelePDFTicket|ModelePDFUser|ModelePDFUserGroup|ModelePdfExpedition|ModelePdfReception|ModeleThirdPartyDoc $obj'; |
| 6036 | - $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); // @phan-suppress-line-PhanTypeMismatchArgument |
|
| 6036 | + $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, $hidedetails, $hidedesc, $hideref, $moreparams); // @phan-suppress-line-PhanTypeMismatchArgument |
|
| 6037 | 6037 | } |
| 6038 | 6038 | // After call of write_file $obj->result['fullpath'] is set with generated file. It will be used to update the ECM database index. |
| 6039 | 6039 | |
@@ -6106,7 +6106,7 @@ discard block |
||
| 6106 | 6106 | $setsharekey = false; |
| 6107 | 6107 | if ($this->element == 'propal' || $this->element == 'proposal') { |
| 6108 | 6108 | if (getDolGlobalInt("PROPOSAL_ALLOW_ONLINESIGN")) { |
| 6109 | - $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 6109 | + $setsharekey = true; // feature to make online signature is not set or set to on (default) |
|
| 6110 | 6110 | } |
| 6111 | 6111 | if (getDolGlobalInt("PROPOSAL_ALLOW_EXTERNAL_DOWNLOAD")) { |
| 6112 | 6112 | $setsharekey = true; |
@@ -6166,7 +6166,7 @@ discard block |
||
| 6166 | 6166 | $ecmfile->gen_or_uploaded = 'generated'; |
| 6167 | 6167 | $ecmfile->description = ''; // indexed content |
| 6168 | 6168 | $ecmfile->keywords = ''; // keyword content |
| 6169 | - $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 6169 | + $ecmfile->src_object_type = $this->table_element; // $this->table_name is 'myobject' or 'mymodule_myobject'. |
|
| 6170 | 6170 | $ecmfile->src_object_id = $this->id; |
| 6171 | 6171 | |
| 6172 | 6172 | $result = $ecmfile->create($user); |
@@ -6318,8 +6318,8 @@ discard block |
||
| 6318 | 6318 | // phpcs:enable |
| 6319 | 6319 | global $langs, $conf; |
| 6320 | 6320 | |
| 6321 | - if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX . '_') !== 0) { |
|
| 6322 | - dol_print_error(null, 'The trigger "' . $triggerName . '" does not start with "' . self::TRIGGER_PREFIX . '_" as required.'); |
|
| 6321 | + if (!empty(self::TRIGGER_PREFIX) && strpos($triggerName, self::TRIGGER_PREFIX.'_') !== 0) { |
|
| 6322 | + dol_print_error(null, 'The trigger "'.$triggerName.'" does not start with "'.self::TRIGGER_PREFIX.'_" as required.'); |
|
| 6323 | 6323 | exit; |
| 6324 | 6324 | } |
| 6325 | 6325 | if (!is_object($langs)) { // If lang was not defined, we set it. It is required by run_triggers(). |
@@ -6514,7 +6514,7 @@ discard block |
||
| 6514 | 6514 | $savDisableCompute = $conf->disable_compute; |
| 6515 | 6515 | $conf->disable_compute = 1; |
| 6516 | 6516 | |
| 6517 | - $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6517 | + $ret = $this->fetch($id); /* @phpstan-ignore-line */ |
|
| 6518 | 6518 | |
| 6519 | 6519 | $conf->disable_compute = $savDisableCompute; |
| 6520 | 6520 | |
@@ -6576,7 +6576,7 @@ discard block |
||
| 6576 | 6576 | if (is_array($optionsArray) && count($optionsArray) > 0) { |
| 6577 | 6577 | $sql = "SELECT rowid"; |
| 6578 | 6578 | foreach ($optionsArray as $name => $label) { |
| 6579 | - if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg','polygon']))) { |
|
| 6579 | + if (empty($extrafields->attributes[$this->table_element]['type'][$name]) || (!in_array($extrafields->attributes[$this->table_element]['type'][$name], ['separate', 'point', 'multipts', 'linestrg', 'polygon']))) { |
|
| 6580 | 6580 | $sql .= ", ".$name; |
| 6581 | 6581 | } |
| 6582 | 6582 | // use geo sql fonction to read as text |
@@ -6621,7 +6621,7 @@ discard block |
||
| 6621 | 6621 | **/ |
| 6622 | 6622 | if (is_array($extrafields->attributes[$this->table_element]['label'])) { |
| 6623 | 6623 | foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { |
| 6624 | - $this->array_options['options_' . $key] = null; |
|
| 6624 | + $this->array_options['options_'.$key] = null; |
|
| 6625 | 6625 | } |
| 6626 | 6626 | } |
| 6627 | 6627 | } |
@@ -6633,9 +6633,9 @@ discard block |
||
| 6633 | 6633 | if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { |
| 6634 | 6634 | //var_dump($conf->disable_compute); |
| 6635 | 6635 | if (empty($conf->disable_compute)) { |
| 6636 | - global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6637 | - $objectoffield = $this; // we can use it inside computed formula |
|
| 6638 | - $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6636 | + global $objectoffield; // We set a global variable to $objectoffield so |
|
| 6637 | + $objectoffield = $this; // we can use it inside computed formula |
|
| 6638 | + $this->array_options['options_'.$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, '2'); |
|
| 6639 | 6639 | } |
| 6640 | 6640 | } |
| 6641 | 6641 | } |
@@ -6816,7 +6816,7 @@ discard block |
||
| 6816 | 6816 | // If old value encrypted in database is same than submitted new value, it means we don't change it, so we don't update. |
| 6817 | 6817 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6818 | 6818 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6819 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6819 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6820 | 6820 | } else { |
| 6821 | 6821 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6822 | 6822 | } |
@@ -6827,7 +6827,7 @@ discard block |
||
| 6827 | 6827 | // If value has changed |
| 6828 | 6828 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 6829 | 6829 | if (!preg_match('/^dolcrypt:/', $this->array_options[$key])) { |
| 6830 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6830 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6831 | 6831 | } else { |
| 6832 | 6832 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6833 | 6833 | } |
@@ -6839,7 +6839,7 @@ discard block |
||
| 6839 | 6839 | //var_dump('jjj'.$algo.' '.$this->oldcopy->array_options[$key].' -> '.$this->array_options[$key]); |
| 6840 | 6840 | // If this->oldcopy is not defined, we can't know if we change attribute or not, so we must keep value |
| 6841 | 6841 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options[$key])) { // dolibarr reversible encryption |
| 6842 | - $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6842 | + $new_array_options[$key] = dolEncrypt($this->array_options[$key]); // warning, must be called when on the master |
|
| 6843 | 6843 | } else { |
| 6844 | 6844 | $new_array_options[$key] = $this->array_options[$key]; // Value is kept |
| 6845 | 6845 | } |
@@ -6884,9 +6884,9 @@ discard block |
||
| 6884 | 6884 | |
| 6885 | 6885 | $sqlFetchObject = "SELECT rowid FROM ".$this->db->prefix().$object->table_element; |
| 6886 | 6886 | if (is_numeric($value)) { |
| 6887 | - $sqlFetchObject .= " WHERE rowid = " . (int) $value; |
|
| 6887 | + $sqlFetchObject .= " WHERE rowid = ".(int) $value; |
|
| 6888 | 6888 | } else { |
| 6889 | - $sqlFetchObject .= " WHERE ref = '" . $this->db->escape($value) . "'"; |
|
| 6889 | + $sqlFetchObject .= " WHERE ref = '".$this->db->escape($value)."'"; |
|
| 6890 | 6890 | } |
| 6891 | 6891 | |
| 6892 | 6892 | $obj = $this->db->getRow($sqlFetchObject); |
@@ -6931,7 +6931,7 @@ discard block |
||
| 6931 | 6931 | } |
| 6932 | 6932 | $geoDataType = ExtraFields::$geoDataTypes[$attributeType] ?? null; |
| 6933 | 6933 | // Add field of attribute |
| 6934 | - if (! $geoDataType) { |
|
| 6934 | + if (!$geoDataType) { |
|
| 6935 | 6935 | // not a geodata type |
| 6936 | 6936 | if ($newValue != '') { |
| 6937 | 6937 | $sqlColumnValues[$attributeKey] = "'".$this->db->escape($newValue)."'"; |
@@ -6967,7 +6967,7 @@ discard block |
||
| 6967 | 6967 | if ($table_element == 'categorie') { |
| 6968 | 6968 | $table_element = 'categories'; // For compatibility |
| 6969 | 6969 | } |
| 6970 | - $extrafieldsTable = $this->db->prefix() . $table_element . '_extrafields'; |
|
| 6970 | + $extrafieldsTable = $this->db->prefix().$table_element.'_extrafields'; |
|
| 6971 | 6971 | |
| 6972 | 6972 | dol_syslog(get_class($this)."::insertExtraFields delete then insert", LOG_DEBUG); |
| 6973 | 6973 | |
@@ -6980,7 +6980,7 @@ discard block |
||
| 6980 | 6980 | * @param string $key |
| 6981 | 6981 | * @return string |
| 6982 | 6982 | */ |
| 6983 | - array_map(function ($key) use ($sqlColumnValues) { |
|
| 6983 | + array_map(function($key) use ($sqlColumnValues) { |
|
| 6984 | 6984 | return "{$key} = {$sqlColumnValues[$key]}"; |
| 6985 | 6985 | }, array_keys($sqlColumnValues)) |
| 6986 | 6986 | ); |
@@ -7276,7 +7276,7 @@ discard block |
||
| 7276 | 7276 | 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. |
| 7277 | 7277 | if ($algo == 'dolcrypt') { // dolibarr reversible encryption |
| 7278 | 7278 | if (!preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { |
| 7279 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7279 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7280 | 7280 | } else { |
| 7281 | 7281 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 7282 | 7282 | } |
@@ -7296,7 +7296,7 @@ discard block |
||
| 7296 | 7296 | } |
| 7297 | 7297 | } else { |
| 7298 | 7298 | if ($algo == 'dolcrypt' && !preg_match('/^dolcrypt:/', $this->array_options["options_".$key])) { // dolibarr reversible encryption |
| 7299 | - $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7299 | + $new_array_options["options_".$key] = dolEncrypt($this->array_options["options_".$key]); // warning, must be called when on the master |
|
| 7300 | 7300 | } else { |
| 7301 | 7301 | $new_array_options["options_".$key] = $this->array_options["options_".$key]; // Value is kept |
| 7302 | 7302 | } |
@@ -7883,7 +7883,7 @@ discard block |
||
| 7883 | 7883 | // 7 : sort field |
| 7884 | 7884 | |
| 7885 | 7885 | // If there is filter |
| 7886 | - if (! empty($InfoFieldList[4])) { |
|
| 7886 | + if (!empty($InfoFieldList[4])) { |
|
| 7887 | 7887 | $pos = 0; |
| 7888 | 7888 | $parenthesisopen = 0; |
| 7889 | 7889 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
@@ -7947,8 +7947,8 @@ discard block |
||
| 7947 | 7947 | } |
| 7948 | 7948 | |
| 7949 | 7949 | $sqlwhere = ''; |
| 7950 | - $sql = "SELECT " . $keyList; |
|
| 7951 | - $sql .= " FROM " . $this->db->prefix() . $InfoFieldList[0]; |
|
| 7950 | + $sql = "SELECT ".$keyList; |
|
| 7951 | + $sql .= " FROM ".$this->db->prefix().$InfoFieldList[0]; |
|
| 7952 | 7952 | |
| 7953 | 7953 | if (!empty($InfoFieldList[4])) { |
| 7954 | 7954 | // can use SELECT request |
@@ -7966,11 +7966,11 @@ discard block |
||
| 7966 | 7966 | // We have to join on extrafield table |
| 7967 | 7967 | $errstr = ''; |
| 7968 | 7968 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 7969 | - $sql .= " as main, " . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . "_extrafields as extra"; |
|
| 7970 | - $sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]); |
|
| 7971 | - $sqlwhere .= " AND " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7969 | + $sql .= " as main, ".$this->db->sanitize($this->db->prefix().$InfoFieldList[0])."_extrafields as extra"; |
|
| 7970 | + $sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]); |
|
| 7971 | + $sqlwhere .= " AND ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7972 | 7972 | } else { |
| 7973 | - $sqlwhere .= " WHERE " . forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7973 | + $sqlwhere .= " WHERE ".forgeSQLFromUniversalSearchCriteria($InfoFieldList[4], $errstr, 1); |
|
| 7974 | 7974 | } |
| 7975 | 7975 | } else { |
| 7976 | 7976 | $sqlwhere .= ' WHERE 1=1'; |
@@ -7991,7 +7991,7 @@ discard block |
||
| 7991 | 7991 | |
| 7992 | 7992 | // Some tables may have field, some other not. For the moment we disable it. |
| 7993 | 7993 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 7994 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 7994 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 7995 | 7995 | } |
| 7996 | 7996 | $sql .= $sqlwhere; |
| 7997 | 7997 | |
@@ -8001,10 +8001,10 @@ discard block |
||
| 8001 | 8001 | } else { |
| 8002 | 8002 | $sql .= " ORDER BY ".$this->db->sanitize(implode(', ', $fields_label)); |
| 8003 | 8003 | } |
| 8004 | - $sql .= ' LIMIT ' . getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000); |
|
| 8004 | + $sql .= ' LIMIT '.getDolGlobalInt('MAIN_EXTRAFIELDS_LIMIT_SELLIST_SQL', 1000); |
|
| 8005 | 8005 | // print $sql; |
| 8006 | 8006 | |
| 8007 | - dol_syslog(get_class($this) . '::showInputField type=sellist', LOG_DEBUG); |
|
| 8007 | + dol_syslog(get_class($this).'::showInputField type=sellist', LOG_DEBUG); |
|
| 8008 | 8008 | $resql = $this->db->query($sql); |
| 8009 | 8009 | if ($resql) { |
| 8010 | 8010 | $out .= '<option value="0"> </option>'; |
@@ -8020,7 +8020,7 @@ discard block |
||
| 8020 | 8020 | if (count($fields_label) > 1) { |
| 8021 | 8021 | $notrans = true; |
| 8022 | 8022 | foreach ($fields_label as $field_toshow) { |
| 8023 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 8023 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 8024 | 8024 | } |
| 8025 | 8025 | } else { |
| 8026 | 8026 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -8031,12 +8031,12 @@ discard block |
||
| 8031 | 8031 | foreach ($fields_label as $field_toshow) { |
| 8032 | 8032 | $translabel = $langs->trans($obj->$field_toshow); |
| 8033 | 8033 | if ($translabel != $obj->$field_toshow) { |
| 8034 | - $labeltoshow = dol_trunc($translabel) . ' '; |
|
| 8034 | + $labeltoshow = dol_trunc($translabel).' '; |
|
| 8035 | 8035 | } else { |
| 8036 | - $labeltoshow = dol_trunc($obj->$field_toshow) . ' '; |
|
| 8036 | + $labeltoshow = dol_trunc($obj->$field_toshow).' '; |
|
| 8037 | 8037 | } |
| 8038 | 8038 | } |
| 8039 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 8039 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 8040 | 8040 | } else { |
| 8041 | 8041 | if (!$notrans) { |
| 8042 | 8042 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
@@ -8050,25 +8050,25 @@ discard block |
||
| 8050 | 8050 | $labeltoshow = '(not defined)'; |
| 8051 | 8051 | } |
| 8052 | 8052 | if ($value == $obj->rowid) { |
| 8053 | - $out .= '<option value="' . $obj->rowid . '" selected>' . $labeltoshow . '</option>'; |
|
| 8053 | + $out .= '<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>'; |
|
| 8054 | 8054 | } |
| 8055 | 8055 | |
| 8056 | 8056 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 8057 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 8057 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 8058 | 8058 | $isDependList = 1; |
| 8059 | 8059 | } |
| 8060 | 8060 | |
| 8061 | - $out .= '<option value="' . $obj->rowid . '"'; |
|
| 8061 | + $out .= '<option value="'.$obj->rowid.'"'; |
|
| 8062 | 8062 | $out .= ($value == $obj->rowid ? ' selected' : ''); |
| 8063 | - $out .= (!empty($parent) ? ' parent="' . $parent . '"' : ''); |
|
| 8064 | - $out .= '>' . $labeltoshow . '</option>'; |
|
| 8063 | + $out .= (!empty($parent) ? ' parent="'.$parent.'"' : ''); |
|
| 8064 | + $out .= '>'.$labeltoshow.'</option>'; |
|
| 8065 | 8065 | } |
| 8066 | 8066 | |
| 8067 | 8067 | $i++; |
| 8068 | 8068 | } |
| 8069 | 8069 | $this->db->free($resql); |
| 8070 | 8070 | } else { |
| 8071 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 8071 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 8072 | 8072 | } |
| 8073 | 8073 | } else { |
| 8074 | 8074 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
@@ -8079,9 +8079,9 @@ discard block |
||
| 8079 | 8079 | $data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 8080 | 8080 | $out .= '<option value="0"> </option>'; |
| 8081 | 8081 | foreach ($data as $data_key => $data_value) { |
| 8082 | - $out .= '<option value="' . $data_key . '"'; |
|
| 8082 | + $out .= '<option value="'.$data_key.'"'; |
|
| 8083 | 8083 | $out .= ($value == $data_key ? ' selected' : ''); |
| 8084 | - $out .= '>' . $data_value . '</option>'; |
|
| 8084 | + $out .= '>'.$data_value.'</option>'; |
|
| 8085 | 8085 | } |
| 8086 | 8086 | } |
| 8087 | 8087 | } |
@@ -8121,7 +8121,7 @@ discard block |
||
| 8121 | 8121 | // 7 : sort field |
| 8122 | 8122 | |
| 8123 | 8123 | // If there is a filter |
| 8124 | - if (! empty($InfoFieldList[4])) { |
|
| 8124 | + if (!empty($InfoFieldList[4])) { |
|
| 8125 | 8125 | $pos = 0; |
| 8126 | 8126 | $parenthesisopen = 0; |
| 8127 | 8127 | while (substr($InfoFieldList[4], $pos, 1) !== '' && ($parenthesisopen || $pos == 0 || substr($InfoFieldList[4], $pos, 1) != ':')) { |
@@ -8187,8 +8187,8 @@ discard block |
||
| 8187 | 8187 | } |
| 8188 | 8188 | |
| 8189 | 8189 | $sqlwhere = ''; |
| 8190 | - $sql = "SELECT " . $keyList; |
|
| 8191 | - $sql .= ' FROM ' . $this->db->prefix() . $InfoFieldList[0]; |
|
| 8190 | + $sql = "SELECT ".$keyList; |
|
| 8191 | + $sql .= ' FROM '.$this->db->prefix().$InfoFieldList[0]; |
|
| 8192 | 8192 | |
| 8193 | 8193 | if (!empty($InfoFieldList[4])) { |
| 8194 | 8194 | // can use SELECT request |
@@ -8206,11 +8206,11 @@ discard block |
||
| 8206 | 8206 | // We have to join on extrafield table |
| 8207 | 8207 | $errstr = ''; |
| 8208 | 8208 | if (strpos($InfoFieldList[4], 'extra') !== false) { |
| 8209 | - $sql .= ' as main, ' . $this->db->sanitize($this->db->prefix() . $InfoFieldList[0]) . '_extrafields as extra'; |
|
| 8210 | - $sqlwhere .= " WHERE extra.fk_object = main." . $this->db->sanitize($InfoFieldList[2]); |
|
| 8211 | - $sqlwhere .= " AND " . $InfoFieldList[4]; |
|
| 8209 | + $sql .= ' as main, '.$this->db->sanitize($this->db->prefix().$InfoFieldList[0]).'_extrafields as extra'; |
|
| 8210 | + $sqlwhere .= " WHERE extra.fk_object = main.".$this->db->sanitize($InfoFieldList[2]); |
|
| 8211 | + $sqlwhere .= " AND ".$InfoFieldList[4]; |
|
| 8212 | 8212 | } else { |
| 8213 | - $sqlwhere .= " WHERE " . $InfoFieldList[4]; |
|
| 8213 | + $sqlwhere .= " WHERE ".$InfoFieldList[4]; |
|
| 8214 | 8214 | } |
| 8215 | 8215 | } else { |
| 8216 | 8216 | $sqlwhere .= ' WHERE 1=1'; |
@@ -8231,14 +8231,14 @@ discard block |
||
| 8231 | 8231 | |
| 8232 | 8232 | // Some tables may have field, some other not. For the moment we disable it. |
| 8233 | 8233 | if (in_array($InfoFieldList[0], array('tablewithentity'))) { |
| 8234 | - $sqlwhere .= " AND entity = " . ((int) $conf->entity); |
|
| 8234 | + $sqlwhere .= " AND entity = ".((int) $conf->entity); |
|
| 8235 | 8235 | } |
| 8236 | 8236 | // $sql.=preg_replace('/^ AND /','',$sqlwhere); |
| 8237 | 8237 | // print $sql; |
| 8238 | 8238 | |
| 8239 | 8239 | $sql .= $sqlwhere; |
| 8240 | 8240 | |
| 8241 | - dol_syslog(get_class($this) . '::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 8241 | + dol_syslog(get_class($this).'::showInputField type=chkbxlst', LOG_DEBUG); |
|
| 8242 | 8242 | |
| 8243 | 8243 | $resql = $this->db->query($sql); |
| 8244 | 8244 | if ($resql) { |
@@ -8257,7 +8257,7 @@ discard block |
||
| 8257 | 8257 | if (count($fields_label) > 1) { |
| 8258 | 8258 | $notrans = true; |
| 8259 | 8259 | foreach ($fields_label as $field_toshow) { |
| 8260 | - $labeltoshow .= $obj->$field_toshow . ' '; |
|
| 8260 | + $labeltoshow .= $obj->$field_toshow.' '; |
|
| 8261 | 8261 | } |
| 8262 | 8262 | } else { |
| 8263 | 8263 | $labeltoshow = $obj->{$InfoFieldList[1]}; |
@@ -8268,9 +8268,9 @@ discard block |
||
| 8268 | 8268 | foreach ($fields_label as $field_toshow) { |
| 8269 | 8269 | $translabel = $langs->trans($obj->$field_toshow); |
| 8270 | 8270 | if ($translabel != $obj->$field_toshow) { |
| 8271 | - $labeltoshow = dol_trunc($translabel, 18) . ' '; |
|
| 8271 | + $labeltoshow = dol_trunc($translabel, 18).' '; |
|
| 8272 | 8272 | } else { |
| 8273 | - $labeltoshow = dol_trunc($obj->$field_toshow, 18) . ' '; |
|
| 8273 | + $labeltoshow = dol_trunc($obj->$field_toshow, 18).' '; |
|
| 8274 | 8274 | } |
| 8275 | 8275 | } |
| 8276 | 8276 | |
@@ -8293,7 +8293,7 @@ discard block |
||
| 8293 | 8293 | } |
| 8294 | 8294 | |
| 8295 | 8295 | if (!empty($InfoFieldList[3]) && $parentField) { |
| 8296 | - $parent = $parentName . ':' . $obj->{$parentField}; |
|
| 8296 | + $parent = $parentName.':'.$obj->{$parentField}; |
|
| 8297 | 8297 | $isDependList = 1; |
| 8298 | 8298 | } |
| 8299 | 8299 | |
@@ -8304,9 +8304,9 @@ discard block |
||
| 8304 | 8304 | } |
| 8305 | 8305 | $this->db->free($resql); |
| 8306 | 8306 | |
| 8307 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8307 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8308 | 8308 | } else { |
| 8309 | - print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>'; |
|
| 8309 | + print 'Error in request '.$sql.' '.$this->db->lasterror().'. Check setup of extra parameters.<br>'; |
|
| 8310 | 8310 | } |
| 8311 | 8311 | } else { |
| 8312 | 8312 | require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
@@ -8315,7 +8315,7 @@ discard block |
||
| 8315 | 8315 | $categcode = Categorie::$MAP_ID_TO_CODE[(int) $InfoFieldList[5]]; |
| 8316 | 8316 | } |
| 8317 | 8317 | $data = $form->select_all_categories($categcode, '', 'parent', 64, $InfoFieldList[6], 1, 1); |
| 8318 | - $out = $form->multiselectarray($keyprefix . $key . $keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8318 | + $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, 0, 0, $morecss, 0, '100%'); |
|
| 8319 | 8319 | } |
| 8320 | 8320 | } |
| 8321 | 8321 | } elseif ($type == 'link') { |
@@ -8350,7 +8350,7 @@ discard block |
||
| 8350 | 8350 | // $val is already the record field found at same place than found by $valparent but already loaded and may have been modified by parent caller. |
| 8351 | 8351 | |
| 8352 | 8352 | //$objectfield = $valparent; |
| 8353 | - $objectfield = $val; // Is better than using old method $valparent |
|
| 8353 | + $objectfield = $val; // Is better than using old method $valparent |
|
| 8354 | 8354 | |
| 8355 | 8355 | // @phan-suppress-next-line PhanTypeMismatchArgumentNullable |
| 8356 | 8356 | $out = $form->selectForForms($param_list_array[0], $keyprefix.$key.$keysuffix, (int) $value, $showempty, '', '', $morecss, $moreparam, 0, (empty($val['disabled']) ? 0 : 1), '', $objectfield); |
@@ -8563,7 +8563,7 @@ discard block |
||
| 8563 | 8563 | $value = $this->getLibStatut(3); |
| 8564 | 8564 | } elseif ($type == 'date') { |
| 8565 | 8565 | if (!empty($value)) { |
| 8566 | - $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 8566 | + $value = dol_print_date($value, 'day'); // We suppose dates without time are always gmt (storage of course + output) |
|
| 8567 | 8567 | } else { |
| 8568 | 8568 | $value = ''; |
| 8569 | 8569 | } |
@@ -8664,7 +8664,7 @@ discard block |
||
| 8664 | 8664 | $value = isset($param['options'][(string) $value]) ? $param['options'][(string) $value] : ''; |
| 8665 | 8665 | if (strpos($value, "|") !== false) { |
| 8666 | 8666 | $value = $langs->trans(explode('|', $value)[0]); |
| 8667 | - } elseif (! is_numeric($value)) { |
|
| 8667 | + } elseif (!is_numeric($value)) { |
|
| 8668 | 8668 | $value = $langs->trans($value); |
| 8669 | 8669 | } |
| 8670 | 8670 | } elseif ($type == 'sellist') { |
@@ -8726,9 +8726,9 @@ discard block |
||
| 8726 | 8726 | $translabel = $langs->trans($obj->$field_toshow); |
| 8727 | 8727 | } |
| 8728 | 8728 | if ($translabel != $field_toshow) { |
| 8729 | - $value .= dol_trunc($translabel, 18) . ' '; |
|
| 8729 | + $value .= dol_trunc($translabel, 18).' '; |
|
| 8730 | 8730 | } else { |
| 8731 | - $value .= $obj->$field_toshow . ' '; |
|
| 8731 | + $value .= $obj->$field_toshow.' '; |
|
| 8732 | 8732 | } |
| 8733 | 8733 | } |
| 8734 | 8734 | } else { |
@@ -8744,7 +8744,7 @@ discard block |
||
| 8744 | 8744 | } |
| 8745 | 8745 | } |
| 8746 | 8746 | } else { |
| 8747 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8747 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8748 | 8748 | |
| 8749 | 8749 | $toprint = array(); |
| 8750 | 8750 | $obj = $this->db->fetch_object($resql); |
@@ -8752,7 +8752,7 @@ discard block |
||
| 8752 | 8752 | $c->fetch($obj->rowid); |
| 8753 | 8753 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8754 | 8754 | foreach ($ways as $way) { |
| 8755 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8755 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8756 | 8756 | } |
| 8757 | 8757 | $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
| 8758 | 8758 | } |
@@ -8768,11 +8768,11 @@ discard block |
||
| 8768 | 8768 | $toprint = array(); |
| 8769 | 8769 | foreach ($value_arr as $keyval => $valueval) { |
| 8770 | 8770 | if (!empty($valueval)) { |
| 8771 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $param['options'][$valueval] . '</li>'; |
|
| 8771 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$param['options'][$valueval].'</li>'; |
|
| 8772 | 8772 | } |
| 8773 | 8773 | } |
| 8774 | 8774 | if (!empty($toprint)) { |
| 8775 | - $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>'; |
|
| 8775 | + $value = '<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">'.implode(' ', $toprint).'</ul></div>'; |
|
| 8776 | 8776 | } |
| 8777 | 8777 | } |
| 8778 | 8778 | } elseif ($type == 'chkbxlst') { |
@@ -8827,9 +8827,9 @@ discard block |
||
| 8827 | 8827 | $translabel = $langs->trans($obj->$field_toshow); |
| 8828 | 8828 | } |
| 8829 | 8829 | if ($translabel != $field_toshow) { |
| 8830 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8830 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8831 | 8831 | } else { |
| 8832 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->$field_toshow . '</li>'; |
|
| 8832 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->$field_toshow.'</li>'; |
|
| 8833 | 8833 | } |
| 8834 | 8834 | } |
| 8835 | 8835 | } else { |
@@ -8838,15 +8838,15 @@ discard block |
||
| 8838 | 8838 | $translabel = $langs->trans($obj->{$InfoFieldList[1]}); |
| 8839 | 8839 | } |
| 8840 | 8840 | if ($translabel != $obj->{$InfoFieldList[1]}) { |
| 8841 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . dol_trunc($translabel, 18) . '</li>'; |
|
| 8841 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.dol_trunc($translabel, 18).'</li>'; |
|
| 8842 | 8842 | } else { |
| 8843 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">' . $obj->{$InfoFieldList[1]} . '</li>'; |
|
| 8843 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories" style="background: #bbb">'.$obj->{$InfoFieldList[1]}.'</li>'; |
|
| 8844 | 8844 | } |
| 8845 | 8845 | } |
| 8846 | 8846 | } |
| 8847 | 8847 | } |
| 8848 | 8848 | } else { |
| 8849 | - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; |
|
| 8849 | + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; |
|
| 8850 | 8850 | |
| 8851 | 8851 | $toprint = array(); |
| 8852 | 8852 | while ($obj = $this->db->fetch_object($resql)) { |
@@ -8855,7 +8855,7 @@ discard block |
||
| 8855 | 8855 | $c->fetch($obj->rowid); |
| 8856 | 8856 | $ways = $c->print_all_ways(); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formatted text |
| 8857 | 8857 | foreach ($ways as $way) { |
| 8858 | - $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #aaa"') . '>' . img_object('', 'category') . ' ' . $way . '</li>'; |
|
| 8858 | + $toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"'.($c->color ? ' style="background: #'.$c->color.';"' : ' style="background: #aaa"').'>'.img_object('', 'category').' '.$way.'</li>'; |
|
| 8859 | 8859 | } |
| 8860 | 8860 | } |
| 8861 | 8861 | } |
@@ -9025,7 +9025,7 @@ discard block |
||
| 9025 | 9025 | global $langs; |
| 9026 | 9026 | |
| 9027 | 9027 | if (!class_exists('Validate')) { |
| 9028 | - require_once DOL_DOCUMENT_ROOT . '/core/class/validate.class.php'; |
|
| 9028 | + require_once DOL_DOCUMENT_ROOT.'/core/class/validate.class.php'; |
|
| 9029 | 9029 | } |
| 9030 | 9030 | |
| 9031 | 9031 | $this->clearFieldError($fieldKey); |
@@ -9264,7 +9264,7 @@ discard block |
||
| 9264 | 9264 | $out .= "\n"; |
| 9265 | 9265 | |
| 9266 | 9266 | $nbofextrafieldsshown = 0; |
| 9267 | - $e = 0; // var to manage the modulo (odd/even) |
|
| 9267 | + $e = 0; // var to manage the modulo (odd/even) |
|
| 9268 | 9268 | |
| 9269 | 9269 | $lastseparatorkeyfound = ''; |
| 9270 | 9270 | $extrafields_collapse_num = ''; |
@@ -9302,9 +9302,9 @@ discard block |
||
| 9302 | 9302 | continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list |
| 9303 | 9303 | } elseif (($mode == 'edit') && !in_array(abs($visibility), array(1, 3, 4))) { |
| 9304 | 9304 | // 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 |
| 9305 | - $ef_name = 'options_' . $key; |
|
| 9305 | + $ef_name = 'options_'.$key; |
|
| 9306 | 9306 | $ef_value = $this->array_options[$ef_name]; |
| 9307 | - $out .= '<input type="hidden" name="' . $ef_name . '" id="' . $ef_name . '" value="' . $ef_value . '" />' . "\n"; |
|
| 9307 | + $out .= '<input type="hidden" name="'.$ef_name.'" id="'.$ef_name.'" value="'.$ef_value.'" />'."\n"; |
|
| 9308 | 9308 | continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list and <> 4 = not visible at the creation |
| 9309 | 9309 | } elseif ($mode == 'view' && empty($visibility)) { |
| 9310 | 9310 | continue; |
@@ -10393,7 +10393,7 @@ discard block |
||
| 10393 | 10393 | continue; |
| 10394 | 10394 | } |
| 10395 | 10395 | } |
| 10396 | - $keys_with_alias[] = $alias . '.' . $fieldname; |
|
| 10396 | + $keys_with_alias[] = $alias.'.'.$fieldname; |
|
| 10397 | 10397 | } |
| 10398 | 10398 | return implode(', ', $keys_with_alias); |
| 10399 | 10399 | } else { |
@@ -10534,7 +10534,7 @@ discard block |
||
| 10534 | 10534 | if (!$error) { |
| 10535 | 10535 | $sql = "INSERT INTO ".$this->db->prefix().$this->table_element; |
| 10536 | 10536 | $sql .= " (".implode(", ", $keys).')'; |
| 10537 | - $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 10537 | + $sql .= " VALUES (".implode(", ", $values).")"; // $values can contains 'abc' or 123 |
|
| 10538 | 10538 | |
| 10539 | 10539 | $res = $this->db->query($sql); |
| 10540 | 10540 | if (!$res) { |
@@ -10845,7 +10845,7 @@ discard block |
||
| 10845 | 10845 | |
| 10846 | 10846 | // Update extrafield |
| 10847 | 10847 | if (!$error) { |
| 10848 | - $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 10848 | + $result = $this->insertExtraFields(); // This delete and reinsert extrafields |
|
| 10849 | 10849 | if ($result < 0) { |
| 10850 | 10850 | $error++; |
| 10851 | 10851 | } |
@@ -11047,12 +11047,12 @@ discard block |
||
| 11047 | 11047 | $error++; |
| 11048 | 11048 | } else { |
| 11049 | 11049 | while ($obj = $this->db->fetch_object($resql)) { |
| 11050 | - $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 11050 | + $result = $this->fetch($obj->rowid); // @phpstan-ignore-line |
|
| 11051 | 11051 | if ($result < 0) { |
| 11052 | 11052 | $error++; |
| 11053 | 11053 | $this->errors[] = $this->error; |
| 11054 | 11054 | } else { |
| 11055 | - $result = $this->delete($user); // @phpstan-ignore-line |
|
| 11055 | + $result = $this->delete($user); // @phpstan-ignore-line |
|
| 11056 | 11056 | if ($result < 0) { |
| 11057 | 11057 | $error++; |
| 11058 | 11058 | $this->errors[] = $this->error; |
@@ -11218,7 +11218,7 @@ discard block |
||
| 11218 | 11218 | ); |
| 11219 | 11219 | foreach ($fields as $key => $value) { |
| 11220 | 11220 | if (array_key_exists($key, $this->fields)) { |
| 11221 | - $this->{$key} = $value; // @phpstan-ignore-line |
|
| 11221 | + $this->{$key} = $value; // @phpstan-ignore-line |
|
| 11222 | 11222 | } |
| 11223 | 11223 | } |
| 11224 | 11224 | |
@@ -6984,7 +6984,7 @@ |
||
| 6984 | 6984 | return "{$key} = {$sqlColumnValues[$key]}"; |
| 6985 | 6985 | }, array_keys($sqlColumnValues)) |
| 6986 | 6986 | ); |
| 6987 | - $sql = "UPDATE {$extrafieldsTable} SET {$sqlColumnValueString} WHERE fk_object = ".((int) $this->id); |
|
| 6987 | + $sql = "update {$extrafieldsTable} SET {$sqlColumnValueString} WHERE fk_object = ".((int) $this->id); |
|
| 6988 | 6988 | } else { |
| 6989 | 6989 | // We must insert a default value for fields for other entities that are mandatory to avoid not null error |
| 6990 | 6990 | $extrafieldsRequiredOnOtherEntities = $extrafields->attributes[$this->table_element]['mandatoryfieldsofotherentities'] ?? array(); |
@@ -252,7 +252,7 @@ |
||
| 252 | 252 | foreach ($substitutionarray as $key => $val) { |
| 253 | 253 | $texthelp .= $key.' -> '.$val.'<br>'; |
| 254 | 254 | } |
| 255 | - echo $form->textwithpicto($langs->trans("AIPromptExtrafield"), $texthelp, 1, 'help', 'valignmiddle', 0, 3, 'abc');?></td> |
|
| 255 | + echo $form->textwithpicto($langs->trans("AIPromptExtrafield"), $texthelp, 1, 'help', 'valignmiddle', 0, 3, 'abc'); ?></td> |
|
| 256 | 256 | <td class="valeur"><textarea name="ai_prompt" id="ai_prompt" class="quatrevingtpercent" rows="<?php echo ROWS_4 ?>"><?php echo(GETPOSTISSET('ai_prompt') ? GETPOST('ai_prompt', 'restricthtml') : ''); ?></textarea></td></tr> |
| 257 | 257 | <!-- Default Value (at sql setup level) --> |
| 258 | 258 | <tr class="extra_default_value"><td><?php echo $langs->trans("DefaultValue").' ('.$langs->trans("Database").')'; ?></td><td class="valeur"><input id="default_value" type="text" name="default_value" class="minwidth200" value="<?php echo(GETPOST('default_value', 'alpha') ? GETPOST('default_value', 'alpha') : ''); ?>"></td></tr> |
@@ -18,22 +18,22 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * @var Conf $conf |
|
| 22 | - * @var DoliDB $db |
|
| 23 | - * @var CommonObject $object |
|
| 24 | - * @var Translate $langs |
|
| 25 | - * @var ?FormMail $formmail |
|
| 26 | - * @var ?FormWebsite $formwebsite |
|
| 27 | - * @var ?FormAI $formai |
|
| 28 | - * @var string $htmlname |
|
| 29 | - * @var string $showlinktolayout 'emailing', 'email', 'websitepage', ... |
|
| 30 | - * @var string $showlinktolayoutlabel '...' |
|
| 31 | - * @var string $showlinktoai '' or 'textgeneration', 'textgenerationemail', 'textgenerationwebpage', ... |
|
| 32 | - * @var string $showlinktoailabel '...' |
|
| 33 | - * @var string $htmlname |
|
| 34 | - * @var ?string $out |
|
| 35 | - * @var ?string $aiprompt |
|
| 36 | - */ |
|
| 21 | + * @var Conf $conf |
|
| 22 | + * @var DoliDB $db |
|
| 23 | + * @var CommonObject $object |
|
| 24 | + * @var Translate $langs |
|
| 25 | + * @var ?FormMail $formmail |
|
| 26 | + * @var ?FormWebsite $formwebsite |
|
| 27 | + * @var ?FormAI $formai |
|
| 28 | + * @var string $htmlname |
|
| 29 | + * @var string $showlinktolayout 'emailing', 'email', 'websitepage', ... |
|
| 30 | + * @var string $showlinktolayoutlabel '...' |
|
| 31 | + * @var string $showlinktoai '' or 'textgeneration', 'textgenerationemail', 'textgenerationwebpage', ... |
|
| 32 | + * @var string $showlinktoailabel '...' |
|
| 33 | + * @var string $htmlname |
|
| 34 | + * @var ?string $out |
|
| 35 | + * @var ?string $aiprompt |
|
| 36 | + */ |
|
| 37 | 37 | |
| 38 | 38 | //Protection to avoid direct call of template |
| 39 | 39 | if (empty($conf) || !is_object($conf)) { |
@@ -318,7 +318,7 @@ |
||
| 318 | 318 | foreach ($substitutionarray as $key => $val) { |
| 319 | 319 | $texthelp .= $key.' -> '.$val.'<br>'; |
| 320 | 320 | } |
| 321 | - echo $form->textwithpicto($langs->trans("AIPromptExtrafield"), $texthelp, 1, 'help', 'valignmiddle', 0, 3, 'abc');?></td> |
|
| 321 | + echo $form->textwithpicto($langs->trans("AIPromptExtrafield"), $texthelp, 1, 'help', 'valignmiddle', 0, 3, 'abc'); ?></td> |
|
| 322 | 322 | <td class="valeur"><textarea name="ai_prompt" id="ai_prompt" class="quatrevingtpercent" rows="<?php echo ROWS_4 ?>"><?php echo($aiprompt); ?></textarea></td></tr> |
| 323 | 323 | |
| 324 | 324 | <!-- Default Value (at sql setup level) --> |