2
0
forked from Wavyzz/dolibarr

Fix : deprecated warnings on various pages

This commit is contained in:
Hystepik
2023-06-13 16:01:52 +02:00
parent ea167579ca
commit e28de18a9b
8 changed files with 20 additions and 13 deletions

View File

@@ -1718,8 +1718,8 @@ class ActionComm extends CommonObject
$tooltip .= '<br>'; $tooltip .= '<br>';
//$tooltip .= '<br><b>'.img_picto('', 'email').' '.$langs->trans("Email").'</b>'; //$tooltip .= '<br><b>'.img_picto('', 'email').' '.$langs->trans("Email").'</b>';
$tooltip .= '<br><b>'.$langs->trans('MailTopic').':</b> '.dol_escape_htmltag($this->email_subject); $tooltip .= '<br><b>'.$langs->trans('MailTopic').':</b> '.dol_escape_htmltag($this->email_subject);
$tooltip .= '<br><b>'.$langs->trans('MailFrom').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_from); $tooltip .= '<br><b>'.$langs->trans('MailFrom').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), !empty($this->email_from) ? $this->email_from : '');
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_to); $tooltip .= '<br><b>'.$langs->trans('MailTo').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), !empty($this->email_to) ? $this->email_to : '');
if (!empty($this->email_tocc)) { if (!empty($this->email_tocc)) {
$tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_tocc); $tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_tocc);
} }

View File

@@ -1986,7 +1986,7 @@ class FormFile
} elseif ($sortfield == "date") { } elseif ($sortfield == "date") {
$sortfield = "datea"; $sortfield = "datea";
} else { } else {
$sortfield = null; $sortfield = '';
} }
$res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder); $res = $link->fetchAll($links, $object->element, $object->id, $sortfield, $sortorder);
$param .= (isset($object->id) ? '&id='.$object->id : ''); $param .= (isset($object->id) ? '&id='.$object->id : '');

View File

@@ -432,7 +432,9 @@ class FormMail extends Form
if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) { if (GETPOST('mode', 'alpha') == 'init' || (GETPOST('modelselected') && GETPOST('modelmailselected', 'alpha') && GETPOST('modelmailselected', 'alpha') != '-1')) {
if (!empty($arraydefaultmessage->joinfiles) && !empty($this->param['fileinit']) && is_array($this->param['fileinit'])) { if (!empty($arraydefaultmessage->joinfiles) && !empty($this->param['fileinit']) && is_array($this->param['fileinit'])) {
foreach ($this->param['fileinit'] as $file) { foreach ($this->param['fileinit'] as $file) {
$this->add_attached_files($file, basename($file), dol_mimetype($file)); if (!empty($file)) {
$this->add_attached_files($file, basename($file), dol_mimetype($file));
}
} }
} }
} }
@@ -1083,7 +1085,7 @@ class FormMail extends Form
$tmparray = $this->withto; $tmparray = $this->withto;
foreach ($tmparray as $key => $val) { foreach ($tmparray as $key => $val) {
$tmparray[$key] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]); $tmparray[$key] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]);
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true); $tmparray[$key] = dol_htmlentities($tmparray[$key], ENT_QUOTES|ENT_SUBSTITUTE, 'UTF-8', true);
} }
$withtoselected = GETPOST("receiver", 'array'); // Array of selected value $withtoselected = GETPOST("receiver", 'array'); // Array of selected value
@@ -1121,7 +1123,7 @@ class FormMail extends Form
$tmparray = $this->withtocc; $tmparray = $this->withtocc;
foreach ($tmparray as $key => $val) { foreach ($tmparray as $key => $val) {
$tmparray[$key] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]); $tmparray[$key] = str_replace(array('<', '>'), array('(', ')'), $tmparray[$key]);
$tmparray[$key] = dol_htmlentities($tmparray[$key], null, 'UTF-8', true); $tmparray[$key] = dol_htmlentities($tmparray[$key], ENT_QUOTES|ENT_SUBSTITUTE, 'UTF-8', true);
} }
$withtoccselected = GETPOST("receivercc", 'array'); // Array of selected value $withtoccselected = GETPOST("receivercc", 'array'); // Array of selected value
$out .= $form->multiselectarray("receivercc", $tmparray, $withtoccselected, null, null, 'inline-block minwidth500', null, ""); $out .= $form->multiselectarray("receivercc", $tmparray, $withtoccselected, null, null, 'inline-block minwidth500', null, "");

