Skip to content

Commit

Permalink
Merge branch 'gwinn-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gwinn committed Feb 9, 2016
2 parents b38b23e + fd56d8a commit 778ced2
Show file tree
Hide file tree
Showing 5 changed files with 451 additions and 298 deletions.
47 changes: 40 additions & 7 deletions admin/controller/module/retailcrm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,42 @@

require_once DIR_SYSTEM . 'library/retailcrm/bootstrap.php';

/**
* Class ControllerModule
*/
class ControllerModuleRetailcrm extends Controller
{
private $error = array();
private $_error = array();
protected $log, $statuses, $payments, $deliveryTypes, $retailcrm;
public $children, $template;

/**
* Install method
*
* @return void
*/
public function install()
{
$this->load->model('setting/setting');
$this->model_setting_setting->editSetting('retailcrm', array('retailcrm_status' => 1));
$this->model_setting_setting
->editSetting('retailcrm', array('retailcrm_status' => 1));
}

/**
* Uninstall method
*
* @return void
*/
public function uninstall()
{
$this->load->model('setting/setting');
$this->model_setting_setting->editSetting('retailcrm', array('retailcrm_status' => 0));
$this->model_setting_setting
->editSetting('retailcrm', array('retailcrm_status' => 0));
}

/**
* Setup page
*/
public function index()
{

Expand Down Expand Up @@ -59,8 +77,12 @@ public function index()
$this->data['retailcrm_errors'] = array();
$this->data['saved_settings'] = $this->model_setting_setting->getSetting('retailcrm');

$url = $this->data['saved_settings']['retailcrm_url'];
$key = $this->data['saved_settings']['retailcrm_apikey'];
$url = isset($this->data['saved_settings']['retailcrm_url'])
? $this->data['saved_settings']['retailcrm_url']
: null;
$key = isset($this->data['saved_settings']['retailcrm_apikey'])
? $this->data['saved_settings']['retailcrm_apikey']
: null;

if (!empty($url) && !empty($key)) {

Expand Down Expand Up @@ -151,6 +173,9 @@ public function index()
$this->response->setOutput($this->render());
}

/**
* History method
*/
public function history()
{
if (file_exists(DIR_APPLICATION . 'model/retailcrm/custom/history.php')) {
Expand All @@ -162,6 +187,9 @@ public function history()
}
}

/**
* ICML generation
*/
public function icml()
{
if (file_exists(DIR_APPLICATION . 'model/retailcrm/custom/icml.php')) {
Expand All @@ -173,13 +201,18 @@ public function icml()
}
}

/**
* Validate
*
* @return bool
*/
private function validate()
{
if (!$this->user->hasPermission('modify', 'module/retailcrm')) {
$this->error['warning'] = $this->language->get('error_permission');
$this->_error['warning'] = $this->language->get('error_permission');
}

if (!$this->error) {
if (!$this->_error) {
return TRUE;
} else {
return FALSE;
Expand Down
Loading

0 comments on commit 778ced2

Please sign in to comment.