From 12e322642b9fbdcb68f7b73a2cc4497777e695d1 Mon Sep 17 00:00:00 2001 From: Jagadedes Date: Thu, 23 Oct 2014 12:47:37 +0530 Subject: [PATCH] #29757 foreign key check removed before insert and enabled after that --- CRM/Wci/Form/CreateWidget.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Wci/Form/CreateWidget.php b/CRM/Wci/Form/CreateWidget.php index cf372ef..5e935c8 100644 --- a/CRM/Wci/Form/CreateWidget.php +++ b/CRM/Wci/Form/CreateWidget.php @@ -239,7 +239,7 @@ where w.id=" . $this->_id; $equals = " = "; $quote = "'"; } - + if (isset($this->_id)) { $sql = "UPDATE civicrm_wci_widget SET title = '". $values['title'] . "', logo_image = '" . $values['logo_image'] . "', image = '" @@ -283,7 +283,9 @@ where w.id=" . $this->_id; $errorScope = CRM_Core_TemporaryErrorScope::useException(); try { $transaction = new CRM_Core_Transaction(); + CRM_Core_DAO::executeQuery("SET foreign_key_checks = 0;"); CRM_Core_DAO::executeQuery($sql); + CRM_Core_DAO::executeQuery("SET foreign_key_checks = 1;"); $transaction->commit(); if(isset($_REQUEST['_qf_CreateWidget_next'])) { @@ -291,7 +293,7 @@ where w.id=" . $this->_id; $widget_id = CRM_Core_DAO::singleValueQuery('SELECT LAST_INSERT_ID()'); CRM_Utils_System::redirect('?action=update&reset=1&id=' . $widget_id); } else { - CRM_Utils_System::redirect('?reset=1'); + CRM_Utils_System::redirect('./?reset=1'); } } catch (Exception $e) { -- 2.25.1