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=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>';
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=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>';
print $urlvcal;

View File

@ -79,7 +79,7 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre"))
$testdate = false;
$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
if ($champdatefin >= dol_now())
@ -90,16 +90,17 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre"))
else
{
$testdate = true;
$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
//$testdate = false;
//$_SESSION['champdatefin'] = dol_print_date($champdatefin,'dayrfc');
//setEventMessage($langs->trans('ExpiredDate'),'errors');
setEventMessage($langs->trans('ExpiredDate'),'warnings');
}
}
if (! $testdate) {
setEventMessage($langs->trans('ErrorFieldRequired',$langs->transnoentitiesnoconv("ExpireDate")), 'errors');
}
if ($titre && $testdate)
{
if (! empty($creation_sondage_date))

View File

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