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 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
|
||||
*/
|
||||
function delete($user, $notrigger, $numsondageadmin)
|
||||
@ -345,6 +345,8 @@ class Opensurveysondage extends CommonObject
|
||||
global $conf, $langs;
|
||||
$error=0;
|
||||
|
||||
$numsondage=substr($numsondageadmin, 0, 16);
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
if (! $error)
|
||||
@ -366,10 +368,10 @@ class Opensurveysondage extends CommonObject
|
||||
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);
|
||||
$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);
|
||||
$resql=$this->db->query($sql);
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
|
||||
|
||||
$action=GETPOST('action');
|
||||
$id=GETPOST('id');
|
||||
$numsondage=substr($id, 0, 16);
|
||||
|
||||
if (! $sortorder) $sortorder="ASC";
|
||||
if (! $sortfield) $sortfield="p.titre";
|
||||
@ -45,16 +46,10 @@ if ($action == 'delete_confirm')
|
||||
{
|
||||
$db->begin();
|
||||
|
||||
$sql='DELETE FROM '.MAIN_DB_PREFIX."opensurvey_comments WHERE id_sondage_admin = '".$id."'";
|
||||
dol_syslog("Delete poll sql=".$sql, LOG_DEBUG);
|
||||
$resql=$db->query($sql);
|
||||
$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);
|
||||
|
||||
$object=new Opensurveysondage($db);
|
||||
|
||||
$result=$object->delete($user,'',$numsondageadmin);
|
||||
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user