Fix warnings when submitting a vote for a survey

This commit is contained in:
Laurent Destailleur 2015-04-12 11:42:49 +02:00
parent 56a14da5d4
commit d5afff4388
5 changed files with 12 additions and 9 deletions

View File

@ -309,7 +309,7 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$object->id_sondage; $url=$urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php',1).'?sondage='.$object->id_sondage;
$urllink='<a href="'.$url.'" target="_blank">'.$url.'</a>'; $urllink='<a href="'.$url.'" target="_blank">'.$url.'</a>';
print $urllink; print $urllink;

View File

@ -480,7 +480,7 @@ $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
$url=$urlwithouturlroot.dol_buildpath('/opensurvey/public/studs.php',1).'?sondage='.$numsondage; $url=$urlwithouturlroot.dol_buildpath('/public/opensurvey/studs.php',1).'?sondage='.$numsondage;
$urlvcal='<a href="'.$url.'" target="_blank">'.$url.'</a>'; $urlvcal='<a href="'.$url.'" target="_blank">'.$url.'</a>';
print $urlvcal; print $urlvcal;

View File

@ -79,7 +79,7 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre"))
$testdate = false; $testdate = false;
$champdatefin = dol_mktime(0,0,0,GETPOST('champdatefinmonth'),GETPOST('champdatefinday'),GETPOST('champdatefinyear')); $champdatefin = dol_mktime(0,0,0,GETPOST('champdatefinmonth'),GETPOST('champdatefinday'),GETPOST('champdatefinyear'));
if (GETPOST('champdatefin') && ($champdatefin > 0)) // A date was provided if ($champdatefin && ($champdatefin > 0)) // A date was provided
{ {
// Expire date is not before today // Expire date is not before today
if ($champdatefin >= dol_now()) if ($champdatefin >= dol_now())
@ -90,9 +90,10 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre"))
else else
{ {
$testdate = true; $testdate = true;
$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
//$testdate = false; //$testdate = false;
//$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc'); //$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
//setEventMessage($langs->trans('ExpiredDate'),'errors'); setEventMessage($langs->trans('ExpiredDate'),'warnings');
} }
} }

View File

@ -17,7 +17,7 @@
*/ */
/** /**
* \file htdocs/opensurvey/public/studs.php * \file htdocs/public/opensurvey/studs.php
* \ingroup opensurvey * \ingroup opensurvey
* \brief Page to list surveys * \brief Page to list surveys
*/ */
@ -114,9 +114,11 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout
// Check if vote already exists // Check if vote already exists
$sql = 'SELECT id_users, nom as name'; $sql = 'SELECT id_users, nom as name';
$sql.= ' FROM '.MAIN_DB_PREFIX."opensurvey_user_studs'; $sql.= ' FROM '.MAIN_DB_PREFIX.'opensurvey_user_studs';
$sql.= ' WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users"; $sql.= " WHERE id_sondage='".$db->escape($numsondage)."' AND nom = '".$db->escape($nom)."' ORDER BY id_users";
$resql = $db->query($sql); $resql = $db->query($sql);
if (! $resql) dol_print_error($db);
$num_rows = $db->num_rows($resql); $num_rows = $db->num_rows($resql);
if ($num_rows > 0) if ($num_rows > 0)
{ {