Merge pull request #23042 from lamrani002/fix_issue_tooLong_reponse

fix issue #23027
This commit is contained in:
Laurent Destailleur 2022-12-01 11:08:25 +01:00 committed by GitHub
commit 62231d5b2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 113 additions and 104 deletions

View File

@ -54,6 +54,8 @@ ALTER TABLE llx_user DROP COLUMN idpers3;
UPDATE llx_c_actioncomm SET type = 'system' WHERE code = 'AC_OTH'; UPDATE llx_c_actioncomm SET type = 'system' WHERE code = 'AC_OTH';
ALTER TABLE llx_opensurvey_user_studs MODIFY reponses VARCHAR(200) NOT NULL;
-- v17 -- v17
ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_type varchar(32); ALTER TABLE llx_mailing_cibles MODIFY COLUMN source_type varchar(32);

View File

@ -19,7 +19,7 @@ CREATE TABLE llx_opensurvey_user_studs (
id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, id_users INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
nom VARCHAR(64) NOT NULL, nom VARCHAR(64) NOT NULL,
id_sondage VARCHAR(16) NOT NULL, id_sondage VARCHAR(16) NOT NULL,
reponses VARCHAR(100) NOT NULL, -- Not used for 'F' surveys reponses VARCHAR(200) NOT NULL, -- Not used for 'F' surveys
tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
) ENGINE=innodb; ) ENGINE=innodb;

View File

@ -37,6 +37,7 @@ if (!$user->rights->opensurvey->write) {
$_SESSION["formatsondage"] = "D"; $_SESSION["formatsondage"] = "D";
$erreur = false; $erreur = false;
$erreurNbchoice = 0;
/* /*
* Actions * Actions
@ -49,6 +50,10 @@ if (GETPOST('confirmation')) {
$nbofchoice = count($_SESSION["totalchoixjour"]); $nbofchoice = count($_SESSION["totalchoixjour"]);
$errheure = array(); $errheure = array();
if ($nbofchoice * $_SESSION["nbrecaseshoraires"] > 200) {
setEventMessages($langs->trans("ErrorFieldTooLong"), null, 'errors');
$erreurNb++;
} else {
for ($i = 0; $i < $nbofchoice; $i++) { for ($i = 0; $i < $nbofchoice; $i++) {
// Show hours choices // Show hours choices
for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) { for ($j = 0; $j < $_SESSION["nbrecaseshoraires"]; $j++) {
@ -156,6 +161,8 @@ if (GETPOST('confirmation')) {
} }
} }
} }
}
if (!empty($errheure)) { if (!empty($errheure)) {
setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors'); setEventMessages($langs->trans("ErrorBadFormat"), null, 'errors');
@ -170,7 +177,7 @@ if (GETPOST('confirmation')) {
} }
// Add survey into database // Add survey into database
if (!$erreur) { if (!$erreur && $erreurNb == 0) {
$_SESSION["toutchoix"] = substr("$choixdate", 1); $_SESSION["toutchoix"] = substr("$choixdate", 1);
ajouter_sondage(); ajouter_sondage();