+copy export files via installation; v0.3b
This commit is contained in:
parent
4166e448f5
commit
0634cc3afe
48
intaro.crm/classes/general/ICrmOrderActions.php
Normal file → Executable file
48
intaro.crm/classes/general/ICrmOrderActions.php
Normal file → Executable file
@ -1,5 +1,4 @@
|
|||||||
<?php
|
<?php
|
||||||
//namespace IntaroCrm;
|
|
||||||
|
|
||||||
class ICrmOrderActions
|
class ICrmOrderActions
|
||||||
{
|
{
|
||||||
@ -245,12 +244,44 @@ class ICrmOrderActions
|
|||||||
return true; //all ok!
|
return true; //all ok!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function orderHistory() {
|
||||||
|
|
||||||
|
if (!CModule::IncludeModule('iblock')) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('iblock', 'module not found');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CModule::IncludeModule("sale")) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('sale', 'module not found');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CModule::IncludeModule("catalog")) {
|
||||||
|
//handle err
|
||||||
|
self::eventLog('catalog', 'module not found');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$api_host = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_HOST_OPTION, 0);
|
||||||
|
$api_key = COption::GetOptionString(self::$MODULE_ID, self::$CRM_API_KEY_OPTION, 0);
|
||||||
|
|
||||||
|
//saved cat params
|
||||||
|
$optionsOrderTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_ORDER_TYPES_ARR, 0));
|
||||||
|
$optionsDelivTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_DELIVERY_TYPES_ARR, 0));
|
||||||
|
$optionsPayTypes = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_TYPES, 0));
|
||||||
|
$optionsPayStatuses = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT_STATUSES, 0)); // --statuses
|
||||||
|
$optionsPayment = unserialize(COption::GetOptionString(self::$MODULE_ID, self::$CRM_PAYMENT, 0));
|
||||||
|
|
||||||
|
$api = new IntaroCrm\RestApi($api_host, $api_key);
|
||||||
|
|
||||||
|
var_dump($api->orderHistory());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* w event in bitrix log
|
* w+ event in bitrix log
|
||||||
* @param type $auditType
|
|
||||||
* @param type $itemId
|
|
||||||
* @param type $description
|
|
||||||
*/
|
*/
|
||||||
private static function eventLog($itemId, $description) {
|
private static function eventLog($itemId, $description) {
|
||||||
CEventLog::Add(array(
|
CEventLog::Add(array(
|
||||||
@ -264,6 +295,12 @@ class ICrmOrderActions
|
|||||||
self::sendEmail($itemId, $description);
|
self::sendEmail($itemId, $description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* send email to admin
|
||||||
|
*/
|
||||||
private static function sendEmail($itemId, $description) {
|
private static function sendEmail($itemId, $description) {
|
||||||
$title = 'Error: Intaro CRM.';
|
$title = 'Error: Intaro CRM.';
|
||||||
$text = 'Error: ' . $itemId . ' - ' . $description;
|
$text = 'Error: ' . $itemId . ' - ' . $description;
|
||||||
@ -285,7 +322,6 @@ class ICrmOrderActions
|
|||||||
return 'ICrmOrderActions::uploadOrdersAgent();';
|
return 'ICrmOrderActions::uploadOrdersAgent();';
|
||||||
|
|
||||||
else return;
|
else return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
0
intaro.crm/classes/general/RestApi.php
Normal file → Executable file
0
intaro.crm/classes/general/RestApi.php
Normal file → Executable file
0
intaro.crm/include.php
Normal file → Executable file
0
intaro.crm/include.php
Normal file → Executable file
0
intaro.crm/install/import/crm_run.php → intaro.crm/install/export/crm_run.php
Normal file → Executable file
0
intaro.crm/install/import/crm_run.php → intaro.crm/install/export/crm_run.php
Normal file → Executable file
38
intaro.crm/install/index.php
Normal file → Executable file
38
intaro.crm/install/index.php
Normal file → Executable file
@ -307,6 +307,8 @@ class intaro_crm extends CModule
|
|||||||
30
|
30
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->CopyFiles();
|
||||||
|
|
||||||
$APPLICATION->IncludeAdminFile(
|
$APPLICATION->IncludeAdminFile(
|
||||||
GetMessage('MODULE_INSTALL_TITLE'),
|
GetMessage('MODULE_INSTALL_TITLE'),
|
||||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step3.php'
|
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step3.php'
|
||||||
@ -318,7 +320,6 @@ class intaro_crm extends CModule
|
|||||||
global $APPLICATION;
|
global $APPLICATION;
|
||||||
|
|
||||||
CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID);
|
CAgent::RemoveAgent("ICrmOrderActions::uploadOrdersAgent();", $this->MODULE_ID);
|
||||||
UnRegisterModule($this->MODULE_ID);
|
|
||||||
|
|
||||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION);
|
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_HOST_OPTION);
|
||||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION);
|
COption::RemoveOption($this->MODULE_ID, $this->CRM_API_KEY_OPTION);
|
||||||
@ -328,10 +329,45 @@ class intaro_crm extends CModule
|
|||||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT);
|
COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT);
|
||||||
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_LAST_ID);
|
COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_LAST_ID);
|
||||||
|
|
||||||
|
$this->DeleteFiles();
|
||||||
|
|
||||||
|
UnRegisterModule($this->MODULE_ID);
|
||||||
|
|
||||||
$APPLICATION->IncludeAdminFile(
|
$APPLICATION->IncludeAdminFile(
|
||||||
GetMessage('MODULE_UNINSTALL_TITLE'),
|
GetMessage('MODULE_UNINSTALL_TITLE'),
|
||||||
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/unstep1.php'
|
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/unstep1.php'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Recursive copy files from folder
|
||||||
|
* @param type $src
|
||||||
|
* @param type $dst
|
||||||
|
*/
|
||||||
|
|
||||||
|
function rCopy($src, $dst) {
|
||||||
|
if (is_dir($src)) {
|
||||||
|
mkdir($dst);
|
||||||
|
$files = scandir($src);
|
||||||
|
foreach ($files as $file)
|
||||||
|
if ($file != "." && $file != "..")
|
||||||
|
$this->rCopy("$src/$file", "$dst/$file");
|
||||||
|
}
|
||||||
|
else if (file_exists($src))
|
||||||
|
copy($src, $dst);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CopyFiles() {
|
||||||
|
$this->rCopy(
|
||||||
|
$_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/export/', $_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DeleteFiles() {
|
||||||
|
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/crm_run.php');
|
||||||
|
unlink($_SERVER['DOCUMENT_ROOT'] . '/bitrix/php_interface/include/catalog_export/crm_setup.php');
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
0
intaro.crm/install/step1.php
Normal file → Executable file
0
intaro.crm/install/step1.php
Normal file → Executable file
0
intaro.crm/install/step2.php
Normal file → Executable file
0
intaro.crm/install/step2.php
Normal file → Executable file
0
intaro.crm/install/step3.php
Normal file → Executable file
0
intaro.crm/install/step3.php
Normal file → Executable file
0
intaro.crm/install/unstep1.php
Normal file → Executable file
0
intaro.crm/install/unstep1.php
Normal file → Executable file
0
intaro.crm/install/unstep2.php
Normal file → Executable file
0
intaro.crm/install/unstep2.php
Normal file → Executable file
4
intaro.crm/install/version.php
Normal file → Executable file
4
intaro.crm/install/version.php
Normal file → Executable file
@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
$arModuleVersion = array(
|
$arModuleVersion = array(
|
||||||
'VERSION' => '0.3a',
|
'VERSION' => '0.3b',
|
||||||
'VERSION_DATE' => '2013-07-10 16:49:00',
|
'VERSION_DATE' => '2013-07-10 18:19:00',
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
0
intaro.crm/lang/ru/install/index.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/index.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/step1.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/step1.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/step2.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/step2.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/step3.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/step3.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/unstep1.php
Normal file → Executable file
0
intaro.crm/lang/ru/install/unstep1.php
Normal file → Executable file
0
intaro.crm/lang/ru/options.php
Normal file → Executable file
0
intaro.crm/lang/ru/options.php
Normal file → Executable file
0
intaro.crm/options.php
Normal file → Executable file
0
intaro.crm/options.php
Normal file → Executable file
Loading…
Reference in New Issue
Block a user