Update card.php

This commit is contained in:
Frédéric FRANCE 2020-11-13 21:20:17 +01:00 committed by GitHub
parent fd14ce4ea4
commit 894f1e8215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,7 @@
<?php <?php
/* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2013-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com> * Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2018-2020 Frédéric France <frederic.france@netlogic.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -41,14 +41,13 @@ $cancel = GETPOST('cancel', 'alpha');
$numsondage = ''; $numsondage = '';
if (GETPOST('id')) { if (GETPOST('id')) {
$numsondage = GETPOST('id', 'alpha'); $numsondage = (string) GETPOST('id', 'alpha');
} }
$object = new Opensurveysondage($db); $object = new Opensurveysondage($db);
$result = $object->fetch(0, $numsondage); $result = $object->fetch(0, $numsondage);
if ($result <= 0) if ($result <= 0) {
{
dol_print_error($db, $object->error); dol_print_error($db, $object->error);
exit; exit;
} }
@ -112,17 +111,16 @@ if (empty($reshook))
if (!$error) if (!$error)
{ {
$object->title = GETPOST('nouveautitre', 'nohtml'); $object->title = (string) GETPOST('nouveautitre', 'nohtml');
$object->description = GETPOST('nouveauxcommentaires', 'restricthtml'); $object->description = (string) GETPOST('nouveauxcommentaires', 'restricthtml');
$object->mail_admin = GETPOST('nouvelleadresse', 'alpha'); $object->mail_admin = (string) GETPOST('nouvelleadresse', 'alpha');
$object->date_fin = $expiredate; $object->date_fin = $expiredate;
$object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? 1 : 0; $object->allow_comments = GETPOST('cancomment', 'alpha') == 'on' ? 1 : 0;
$object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? 1 : 0; $object->allow_spy = GETPOST('canseeothersvote', 'alpha') == 'on' ? 1 : 0;
$object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false; $object->mailsonde = GETPOST('mailsonde', 'alpha') == 'on' ? true : false;
$res = $object->update($user); $res = $object->update($user);
if ($res < 0) if ($res < 0) {
{
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$action = 'edit'; $action = 'edit';
} }