Fix missing field migration, fix select2
This commit is contained in:
parent
5e74b622bd
commit
5fdfa79e56
3 changed files with 10 additions and 9 deletions
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
-- V22 forgotten
|
||||
|
||||
ALTER TABLE llx_opensurvey_user_studs ADD COLUMN tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
|
||||
|
||||
|
||||
-- V23 migration
|
||||
|
|
|
|||
|
|
@ -63,8 +63,7 @@ $object = new Opensurveysondage($db);
|
|||
|
||||
$result = $object->fetch('', $numsondage);
|
||||
if ($result <= 0) {
|
||||
dol_print_error($db, $object->error);
|
||||
exit;
|
||||
accessforbidden("Record not found");
|
||||
}
|
||||
|
||||
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
|
||||
|
|
|
|||
|
|
@ -74,16 +74,17 @@ if (GETPOST("ajoutcases") || GETPOST("ajoutcases_x")) {
|
|||
|
||||
// Create survey into database
|
||||
if (GETPOSTISSET("confirmecreation")) {
|
||||
//recuperation des données de champs textes
|
||||
$toutchoix = '';
|
||||
for ($i = 0; $i < $_SESSION["nbrecases"] + 1; $i++) {
|
||||
if (!empty($arrayofchoices[$i])) {
|
||||
$tmpchoice = $arrayofchoices[$i];
|
||||
$tmptypecolumn = GETPOST('typecolonne'.$i, 'alphanohtml');
|
||||
if (!empty($tmpchoice)) {
|
||||
$toutchoix .= ',';
|
||||
$toutchoix .= str_replace(array(",", "@"), " ", $arrayofchoices[$i]).(empty($arrayoftypecolumn[$i]) ? '' : '@'.$arrayoftypecolumn[$i]);
|
||||
$toutchoix .= str_replace(array(",", "@"), " ", $tmpchoice).(empty($tmptypecolumn) ? '' : '@'.$tmptypecolumn);
|
||||
}
|
||||
}
|
||||
|
||||
$toutchoix = substr("$toutchoix", 1);
|
||||
$toutchoix = substr($toutchoix, 1);
|
||||
$_SESSION["toutchoix"] = $toutchoix;
|
||||
|
||||
//test de remplissage des cases
|
||||
|
|
@ -94,11 +95,11 @@ if (GETPOSTISSET("confirmecreation")) {
|
|||
}
|
||||
}
|
||||
|
||||
//message d'erreur si aucun champ renseigné
|
||||
// Error if no field defined
|
||||
if ($testremplissage != "ok" || (!$toutchoix)) {
|
||||
setEventMessages($langs->trans("ErrorOpenSurveyOneChoice"), null, 'errors');
|
||||
} else {
|
||||
//format du sondage AUTRE
|
||||
// format of survey AUTRE
|
||||
$_SESSION["formatsondage"] = "A";
|
||||
|
||||
// Add into database
|
||||
|
|
@ -147,7 +148,7 @@ for ($i = 0; $i < $_SESSION["nbrecases"]; $i++) {
|
|||
print '<tr><td>'.$langs->trans("TitleChoice").' '.$j.': </td><td><input type="text" name="choix[]" size="40" maxlength="40" value="'.dol_escape_htmltag($_SESSION["choix$i"]).'" id="choix'.$i.'">';
|
||||
$tmparray = array('checkbox' => $langs->trans("CheckBox"), 'yesno' => $langs->trans("YesNoList"), 'foragainst' => $langs->trans("PourContreList"));
|
||||
|
||||
print ' '.$langs->trans("Type").' '.$form->selectarray("typecolonne[]", $tmparray, $_SESSION["typecolonne".$i]);
|
||||
print ' '.$langs->trans("Type").' '.$form->selectarray("typecolonne".$i, $tmparray, $_SESSION["typecolonne".$i]);
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue