This commit is contained in:
Laurent Destailleur
2016-09-12 02:47:36 +02:00
parent d6ea6d1725
commit ac509d6565
3 changed files with 23 additions and 10 deletions

View File

@@ -46,11 +46,6 @@ if (GETPOST('id')) {
$object=new Opensurveysondage($db); $object=new Opensurveysondage($db);
$result=$object->fetch(0, $numsondage); $result=$object->fetch(0, $numsondage);
if ($result <= 0)
{
dol_print_error($db,$object->error);
exit;
}
$expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear')); $expiredate=dol_mktime(0, 0, 0, GETPOST('expiremonth'), GETPOST('expireday'), GETPOST('expireyear'));
@@ -206,6 +201,16 @@ foreach ($toutsujet as $value)
$toutsujet=str_replace("@","<br>",$toutsujet); $toutsujet=str_replace("@","<br>",$toutsujet);
$toutsujet=str_replace("°","'",$toutsujet); $toutsujet=str_replace("°","'",$toutsujet);
if (empty($object->ref)) // For survey, id is a hex string
{
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
llxFooter();
$db->close();
exit;
}
print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'" method="POST">'."\n"; print '<form name="updatesurvey" action="'.$_SERVER["PHP_SELF"].'?id='.$numsondage.'" method="POST">'."\n";
print '<input type="hidden" name="action" value="update">'; print '<input type="hidden" name="action" value="update">';
@@ -442,6 +447,6 @@ print '</form>';
print '<br>'; print '<br>';
llxFooterSurvey(); llxFooter();
$db->close(); $db->close();

View File

@@ -228,8 +228,7 @@ class Opensurveysondage extends CommonObject
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->id_sondage = $obj->id_sondage; $this->id_sondage = $obj->id_sondage;
//For compatibility $this->ref = $this->id_sondage; //For compatibility
$this->ref = $this->id_sondage;
$this->commentaires = $obj->description; // deprecated $this->commentaires = $obj->description; // deprecated
$this->description = $obj->description; $this->description = $obj->description;

View File

@@ -41,7 +41,6 @@ if (GETPOST('sondage'))
$object=new Opensurveysondage($db); $object=new Opensurveysondage($db);
$result=$object->fetch(0,$numsondage); $result=$object->fetch(0,$numsondage);
if ($result <= 0) dol_print_error('','Failed to get survey id '.$numsondage);
$nblignes=$object->fetch_lines(); $nblignes=$object->fetch_lines();
@@ -241,6 +240,16 @@ $arrayofjs=array();
$arrayofcss=array('/opensurvey/css/style.css'); $arrayofcss=array('/opensurvey/css/style.css');
llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss); llxHeaderSurvey($object->titre, "", 0, 0, $arrayofjs, $arrayofcss);
if (empty($object->ref)) // For survey, id is a hex string
{
$langs->load("errors");
print $langs->trans("ErrorRecordNotFound");
llxFooterSurvey();
$db->close();
exit;
}
// Define format of choices // Define format of choices
$toutsujet=explode(",",$object->sujet); $toutsujet=explode(",",$object->sujet);