Magento_SugarCRM_Contact_Module - Version 1.4.1

Version Notes

Stable release : Bug fixes

Download this release

Release Info

Developer Dipesh Patel
Extension Magento_SugarCRM_Contact_Module
Version 1.4.1
Comparing to
See all releases


Code changes from version 1.3.0 to 1.4.1

app/code/local/Offshoreevolution/Contact/Block/Adminhtml/Sugarsettings/Edit/Form.php CHANGED
@@ -7,11 +7,12 @@ class Offshoreevolution_Contact_Block_Adminhtml_Sugarsettings_Edit_Form extends
7
  * @return Mage_Adminhtml_Block_Widget_Form
8
  */
9
  protected function _prepareForm()
10
- {
 
11
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
12
  $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
13
 
14
- $resultRs = $read->fetchAll("SELECT * FROM oepl_sugar WHERE module='login'");
15
 
16
  $form = new Varien_Data_Form(
17
  array(
7
  * @return Mage_Adminhtml_Block_Widget_Form
8
  */
9
  protected function _prepareForm()
10
+ {
11
+ $prefix = Mage::getConfig()->getTablePrefix();
12
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
13
  $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
14
 
15
+ $resultRs = $read->fetchAll("SELECT * FROM ".$prefix."oepl_sugar WHERE module='login'");
16
 
17
  $form = new Varien_Data_Form(
18
  array(
app/code/local/Offshoreevolution/Contact/Block/Adminhtml/Useroperations/Edit/Form.php CHANGED
@@ -3,6 +3,7 @@ class Offshoreevolution_Contact_Block_Adminhtml_Useroperations_Edit_Form extends
3
  {
4
  protected function _prepareForm()
5
  {
 
6
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
7
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
8
 
@@ -26,7 +27,7 @@ class Offshoreevolution_Contact_Block_Adminhtml_Useroperations_Edit_Form extends
26
  ));
27
  foreach($modules as $key=>$val)
28
  {
29
- $resultRs = $read->fetchAll("SELECT * FROM oepl_sugar WHERE module='".$val."'");
30
  //echo "<pre>"; print_r($resultRs); echo "</pre>";
31
 
32
  $temp = $val;
3
  {
4
  protected function _prepareForm()
5
  {
6
+ $prefix = Mage::getConfig()->getTablePrefix();
7
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
8
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
9
 
27
  ));
28
  foreach($modules as $key=>$val)
29
  {
30
+ $resultRs = $read->fetchAll("SELECT * FROM ".$prefix."oepl_sugar WHERE module='".$val."'");
31
  //echo "<pre>"; print_r($resultRs); echo "</pre>";
32
 
33
  $temp = $val;
app/code/local/Offshoreevolution/Contact/Helper/Data.php CHANGED
@@ -22,9 +22,10 @@ class Offshoreevolution_Contact_Helper_Data extends Mage_Core_Helper_Abstract
22
 
23
  public function getSugarObject()
24
  {
 
25
  $ObjectSugar = new Offshoreevolution_ClassOEPL();
26
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
27
- $resultRs = $read->fetchAll("SELECT * FROM oepl_sugar WHERE module='login'");
28
  $ObjectSugar->SugarURL = $resultRs[0]['meta_value'];
29
  $ObjectSugar->SugarUser = $resultRs[1]['meta_value'];
30
  $ObjectSugar->SugarPass = $resultRs[2]['meta_value'];
22
 
23
  public function getSugarObject()
24
  {
25
+ $prefix = Mage::getConfig()->getTablePrefix();
26
  $ObjectSugar = new Offshoreevolution_ClassOEPL();
27
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
28
+ $resultRs = $read->fetchAll("SELECT * FROM ".$prefix."oepl_sugar WHERE module='login'");
29
  $ObjectSugar->SugarURL = $resultRs[0]['meta_value'];
30
  $ObjectSugar->SugarUser = $resultRs[1]['meta_value'];
31
  $ObjectSugar->SugarPass = $resultRs[2]['meta_value'];
app/code/local/Offshoreevolution/Contact/Model/Observer.php CHANGED
@@ -17,6 +17,7 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
17
  $Customer = Mage::getSingleton('customer/session')->getCustomer();
18
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
19
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
 
20
  if(is_object($Customer)){
21
  $Customer = $Customer->getData();
22
  $customerId = $Customer['entity_id'];
@@ -26,8 +27,8 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
26
  $type = 'Shipping';
27
  }
28
 
29
- $fieldsToExport = $read->fetchAll("SELECT * FROM oepl_map_fields WHERE module = 'Contacts' AND mag_field_type = '".$type."' AND `mag_field` != ''");
30
- $permission = $read->fetchAll("SELECT * FROM oepl_sugar WHERE module = 'Contacts'");
31
 
32
  $Flag = true;
33
  $name_value_list = array();
@@ -35,7 +36,7 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
35
  {
36
  $name_value_list[$temp['field_name']] = $address[$temp['mag_field']] ;
37
  }
38
- $query2 = "SELECT sugar_id FROM oepl_sugar_map
39
  WHERE mag_id = '".$customerId."' AND module='Contact'";
40
  $sugarID = $read->fetchAll($query2);
41
  if(!empty($sugarID) && $sugarID != '')
@@ -79,12 +80,12 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
79
  } else {
80
  $defaultShipping = array();
81
  }
82
-
83
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
84
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
85
 
86
- $fieldsToExport = $read->fetchAll("SELECT * FROM oepl_map_fields WHERE module = 'Contacts' AND `mag_field` != ''");
87
- $permission = $read->fetchAll("SELECT * FROM oepl_sugar WHERE module = 'Contacts'");
88
 
89
  $Flag = true;
90
  $name_value_list = array();
@@ -98,7 +99,7 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
98
  $name_value_list[$temp['field_name']] = $customerData[$temp['mag_field']] ;
99
  }
100
  }
101
- $query2 = "SELECT sugar_id FROM oepl_sugar_map
102
  WHERE mag_id = '".$customerData['entity_id']."' AND module='Contact'";
103
  $sugarID = $read->fetchAll($query2);
104
  if(!empty($sugarID) && $sugarID != '')
@@ -127,7 +128,7 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
127
  }
128
  if(empty($sugarID)){
129
  if($Flag){
130
- $query = "INSERT INTO oepl_sugar_map
131
  SET mag_id='".$customerData['entity_id']."',sugar_id='".$SugarResult->id."',module='Contact'";
132
  $write->query($query);
133
  }
@@ -136,12 +137,13 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
136
  }
137
 
138
  public function guest_user_sync($observer){
 
139
  if(!Mage::helper('customer')->isLoggedIn()){
140
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
141
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
142
 
143
- $fieldsToExport = $read->fetchAll("SELECT * FROM oepl_map_fields WHERE module = 'Contacts' AND `mag_field` != ''");
144
- $permission = $read->fetchAll("SELECT * FROM oepl_sugar WHERE module = 'Contacts' AND meta_key = 'guest_order_sync'");
145
  $permission = $permission[0];
146
  if($permission['meta_value'] == 'Y')
147
  {
@@ -171,16 +173,16 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
171
 
172
  public function userDelete($observer)
173
  {
174
-
175
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
176
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
177
  $data = $observer->getEvent()->getData();
178
  $id = $data['object']->_data['entity_id'];
179
  if($id && $id != ''){
180
- $permission = $read->fetchAll("SELECT * FROM oepl_sugar WHERE module = 'Contacts' AND meta_key= 'Delete'");
181
  if($permission[0]['meta_value'] == 'Y')
182
  {
183
- $query = "SELECT sugar_id FROM oepl_sugar_map
184
  WHERE mag_id = '".$id."'";
185
 
186
  $sugarIdRs = $read->fetchAll($query);
@@ -202,7 +204,7 @@ class Offshoreevolution_Contact_Model_Observer extends Varien_Event_Observer
202
  if($sugarID && $sugarID != '')
203
  {
204
  $where = "mag_id = ".$id." AND sugar_id = '".$sugarID."'";
205
- $write->delete('oepl_sugar_map', $where);
206
  }
207
  }
208
  }
17
  $Customer = Mage::getSingleton('customer/session')->getCustomer();
18
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
19
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
20
+ $prefix = Mage::getConfig()->getTablePrefix();
21
  if(is_object($Customer)){
22
  $Customer = $Customer->getData();
23
  $customerId = $Customer['entity_id'];
27
  $type = 'Shipping';
28
  }
29
 
30
+ $fieldsToExport = $read->fetchAll("SELECT * FROM ".$prefix."oepl_map_fields WHERE module = 'Contacts' AND mag_field_type = '".$type."' AND `mag_field` != ''");
31
+ $permission = $read->fetchAll("SELECT * FROM ".$prefix."oepl_sugar WHERE module = 'Contacts'");
32
 
33
  $Flag = true;
34
  $name_value_list = array();
36
  {
37
  $name_value_list[$temp['field_name']] = $address[$temp['mag_field']] ;
38
  }
39
+ $query2 = "SELECT sugar_id FROM ".$prefix."oepl_sugar_map
40
  WHERE mag_id = '".$customerId."' AND module='Contact'";
41
  $sugarID = $read->fetchAll($query2);
42
  if(!empty($sugarID) && $sugarID != '')
80
  } else {
81
  $defaultShipping = array();
82
  }
83
+ $prefix = Mage::getConfig()->getTablePrefix();
84
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
85
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
86
 
87
+ $fieldsToExport = $read->fetchAll("SELECT * FROM ".$prefix."oepl_map_fields WHERE module = 'Contacts' AND `mag_field` != ''");
88
+ $permission = $read->fetchAll("SELECT * FROM ".$prefix."oepl_sugar WHERE module = 'Contacts'");
89
 
90
  $Flag = true;
91
  $name_value_list = array();
99
  $name_value_list[$temp['field_name']] = $customerData[$temp['mag_field']] ;
100
  }
101
  }
102
+ $query2 = "SELECT sugar_id FROM ".$prefix."oepl_sugar_map
103
  WHERE mag_id = '".$customerData['entity_id']."' AND module='Contact'";
104
  $sugarID = $read->fetchAll($query2);
105
  if(!empty($sugarID) && $sugarID != '')
128
  }
129
  if(empty($sugarID)){
130
  if($Flag){
131
+ $query = "INSERT INTO ".$prefix."oepl_sugar_map
132
  SET mag_id='".$customerData['entity_id']."',sugar_id='".$SugarResult->id."',module='Contact'";
133
  $write->query($query);
134
  }
137
  }
138
 
139
  public function guest_user_sync($observer){
140
+ $prefix = Mage::getConfig()->getTablePrefix();
141
  if(!Mage::helper('customer')->isLoggedIn()){
142
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
143
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
144
 
145
+ $fieldsToExport = $read->fetchAll("SELECT * FROM '".$prefix."'oepl_map_fields WHERE module = 'Contacts' AND `mag_field` != ''");
146
+ $permission = $read->fetchAll("SELECT * FROM '".$prefix."'oepl_sugar WHERE module = 'Contacts' AND meta_key = 'guest_order_sync'");
147
  $permission = $permission[0];
148
  if($permission['meta_value'] == 'Y')
149
  {
173
 
174
  public function userDelete($observer)
175
  {
176
+ $prefix = Mage::getConfig()->getTablePrefix();
177
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
178
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
179
  $data = $observer->getEvent()->getData();
180
  $id = $data['object']->_data['entity_id'];
181
  if($id && $id != ''){
182
+ $permission = $read->fetchAll("SELECT * FROM '".$prefix."'oepl_sugar WHERE module = 'Contacts' AND meta_key= 'Delete'");
183
  if($permission[0]['meta_value'] == 'Y')
184
  {
185
+ $query = "SELECT sugar_id FROM '".$prefix."'oepl_sugar_map
186
  WHERE mag_id = '".$id."'";
187
 
188
  $sugarIdRs = $read->fetchAll($query);
204
  if($sugarID && $sugarID != '')
205
  {
206
  $where = "mag_id = ".$id." AND sugar_id = '".$sugarID."'";
207
+ $write->delete($prefix.'oepl_sugar_map', $where);
208
  }
209
  }
210
  }
app/code/local/Offshoreevolution/Contact/controllers/Adminhtml/AjaxController.php CHANGED
@@ -71,7 +71,7 @@ class Offshoreevolution_Contact_Adminhtml_AjaxController extends Mage_Adminhtml_
71
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
72
  $prefix = Mage::getConfig()->getTablePrefix();
73
 
74
- $write->query('UPDATE oepl_map_fields SET mag_field = "'.$field[1].'", mag_field_type = "'.$field[0].'" WHERE pid ='.trim($data['id']).'');
75
  echo "true";
76
  }
77
  }
71
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
72
  $prefix = Mage::getConfig()->getTablePrefix();
73
 
74
+ $write->query('UPDATE '.$prefix.'oepl_map_fields SET mag_field = "'.$field[1].'", mag_field_type = "'.$field[0].'" WHERE pid ='.trim($data['id']).'');
75
  echo "true";
76
  }
77
  }
app/code/local/Offshoreevolution/Contact/controllers/Adminhtml/SugarsettingController.php CHANGED
@@ -30,9 +30,8 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
30
  }
31
 
32
  public function saveAction(){
33
- echo "<pre>";
34
  $data = $this->getRequest()->getPost();
35
-
36
  $objSugar = new Offshoreevolution_ClassOEPL();
37
  $objSugar->SugarURL = $data['url'];
38
  $objSugar->SugarUser = $data['username'];
@@ -43,7 +42,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
43
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
44
  $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
45
  $skiparray = array('form_key','password');
46
- $connection->query('DELETE FROM oepl_sugar WHERE module = "login"');
47
  foreach($data as $key=>$value)
48
  {
49
  $flag = false;
@@ -63,7 +62,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
63
  }
64
  if($flag == true)
65
  {
66
- $insert = $connection->insert('oepl_sugar', $__fields);
67
  }
68
  }
69
  Mage::getSingleton('core/session')->addSuccess('Configuration saved successfully.');
@@ -83,6 +82,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
83
  }
84
 
85
  public function AccesssaveAction(){
 
86
  $data = $this->getRequest()->getPost();
87
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
88
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
@@ -91,7 +91,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
91
  $modules = $test->ModuleList;
92
  $operations = array('Insert','Update','Delete');
93
  foreach($modules as $module){
94
- $write->query('DELETE FROM oepl_sugar WHERE module = "'.$module.'"');
95
  foreach ($operations as $op){
96
  $fields['module'] = $module;
97
  $fields['meta_key'] = $op;
@@ -102,7 +102,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
102
  $fields['module'] = 'Contacts';
103
  $fields['meta_key'] = 'guest_order_sync';
104
  $fields['meta_value'] = $data['guest_order_sync'];
105
- $write->insert('oepl_sugar', $fields);
106
  Mage::getSingleton('core/session')->addSuccess('Operations saved successfully');
107
  $this->_redirect('*/*/Useroperations');
108
  }
30
  }
31
 
32
  public function saveAction(){
 
33
  $data = $this->getRequest()->getPost();
34
+ $prefix = Mage::getConfig()->getTablePrefix();
35
  $objSugar = new Offshoreevolution_ClassOEPL();
36
  $objSugar->SugarURL = $data['url'];
37
  $objSugar->SugarUser = $data['username'];
42
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
43
  $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
44
  $skiparray = array('form_key','password');
45
+ $connection->query('DELETE FROM '.$prefix.'oepl_sugar WHERE module = "login"');
46
  foreach($data as $key=>$value)
47
  {
48
  $flag = false;
62
  }
63
  if($flag == true)
64
  {
65
+ $insert = $connection->insert($prefix.'oepl_sugar', $__fields);
66
  }
67
  }
68
  Mage::getSingleton('core/session')->addSuccess('Configuration saved successfully.');
82
  }
83
 
84
  public function AccesssaveAction(){
85
+ $prefix = Mage::getConfig()->getTablePrefix();
86
  $data = $this->getRequest()->getPost();
87
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
88
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
91
  $modules = $test->ModuleList;
92
  $operations = array('Insert','Update','Delete');
93
  foreach($modules as $module){
94
+ $write->query('DELETE FROM '.$prefix.'oepl_sugar WHERE module = "'.$module.'"');
95
  foreach ($operations as $op){
96
  $fields['module'] = $module;
97
  $fields['meta_key'] = $op;
102
  $fields['module'] = 'Contacts';
103
  $fields['meta_key'] = 'guest_order_sync';
104
  $fields['meta_value'] = $data['guest_order_sync'];
105
+ $write->insert($prefix.'oepl_sugar', $fields);
106
  Mage::getSingleton('core/session')->addSuccess('Operations saved successfully');
107
  $this->_redirect('*/*/Useroperations');
108
  }
app/code/local/Offshoreevolution/Contact/controllers/controllers/Adminhtml/AjaxController.php CHANGED
@@ -71,7 +71,7 @@ class Offshoreevolution_Contact_Adminhtml_AjaxController extends Mage_Adminhtml_
71
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
72
  $prefix = Mage::getConfig()->getTablePrefix();
73
 
74
- $write->query('UPDATE oepl_map_fields SET mag_field = "'.$field[1].'", mag_field_type = "'.$field[0].'" WHERE pid ='.trim($data['id']).'');
75
  echo "true";
76
  }
77
  }
71
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
72
  $prefix = Mage::getConfig()->getTablePrefix();
73
 
74
+ $write->query('UPDATE '.$prefix.'oepl_map_fields SET mag_field = "'.$field[1].'", mag_field_type = "'.$field[0].'" WHERE pid ='.trim($data['id']).'');
75
  echo "true";
76
  }
77
  }
app/code/local/Offshoreevolution/Contact/controllers/controllers/Adminhtml/SugarsettingController.php CHANGED
@@ -11,6 +11,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
11
 
12
  public function testAction()
13
  {
 
14
  if($this->getRequest()->getPost())
15
  {
16
  $data = $this->getRequest()->getPost();
@@ -25,12 +26,12 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
25
  echo "true";
26
  } else {
27
  echo "false";
28
- }
29
  }
30
  }
31
 
32
  public function saveAction(){
33
- echo "<pre>";
34
  $data = $this->getRequest()->getPost();
35
 
36
  $objSugar = new Offshoreevolution_ClassOEPL();
@@ -43,7 +44,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
43
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
44
  $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
45
  $skiparray = array('form_key','password');
46
- $connection->query('DELETE FROM oepl_sugar WHERE module = "login"');
47
  foreach($data as $key=>$value)
48
  {
49
  $flag = false;
@@ -83,6 +84,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
83
  }
84
 
85
  public function AccesssaveAction(){
 
86
  $data = $this->getRequest()->getPost();
87
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
88
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
@@ -91,7 +93,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
91
  $modules = $test->ModuleList;
92
  $operations = array('Insert','Update','Delete');
93
  foreach($modules as $module){
94
- $write->query('DELETE FROM oepl_sugar WHERE module = "'.$module.'"');
95
  foreach ($operations as $op){
96
  $fields['module'] = $module;
97
  $fields['meta_key'] = $op;
@@ -102,7 +104,7 @@ class Offshoreevolution_Contact_Adminhtml_SugarsettingController extends Mage_Ad
102
  $fields['module'] = 'Contacts';
103
  $fields['meta_key'] = 'guest_order_sync';
104
  $fields['meta_value'] = $data['guest_order_sync'];
105
- $write->insert('oepl_sugar', $fields);
106
  Mage::getSingleton('core/session')->addSuccess('Operations saved successfully');
107
  $this->_redirect('*/*/Useroperations');
108
  }
11
 
12
  public function testAction()
13
  {
14
+ $prefix = Mage::getConfig()->getTablePrefix();
15
  if($this->getRequest()->getPost())
16
  {
17
  $data = $this->getRequest()->getPost();
26
  echo "true";
27
  } else {
28
  echo "false";
29
+ }
30
  }
31
  }
32
 
33
  public function saveAction(){
34
+ $prefix = Mage::getConfig()->getTablePrefix();
35
  $data = $this->getRequest()->getPost();
36
 
37
  $objSugar = new Offshoreevolution_ClassOEPL();
44
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
45
  $connection = Mage::getSingleton('core/resource')->getConnection('core_write');
46
  $skiparray = array('form_key','password');
47
+ $connection->query('DELETE FROM '.$prefix.'oepl_sugar WHERE module = "login"');
48
  foreach($data as $key=>$value)
49
  {
50
  $flag = false;
84
  }
85
 
86
  public function AccesssaveAction(){
87
+ $prefix = Mage::getConfig()->getTablePrefix();
88
  $data = $this->getRequest()->getPost();
89
  $read = Mage::getSingleton('core/resource')->getConnection('core_read');
90
  $write = Mage::getSingleton('core/resource')->getConnection('core_write');
93
  $modules = $test->ModuleList;
94
  $operations = array('Insert','Update','Delete');
95
  foreach($modules as $module){
96
+ $write->query('DELETE FROM '.$prefix.'oepl_sugar WHERE module = "'.$module.'"');
97
  foreach ($operations as $op){
98
  $fields['module'] = $module;
99
  $fields['meta_key'] = $op;
104
  $fields['module'] = 'Contacts';
105
  $fields['meta_key'] = 'guest_order_sync';
106
  $fields['meta_value'] = $data['guest_order_sync'];
107
+ $write->insert($prefix.'oepl_sugar', $fields);
108
  Mage::getSingleton('core/session')->addSuccess('Operations saved successfully');
109
  $this->_redirect('*/*/Useroperations');
110
  }
app/code/local/Offshoreevolution/Contact/sql/sugarcrm_contact_setup/mysql4-install-1.2.0.php CHANGED
@@ -2,39 +2,44 @@
2
  $installer = $this;
3
  $installer->startSetup();
4
 
5
- $prefix = Mage::getConfig()->getTablePrefix();
 
 
 
 
 
 
 
 
 
6
 
7
- $installer->run('CREATE TABLE IF NOT EXISTS `oepl_sugar` (
8
- `id` int(11) NOT NULL AUTO_INCREMENT,
9
- `module` varchar(20) NOT NULL,
10
- `meta_key` varchar(500) NOT NULL,
11
- `meta_value` varchar(500) NOT NULL,
12
- PRIMARY KEY (`id`)
13
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;');
14
-
15
- $installer->run('CREATE TABLE IF NOT EXISTS `oepl_sugar_map` (
16
- `id` int(11) NOT NULL AUTO_INCREMENT,
17
- `module` varchar(100) NOT NULL,
18
- `mag_id` varchar(100) NOT NULL,
19
- `sugar_id` varchar(100) NOT NULL,
20
- PRIMARY KEY (`id`)
21
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;');
22
 
23
- $installer->run("CREATE TABLE IF NOT EXISTS `oepl_map_fields` (
24
- `pid` int(11) NOT NULL AUTO_INCREMENT,
25
- `module` varchar(150) NOT NULL,
26
- `field_type` enum('text','select','radio','checkbox','textarea','filler') NOT NULL DEFAULT 'text',
27
- `data_type` varchar(50) NOT NULL,
28
- `field_name` varchar(255) NOT NULL,
29
- `field_value` text NOT NULL,
30
- `mag_field` varchar(100) NOT NULL,
31
- `mag_field_type` varchar(100) NOT NULL DEFAULT 'Default',
32
- `wp_meta_label` varchar(200) NOT NULL,
33
- `display_order` int(11) NOT NULL,
34
- `is_show` enum('Y','N') NOT NULL DEFAULT 'N',
35
- `show_column` enum('1','2') NOT NULL DEFAULT '1',
36
- PRIMARY KEY (`pid`)
37
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=72 ;");
 
 
38
 
39
  $installer->endSetup();
40
  ?>
2
  $installer = $this;
3
  $installer->startSetup();
4
 
5
+ //$prefix = Mage::getConfig()->getTablePrefix();
6
+ $installer->run("-- DROP TABLE IF EXISTS {$this->getTable('oepl_sugar')};
7
+ CREATE TABLE {$this->getTable('oepl_sugar')} (
8
+ `id` int(11) NOT NULL AUTO_INCREMENT,
9
+ `module` varchar(20) NOT NULL,
10
+ `meta_key` varchar(500) NOT NULL,
11
+ `meta_value` varchar(500) NOT NULL,
12
+ PRIMARY KEY (`id`)
13
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
14
+ ");
15
 
16
+ $installer->run("-- DROP TABLE IF EXISTS {$this->getTable('oepl_sugar_map')};
17
+ CREATE TABLE {$this->getTable('oepl_sugar_map')} (
18
+ `id` int(11) NOT NULL AUTO_INCREMENT,
19
+ `module` varchar(100) NOT NULL,
20
+ `mag_id` varchar(100) NOT NULL,
21
+ `sugar_id` varchar(100) NOT NULL,
22
+ PRIMARY KEY (`id`)
23
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
24
+ ");
 
 
 
 
 
 
25
 
26
+ $installer->run("-- DROP TABLE IF EXISTS {$this->getTable('oepl_map_fields')};
27
+ CREATE TABLE {$this->getTable('oepl_map_fields')} (
28
+ `pid` int(11) NOT NULL AUTO_INCREMENT,
29
+ `module` varchar(150) NOT NULL,
30
+ `field_type` enum('text','select','radio','checkbox','textarea','filler') NOT NULL DEFAULT 'text',
31
+ `data_type` varchar(50) NOT NULL,
32
+ `field_name` varchar(255) NOT NULL,
33
+ `field_value` text NOT NULL,
34
+ `mag_field` varchar(100) NOT NULL,
35
+ `mag_field_type` varchar(100) NOT NULL DEFAULT 'Default',
36
+ `wp_meta_label` varchar(200) NOT NULL,
37
+ `display_order` int(11) NOT NULL,
38
+ `is_show` enum('Y','N') NOT NULL DEFAULT 'N',
39
+ `show_column` enum('1','2') NOT NULL DEFAULT '1',
40
+ PRIMARY KEY (`pid`)
41
+ ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=72 ;
42
+ ");
43
 
44
  $installer->endSetup();
45
  ?>
package.xml CHANGED
@@ -1,21 +1,20 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magento_SugarCRM_Contact_Module</name>
4
- <version>1.3.0</version>
5
  <stability>stable</stability>
6
- <license>OSL v3.0</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension is simple, easy to integrate solution to keep your SugarCRM Contacts up-to-date with registered users or guest users on your Magento site.</summary>
10
- <description> &#x2018;Magento SugarCRM Contact Module&#x2019; is a installable plug-in module developed by us. This module is a bridge between your Magento site and your SugarCRM. It will sync all your magento Registered users with your SugarCRM Contact module. Whenever a new user regester it will push a new contact in your Contact module in magento. If user edit his information it will be also updated in your SugarCRM with assigned contact. And if Magento admin user delete a user from magento. It will be also deleted from your SugarCRM contact list.&#xD;
11
  &#xD;
12
- Let&#x2019;s say you don&#x2019;t want to sync new users . You can easily do that. You can disable any of three Insert, Update or Delete functions anytime you want.</description>
13
- <notes>Stable release :&#xD;
14
- - Bug fixes.</notes>
15
  <authors><author><name>Dipesh Patel</name><user>dspatel</user><email>dipesh.99869@gmail.com</email></author></authors>
16
- <date>2015-03-13</date>
17
- <time>04:52:49</time>
18
- <contents><target name="magelocal"><dir name="Offshoreevolution"><dir name="Contact"><dir name="Block"><dir name="Adminhtml"><file name="Ajaxblock.php" hash="9384f4bd8c3abbd95905a059065085fe"/><dir name="Sugarsettings"><dir name="Edit"><file name="Form.php" hash="05ea733994d2bb85802007d9414a62df"/></dir><file name="Edit.php" hash="4e6dc1724cafe0b579404b5abedcc039"/></dir><dir name="Synctable"><dir name="Grid"><dir name="Edit"><file name="Form.php" hash="6409a4d7b853783112a6c7ed4d4d0729"/></dir><file name="Edit.php" hash="ca0df27b1f3a051cb4c2b0df51e524af"/><file name="Grid.php" hash="65f08abf23bd7a5b1857af64e0aebf91"/><dir name="Renderer"><file name="Button.php" hash="f0f8a4483561b29e70ab6cf2111c4b15"/><file name="Filter.php" hash="d25cc9a43ad33e4de3d8d19c013676f8"/></dir></dir><file name="Grid.php" hash="8723a23d9f509c9e865507ce3f958475"/></dir><dir name="Useroperations"><dir name="Edit"><file name="Form.php" hash="9e51c262e7484f71c2b8adb63f98db4d"/></dir><file name="Edit.php" hash="28c065d48a2b84602d0c34463117d870"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="82eb52811cca909bce37084c73f7f8c8"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Settings"><file name="Collection.php" hash="88c464e60b702c8caa8f25c966fd81a9"/></dir><file name="Settings.php" hash="fd90a2a4f21b47f4e5fc82af73a5143a"/></dir><file name="Observer.php" hash="08f90c7b8af9ee0a15330ccfe8ef74db"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="f795d8fedb7666d08716be82c19747ba"/></dir></dir><file name="Settings.php" hash="2ea34fa0569be9f0659ab04b8c5a3f63"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AjaxController.php" hash="d90c6bd78b2ca345a56ec7b3320f6768"/><file name="FieldmappingController.php" hash="bb09cbcb72329f4bd717fa335440aa8d"/><file name="SugarsettingController.php" hash="beed5238560587758c1ce29d92c95cb0"/></dir><file name="IndexController.php" hash="973e207bb5306de938a6462b0ac1af12"/><dir name="controllers"><dir name="Adminhtml"><file name="AjaxController.php" hash="d90c6bd78b2ca345a56ec7b3320f6768"/><file name="FieldmappingController.php" hash="bb09cbcb72329f4bd717fa335440aa8d"/><file name="SugarsettingController.php" hash="beed5238560587758c1ce29d92c95cb0"/></dir><file name="IndexController.php" hash="973e207bb5306de938a6462b0ac1af12"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6ccaa7969db2babfc83a3aca10ad7415"/><file name="config.xml" hash="ec8e297654d32e1ea8eaf144432b8fbb"/></dir><dir name="sql"><dir name="sugarcrm_contact_setup"><file name="mysql4-install-1.2.0.php" hash="93db1c637b8efe304a480d813eb9a331"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Offshoreevolution_All.xml" hash="82b06192b0383182c6c98e894f6aeddb"/></dir></target><target name="mageweb"><dir name="js"><dir name="offshoreevolution"><file name="jquery-1.10.2.js" hash="6d413d528896d9f756bfacae566e5a88"/></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="offshoreevolution_contact.xml" hash="f29604446920330d6da779fab5171acb"/></dir><dir name="template"><dir name="offshoreevolution"><file name="sugarsetting.phtml" hash="800aa0a51c13c5b030cb6274e76c26ce"/><file name="synctable.phtml" hash="69e9888655912fce899ded90e4da401a"/><file name="useroperations.phtml" hash="8e22af57a4042aa67d13e7603b0ccbb9"/></dir></dir></dir></dir></dir></target><target name="magelib"><dir name="Offshoreevolution"><file name="ClassOEPL.php" hash="35b5446eec5bf92e0ffa5c77c432adbe"/></dir></target></contents>
19
  <compatible/>
20
- <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
21
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magento_SugarCRM_Contact_Module</name>
4
+ <version>1.4.1</version>
5
  <stability>stable</stability>
6
+ <license>OSL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>This extension is simple, easy to integrate solution to keep your SugarCRM Contacts up-to-date with registered users or guest users on your Magento site.</summary>
10
+ <description>Magento SugarCRM Contact Module is a installable plug-in module developed by us. This module is a bridge between your Magento site and your SugarCRM. It will sync all your magento Registered users with your SugarCRM Contact module. Whenever a new user regester it will push a new contact in your Contact module in magento. If user edit his information it will be also updated in your SugarCRM with assigned contact. And if Magento admin user delete a user from magento. It will be also deleted from your SugarCRM contact list.&#xD;
11
  &#xD;
12
+ Let's say you don't want to sync new users . You can easily do that. You can disable any of three Insert, Update or Delete functions anytime you want.</description>
13
+ <notes>Stable release : Bug fixes</notes>
 
14
  <authors><author><name>Dipesh Patel</name><user>dspatel</user><email>dipesh.99869@gmail.com</email></author></authors>
15
+ <date>2016-03-15</date>
16
+ <time>06:27:16</time>
17
+ <contents><target name="magelocal"><dir name="Offshoreevolution"><dir name="Contact"><dir name="Block"><dir name="Adminhtml"><file name="Ajaxblock.php" hash="9384f4bd8c3abbd95905a059065085fe"/><dir name="Sugarsettings"><dir name="Edit"><file name="Form.php" hash="3937e9fb1e81a881c14f32ee475fffc1"/></dir><file name="Edit.php" hash="4e6dc1724cafe0b579404b5abedcc039"/></dir><dir name="Synctable"><dir name="Grid"><dir name="Edit"><file name="Form.php" hash="6409a4d7b853783112a6c7ed4d4d0729"/></dir><file name="Edit.php" hash="ca0df27b1f3a051cb4c2b0df51e524af"/><file name="Grid.php" hash="65f08abf23bd7a5b1857af64e0aebf91"/><dir name="Renderer"><file name="Button.php" hash="f0f8a4483561b29e70ab6cf2111c4b15"/><file name="Filter.php" hash="d25cc9a43ad33e4de3d8d19c013676f8"/></dir></dir><file name="Grid.php" hash="8723a23d9f509c9e865507ce3f958475"/></dir><dir name="Useroperations"><dir name="Edit"><file name="Form.php" hash="f7f8bfc8d0af0b5a517407e5d150f44b"/></dir><file name="Edit.php" hash="28c065d48a2b84602d0c34463117d870"/></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fbac7650be2e24028c861524056faea9"/></dir><dir name="Model"><dir name="Mysql4"><dir name="Settings"><file name="Collection.php" hash="88c464e60b702c8caa8f25c966fd81a9"/></dir><file name="Settings.php" hash="fd90a2a4f21b47f4e5fc82af73a5143a"/></dir><file name="Observer.php" hash="4555a6fdffac965b4ade01ae3c42d291"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="f795d8fedb7666d08716be82c19747ba"/></dir></dir><file name="Settings.php" hash="2ea34fa0569be9f0659ab04b8c5a3f63"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="AjaxController.php" hash="071f1e7c8f89b192b4c1cd96e023beb5"/><file name="FieldmappingController.php" hash="bb09cbcb72329f4bd717fa335440aa8d"/><file name="SugarsettingController.php" hash="0a7b4ac806cd1ede274c55f7b1f2e91d"/></dir><file name="IndexController.php" hash="973e207bb5306de938a6462b0ac1af12"/><dir name="controllers"><dir name="Adminhtml"><file name="AjaxController.php" hash="071f1e7c8f89b192b4c1cd96e023beb5"/><file name="FieldmappingController.php" hash="bb09cbcb72329f4bd717fa335440aa8d"/><file name="SugarsettingController.php" hash="c4d96c9d75dbab3db10a5336c96e6f8a"/></dir><file name="IndexController.php" hash="973e207bb5306de938a6462b0ac1af12"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="6ccaa7969db2babfc83a3aca10ad7415"/><file name="config.xml" hash="ec8e297654d32e1ea8eaf144432b8fbb"/></dir><dir name="sql"><dir name="sugarcrm_contact_setup"><file name="mysql4-install-1.2.0.php" hash="61aa417045c5f758e78a72da6182cbce"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Offshoreevolution_All.xml" hash="82b06192b0383182c6c98e894f6aeddb"/></dir></target><target name="magelib"><dir name="Offshoreevolution"><file name="ClassOEPL.php" hash="35b5446eec5bf92e0ffa5c77c432adbe"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="offshoreevolution_contact.xml" hash="f29604446920330d6da779fab5171acb"/></dir><dir name="template"><dir name="offshoreevolution"><file name="sugarsetting.phtml" hash="800aa0a51c13c5b030cb6274e76c26ce"/><file name="synctable.phtml" hash="69e9888655912fce899ded90e4da401a"/><file name="useroperations.phtml" hash="8e22af57a4042aa67d13e7603b0ccbb9"/></dir></dir></dir></dir></dir></target><target name="mage"><dir name="js"><dir name="offshoreevolution"><file name="jquery-1.10.2.js" hash="6d413d528896d9f756bfacae566e5a88"/></dir></dir></target></contents>
18
  <compatible/>
19
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
20
  </package>