Fix: delete of survey
This commit is contained in:
parent
5c1b3d86c3
commit
8a69cdd433
@ -337,7 +337,7 @@ class Opensurveysondage extends CommonObject
|
|||||||
*
|
*
|
||||||
* @param User $user User that deletes
|
* @param User $user User that deletes
|
||||||
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
* @param string $numsondageadmin Num sondage to delete
|
* @param string $numsondageadmin Num sondage admin to delete
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($user, $notrigger, $numsondageadmin)
|
function delete($user, $notrigger, $numsondageadmin)
|
||||||
@ -345,6 +345,8 @@ class Opensurveysondage extends CommonObject
|
|||||||
global $conf, $langs;
|
global $conf, $langs;
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
$numsondage=substr($numsondageadmin, 0, 16);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -366,10 +368,10 @@ class Opensurveysondage extends CommonObject
|
|||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage_admin = '".$numsondageadmin."'";
|
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage = '".$numsondage."'";
|
||||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage_admin = '".$numsondageadmin."'";
|
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage = '".$numsondage."'";
|
||||||
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete sql=".$sql, LOG_DEBUG);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
|||||||
|
|
||||||
$action=GETPOST('action');
|
$action=GETPOST('action');
|
||||||
$id=GETPOST('id');
|
$id=GETPOST('id');
|
||||||
|
$numsondage=substr($id, 0, 16);
|
||||||
|
|
||||||
if (! $sortorder) $sortorder="ASC";
|
if (! $sortorder) $sortorder="ASC";
|
||||||
if (! $sortfield) $sortfield="p.titre";
|
if (! $sortfield) $sortfield="p.titre";
|
||||||
@ -45,15 +46,9 @@ if ($action == 'delete_confirm')
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage_admin = '".$id."'";
|
$object=new Opensurveysondage($db);
|
||||||
dol_syslog("Delete poll sql=".$sql, LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
$result=$object->delete($user,'',$numsondageadmin);
|
||||||
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_user_studs WHERE id_sondage_admin = '".$id."'";
|
|
||||||
dol_syslog("Delete poll sql=".$sql, LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_sondage WHERE id_sondage_admin = '".$id."'";
|
|
||||||
dol_syslog("Delete poll sql=".$sql, LOG_DEBUG);
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
|
|
||||||
$db->commit();
|
$db->commit();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user