View File

@@ -2006,7 +2006,7 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin
if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) { if (empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($arraylist[$labeltype])) {
$labeltype = 'AC_OTH'; $labeltype = 'AC_OTH';
} }
if (preg_match('/^TICKET_MSG/', $actionstatic->code)) { if (!empty($actionstatic->code) && preg_match('/^TICKET_MSG/', $actionstatic->code)) {
$labeltype = $langs->trans("Message"); $labeltype = $langs->trans("Message");
} else { } else {
if (!empty($arraylist[$labeltype])) { if (!empty($arraylist[$labeltype])) {

View File

@@ -7273,9 +7273,13 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8')
$firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters $firstline = preg_replace('/<br[^>]*>.*$/s', '', $text); // The s pattern modifier means the . can match newline characters
$firstline = preg_replace('/<div[^>]*>.*$/s', '', $firstline); // The s pattern modifier means the . can match newline characters $firstline = preg_replace('/<div[^>]*>.*$/s', '', $firstline); // The s pattern modifier means the . can match newline characters
} else { } else {
$firstline = preg_replace('/[\n\r].*/', '', $text); if (isset($text)) {
$firstline = preg_replace('/[\n\r].*/', '', $text);
} else {
$firstline = '';
}
} }
return $firstline.((strlen($firstline) != strlen($text)) ? '...' : ''); return $firstline.(isset($firstline) && isset($text) && (strlen($firstline) != strlen($text)) ? '...' : '');
} else { } else {
$ishtml = 0; $ishtml = 0;
if (dol_textishtml($text)) { if (dol_textishtml($text)) {
@@ -8119,7 +8123,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null,
$substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key];
$substitutionarray['__EXTRAFIELD_'.strtoupper($key).'_FORMATED__'] = price($object->array_options['options_'.$key]); $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'_FORMATED__'] = price($object->array_options['options_'.$key]);
} elseif ($extrafields->attributes[$object->table_element]['type'][$key] != 'separator') { } elseif ($extrafields->attributes[$object->table_element]['type'][$key] != 'separator') {
$substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = $object->array_options['options_'.$key]; $substitutionarray['__EXTRAFIELD_'.strtoupper($key).'__'] = !empty($object->array_options['options_'.$key]) ? $object->array_options['options_'.$key] :'';
} }
} }
} }

View File

@@ -150,7 +150,8 @@ class mod_project_simple extends ModeleNumRefProjects
$date = (empty($project->date_c) ? dol_now() : $project->date_c); $date = (empty($project->date_c) ? dol_now() : $project->date_c);
//$yymm = strftime("%y%m",time()); //$yymm = strftime("%y%m",time());
$yymm = strftime("%y%m", $date); //$yymm = strftime("%y%m", $date);
$yymm = date("%y%m", $date);
if ($max >= (pow(10, 4) - 1)) { if ($max >= (pow(10, 4) - 1)) {
$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is $num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is

View File

@@ -487,7 +487,7 @@ class CommandeFournisseur extends CommonOrder
$this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
$this->extraparams = (array) json_decode($obj->extraparams, true); $this->extraparams = isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array();
$this->db->free($resql); $this->db->free($resql);

View File

@@ -1003,7 +1003,7 @@ class FactureFournisseur extends CommonInvoice
$this->multicurrency_total_tva = $obj->multicurrency_total_tva; $this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
$this->extraparams = (array) json_decode($obj->extraparams, true); $this->extraparams = isset($obj->extraparams) ? (array) json_decode($obj->extraparams, true) : array();
$this->socid = $obj->socid; $this->socid = $obj->socid;
$this->socnom = $obj->socnom; $this->socnom = $obj->socnom;