fix : php8.1 warnings

This commit is contained in:
hystepik 2022-11-28 16:49:58 +01:00
parent 6dd0f7850f
commit e2b2b30320
6 changed files with 15 additions and 11 deletions

View File

@ -209,7 +209,7 @@ $toutsujet = explode(",", $object->sujet);
$listofanswers = array();
foreach ($toutsujet as $value) {
$tmp = explode('@', $value);
$listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox'));
$listofanswers[] = array('label'=>$tmp[0], 'format'=>(!empty($tmp[1]) ? $tmp[1] : 'checkbox'));
}
$toutsujet = str_replace("@", "<br>", $toutsujet);
$toutsujet = str_replace("°", "'", $toutsujet);

View File

@ -274,7 +274,7 @@ class Opensurveysondage extends CommonObject
$this->sujet = $obj->sujet;
$this->fk_user_creat = $obj->fk_user_creat;
$this->date_m = $this->db->jdate($obj->tls);
$this->date_m = $this->db->jdate(!empty($obj->tls) ? $obj->tls : "");
$ret = 1;
} else {
$sondage = ($id ? 'id='.$id : 'sondageid='.$numsurvey);
@ -686,7 +686,7 @@ class Opensurveysondage extends CommonObject
{
$result = 0;
$sql .= " SELECT COUNT(id_users) as nb FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
$sql = " SELECT COUNT(id_users) as nb FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
$sql .= " WHERE id_sondage = '".$this->db->escape($this->ref)."'";
$resql = $this->db->query($sql);

View File

@ -63,9 +63,9 @@ $now = dol_now();
$nbcolonnes = substr_count($object->sujet, ',') + 1;
$toutsujet = explode(",", $object->sujet);
$somme = array();
// affichage des sujets du sondage
$input .= $langs->trans("Name").";";
$input = $langs->trans("Name").";";
for ($i = 0; $toutsujet[$i]; $i++) {
if ($object->format == "D") {
$input .= ''.dol_print_date($toutsujet[$i], 'dayhour').';';
@ -105,6 +105,9 @@ if ($resql) {
//affichage des resultats
$ensemblereponses = $obj->reponses;
for ($k = 0; $k < $nbcolonnes; $k++) {
if (empty($somme[$k])) {
$somme[$k] = 0;
}
$car = substr($ensemblereponses, $k, 1);
if ($car == "1") {
$input .= 'OK;';

View File

@ -40,6 +40,7 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'opensurveylist'; // To manage different context of search
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$id = GETPOST('id', 'alpha');
$search_ref = GETPOST('search_ref', 'alpha');
@ -175,16 +176,16 @@ $sql .= " WHERE p.entity IN (".getEntity('survey').")";
if ($search_status != '-1' && $search_status != '') {
$sql .= natural_search("p.status", $search_status, 2);
}
if ($search_expired == 'expired') {
if (!empty($search_expired) && $search_expired == 'expired') {
$sql .= " AND p.date_fin < '".$db->idate($now)."'";
}
if ($search_expired == 'opened') {
if (!empty($search_expired) && $search_expired == 'opened') {
$sql .= " AND p.date_fin >= '".$db->idate($now)."'";
}
if ($search_ref) {
if (!empty($search_ref)) {
$sql .= natural_search("p.id_sondage", $search_ref);
}
if ($search_title) {
if (!empty($search_title)) {
$sql .= natural_search("p.titre", $search_title);
}
// Add where from extra fields

View File

@ -435,7 +435,7 @@ $toutsujet = explode(",", $object->sujet);
$listofanswers = array();
foreach ($toutsujet as $value) {
$tmp = explode('@', $value);
$listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox'));
$listofanswers[] = array('label'=>$tmp[0], 'format'=>(!empty($tmp[1]) ? $tmp[1] : 'checkbox'));
}
$toutsujet = str_replace("@", "<br>", $toutsujet);
$toutsujet = str_replace("°", "'", $toutsujet);

View File

@ -319,7 +319,7 @@ $toutsujet = explode(",", $object->sujet);
$listofanswers = array();
foreach ($toutsujet as $value) {
$tmp = explode('@', $value);
$listofanswers[] = array('label'=>$tmp[0], 'format'=>($tmp[1] ? $tmp[1] : 'checkbox'));
$listofanswers[] = array('label'=>$tmp[0], 'format'=>(!empty($tmp[1]) ? $tmp[1] : 'checkbox'));
}
$toutsujet = str_replace("°", "'", $toutsujet);