Fix opensurvey

This commit is contained in:
Laurent Destailleur 2023-05-10 13:44:15 +02:00
parent 5239f3c133
commit fc4aeccf21
2 changed files with 14 additions and 11 deletions

View File

@ -37,7 +37,7 @@ if (empty($user->rights->opensurvey->read)) {
// Init vars
$action = GETPOST('action', 'aZ09');
$numsondage = GETPOST("id");
$numsondage = GETPOST("id", 'alphanohtml');
$object = new Opensurveysondage($db);
$result = $object->fetch(0, $numsondage);
@ -53,8 +53,8 @@ $nblines = $object->fetch_lines();
*/
// Return to the results
if (GETPOST('retoursondage')) {
header('Location: results.php?id='.(GETPOSTISSET('id_sondage') ? GETPOST('id_sondage', 'aZ09') : GETPOST('id', 'int')));
if (GETPOST('cancel')) {
header('Location: results.php?id='.(GETPOSTISSET('id_sondage') ? GETPOST('id_sondage', 'aZ09') : GETPOST('id', 'alphanohtml')));
exit;
}
@ -427,6 +427,7 @@ $title = $object->title." - ".$langs->trans('Card');
$helpurl = '';
$arrayofjs = array();
$arrayofcss = array('/opensurvey/css/style.css');
llxHeader('', $title, $helpurl, 0, 0, 0, $arrayofjs, $arrayofcss);
@ -443,6 +444,7 @@ $toutsujet = str_replace("°", "'", $toutsujet);
print '<form name="formulaire4" action="#" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="id" value="'.GETPOST('id').'">';
$head = opensurvey_prepare_head($object);
@ -508,7 +510,6 @@ print '<div class="underbanner clearboth"></div>';
print '<table class="border tableforfield centpercent">';
// Expire date
print '<tr><td>'.$langs->trans('ExpireDate').'</td><td>';
if ($action == 'edit') {
@ -575,9 +576,11 @@ if (GETPOST('ajoutsujet')) {
accessforbidden();
}
print '<form name="formulaire" action="" method="POST">'."\n";
print '<form name="formulaire" action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="backtopage" value="'.GETPOST('backtopage', 'alpha').'">';
print '<input type="hidden" name="id" value="'.GETPOST('id', 'alpha').'">';
print '<input type="hidden" name="ajoutsujet" value="1">';
print '<div class="center">'."\n";
print "<br><br>\n";
@ -591,7 +594,7 @@ if (GETPOST('ajoutsujet')) {
print '<input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans("Add")).'">';
print '<input type="hidden" name="id_sondage" value="'.dol_escape_htmltag($object->id_sondage).'">';
print ' &nbsp; &nbsp; ';
print '<input type="submit" class="button button-cancel" name="retoursondage" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.dol_escape_htmltag($langs->trans("Cancel")).'">';
print '<br><br>'."\n";
} else {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
@ -644,7 +647,7 @@ if (GETPOST('ajoutsujet')) {
print '<br><br>';
print' <input type="submit" class="button" name="ajoutercolonne" value="'.dol_escape_htmltag($langs->trans("Add")).'">'."\n";
print '&nbsp; &nbsp;';
print '<input type="submit" class="button button-cancel" name="retoursondage" value="'.$langs->trans("Cancel").'">';
print '<input type="submit" class="button button-cancel" name="cancel" value="'.$langs->trans("Cancel").'">';
}
print '</form>'."\n";
@ -757,10 +760,10 @@ if ($object->format == "D") {
} else {
$next = intval($toutsujet[$i + 1]);
}
if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) {
if ($next && dol_print_date($cur, "%a %d") == dol_print_date($next, "%a %d") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) {
$colspan++;
} else {
print '<td colspan='.$colspan.' class="jour">'.dol_print_date($cur, "%a %e").'</td>'."\n";
print '<td colspan='.$colspan.' class="jour">'.dol_print_date($cur, "%a %d").'</td>'."\n";
$colspan = 1;
}

View File

@ -424,10 +424,10 @@ if ($object->format == "D") {
} else {
$next = intval($toutsujet[$i + 1]);
}
if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) {
if ($next && dol_print_date($cur, "%a %d") == dol_print_date($next, "%a %d") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) {
$colspan++;
} else {
print '<td colspan="'.$colspan.'" class="jour">'.dol_print_date($cur, "%a %e").'</td>'."\n";
print '<td colspan="'.$colspan.'" class="jour">'.dol_print_date($cur, "%a %d").'</td>'."\n";
$colspan = 1;
}
}