From 0634cc3afea16080bfa540c64e6cabb102ba227f Mon Sep 17 00:00:00 2001 From: Grisha Pomadchin Date: Wed, 10 Jul 2013 18:21:13 +0400 Subject: [PATCH] +copy export files via installation; v0.3b --- .../classes/general/ICrmOrderActions.php | 48 ++++++++++++++++--- intaro.crm/classes/general/RestApi.php | 0 intaro.crm/include.php | 0 .../install/{import => export}/crm_run.php | 0 .../install/{import => export}/crm_setup.php | 0 intaro.crm/install/index.php | 40 +++++++++++++++- intaro.crm/install/step1.php | 0 intaro.crm/install/step2.php | 0 intaro.crm/install/step3.php | 0 intaro.crm/install/unstep1.php | 0 intaro.crm/install/unstep2.php | 0 intaro.crm/install/version.php | 4 +- intaro.crm/lang/ru/install/index.php | 0 intaro.crm/lang/ru/install/step1.php | 0 intaro.crm/lang/ru/install/step2.php | 0 intaro.crm/lang/ru/install/step3.php | 0 intaro.crm/lang/ru/install/unstep1.php | 0 intaro.crm/lang/ru/options.php | 0 intaro.crm/options.php | 0 19 files changed, 82 insertions(+), 10 deletions(-) mode change 100644 => 100755 intaro.crm/classes/general/ICrmOrderActions.php mode change 100644 => 100755 intaro.crm/classes/general/RestApi.php mode change 100644 => 100755 intaro.crm/include.php rename intaro.crm/install/{import => export}/crm_run.php (100%) mode change 100644 => 100755 rename intaro.crm/install/{import => export}/crm_setup.php (100%) mode change 100644 => 100755 intaro.crm/install/index.php mode change 100644 => 100755 intaro.crm/install/step1.php mode change 100644 => 100755 intaro.crm/install/step2.php mode change 100644 => 100755 intaro.crm/install/step3.php mode change 100644 => 100755 intaro.crm/install/unstep1.php mode change 100644 => 100755 intaro.crm/install/unstep2.php mode change 100644 => 100755 intaro.crm/install/version.php mode change 100644 => 100755 intaro.crm/lang/ru/install/index.php mode change 100644 => 100755 intaro.crm/lang/ru/install/step1.php mode change 100644 => 100755 intaro.crm/lang/ru/install/step2.php mode change 100644 => 100755 intaro.crm/lang/ru/install/step3.php mode change 100644 => 100755 intaro.crm/lang/ru/install/unstep1.php mode change 100644 => 100755 intaro.crm/lang/ru/options.php mode change 100644 => 100755 intaro.crm/options.php diff --git a/intaro.crm/classes/general/ICrmOrderActions.php b/intaro.crm/classes/general/ICrmOrderActions.php old mode 100644 new mode 100755 index 84ad3306..41fc6298 --- a/intaro.crm/classes/general/ICrmOrderActions.php +++ b/intaro.crm/classes/general/ICrmOrderActions.php @@ -1,5 +1,4 @@ orderHistory()); + } + /** * - * w event in bitrix log - * @param type $auditType - * @param type $itemId - * @param type $description + * w+ event in bitrix log */ private static function eventLog($itemId, $description) { CEventLog::Add(array( @@ -264,6 +295,12 @@ class ICrmOrderActions self::sendEmail($itemId, $description); } + + + /** + * + * send email to admin + */ private static function sendEmail($itemId, $description) { $title = 'Error: Intaro CRM.'; $text = 'Error: ' . $itemId . ' - ' . $description; @@ -285,7 +322,6 @@ class ICrmOrderActions return 'ICrmOrderActions::uploadOrdersAgent();'; else return; - } } diff --git a/intaro.crm/classes/general/RestApi.php b/intaro.crm/classes/general/RestApi.php old mode 100644 new mode 100755 diff --git a/intaro.crm/include.php b/intaro.crm/include.php old mode 100644 new mode 100755 diff --git a/intaro.crm/install/import/crm_run.php b/intaro.crm/install/export/crm_run.php old mode 100644 new mode 100755 similarity index 100% rename from intaro.crm/install/import/crm_run.php rename to intaro.crm/install/export/crm_run.php diff --git a/intaro.crm/install/import/crm_setup.php b/intaro.crm/install/export/crm_setup.php similarity index 100% rename from intaro.crm/install/import/crm_setup.php rename to intaro.crm/install/export/crm_setup.php diff --git a/intaro.crm/install/index.php b/intaro.crm/install/index.php old mode 100644 new mode 100755 index 8ad94915..f2e77ce4 --- a/intaro.crm/install/index.php +++ b/intaro.crm/install/index.php @@ -307,6 +307,8 @@ class intaro_crm extends CModule 30 ); + $this->CopyFiles(); + $APPLICATION->IncludeAdminFile( GetMessage('MODULE_INSTALL_TITLE'), $_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/' . $this->MODULE_ID . '/install/step3.php' @@ -318,7 +320,6 @@ class intaro_crm extends CModule global $APPLICATION; 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_KEY_OPTION); @@ -327,11 +328,46 @@ class intaro_crm extends CModule COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT_STATUSES); COption::RemoveOption($this->MODULE_ID, $this->CRM_PAYMENT); COption::RemoveOption($this->MODULE_ID, $this->CRM_ORDER_LAST_ID); - + + $this->DeleteFiles(); + + UnRegisterModule($this->MODULE_ID); + $APPLICATION->IncludeAdminFile( GetMessage('MODULE_UNINSTALL_TITLE'), $_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'); + + } } ?> diff --git a/intaro.crm/install/step1.php b/intaro.crm/install/step1.php old mode 100644 new mode 100755 diff --git a/intaro.crm/install/step2.php b/intaro.crm/install/step2.php old mode 100644 new mode 100755 diff --git a/intaro.crm/install/step3.php b/intaro.crm/install/step3.php old mode 100644 new mode 100755 diff --git a/intaro.crm/install/unstep1.php b/intaro.crm/install/unstep1.php old mode 100644 new mode 100755 diff --git a/intaro.crm/install/unstep2.php b/intaro.crm/install/unstep2.php old mode 100644 new mode 100755 diff --git a/intaro.crm/install/version.php b/intaro.crm/install/version.php old mode 100644 new mode 100755 index c65aac0c..dafd6ca5 --- a/intaro.crm/install/version.php +++ b/intaro.crm/install/version.php @@ -1,6 +1,6 @@ '0.3a', - 'VERSION_DATE' => '2013-07-10 16:49:00', + 'VERSION' => '0.3b', + 'VERSION_DATE' => '2013-07-10 18:19:00', ); ?> diff --git a/intaro.crm/lang/ru/install/index.php b/intaro.crm/lang/ru/install/index.php old mode 100644 new mode 100755 diff --git a/intaro.crm/lang/ru/install/step1.php b/intaro.crm/lang/ru/install/step1.php old mode 100644 new mode 100755 diff --git a/intaro.crm/lang/ru/install/step2.php b/intaro.crm/lang/ru/install/step2.php old mode 100644 new mode 100755 diff --git a/intaro.crm/lang/ru/install/step3.php b/intaro.crm/lang/ru/install/step3.php old mode 100644 new mode 100755 diff --git a/intaro.crm/lang/ru/install/unstep1.php b/intaro.crm/lang/ru/install/unstep1.php old mode 100644 new mode 100755 diff --git a/intaro.crm/lang/ru/options.php b/intaro.crm/lang/ru/options.php old mode 100644 new mode 100755 diff --git a/intaro.crm/options.php b/intaro.crm/options.php old mode 100644 new mode 100755