Fixed problem with visualization of previous votes in poll voting page

This commit is contained in:
Marcos García de La Fuente 2014-01-05 20:10:39 +01:00
parent c891f4afc4
commit b32fafef17

View File

@ -361,31 +361,35 @@ else
// Loop on each answer // Loop on each answer
if ($object->allow_spy) { $sumfor = array();
$sumfor = array(); $sumagainst = array();
$sumagainst = array(); $compteur = 0;
$compteur = 0; $sql ="SELECT id_users, nom, id_sondage, reponses";
$sql ="SELECT id_users, nom, id_sondage, reponses"; $sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs";
$sql.=" FROM ".MAIN_DB_PREFIX."opensurvey_user_studs"; $sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'";
$sql.=" WHERE id_sondage = '".$db->escape($numsondage)."'"; dol_syslog('sql='.$sql);
dol_syslog('sql='.$sql); $resql=$db->query($sql);
$resql=$db->query($sql); if (! $resql)
if (! $resql) {
{
dol_print_error($db); dol_print_error($db);
exit; exit;
} }
$num=$db->num_rows($resql); $num=$db->num_rows($resql);
while ($compteur < $num) while ($compteur < $num)
{ {
$obj=$db->fetch_object($resql); $obj=$db->fetch_object($resql);
$ensemblereponses = $obj->reponses; $ensemblereponses = $obj->reponses;
print '<tr>'."\n";
// ligne d'un usager pré-authentifié // ligne d'un usager pré-authentifié
$mod_ok = (! empty($nombase) && in_array($nombase, $listofvoters)); $mod_ok = (in_array($obj->nom, $listofvoters));
if (!$mod_ok && !$object->allow_spy) {
$compteur++;
continue;
}
print '<tr>'."\n";
// Name // Name
print '<td class="nom">'.htmlentities($obj->nom).'</td>'."\n"; print '<td class="nom">'.htmlentities($obj->nom).'</td>'."\n";
@ -520,7 +524,6 @@ if ($object->allow_spy) {
$compteur++; $compteur++;
print '</tr>'."\n"; print '</tr>'."\n";
}
} }
// Add line to add new record // Add line to add new record