fix error on fetching thirdparty when there is none

This commit is contained in:
Dorian Vabre 2021-05-10 12:47:09 +02:00
parent 0dce9ee359
commit 0e62edfd42

View File

@ -119,12 +119,17 @@ $result = $db->query($sqlforconf);
$i = 0; $i = 0;
while ($i < $db->num_rows($result)) { while ($i < $db->num_rows($result)) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); if (!empty($obj->fk_soc)) {
if ($resultthirdparty) { $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc);
$thirdpartyname = $tmpthirdparty->name; if ($resultthirdparty) {
$thirdpartyname = $tmpthirdparty->name;
} else {
$thirdpartyname = '';
}
} else { } else {
$thirdpartyname = ''; $thirdpartyname = '';
} }
$listOfConferences .= '<tr><td>'.$obj->label.'</td><td>'.$obj->libelle.'</td><td>'.$obj->datep.'</td><td>'.$obj->datep2.'</td><td>'.$thirdpartyname.'</td><td>'.$obj->note.'</td>'; $listOfConferences .= '<tr><td>'.$obj->label.'</td><td>'.$obj->libelle.'</td><td>'.$obj->datep.'</td><td>'.$obj->datep2.'</td><td>'.$thirdpartyname.'</td><td>'.$obj->note.'</td>';
$listOfConferences .= '<td><button type="submit" name="vote" value="'.$obj->id.'" class="button">'.$langs->trans("Vote").'</button></td></tr>'; $listOfConferences .= '<td><button type="submit" name="vote" value="'.$obj->id.'" class="button">'.$langs->trans("Vote").'</button></td></tr>';
$i++; $i++;
@ -135,12 +140,17 @@ $result = $db->query($sqlforbooth);
$i = 0; $i = 0;
while ($i < $db->num_rows($result)) { while ($i < $db->num_rows($result)) {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc); if (!empty($obj->fk_soc)) {
if ($resultthirdparty) { $resultthirdparty = $tmpthirdparty->fetch($obj->fk_soc);
$thirdpartyname = $tmpthirdparty->name; if ($resultthirdparty) {
$thirdpartyname = $tmpthirdparty->name;
} else {
$thirdpartyname = '';
}
} else { } else {
$thirdpartyname = ''; $thirdpartyname = '';
} }
$listOfBooths .= '<tr><td>'.$obj->label.'</td><td>'.$obj->libelle.'</td><td>'.$obj->datep.'</td><td>'.$obj->datep2.'</td><td>'.$thirdpartyname.'</td><td>'.$obj->note.'</td>'; $listOfBooths .= '<tr><td>'.$obj->label.'</td><td>'.$obj->libelle.'</td><td>'.$obj->datep.'</td><td>'.$obj->datep2.'</td><td>'.$thirdpartyname.'</td><td>'.$obj->note.'</td>';
$listOfBooths .= '<td><button type="submit" name="vote" value="'.$obj->id.'" class="button">'.$langs->trans("Vote").'</button></td></tr>'; $listOfBooths .= '<td><button type="submit" name="vote" value="'.$obj->id.'" class="button">'.$langs->trans("Vote").'</button></td></tr>';
$i++; $i++;