diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index b243b8c8342..36c5b2ea07d 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -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("@", "
", $toutsujet); $toutsujet = str_replace("°", "'", $toutsujet); diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index b7fadbdb60d..8848af12629 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -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); diff --git a/htdocs/opensurvey/exportcsv.php b/htdocs/opensurvey/exportcsv.php index a7e8b709793..1e9005b6af4 100644 --- a/htdocs/opensurvey/exportcsv.php +++ b/htdocs/opensurvey/exportcsv.php @@ -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;'; diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index e03ee278574..626499e2412 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -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 diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index f8a2648a809..bedec1eb1aa 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -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("@", "
", $toutsujet); $toutsujet = str_replace("°", "'", $toutsujet); diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 900483bbbfa..b6708a5b5f6 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -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);