From 4885897f148f36d3bed396ddf41563f4c00cec3c Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Thu, 27 Sep 2018 11:32:33 +0300 Subject: [PATCH] New library classes, refactoring for OC 3.1 --- RoboFile.php | 9 +- composer.json | 2 +- composer.lock | 3197 ----------------- src/upload/admin/controller/cron/icml.php | 7 + .../controller/extension/module/retailcrm.php | 90 +- .../en-gb/extension/module/retailcrm.php | 7 +- .../ru-ru/extension/module/retailcrm.php | 7 +- .../model/extension/retailcrm/history.php | 927 ++++- .../extension/retailcrm/history/v4_5.php | 827 ----- .../admin/model/extension/retailcrm/icml.php | 4 +- .../admin/model/extension/retailcrm/order.php | 429 +-- .../model/extension/retailcrm/products.php | 9 + .../admin/view/stylesheet/retailcrm.css | 2 +- .../template/extension/module/retailcrm.twig | 304 +- .../catalog/controller/api/retailcrm.php | 43 +- .../controller/extension/module/retailcrm.php | 66 +- .../model/extension/retailcrm/order.php | 347 +- .../model/extension/retailcrm/products.php | 9 + src/upload/system/cron/dispatch.php | 24 +- src/upload/system/cron/icml.php | 3 - src/upload/system/cron/prices.php | 4 - .../retailcrm/{ => api}/OpencartApiClient.php | 8 +- .../{ => api}/RetailcrmHistoryHelper.php | 0 .../library/retailcrm/api/RetailcrmProxy.php | 18 +- src/upload/system/library/retailcrm/base.php | 84 +- .../system/library/retailcrm/custom/Base.php | 13 + .../system/library/retailcrm/customer.php | 42 +- src/upload/system/library/retailcrm/order.php | 77 +- .../system/library/retailcrm/retailcrm.php | 36 +- 29 files changed, 1504 insertions(+), 5091 deletions(-) delete mode 100644 composer.lock create mode 100644 src/upload/admin/controller/cron/icml.php delete mode 100644 src/upload/admin/model/extension/retailcrm/history/v4_5.php create mode 100644 src/upload/admin/model/extension/retailcrm/products.php create mode 100644 src/upload/catalog/model/extension/retailcrm/products.php delete mode 100644 src/upload/system/cron/icml.php delete mode 100644 src/upload/system/cron/prices.php rename src/upload/system/library/retailcrm/{ => api}/OpencartApiClient.php (95%) rename src/upload/system/library/retailcrm/{ => api}/RetailcrmHistoryHelper.php (100%) create mode 100644 src/upload/system/library/retailcrm/custom/Base.php diff --git a/RoboFile.php b/RoboFile.php index 6be3b39..861f1b1 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -73,8 +73,9 @@ class RoboFile extends \Robo\Tasks $this->taskDeleteDir('www')->run(); $this->taskFileSystemStack() ->mirror('vendor/opencart/opencart/upload', 'www') - ->copy('vendor/beyondit/opencart-test-suite/src/upload/system/config/test-config.php','www/system/config/test-config.php') - ->copy('vendor/beyondit/opencart-test-suite/src/upload/catalog/controller/startup/test_startup.php','www/catalog/controller/startup/test_startup.php') + ->copy('vendor/beyondit/opencart-test-suite/src/upload/system/config/test-config.php', 'www/system/config/test-config.php') + ->copy('vendor/beyondit/opencart-test-suite/src/upload/system/library/session/test.php', 'www/system/library/session/test.php') + ->copy('vendor/beyondit/opencart-test-suite/src/upload/admin/controller/startup/test_startup.php','www/admin/controller/startup/test_startup.php') ->chmod('www', 0777, 0000, true) ->run(); @@ -97,7 +98,9 @@ class RoboFile extends \Robo\Tasks $install->run(); $this->taskDeleteDir('www/install')->run(); - $this->restoreSampleData($conn); + if (isset($conn)) { + $this->restoreSampleData($conn); + } $conn = null; } diff --git a/composer.json b/composer.json index e4499f4..a83a6af 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require-dev": { - "opencart/opencart" : "3.0.2.0", + "opencart/opencart" : "3.1.0.0_a1", "vlucas/phpdotenv": "~1.1.0", "phpunit/phpunit" : "^6", "beyondit/opencart-test-suite": "~3.0", diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 4f6742b..0000000 --- a/composer.lock +++ /dev/null @@ -1,3197 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", - "This file is @generated automatically" - ], - "hash": "d99f618b88f08898e6a4fef93d970c82", - "content-hash": "ca0e4df35c14fb6adac2eb994bcf9e44", - "packages": [], - "packages-dev": [ - { - "name": "beyondit/opencart-extension-installer", - "version": "2.3.2", - "source": { - "type": "git", - "url": "https://github.com/beyondit/opencart-extension-installer.git", - "reference": "eeb6d7b65924122b48a846814863ab2ec9b01638" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/beyondit/opencart-extension-installer/zipball/eeb6d7b65924122b48a846814863ab2ec9b01638", - "reference": "eeb6d7b65924122b48a846814863ab2ec9b01638", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0" - }, - "require-dev": { - "composer/composer": "^1.1", - "phpunit/phpunit": "~4" - }, - "type": "composer-plugin", - "extra": { - "class": "BeyondIT\\Composer\\OpenCartExtensionInstallerPlugin" - }, - "autoload": { - "psr-4": { - "BeyondIT\\Composer\\": "src/BeyondIT/Composer" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL 3.0" - ], - "authors": [ - { - "name": "Stefan Huber", - "email": "stefan.huber@beyondit.at" - } - ], - "description": "Custom Composer Installer for installing OpenCart Extensions", - "time": "2017-08-18 08:14:10" - }, - { - "name": "beyondit/opencart-test-suite", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/beyondit/opencart-test-suite.git", - "reference": "066f980fcef884409e606302bf028d04157d83b2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/beyondit/opencart-test-suite/zipball/066f980fcef884409e606302bf028d04157d83b2", - "reference": "066f980fcef884409e606302bf028d04157d83b2", - "shasum": "" - }, - "require": { - "beyondit/opencart-extension-installer": "~2.3.0", - "phpunit/phpunit": "4.*" - }, - "require-dev": { - "consolidation/robo": "^1.0", - "opencart/opencart": "2.3.0.2", - "phpunit/phpunit": "4.*", - "vlucas/phpdotenv": "~1.1.0" - }, - "type": "opencart-extension", - "extra": { - "src-dir": "src/upload", - "mappings": [ - "system/config/test-config.php", - "catalog/controller/startup/test_startup.php" - ] - }, - "autoload": { - "files": [ - "src/OpenCartTest.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0" - ], - "authors": [ - { - "name": "Stefan Huber", - "email": "stefan.huber@beyondit.at", - "homepage": "http://www.beyondit.at", - "role": "Developer" - } - ], - "description": "Testing Suite for OpenCart Development", - "time": "2016-12-02 10:08:16" - }, - { - "name": "braintree/braintree_php", - "version": "3.2.0", - "source": { - "type": "git", - "url": "https://github.com/braintree/braintree_php.git", - "reference": "c7e0e2d1ae21d659cddb5507fb0bf181813b5733" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/braintree/braintree_php/zipball/c7e0e2d1ae21d659cddb5507fb0bf181813b5733", - "reference": "c7e0e2d1ae21d659cddb5507fb0bf181813b5733", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-dom": "*", - "ext-hash": "*", - "ext-openssl": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "3.7.*" - }, - "type": "library", - "autoload": { - "psr-0": { - "Braintree": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Braintree", - "homepage": "http://www.braintreepayments.com" - } - ], - "description": "Braintree PHP Client Library", - "time": "2015-07-15 15:07:13" - }, - { - "name": "cardinity/cardinity-sdk-php", - "version": "v1.0.3", - "source": { - "type": "git", - "url": "https://github.com/cardinity/cardinity-sdk-php.git", - "reference": "f51f6fbacee393b4eeff7b80be2b1cee77896b4c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/cardinity/cardinity-sdk-php/zipball/f51f6fbacee393b4eeff7b80be2b1cee77896b4c", - "reference": "f51f6fbacee393b4eeff7b80be2b1cee77896b4c", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "~5.1", - "guzzlehttp/log-subscriber": "~1.0", - "guzzlehttp/oauth-subscriber": "0.2.*", - "php": ">=5.4.0", - "symfony/validator": "~2.6" - }, - "require-dev": { - "monolog/monolog": "~1.0", - "phpspec/phpspec": "~2.1", - "phpunit/phpunit": "~4.3" - }, - "type": "library", - "autoload": { - "psr-4": { - "Cardinity\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Client library for Cardinity credit card processing API", - "homepage": "http://cardinity.com", - "time": "2016-12-29 09:57:23" - }, - { - "name": "consolidation/annotated-command", - "version": "2.8.4", - "source": { - "type": "git", - "url": "https://github.com/consolidation/annotated-command.git", - "reference": "651541a0b68318a2a202bda558a676e5ad92223c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/651541a0b68318a2a202bda558a676e5ad92223c", - "reference": "651541a0b68318a2a202bda558a676e5ad92223c", - "shasum": "" - }, - "require": { - "consolidation/output-formatters": "^3.1.12", - "php": ">=5.4.0", - "psr/log": "^1", - "symfony/console": "^2.8|^3|^4", - "symfony/event-dispatcher": "^2.5|^3|^4", - "symfony/finder": "^2.5|^3|^4" - }, - "require-dev": { - "g1a/composer-test-scenarios": "^2", - "phpunit/phpunit": "^6", - "satooshi/php-coveralls": "^2", - "squizlabs/php_codesniffer": "^2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Consolidation\\AnnotatedCommand\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Greg Anderson", - "email": "greg.1.anderson@greenknowe.org" - } - ], - "description": "Initialize Symfony Console commands from annotated command class methods.", - "time": "2018-05-25 18:04:25" - }, - { - "name": "consolidation/config", - "version": "1.0.11", - "source": { - "type": "git", - "url": "https://github.com/consolidation/config.git", - "reference": "ede41d946078e97e7a9513aadc3352f1c26817af" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/config/zipball/ede41d946078e97e7a9513aadc3352f1c26817af", - "reference": "ede41d946078e97e7a9513aadc3352f1c26817af", - "shasum": "" - }, - "require": { - "dflydev/dot-access-data": "^1.1.0", - "grasmash/expander": "^1", - "php": ">=5.4.0" - }, - "require-dev": { - "g1a/composer-test-scenarios": "^1", - "phpunit/phpunit": "^4", - "satooshi/php-coveralls": "^1.0", - "squizlabs/php_codesniffer": "2.*", - "symfony/console": "^2.5|^3|^4", - "symfony/yaml": "^2.8.11|^3|^4" - }, - "suggest": { - "symfony/yaml": "Required to use Consolidation\\Config\\Loader\\YamlConfigLoader" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Consolidation\\Config\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Greg Anderson", - "email": "greg.1.anderson@greenknowe.org" - } - ], - "description": "Provide configuration services for a commandline tool.", - "time": "2018-05-27 01:17:02" - }, - { - "name": "consolidation/log", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/consolidation/log.git", - "reference": "dfd8189a771fe047bf3cd669111b2de5f1c79395" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/log/zipball/dfd8189a771fe047bf3cd669111b2de5f1c79395", - "reference": "dfd8189a771fe047bf3cd669111b2de5f1c79395", - "shasum": "" - }, - "require": { - "php": ">=5.5.0", - "psr/log": "~1.0", - "symfony/console": "^2.8|^3|^4" - }, - "require-dev": { - "g1a/composer-test-scenarios": "^1", - "phpunit/phpunit": "4.*", - "satooshi/php-coveralls": "^2", - "squizlabs/php_codesniffer": "2.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Consolidation\\Log\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Greg Anderson", - "email": "greg.1.anderson@greenknowe.org" - } - ], - "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", - "time": "2018-05-25 18:14:39" - }, - { - "name": "consolidation/output-formatters", - "version": "3.2.1", - "source": { - "type": "git", - "url": "https://github.com/consolidation/output-formatters.git", - "reference": "d78ef59aea19d3e2e5a23f90a055155ee78a0ad5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/d78ef59aea19d3e2e5a23f90a055155ee78a0ad5", - "reference": "d78ef59aea19d3e2e5a23f90a055155ee78a0ad5", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "symfony/console": "^2.8|^3|^4", - "symfony/finder": "^2.5|^3|^4" - }, - "require-dev": { - "g1a/composer-test-scenarios": "^2", - "phpunit/phpunit": "^5.7.27", - "satooshi/php-coveralls": "^2", - "squizlabs/php_codesniffer": "^2.7", - "symfony/console": "3.2.3", - "symfony/var-dumper": "^2.8|^3|^4", - "victorjonsson/markdowndocs": "^1.3" - }, - "suggest": { - "symfony/var-dumper": "For using the var_dump formatter" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "autoload": { - "psr-4": { - "Consolidation\\OutputFormatters\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Greg Anderson", - "email": "greg.1.anderson@greenknowe.org" - } - ], - "description": "Format text by applying transformations provided by plug-in formatters.", - "time": "2018-05-25 18:02:34" - }, - { - "name": "consolidation/robo", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/consolidation/Robo.git", - "reference": "ac563abfadf7cb7314b4e152f2b5033a6c255f6f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/consolidation/Robo/zipball/ac563abfadf7cb7314b4e152f2b5033a6c255f6f", - "reference": "ac563abfadf7cb7314b4e152f2b5033a6c255f6f", - "shasum": "" - }, - "require": { - "consolidation/annotated-command": "^2.8.2", - "consolidation/config": "^1.0.10", - "consolidation/log": "~1", - "consolidation/output-formatters": "^3.1.13", - "grasmash/yaml-expander": "^1.3", - "league/container": "^2.2", - "php": ">=5.5.0", - "symfony/console": "^2.8|^3|^4", - "symfony/event-dispatcher": "^2.5|^3|^4", - "symfony/filesystem": "^2.5|^3|^4", - "symfony/finder": "^2.5|^3|^4", - "symfony/process": "^2.5|^3|^4" - }, - "replace": { - "codegyre/robo": "< 1.0" - }, - "require-dev": { - "codeception/aspect-mock": "^1|^2.1.1", - "codeception/base": "^2.3.7", - "codeception/verify": "^0.3.2", - "g1a/composer-test-scenarios": "^2", - "goaop/framework": "~2.1.2", - "goaop/parser-reflection": "^1.1.0", - "natxet/cssmin": "3.0.4", - "nikic/php-parser": "^3.1.5", - "patchwork/jsqueeze": "~2", - "pear/archive_tar": "^1.4.2", - "phpunit/php-code-coverage": "~2|~4", - "satooshi/php-coveralls": "^2", - "squizlabs/php_codesniffer": "^2.8" - }, - "suggest": { - "henrikbjorn/lurker": "For monitoring filesystem changes in taskWatch", - "natxet/CssMin": "For minifying CSS files in taskMinify", - "patchwork/jsqueeze": "For minifying JS files in taskMinify", - "pear/archive_tar": "Allows tar archives to be created and extracted in taskPack and taskExtract, respectively." - }, - "bin": [ - "robo" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev", - "dev-state": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Robo\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Davert", - "email": "davert.php@resend.cc" - } - ], - "description": "Modern task runner", - "time": "2018-05-27 01:42:53" - }, - { - "name": "container-interop/container-interop", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/container-interop/container-interop.git", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "shasum": "" - }, - "require": { - "psr/container": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/Interop/Container/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14 19:40:03" - }, - { - "name": "dflydev/dot-access-data", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://github.com/dflydev/dflydev-dot-access-data.git", - "reference": "3fbd874921ab2c041e899d044585a2ab9795df8a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/3fbd874921ab2c041e899d044585a2ab9795df8a", - "reference": "3fbd874921ab2c041e899d044585a2ab9795df8a", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "Dflydev\\DotAccessData": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dragonfly Development Inc.", - "email": "info@dflydev.com", - "homepage": "http://dflydev.com" - }, - { - "name": "Beau Simensen", - "email": "beau@dflydev.com", - "homepage": "http://beausimensen.com" - }, - { - "name": "Carlos Frutos", - "email": "carlos@kiwing.it", - "homepage": "https://github.com/cfrutos" - } - ], - "description": "Given a deep data structure, access data by dot notation.", - "homepage": "https://github.com/dflydev/dflydev-dot-access-data", - "keywords": [ - "access", - "data", - "dot", - "notation" - ], - "time": "2017-01-20 21:14:22" - }, - { - "name": "divido/divido-php", - "version": "v1.15-stable", - "source": { - "type": "git", - "url": "git@github.com:DividoFinancialServices/divido-api-php.git", - "reference": "8edd902ec2be8151331985021107031292b41ca1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/DividoFinancialServices/divido-api-php/zipball/8edd902ec2be8151331985021107031292b41ca1", - "reference": "8edd902ec2be8151331985021107031292b41ca1", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "php": ">=5.2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "master": "2.0-dev", - "v1.1.1": "1.1.1-dev" - } - }, - "autoload": { - "psr-0": { - "Divido": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Divido PHP library", - "homepage": "https://www.divido.com/", - "keywords": [ - "api", - "divido", - "finance", - "instalments", - "payment processing" - ], - "time": "2018-01-21 15:38:57" - }, - { - "name": "doctrine/instantiator", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", - "shasum": "" - }, - "require": { - "php": ">=5.3,<8.0-DEV" - }, - "require-dev": { - "athletic/athletic": "~0.1.8", - "ext-pdo": "*", - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2015-06-14 21:17:01" - }, - { - "name": "grasmash/expander", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/grasmash/expander.git", - "reference": "95d6037344a4be1dd5f8e0b0b2571a28c397578f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/grasmash/expander/zipball/95d6037344a4be1dd5f8e0b0b2571a28c397578f", - "reference": "95d6037344a4be1dd5f8e0b0b2571a28c397578f", - "shasum": "" - }, - "require": { - "dflydev/dot-access-data": "^1.1.0", - "php": ">=5.4" - }, - "require-dev": { - "greg-1-anderson/composer-test-scenarios": "^1", - "phpunit/phpunit": "^4|^5.5.4", - "satooshi/php-coveralls": "^1.0.2|dev-master", - "squizlabs/php_codesniffer": "^2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Grasmash\\Expander\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matthew Grasmick" - } - ], - "description": "Expands internal property references in PHP arrays file.", - "time": "2017-12-21 22:14:55" - }, - { - "name": "grasmash/yaml-expander", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/grasmash/yaml-expander.git", - "reference": "3f0f6001ae707a24f4d9733958d77d92bf9693b1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/grasmash/yaml-expander/zipball/3f0f6001ae707a24f4d9733958d77d92bf9693b1", - "reference": "3f0f6001ae707a24f4d9733958d77d92bf9693b1", - "shasum": "" - }, - "require": { - "dflydev/dot-access-data": "^1.1.0", - "php": ">=5.4", - "symfony/yaml": "^2.8.11|^3|^4" - }, - "require-dev": { - "greg-1-anderson/composer-test-scenarios": "^1", - "phpunit/phpunit": "^4.8|^5.5.4", - "satooshi/php-coveralls": "^1.0.2|dev-master", - "squizlabs/php_codesniffer": "^2.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Grasmash\\YamlExpander\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Matthew Grasmick" - } - ], - "description": "Expands internal property references in a yaml file.", - "time": "2017-12-16 16:06:03" - }, - { - "name": "guzzlehttp/guzzle", - "version": "5.3.2", - "source": { - "type": "git", - "url": "https://github.com/guzzle/guzzle.git", - "reference": "f9acb4761844317e626a32259205bec1f1bc60d2" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f9acb4761844317e626a32259205bec1f1bc60d2", - "reference": "f9acb4761844317e626a32259205bec1f1bc60d2", - "shasum": "" - }, - "require": { - "guzzlehttp/ringphp": "^1.1", - "php": ">=5.4.0", - "react/promise": "^2.2" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "^4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "client", - "curl", - "framework", - "http", - "http client", - "rest", - "web service" - ], - "time": "2018-01-15 07:18:01" - }, - { - "name": "guzzlehttp/log-subscriber", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/guzzle/log-subscriber.git", - "reference": "99c3c0004165db721d8ef7bbef60c996210e538a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/log-subscriber/zipball/99c3c0004165db721d8ef7bbef60c996210e538a", - "reference": "99c3c0004165db721d8ef7bbef60c996210e538a", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "~4.0 | ~5.0", - "php": ">=5.4.0", - "psr/log": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Subscriber\\Log\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Logs HTTP requests and responses as they are sent over the wire (Guzzle 4+)", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "log", - "plugin" - ], - "time": "2014-10-13 03:31:43" - }, - { - "name": "guzzlehttp/oauth-subscriber", - "version": "0.2.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/oauth-subscriber.git", - "reference": "03f1ebe31d3112526106d0570c80eba6820e86e5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/oauth-subscriber/zipball/03f1ebe31d3112526106d0570c80eba6820e86e5", - "reference": "03f1ebe31d3112526106d0570c80eba6820e86e5", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": "~4.0|~5.0", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.1-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Subscriber\\Oauth\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Guzzle OAuth 1.0 subscriber", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "oauth" - ], - "time": "2014-10-23 22:19:02" - }, - { - "name": "guzzlehttp/ringphp", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/RingPHP.git", - "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/dbbb91d7f6c191e5e405e900e3102ac7f261bc0b", - "reference": "dbbb91d7f6c191e5e405e900e3102ac7f261bc0b", - "shasum": "" - }, - "require": { - "guzzlehttp/streams": "~3.0", - "php": ">=5.4.0", - "react/promise": "~2.0" - }, - "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~4.0" - }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Ring\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", - "time": "2015-05-20 03:37:09" - }, - { - "name": "guzzlehttp/streams", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/streams.git", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "GuzzleHttp\\Stream\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple abstraction over streams of data", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ], - "time": "2014-10-12 19:18:40" - }, - { - "name": "henrikbjorn/lurker", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/flint/Lurker.git", - "reference": "712d3ef19bef161daa2ba0e0237c6b875587a089" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/flint/Lurker/zipball/712d3ef19bef161daa2ba0e0237c6b875587a089", - "reference": "712d3ef19bef161daa2ba0e0237c6b875587a089", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "symfony/config": "^2.2|^3.0", - "symfony/event-dispatcher": "^2.2|^3.0" - }, - "suggest": { - "ext-inotify": ">=0.1.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Lurker": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Yaroslav Kiliba", - "email": "om.dattaya@gmail.com" - }, - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com" - }, - { - "name": "Henrik Bjrnskov", - "email": "henrik@bjrnskov.dk" - } - ], - "description": "Resource Watcher.", - "keywords": [ - "filesystem", - "resource", - "watching" - ], - "time": "2016-03-16 15:22:20" - }, - { - "name": "klarna/kco_rest", - "version": "v2.2.0", - "source": { - "type": "git", - "url": "https://github.com/klarna/kco_rest_php.git", - "reference": "8a2142a2ebb087bb61901d51d1bb9698790e78c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/klarna/kco_rest_php/zipball/8a2142a2ebb087bb61901d51d1bb9698790e78c5", - "reference": "8a2142a2ebb087bb61901d51d1bb9698790e78c5", - "shasum": "" - }, - "require": { - "guzzlehttp/guzzle": ">=4.2,<6.0", - "php": ">=5.4.0" - }, - "require-dev": { - "apigen/apigen": "4.0.*", - "klarna/apigen-theme": "~1.0", - "phploc/phploc": "2.0.*", - "phpmd/phpmd": "2.1.*", - "phpunit/phpunit": "4.2.*", - "satooshi/php-coveralls": "0.6.*", - "sebastian/phpcpd": "2.0.*", - "squizlabs/php_codesniffer": "1.5.*" - }, - "type": "library", - "autoload": { - "psr-4": { - "": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Klarna AB", - "email": "integration@klarna.com" - } - ], - "description": "Klarna Checkout PHP SDK", - "homepage": "http://developers.klarna.com", - "time": "2015-12-07 09:51:35" - }, - { - "name": "leafo/scssphp", - "version": "v0.0.12", - "source": { - "type": "git", - "url": "https://github.com/leafo/scssphp.git", - "reference": "ff76df3e45af45e808f3fcd516a2cb5cbc77f45e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/leafo/scssphp/zipball/ff76df3e45af45e808f3fcd516a2cb5cbc77f45e", - "reference": "ff76df3e45af45e808f3fcd516a2cb5cbc77f45e", - "shasum": "" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "php": ">=5.3.0", - "phpunit/phpunit": "3.7.*" - }, - "bin": [ - "pscss" - ], - "type": "library", - "autoload": { - "classmap": [ - "scss.inc.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT", - "GPL-3.0" - ], - "authors": [ - { - "name": "Leaf Corcoran", - "email": "leafot@gmail.com", - "homepage": "http://leafo.net" - } - ], - "description": "scssphp is a compiler for SCSS written in PHP.", - "homepage": "http://leafo.net/scssphp/", - "time": "2014-07-07 01:51:39" - }, - { - "name": "league/container", - "version": "2.4.1", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/container.git", - "reference": "43f35abd03a12977a60ffd7095efd6a7808488c0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/container/zipball/43f35abd03a12977a60ffd7095efd6a7808488c0", - "reference": "43f35abd03a12977a60ffd7095efd6a7808488c0", - "shasum": "" - }, - "require": { - "container-interop/container-interop": "^1.2", - "php": "^5.4.0 || ^7.0" - }, - "provide": { - "container-interop/container-interop-implementation": "^1.2", - "psr/container-implementation": "^1.0" - }, - "replace": { - "orno/di": "~2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-2.x": "2.x-dev", - "dev-1.x": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Container\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Phil Bennett", - "email": "philipobenito@gmail.com", - "homepage": "http://www.philipobenito.com", - "role": "Developer" - } - ], - "description": "A fast and intuitive dependency injection container.", - "homepage": "https://github.com/thephpleague/container", - "keywords": [ - "container", - "dependency", - "di", - "injection", - "league", - "provider", - "service" - ], - "time": "2017-05-10 09:20:27" - }, - { - "name": "opencart/opencart", - "version": "2.3.0.2", - "source": { - "type": "git", - "url": "https://github.com/opencart/opencart.git", - "reference": "85e0f35ae96197e0aa92a4aedd3aad76eebd2961" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/opencart/opencart/zipball/85e0f35ae96197e0aa92a4aedd3aad76eebd2961", - "reference": "85e0f35ae96197e0aa92a4aedd3aad76eebd2961", - "shasum": "" - }, - "require": { - "braintree/braintree_php": "3.2.0", - "cardinity/cardinity-sdk-php": "^1.0", - "divido/divido-php": ">=1.1.1", - "klarna/kco_rest": "^2.2", - "leafo/scssphp": "0.0.12", - "php": ">=5.4.0" - }, - "type": "project", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-3.0+" - ], - "description": "OpenCart", - "homepage": "http://www.opencart.com", - "keywords": [ - "ecommerce", - "framework", - "opencart", - "opensource" - ], - "time": "2016-08-01 13:43:14" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2017-09-11 18:02:19" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", - "reference": "94fd0001232e47129dd3504189fa1c7225010d08", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2017-11-30 07:14:17" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2017-07-14 14:27:02" - }, - { - "name": "phpspec/prophecy", - "version": "1.7.6", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2018-04-18 13:57:24" - }, - { - "name": "phpunit/php-code-coverage", - "version": "2.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "~1.3", - "sebastian/environment": "^1.3.2", - "sebastian/version": "~1.0" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2015-10-06 15:47:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2017-11-27 13:52:08" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21 13:50:34" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26 11:10:40" - }, - { - "name": "phpunit/php-token-stream", - "version": "1.4.12", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", - "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-12-04 08:55:13" - }, - { - "name": "phpunit/phpunit", - "version": "4.8.36", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", - "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpspec/prophecy": "^1.3.1", - "phpunit/php-code-coverage": "~2.1", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "~1.3", - "sebastian/exporter": "~1.2", - "sebastian/global-state": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.1|~3.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.8.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-06-21 08:07:12" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "2.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2", - "sebastian/exporter": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2015-10-02 06:51:40" - }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14 16:28:37" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10 12:19:37" - }, - { - "name": "react/promise", - "version": "v2.6.0", - "source": { - "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "5e60e5596a5422287f9d2205f405bef2ae0cef4b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/5e60e5596a5422287f9d2205f405bef2ae0cef4b", - "reference": "5e60e5596a5422287f9d2205f405bef2ae0cef4b", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.8" - }, - "type": "library", - "autoload": { - "psr-4": { - "React\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com" - } - ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "keywords": [ - "promise", - "promises" - ], - "time": "2018-06-11 11:05:43" - }, - { - "name": "sebastian/comparator", - "version": "1.2.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-01-29 09:50:25" - }, - { - "name": "sebastian/diff", - "version": "1.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-05-22 07:24:03" - }, - { - "name": "sebastian/environment", - "version": "1.3.8", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2016-08-18 05:49:44" - }, - { - "name": "sebastian/exporter", - "version": "1.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", - "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~1.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2016-06-17 09:04:28" - }, - { - "name": "sebastian/global-state", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.2" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2015-10-12 03:26:01" - }, - { - "name": "sebastian/recursion-context", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" - }, - { - "name": "sebastian/version", - "version": "1.0.6", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" - }, - { - "name": "symfony/config", - "version": "v3.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "73e055cf2e6467715f187724a0347ea32079967c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/73e055cf2e6467715f187724a0347ea32079967c", - "reference": "73e055cf2e6467715f187724a0347ea32079967c", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2018-05-14 16:49:53" - }, - { - "name": "symfony/console", - "version": "v3.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "36f83f642443c46f3cf751d4d2ee5d047d757a27" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/36f83f642443c46f3cf751d4d2ee5d047d757a27", - "reference": "36f83f642443c46f3cf751d4d2ee5d047d757a27", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" - }, - "suggest": { - "psr/log-implementation": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2018-05-16 08:49:21" - }, - { - "name": "symfony/debug", - "version": "v3.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "b28fd73fefbac341f673f5efd707d539d6a19f68" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/b28fd73fefbac341f673f5efd707d539d6a19f68", - "reference": "b28fd73fefbac341f673f5efd707d539d6a19f68", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2018-05-16 14:03:39" - }, - { - "name": "symfony/event-dispatcher", - "version": "v3.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fdd5abcebd1061ec647089c6c41a07ed60af09f8", - "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2018-04-06 07:35:25" - }, - { - "name": "symfony/filesystem", - "version": "v3.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "8e03ca3fa52a0f56b87506f38cf7bd3f9442b3a0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/8e03ca3fa52a0f56b87506f38cf7bd3f9442b3a0", - "reference": "8e03ca3fa52a0f56b87506f38cf7bd3f9442b3a0", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2018-05-16 08:49:21" - }, - { - "name": "symfony/finder", - "version": "v3.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "472a92f3df8b247b49ae364275fb32943b9656c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/472a92f3df8b247b49ae364275fb32943b9656c6", - "reference": "472a92f3df8b247b49ae364275fb32943b9656c6", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2018-05-16 08:49:21" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2018-04-30 19:57:29" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2018-04-26 10:06:28" - }, - { - "name": "symfony/process", - "version": "v3.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "4cbf2db9abcb01486a21b7a059e03a62fae63187" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/4cbf2db9abcb01486a21b7a059e03a62fae63187", - "reference": "4cbf2db9abcb01486a21b7a059e03a62fae63187", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2018-05-16 08:49:21" - }, - { - "name": "symfony/translation", - "version": "v3.0.9", - "source": { - "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "eee6c664853fd0576f21ae25725cfffeafe83f26" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/eee6c664853fd0576f21ae25725cfffeafe83f26", - "reference": "eee6c664853fd0576f21ae25725cfffeafe83f26", - "shasum": "" - }, - "require": { - "php": ">=5.5.9", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/config": "<2.8" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0", - "symfony/intl": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0" - }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Translation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Translation Component", - "homepage": "https://symfony.com", - "time": "2016-07-30 07:22:48" - }, - { - "name": "symfony/validator", - "version": "v2.8.41", - "source": { - "type": "git", - "url": "https://github.com/symfony/validator.git", - "reference": "96bbfd5534d2e07ba45255bad27ee90d3bc121a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/validator/zipball/96bbfd5534d2e07ba45255bad27ee90d3bc121a3", - "reference": "96bbfd5534d2e07ba45255bad27ee90d3bc121a3", - "shasum": "" - }, - "require": { - "php": ">=5.3.9", - "symfony/polyfill-ctype": "~1.8", - "symfony/polyfill-mbstring": "~1.0", - "symfony/translation": "~2.4|~3.0.0" - }, - "require-dev": { - "doctrine/annotations": "~1.0", - "doctrine/cache": "~1.0", - "egulias/email-validator": "^1.2.1", - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/http-foundation": "~2.3|~3.0.0", - "symfony/intl": "~2.7.25|^2.8.18|~3.2.5", - "symfony/property-access": "~2.3|~3.0.0", - "symfony/yaml": "^2.0.5|~3.0.0" - }, - "suggest": { - "doctrine/annotations": "For using the annotation mapping. You will also need doctrine/cache.", - "doctrine/cache": "For using the default cached annotation reader and metadata cache.", - "egulias/email-validator": "Strict (RFC compliant) email validation", - "symfony/config": "", - "symfony/expression-language": "For using the 2.4 Expression validator", - "symfony/http-foundation": "", - "symfony/intl": "", - "symfony/property-access": "For using the 2.4 Validator API", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Validator\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Validator Component", - "homepage": "https://symfony.com", - "time": "2018-05-07 06:57:27" - }, - { - "name": "symfony/yaml", - "version": "v3.4.11", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c5010cc1692ce1fa328b1fb666961eb3d4a85bb0", - "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-ctype": "~1.8" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2018-05-03 23:18:14" - }, - { - "name": "vlucas/phpdotenv", - "version": "v1.1.1", - "source": { - "type": "git", - "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa", - "reference": "0cac554ce06277e33ddf9f0b7ade4b8bbf2af3fa", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "autoload": { - "psr-0": { - "Dotenv": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD" - ], - "authors": [ - { - "name": "Vance Lucas", - "email": "vance@vancelucas.com", - "homepage": "http://www.vancelucas.com" - } - ], - "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", - "homepage": "http://github.com/vlucas/phpdotenv", - "keywords": [ - "dotenv", - "env", - "environment" - ], - "time": "2015-05-30 15:59:26" - }, - { - "name": "webmozart/assert", - "version": "1.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2018-01-29 19:49:41" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [] -} diff --git a/src/upload/admin/controller/cron/icml.php b/src/upload/admin/controller/cron/icml.php new file mode 100644 index 0000000..7c0b745 --- /dev/null +++ b/src/upload/admin/controller/cron/icml.php @@ -0,0 +1,7 @@ +load->controller('extension/module/retailcrm/icml'); + } +} diff --git a/src/upload/admin/controller/extension/module/retailcrm.php b/src/upload/admin/controller/extension/module/retailcrm.php index 7be03e2..f64d151 100644 --- a/src/upload/admin/controller/extension/module/retailcrm.php +++ b/src/upload/admin/controller/extension/module/retailcrm.php @@ -28,6 +28,7 @@ class ControllerExtensionModuleRetailcrm extends Controller { ) ); + $this->addCronJobs(); $this->addEvents(); } @@ -45,6 +46,7 @@ class ControllerExtensionModuleRetailcrm extends Controller { array(\Retailcrm\Retailcrm::MODULE . '_status' => 0) ); $this->model_setting_setting->deleteSetting('retailcrm_history'); + $this->deleteCronJobs(); $this->deleteEvents(); } @@ -214,7 +216,9 @@ class ControllerExtensionModuleRetailcrm extends Controller { 'special_price_settings', 'special_price', 'order_number', - 'text_order_number' + 'text_order_number', + 'debug', + 'text_debug' ); foreach ($text_strings as $text) { @@ -369,12 +373,14 @@ class ControllerExtensionModuleRetailcrm extends Controller { */ public function history() { - if (file_exists(DIR_APPLICATION . 'model/extension/retailcrm/custom/history/v4-5.php')) { - $this->load->model('extension/retailcrm/custom/history/v4-5'); - $this->model_extension_retailcrm_custom_history_v4_5->request($this->retailcrm->getApiClient()); + $this->load->library('retailcrm/retailcrm'); + + if (file_exists(DIR_APPLICATION . 'model/extension/retailcrm/custom/history.php')) { + $this->load->model('extension/retailcrm/custom/history'); + $this->model_extension_retailcrm_custom_history->request($this->retailcrm->getApiClient()); } else { - $this->load->model('extension/retailcrm/history/v4_5'); - $this->model_extension_retailcrm_history_v4_5->request($this->retailcrm->getApiClient()); + $this->load->model('extension/retailcrm/history'); + $this->model_extension_retailcrm_history->request($this->retailcrm->getApiClient()); } } @@ -385,6 +391,8 @@ class ControllerExtensionModuleRetailcrm extends Controller { */ public function icml() { + $this->load->library('retailcrm/retailcrm'); + if (file_exists(DIR_APPLICATION . 'model/extension/retailcrm/custom/icml.php')) { $this->load->model('extension/retailcrm/custom/icml'); $this->model_extension_retailcrm_custom_icml->generateICML(); @@ -402,7 +410,7 @@ class ControllerExtensionModuleRetailcrm extends Controller { * * @return void */ - public function customer_edit($route, $customer) + public function customerEdit($route, $customer) { $this->load->model('localisation/country'); $this->load->model('localisation/zone'); @@ -443,23 +451,18 @@ class ControllerExtensionModuleRetailcrm extends Controller { $order_id = isset($this->request->get['order_id']) ? $this->request->get['order_id'] : ''; $this->load->model('sale/order'); - $data = $this->model_sale_order->getOrder($order_id); - $data['products'] = $this->model_sale_order->getOrderProducts($order_id); - $data['totals'] = $this->model_sale_order->getOrderTotals($order_id); + $order = $this->model_sale_order->getOrder($order_id); + $order['products'] = $this->model_sale_order->getOrderProducts($order_id); + $order['totals'] = $this->model_sale_order->getOrderTotals($order_id); - foreach ($data['products'] as $key => $product) { - $data['products'][$key]['option'] = $this->model_sale_order->getOrderOptions($product['order_id'], $product['order_product_id']); + foreach ($order['products'] as $key => $product) { + $order['products'][$key]['option'] = $this->model_sale_order->getOrderOptions($product['order_id'], $product['order_product_id']); } - if (!isset($data['fromApi'])) { - $this->load->model('setting/setting'); - $status = $this->model_setting_setting->getSetting(\Retailcrm\Retailcrm::MODULE); - $data['order_status'] = $status[\Retailcrm\Retailcrm::MODULE . '_status'][$data['order_status_id']]; - - $this->load->model('extension/retailcrm/order'); - $this->model_extension_retailcrm_order->uploadOrder($data, $this->retailcrm->getApiClient()); - $response = ModelExtensionRetailcrmOrder::getLastResponse(); - } + $this->load->library('retailcrm/retailcrm'); + $retailcrm_order = $this->retailcrm->createObject(\Retailcrm\Order::class); + $retailcrm_order->prepare($order); + $response = $retailcrm_order->create($this->retailcrm->getApiClient()); if (!$response->isSuccessful()) { if (isset($response['errors'])) { @@ -495,14 +498,17 @@ class ControllerExtensionModuleRetailcrm extends Controller { public function export() { $this->load->model('customer/customer'); - $this->load->model('extension/retailcrm/customer'); - $this->load->model('extension/retailcrm/order'); $this->load->model('sale/order'); + $this->load->library('retailcrm/retailcrm'); + + $retailcrm_api_client = $this->retailcrm->getApiClient(); + $retailcrm_customer = $this->retailcrm->createObject(\Retailcrm\Customer::class); + $retailcrm_order = $this->retailcrm->createObject(\Retailcrm\Order::class); $customers = $this->model_customer_customer->getCustomers(); - $this->model_extension_retailcrm_customer->uploadToCrm($customers, $this->retailcrm->getApiClient()); - $orders = $this->model_sale_order->getOrders(); + $retailcrm_customer->upload($retailcrm_api_client, $customers, 'customers'); + $orders = $this->model_sale_order->getOrders(); $fullOrders = array(); foreach ($orders as $order) { @@ -511,15 +517,14 @@ class ControllerExtensionModuleRetailcrm extends Controller { $fullOrder['totals'] = $this->model_sale_order->getOrderTotals($order['order_id']); $fullOrder['products'] = $this->model_sale_order->getOrderProducts($order['order_id']); - foreach($fullOrder['products'] as $key => $product) { + foreach ($fullOrder['products'] as $key => $product) { $fullOrder['products'][$key]['option'] = $this->model_sale_order->getOrderOptions($product['order_id'], $product['order_product_id']); } $fullOrders[] = $fullOrder; } - $this->model_extension_retailcrm_order->uploadToCrm($fullOrders, $this->retailcrm->getApiClient()); - fopen(DIR_SYSTEM . '/cron/export_done', "x"); + $retailcrm_order->upload($retailcrm_api_client, $fullOrders); } /** @@ -530,6 +535,7 @@ class ControllerExtensionModuleRetailcrm extends Controller { public function prices() { $this->load->model('catalog/product'); + $this->load->library('retailcrm/retailcrm'); $products = $this->model_catalog_product->getProducts(); if (file_exists(DIR_APPLICATION . 'model/extension/retailcrm/custom/prices.php')) { @@ -670,42 +676,42 @@ class ControllerExtensionModuleRetailcrm extends Controller { ->addEvent( \Retailcrm\Retailcrm::MODULE, 'catalog/model/checkout/order/addOrder/after', - 'extension/module/retailcrm/order_create' + 'extension/module/retailcrm/orderCreate' ); $this->model_setting_event ->addEvent( \Retailcrm\Retailcrm::MODULE, - 'catalog/model/checkout/order/addOrderHistory/after', - 'extension/module/retailcrm/order_edit' + 'catalog/model/checkout/order/editOrder/after', + 'extension/module/retailcrm/orderEdit' ); $this->model_setting_event ->addEvent( \Retailcrm\Retailcrm::MODULE, 'catalog/model/account/customer/addCustomer/after', - 'extension/module/retailcrm/customer_create' + 'extension/module/retailcrm/customerCreate' ); $this->model_setting_event ->addEvent( \Retailcrm\Retailcrm::MODULE, 'catalog/model/account/customer/editCustomer/after', - 'extension/module/retailcrm/customer_edit' + 'extension/module/retailcrm/customerEdit' ); $this->model_setting_event ->addEvent( \Retailcrm\Retailcrm::MODULE, 'catalog/model/account/address/editAddress/after', - 'extension/module/retailcrm/customer_edit' + 'extension/module/retailcrm/customerEdit' ); $this->model_setting_event ->addEvent( \Retailcrm\Retailcrm::MODULE, 'admin/model/customer/customer/editCustomer/after', - 'extension/module/retailcrm/customer_edit' + 'extension/module/retailcrm/customerEdit' ); } @@ -719,7 +725,7 @@ class ControllerExtensionModuleRetailcrm extends Controller { $events = $this->model_setting_event->getEvent( \Retailcrm\Retailcrm::MODULE, 'catalog/model/checkout/order/addOrder/after', - 'extension/module/retailcrm/order_create' + 'extension/module/retailcrm/orderCreate' ); if (!empty($events)) { @@ -787,4 +793,16 @@ class ControllerExtensionModuleRetailcrm extends Controller { ) ); } + + private function addCronJobs() { + $this->load->model('setting/cron'); + $this->model_setting_cron->addCron('icml', 'day', 'cron/icml', 1); + $this->model_setting_cron->addCron('prices', 'day', 'cron/icml', 0); + } + + private function deleteCronJobs() { + $this->load->model('setting/cron'); + $this->model_setting_cron->deleteCronByCode('icml'); + $this->model_setting_cron->deleteCronByCode('prices'); + } } diff --git a/src/upload/admin/language/en-gb/extension/module/retailcrm.php b/src/upload/admin/language/en-gb/extension/module/retailcrm.php index 3b7db86..a709fd8 100644 --- a/src/upload/admin/language/en-gb/extension/module/retailcrm.php +++ b/src/upload/admin/language/en-gb/extension/module/retailcrm.php @@ -24,7 +24,7 @@ $_['retailcrm_url'] = 'RetailCRM URL'; $_['retailcrm_apikey'] = 'RetailCRM API Key'; $_['collector_site_key'] = 'Site key'; $_['special_price_settings'] = 'Settings specials'; -$_['special_price'] = 'The type of price at which the share price will be unloaded'; +$_['special_price'] = 'The type of price at which the share price will be unloaded'; $_['text_success_export'] = 'Orders and customers successfully unloaded'; $_['text_success_export_order'] = 'Order successfully unloaded'; @@ -56,7 +56,7 @@ $_['text_error_cf_opencart'] = 'None custom fields in Opencart'; $_['text_error_cf_retailcrm'] = 'None custom fields in RetailCRM'; $_['text_error_save'] = 'Error saving settings'; $_['text_error_log'] = 'Log size more than 2MB'; -$_['text_error_delivery'] = 'Not found delivery methods'; +$_['text_error_delivery'] = 'Not found delivery methods'; $_['text_confirm_log'] = 'Are you sure you want to clear the log?'; $_['retailcrm_dict_delivery'] = 'Shipment methods'; @@ -69,6 +69,9 @@ $_['retailcrm_missing_status'] = 'Missing orders status'; $_['order_number'] = 'Order number'; $_['text_order_number'] = 'Transfer order number to retailCRM'; +$_['debug'] = 'Debug mode'; +$_['text_debug'] = 'Enable debug mode'; + $_['column_total'] = 'Total'; $_['product_summ'] = 'Amount'; diff --git a/src/upload/admin/language/ru-ru/extension/module/retailcrm.php b/src/upload/admin/language/ru-ru/extension/module/retailcrm.php index cbfd9ee..8556707 100644 --- a/src/upload/admin/language/ru-ru/extension/module/retailcrm.php +++ b/src/upload/admin/language/ru-ru/extension/module/retailcrm.php @@ -24,7 +24,7 @@ $_['retailcrm_url'] = 'Адрес RetailCRM'; $_['retailcrm_apikey'] = 'Api ключ RetailCRM'; $_['collector_site_key'] = 'Ключ сайта'; $_['special_price_settings'] = 'Настройка выгрузки акционной цены'; -$_['special_price'] = 'Тип цены, в который будет выгружаться цена по акции'; +$_['special_price'] = 'Тип цены, в который будет выгружаться цена по акции'; $_['text_success_export'] = 'Заказы и клиенты успешно выгружены'; $_['text_success_export_order'] = 'Заказ успешно выгружен'; @@ -56,7 +56,7 @@ $_['text_error_cf_opencart'] = 'Отсутствуют пользовате $_['text_error_cf_retailcrm'] = 'Отсутствуют пользовательские поля в RetailCRM'; $_['text_error_save'] = 'Ошибка сохранения настроек'; $_['text_error_log'] = 'Размер лога более 2MB'; -$_['text_error_delivery'] = 'Не найдены типы доставки'; +$_['text_error_delivery'] = 'Не найдены типы доставки'; $_['text_confirm_log'] = 'Вы уверены, что хотите очистить лог?'; $_['retailcrm_dict_delivery'] = 'Способы доставки'; @@ -69,6 +69,9 @@ $_['retailcrm_missing_status'] = 'Статус пропавших заказо $_['order_number'] = 'Номер заказа'; $_['text_order_number'] = 'Передавать номер заказа в retailCRM'; +$_['debug'] = 'Debug режим'; +$_['text_debug'] = 'Включить подробное логирование'; + $_['column_total'] = 'Итого'; $_['product_summ'] = 'Сумма'; diff --git a/src/upload/admin/model/extension/retailcrm/history.php b/src/upload/admin/model/extension/retailcrm/history.php index 7a46524..bd353b6 100644 --- a/src/upload/admin/model/extension/retailcrm/history.php +++ b/src/upload/admin/model/extension/retailcrm/history.php @@ -1,194 +1,825 @@ db->query("INSERT INTO `" . DB_PREFIX . "order` SET store_id = '" . (int)$order['store_id'] . "', store_name = '" . $order['store_name'] . "', customer_id = '" . (int)$order['customer_id'] . "', customer_group_id = '" . (int)$order['customer_group_id'] . "', firstname = '" . $this->db->escape($order['firstname']) . "', lastname = '" . $this->db->escape($order['lastname']) . "', email = '" . $this->db->escape($order['email']) . "', telephone = '" . $this->db->escape($order['telephone']) . "', custom_field = '" . $this->db->escape(isset($order['custom_field']) ? json_encode($order['custom_field']) : '') . "', payment_firstname = '" . $this->db->escape($order['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($order['payment_lastname']) . "', payment_address_1 = '" . $this->db->escape($order['payment_address_1']) . "', payment_city = '" . $this->db->escape($order['payment_city']) . "', payment_postcode = '" . $this->db->escape($order['payment_postcode']) . "', payment_country = '" . $this->db->escape($order['payment_country']) . "', payment_country_id = '" . (int)$order['payment_country_id'] . "', payment_zone = '" . $this->db->escape($order['payment_zone']) . "', payment_zone_id = '" . (int)$order['payment_zone_id'] . "', payment_method = '" . $this->db->escape($order['payment_method']) . "', payment_code = '" . $this->db->escape($order['payment_code']) . "', shipping_firstname = '" . $this->db->escape($order['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($order['shipping_lastname']) . "', shipping_address_1 = '" . $this->db->escape($order['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($order['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($order['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($order['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($order['shipping_country']) . "', shipping_country_id = '" . (int)$order['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($order['shipping_zone']) . "', shipping_zone_id = '" . (int)$order['shipping_zone_id'] . "', shipping_method = '" . $this->db->escape($order['shipping_method']) . "', shipping_code = '" . $this->db->escape($order['shipping_code']) . "', comment = '" . $this->db->escape($order['comment']) . "', total = '" . (float)$order['total'] . "', affiliate_id = '" . (int)$order['affiliate_id'] . "', language_id = '" . (int)$order['language_id'] . "', currency_id = '" . (int)$order['currency_id'] . "', currency_code = '" . $this->db->escape($order['currency_code']) . "', currency_value = '" . (float)$order['currency_value'] . "', order_status_id = '" . (int)$order['order_status_id'] . "', date_added = NOW(), date_modified = NOW()"); - - $order_id = $this->db->getLastId(); - - // Products - if (isset($order['order_product']) && $order['order_product']) { - $this->addOrderProducts($order_id, $order['order_product']); - } - - // Totals - if (isset($order['order_total'])) { - $this->addOrderTotals($order_id, $order['order_total']); - } - - return $order_id; + parent::__construct($registry); + $this->load->library('retailcrm/retailcrm'); + $this->opencartApiClient = $this->retailcrm->getOcApiClient($registry); } /** - * Edit order in OC - * - * @param int $order_id - * @param array $order - * - * @return void + * Getting changes from RetailCRM + * @param \RetailcrmProxy $retailcrmApiClient + * + * @return boolean */ - public function editOrder($order_id, $order) + public function request($retailcrmApiClient) { - $this->db->query("UPDATE `" . DB_PREFIX . "order` SET customer_id = '" . (int)$order['customer_id'] . "', customer_group_id = '" . (int)$order['customer_group_id'] . "', firstname = '" . $this->db->escape($order['firstname']) . "', lastname = '" . $this->db->escape($order['lastname']) . "', email = '" . $this->db->escape($order['email']) . "', telephone = '" . $this->db->escape($order['telephone']) . "', custom_field = '" . $this->db->escape(json_encode($order['custom_field'])) . "', payment_firstname = '" . $this->db->escape($order['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($order['payment_lastname']) . "', payment_address_1 = '" . $this->db->escape($order['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($order['payment_address_2']) . "', payment_city = '" . $this->db->escape($order['payment_city']) . "', payment_postcode = '" . $this->db->escape($order['payment_postcode']) . "', payment_country = '" . $this->db->escape($order['payment_country']) . "', payment_country_id = '" . (int)$order['payment_country_id'] . "', payment_zone = '" . $this->db->escape($order['payment_zone']) . "', payment_zone_id = '" . (int)$order['payment_zone_id'] . "', payment_method = '" . $this->db->escape($order['payment_method']) . "', payment_code = '" . $this->db->escape($order['payment_code']) . "', shipping_firstname = '" . $this->db->escape($order['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($order['shipping_lastname']) . "', shipping_address_1 = '" . $this->db->escape($order['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($order['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($order['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($order['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($order['shipping_country']) . "', shipping_country_id = '" . (int)$order['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($order['shipping_zone']) . "', shipping_zone_id = '" . (int)$order['shipping_zone_id'] . "', shipping_method = '" . $this->db->escape($order['shipping_method']) . "', shipping_code = '" . $this->db->escape($order['shipping_code']) . "', comment = '" . $this->db->escape($order['comment']) . "', total = '" . (float)$order['total'] . "', order_status_id = '" . (int)$order['order_status_id'] . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "'"); + $this->load->library('retailcrm/retailcrm'); + $this->load->model('setting/setting'); + $this->load->model('setting/store'); + $this->load->model('user/api'); + $this->load->model('sale/order'); + $this->load->model('customer/customer'); + $this->load->model('extension/retailcrm/references'); + $this->load->model('catalog/product'); + $this->load->model('catalog/option'); + $this->load->model('localisation/zone'); - $this->db->query("DELETE FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'"); + $this->load->language('extension/module/retailcrm'); - // Products - if (isset($order['order_product']) && $order['order_product']) { - $this->addOrderProducts($order_id, $order['order_product']); + $settings = $this->model_setting_setting->getSetting(\Retailcrm\Retailcrm::MODULE); + $history = $this->model_setting_setting->getSetting('retailcrm_history'); + $settings['domain'] = parse_url(HTTP_SERVER, PHP_URL_HOST); + + $url = isset($settings[\Retailcrm\Retailcrm::MODULE . '_url']) ? $settings[\Retailcrm\Retailcrm::MODULE . '_url'] : null; + $key = isset($settings[\Retailcrm\Retailcrm::MODULE . '_apikey']) ? $settings[\Retailcrm\Retailcrm::MODULE . '_apikey'] : null; + + if (empty($url) || empty($key)) { + $this->log->addNotice('You need to configure retailcrm module first.'); + return false; } - // Totals - $this->db->query("DELETE FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "'"); + $sinceIdOrders = $history['retailcrm_history_orders'] ? $history['retailcrm_history_orders'] : null; + $sinceIdCustomers = $history['retailcrm_history_customers'] ? $history['retailcrm_history_customers'] : null; - if (isset($order['order_total'])) { - $this->addOrderTotals($order_id, $order['order_total']); + $packsOrders = $retailcrmApiClient->ordersHistory(array( + 'sinceId' => $sinceIdOrders ? $sinceIdOrders : 0 + ), 1, 100); + $packsCustomers = $retailcrmApiClient->customersHistory(array( + 'sinceId' => $sinceIdCustomers ? $sinceIdCustomers : 0 + ), 1, 100); + + if(!$packsOrders->isSuccessful() && count($packsOrders->history) <= 0 && !$packsCustomers->isSuccessful() && count($packsCustomers->history) <= 0) { + return false; } - } - /** - * Add order products - * - * @param int $order_id - * @param array $products - * - * @return void - */ - public function addOrderProducts($order_id, $products) - { - foreach ($products as $product) { - $this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET order_id = '" . (int)$order_id . "', product_id = '" . (int)$product['product_id'] . "', name = '" . $this->db->escape($product['name']) . "', model = '" . $this->db->escape($product['model']) . "', quantity = '" . (int)$product['quantity'] . "', price = '" . (float)$product['price'] . "', total = '" . (float)$product['total'] . "', reward = '" . (float)$product['reward'] . "'"); + $generatedAt = $packsOrders['generatedAt']; + $orders = RetailcrmHistoryHelper::assemblyOrder($packsOrders->history); + $customers = RetailcrmHistoryHelper::assemblyCustomer($packsCustomers->history); - $order_product_id = $this->db->getLastId(); + $ordersHistory = $packsOrders->history; + $customersHistory = $packsCustomers->history; - foreach ($product['option'] as $option) { - $this->db->query("INSERT INTO " . DB_PREFIX . "order_option SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', product_option_id = '" . (int)$option['product_option_id'] . "', product_option_value_id = '" . (int)$option['product_option_value_id'] . "', name = '" . $this->db->escape($option['name']) . "', `value` = '" . $this->db->escape($option['value']) . "', `type` = '" . $this->db->escape($option['type']) . "'"); + $lastChangeOrders = $ordersHistory ? end($ordersHistory) : null; + $lastChangeCustomers = $customersHistory ? end($customersHistory) : null; + + if ($lastChangeOrders !== null) { + $sinceIdOrders = $lastChangeOrders['id']; + } + + if ($lastChangeCustomers !== null) { + $sinceIdCustomers = $lastChangeCustomers['id']; + } + + $this->settings = $settings; + $this->totalTitle = $this->totalTitles(); + $this->subtotalSettings = $this->model_setting_setting->getSetting($this->totalTitle . 'sub_total'); + $this->totalSettings = $this->model_setting_setting->getSetting($this->totalTitle . 'total'); + $this->shippingSettings = $this->model_setting_setting->getSetting($this->totalTitle . 'shipping'); + + $this->delivery = array_flip($settings[\Retailcrm\Retailcrm::MODULE . '_delivery']); + $this->payment = array_flip($settings[\Retailcrm\Retailcrm::MODULE . '_payment']); + $this->status = array_flip($settings[\Retailcrm\Retailcrm::MODULE . '_status']); + $this->delivery_default = $settings[\Retailcrm\Retailcrm::MODULE . '_default_shipping']; + $this->payment_default = $settings[\Retailcrm\Retailcrm::MODULE . '_default_payment']; + $this->ocPayment = $this->model_extension_retailcrm_references + ->getOpercartPaymentTypes(); + + $this->ocDelivery = $this->model_extension_retailcrm_references + ->getOpercartDeliveryTypes($this->opencartApiClient); + + $this->zones = $this->model_localisation_zone->getZones(); + + if (isset($settings[\Retailcrm\Retailcrm::MODULE . '_custom_field'])) { + $this->customFieldSetting = array_flip($settings[\Retailcrm\Retailcrm::MODULE . '_custom_field']); + } + + $updatedOrders = array(); + $newOrders = array(); + + foreach ($orders as $order) { + + if (isset($order['deleted'])) { + continue; + } + + if (isset($order['externalId'])) { + $updatedOrders[] = $order['id']; + } else { + $newOrders[] = $order['id']; } } + + unset($orders); + + $updateCustomers = array(); + + foreach ($customers as $customer) { + + if (isset($customer['deleted'])) { + continue; + } + + if (isset($customer['externalId'])) { + $updateCustomers[] = $customer['id']; + } + } + + unset($customers); + + if (!empty($updateCustomers)) { + $customers = $retailcrmApiClient->customersList($filter = array('ids' => $updateCustomers)); + if ($customers) { + $this->updateCustomers($customers['customers']); + } + } + + if (!empty($newOrders)) { + $orders = $retailcrmApiClient->ordersList($filter = array('ids' => $newOrders)); + if ($orders) { + $this->createResult = $this->createOrders($orders['orders']); + } + } + + if (!empty($updatedOrders)) { + $orders = $retailcrmApiClient->ordersList($filter = array('ids' => $updatedOrders)); + if ($orders) { + $this->updateOrders($orders['orders']); + } + } + + $this->model_setting_setting->editSetting( + 'retailcrm_history', + array( + 'retailcrm_history_orders' => $sinceIdOrders, + 'retailcrm_history_customers' => $sinceIdCustomers, + 'retailcrm_history_datetime' => $generatedAt + ) + ); + + if (!empty($this->createResult['customers'])) { + $retailcrmApiClient->customersFixExternalIds($this->createResult['customers']); + } + + if (!empty($this->createResult['orders'])) { + $retailcrmApiClient->ordersFixExternalIds($this->createResult['orders']); + } + + return true; } /** - * Add order totals - * - * @param int $order_id - * @param array $totals - * + * Update orders from history + * + * @param array $orders + * * @return void */ - public function addOrderTotals($order_id, $totals) + protected function updateOrders($orders) { - foreach ($totals as $total) { - $this->db->query("INSERT INTO " . DB_PREFIX . "order_total SET order_id = '" . (int)$order_id . "', code = '" . $this->db->escape($total['code']) . "', title = '" . $this->db->escape($total['title']) . "', `value` = '" . (float)$total['value'] . "', sort_order = '" . (int)$total['sort_order'] . "'"); + foreach ($orders as $order) { + $ocOrder = $this->model_sale_order->getOrder($order['externalId']); + + if (isset($order['payments']) && $order['payments']) { + foreach ($order['payments'] as $orderPayment) { + if (isset($orderPayment['externalId'])) { + $payment = $orderPayment; + } + } + + if (!isset($payment) && count($order['payments']) == 1) { + $payment = end($order['payments']); + } + } elseif (isset($order['paymentType'])) { + $payment['type'] = $order['paymentType']; + } + + $data = array(); + + $mail = isset($order['email']) ? $order['email'] : $order['customer']['email']; + $phone = isset($order['phone']) ? $order['phone'] : ''; + + if (!$phone) { + $data['telephone'] = $order['customer']['phones'] ? $order['customer']['phones'][0]['number'] : '80000000000'; + } else { + $data['telephone'] = $phone; + } + + if (isset($order['customer']['externalId']) && $order['customer']['externalId']) { + $customer = $this->model_customer_customer->getCustomer($order['customer']['externalId']); + } + + $data['customer'] = $order['firstName']; + $data['customer_id'] = (isset($customer)) ? $customer['customer_id'] : 0; + $data['customer_group_id'] = (isset($customer)) ? $customer['customer_group_id'] : 1; + $data['firstname'] = $order['firstName']; + $data['lastname'] = isset($order['lastName']) ? $order['lastName'] : $order['firstName']; + $data['email'] = $mail ? $mail : uniqid() . '@retailrcm.ru'; + $data['comment'] = !empty($order['customerComment']) ? $order['customerComment'] : ''; + $data['payment_address'] = '0'; + $data['payment_firstname'] = $order['firstName']; + $data['payment_lastname'] = isset($order['lastName']) ? $order['lastName'] : $order['firstName']; + $data['payment_address_1'] = isset($order['customer']['address']) ? $order['customer']['address']['text'] : ''; + $data['payment_address_2'] = ''; + $data['payment_city'] = !empty($order['customer']['address']['city']) ? $order['customer']['address']['city'] : $order['delivery']['address']['city']; + $data['payment_postcode'] = !empty( $order['customer']['address']['index'] ) ? $order['customer']['address']['index'] : $order['delivery']['address']['index']; + + $shippingZone = ''; + + if (is_int($order['delivery']['address']['region'])) { + $shippingZone = $order['delivery']['address']['region']; + } else { + $shippingZone = $this->getZoneByName($order['delivery']['address']['region']); + + if ($shippingZone) { + $shipping_zone_id = $shippingZone['zone_id']; + } else { + $shipping_zone_id = 0; + } + } + + if (isset($order['customer']['address']['region'])) { + $paymentZone = $this->getZoneByName($order['customer']['address']['region']); + + if ($paymentZone) { + $payment_zone_id = $paymentZone['zone_id']; + } else { + $payment_zone_id = 0; + } + } + + if (isset($order['countryIso']) && !empty($order['countryIso'])) { + $shippingCountry = $this->getCountryByIsoCode($order['countryIso']); + } + + if (isset($order['customer']['address']['countryIso']) && !empty($order['customer']['address']['countryIso'])) { + $paymentCountry = $this->getCountryByIsoCode($order['customer']['address']['countryIso']); + } else { + $paymentCountry = $this->getCountryByIsoCode($order['countryIso']); + } + + $delivery = isset($order['delivery']['code']) ? $order['delivery']['code'] : null; + $data['payment_country_id'] = $paymentCountry ? $paymentCountry['country_id'] : $ocOrder['payment_country_id']; + $data['payment_country'] = isset($paymentCountry) ? $paymentCountry['name'] : $ocOrder['payment_country']; + $data['payment_zone_id'] = $payment_zone_id ? $payment_zone_id : $ocOrder['payment_zone_id']; + $data['payment_zone'] = isset($order['customer']['address']['region']) ? $order['customer']['address']['region'] : $ocOrder['payment_zone']; + $data['shipping_country_id'] = isset($shippingCountry) ? $shippingCountry['country_id'] : $ocOrder['shipping_country_id']; + $data['shipping_country'] = isset($shippingCountry) ? $shippingCountry['name'] : $ocOrder['shipping_country']; + $data['shipping_zone_id'] = $shipping_zone_id ? $shipping_zone_id : $ocOrder['shipping_zone_id']; + $data['shipping_zone'] = $shippingZone ? $shippingZone['name'] : $ocOrder['shipping_zone']; + $data['shipping_address'] = '0'; + $data['shipping_firstname'] = $order['firstName']; + $data['shipping_lastname'] = isset($order['lastName']) ? $order['lastName'] : $order['firstName']; + $data['shipping_address_1'] = $order['delivery']['address']['text']; + $data['shipping_address_2'] = ''; + $data['shipping_company'] = ''; + $data['shipping_company_id'] = ''; + $data['shipping_city'] = $order['delivery']['address']['city']; + $data['shipping_postcode'] = $order['delivery']['address']['index']; + + if ($delivery !== null) { + if (isset($this->settings[\Retailcrm\Retailcrm::MODULE . '_delivery'][$ocOrder['shipping_code']]) + && isset($this->delivery[$delivery]) + ) { + $data['shipping'] = $this->delivery[$delivery]; + + $shipping = explode('.', $data['shipping']); + $shippingModule = $shipping[0]; + + if (isset($this->ocDelivery[$shippingModule][$data['shipping']]['title'])) { + $data['shipping_method'] = $this->ocDelivery[$shippingModule][$data['shipping']]['title']; + } else { + $data['shipping_method'] = $this->ocDelivery[$shippingModule]['title']; + } + + $data['shipping_code'] = $data['shipping']; + } elseif (!isset($this->settings[\Retailcrm\Retailcrm::MODULE . '_delivery'][$ocOrder['shipping_code']]) + ) { + $data['shipping_method'] = $ocOrder['shipping_method']; + $data['shipping_code'] = $ocOrder['shipping_code']; + } + } else { + if (!isset($this->settings[$ocOrder['shipping_code']]) + || !isset($this->delivery[$delivery]) + ) { + $data['shipping_method'] = $ocOrder['shipping_method']; + $data['shipping_code'] = $ocOrder['shipping_code']; + } + } + + if (isset($payment)) { + $data['payment'] = $this->payment[$payment['type']]; + $data['payment_method'] = isset($this->ocPayment[$data['payment']]) ? $this->ocPayment[$data['payment']] : $ocOrder['payment_method']; + $data['payment_code'] = isset($this->payment[$payment['type']]) ? $this->payment[$payment['type']] : $ocOrder['payment_code']; + } else { + $data['payment_method'] = $ocOrder['payment_method']; + $data['payment_code'] = $ocOrder['payment_code']; + } + + // this data will not retrive from crm for now + $data['tax'] = ''; + $data['tax_id'] = ''; + $data['product'] = ''; + $data['product_id'] = ''; + $data['reward'] = ''; + $data['affiliate'] = ''; + $data['affiliate_id'] = ''; + $data['payment_tax_id'] = ''; + $data['order_product_id'] = ''; + $data['payment_company'] = ''; + $data['payment_company_id'] = ''; + $data['company'] = ''; + $data['company_id'] = ''; + + $data['order_product'] = array(); + + $discount = false; + + foreach ($order['items'] as $item) { + $productId = $item['offer']['externalId']; + $options = array(); + + if (isset($item['discountTotal']) && $item['discountTotal'] > 0) { + $discount = true; + } + + if (mb_strpos($item['offer']['externalId'], '#') > 1) { + $offer = explode('#', $item['offer']['externalId']); + $productId = $offer[0]; + $optionsFromCRM = explode('_', $offer[1]); + + foreach ($optionsFromCRM as $optionFromCRM) { + $optionData = explode('-', $optionFromCRM); + $productOptionId = $optionData[0]; + $optionValueId = $optionData[1]; + + $productOptions = $this->model_catalog_product->getProductOptions($productId); + + foreach($productOptions as $productOption) { + if($productOptionId == $productOption['product_option_id']) { + foreach($productOption['product_option_value'] as $productOptionValue) { + if($productOptionValue['option_value_id'] == $optionValueId) { + $options[] = array( + 'product_option_id' => $productOptionId, + 'product_option_value_id' => $productOptionValue['product_option_value_id'], + 'value' => $this->getOptionValue($productOptionValue['option_value_id'], 'name'), + 'type' => $productOption['type'], + 'name' => $productOption['name'], + ); + } + } + } + } + } + } + + $product = $this->model_catalog_product->getProduct($productId); + $rewards = $this->model_catalog_product->getProductRewards($productId); + + $data['order_product'][] = array( + 'name' => $product['name'], + 'model' => $product['model'], + 'price' => $item['initialPrice'], + 'total' => (float)($item['initialPrice'] * $item['quantity']), + 'product_id' => $productId, + 'quantity' => $item['quantity'], + 'option' => $options, + 'reward' => $rewards[$data['customer_group_id']]['points'] * $item['quantity'] + ); + } + + if (isset($this->customFieldSetting) && $order['customFields']) { + foreach ($order['customFields'] as $code => $value) { + if (array_key_exists($code, $this->customFieldSetting)) { + $fieldCode = str_replace('o_', '', $this->customFieldSetting[$code]); + $customFields[$fieldCode] = $value; + } + } + + $data['custom_field'] = isset($customFields) ? $customFields : ''; + } else { + $data['custom_field'] = $ocOrder['custom_field']; + } + + $deliveryCost = !empty($order['delivery']['cost']) ? $order['delivery']['cost'] : 0; + + $data['total'] = $order['totalSumm']; + $data['order_total'] = array( + array( + 'order_total_id' => '', + 'code' => 'sub_total', + 'title' => $this->language->get('product_summ'), + 'value' => $order['summ'], + 'text' => $order['summ'], + 'sort_order' => $this->subtotalSettings['sub_total_sort_order'] + ), + array( + 'order_total_id' => '', + 'code' => 'shipping', + 'title' => $data['shipping_method'], + 'value' => $deliveryCost, + 'text' => $deliveryCost, + 'sort_order' => $this->shippingSettings[$this->totalTitle . 'shipping_sort_order'] + ), + array( + 'order_total_id' => '', + 'code' => 'total', + 'title' => $this->language->get('column_total'), + 'value' => isset($order['totalSumm']) ? $order['totalSumm'] : $order['summ'] + $deliveryCost, + 'text' => isset($order['totalSumm']) ? $order['totalSumm'] : $order['summ'] + $deliveryCost, + 'sort_order' => $this->totalSettings[$this->totalTitle . 'total_sort_order'] + ) + ); + + if ((isset($order['discount']) + && $order['discount'] > 0) + || $discount + ) { + $orderTotals = $this->model_sale_order->getOrderTotals($order['externalId']); + foreach ($orderTotals as $orderTotal) { + if ($orderTotal['code'] == 'coupon' + || $orderTotal['code'] == 'reward' + ) { + $data['order_total'][] = $orderTotal; + } + } + } + + $data['fromApi'] = true; + + if (array_key_exists($order['status'], $this->status)) { + $data['order_status_id'] = $this->status[$order['status']]; + } else { + $tmpOrder = $this->model_sale_order->getOrder($order['externalId']); + $data['order_status_id'] = $tmpOrder['order_status_id']; + } + + $this->editOrder($order['externalId'], $data); + $this->opencartApiClient->addHistory($order['externalId'], $data['order_status_id']); } } /** - * Get total titles - * - * @return string $title - */ - protected function totalTitles() - { - if (version_compare(VERSION, '3.0', '<')) { - $title = ''; - } else { - $title = 'total_'; - } - - return $title; - } - - /** - * Get country by iso code 2 - * - * @param string $isoCode - * + * Create orders from history + * + * @param array $orders + * * @return array */ - public function getCountryByIsoCode($isoCode) + protected function createOrders($orders) { - $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "country` WHERE iso_code_2 = '" . $isoCode . "'"); - - return $query->row; - } + $customersIdsFix = array(); + $ordersIdsFix = array(); - /** - * Get zone by name - * - * @param string $name - * - * @return array - */ - public function getZoneByName($name) - { - $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone` WHERE name = '" . $name . "'"); + foreach ($orders as $order) { + $store = $this->config->get('config_store_id'); - return $query->row; - } + if (isset($order['payments']) && $order['payments']) { + $payment = end($order['payments']); + } elseif (isset($order['paymentType'])) { + $payment['type'] = $order['paymentType']; + } - /** - * Get currency - * - * @param string $code - * @param string $field (default = '') - * - * @return mixed array | string - */ - public function getCurrencyByCode($code, $field = '') - { - $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "currency` WHERE code = '" . $code . "'"); + $customer_id = (!empty($order['customer']['externalId'])) + ? $order['customer']['externalId'] + : 0; - if (!$field) { - return $query->row; + $data = array(); + + if ($customer_id == 0) { + if (isset($order['customer']['address']['countryIso'])) { + $customerCountry = $this->getCountryByIsoCode($order['customer']['address']['countryIso']); + } else { + $customerCountry = $this->getCountryByIsoCode($order['delivery']['address']['countryIso']); + } + + if (isset($order['customer']['address']['region'])) { + $customerZone = $this->getZoneByName($order['customer']['address']['region']); + } else { + $customerZone = $this->getZoneByName($order['delivery']['address']['region']); + } + + $cData = array( + 'store_id' => 0, + 'customer_group_id' => '1', + 'firstname' => isset($order['patronymic']) ? $order['firstName'] . ' ' . $order['patronymic'] : $order['firstName'], + 'lastname' => (!empty($order['customer']['lastName'])) ? $order['customer']['lastName'] : ' ', + 'email' => $order['customer']['email'], + 'telephone' => $order['customer']['phones'] ? $order['customer']['phones'][0]['number'] : ' ', + 'fax' => '', + 'newsletter' => 0, + 'password' => 'tmppass', + 'status' => 1, + 'approved' => 1, + 'safe' => 0, + 'affiliate' => '', + 'address' => array( + array( + 'firstname' => isset($order['patronymic']) ? $order['firstName'] . ' ' . $order['patronymic'] : $order['firstName'], + 'lastname' => (!empty($order['customer']['lastName'])) ? $order['customer']['lastName'] : ' ', + 'address_1' => $order['customer']['address']['text'], + 'address_2' => ' ', + 'city' => !empty($order['customer']['address']['city']) ? $order['customer']['address']['city'] : $order['delivery']['address']['city'], + 'postcode' => isset($order['customer']['address']['index']) ? $order['customer']['address']['index'] : $order['delivery']['address']['index'], + 'tax_id' => '1', + 'company' => '', + 'company_id' => '', + 'zone_id' => $customerZone ? $customerZone['zone_id'] : 0, + 'country_id' => $customerCountry ? $customerCountry['country_id'] : 0, + 'default' => '1' + ) + ), + ); + + $customer_id = $this->model_customer_customer->addCustomer($cData); + + $customersIdsFix[] = array('id' => $order['customer']['id'], 'externalId' => (int)$customer_id); + } + + $mail = isset($order['email']) ? $order['email'] : $order['customer']['email']; + $phone = isset($order['phone']) ? $order['phone'] : ''; + + if (!$phone) { + $data['telephone'] = $order['customer']['phones'] ? $order['customer']['phones'][0]['number'] : '80000000000'; + } else { + $data['telephone'] = $phone; + } + + $data['currency_code'] = $this->config->get('config_currency'); + $data['currency_value'] = $this->getCurrencyByCode($data['currency_code'], 'value'); + $data['currency_id'] = $this->getCurrencyByCode($data['currency_code'], 'currency_id'); + $data['language_id'] = $this->getLanguageByCode($this->config->get('config_language'), 'language_id'); + $data['store_id'] = $store == null ? 0 : $store; + $data['store_name'] = $this->config->get('config_name'); + $data['customer'] = $order['firstName']; + $data['customer_id'] = $customer_id; + $data['customer_group_id'] = 1; + $data['firstname'] = $order['firstName']; + $data['lastname'] = (isset($order['lastName'])) ? $order['lastName'] : $order['firstName']; + $data['email'] = $mail ? $mail : uniqid() . '@retailrcm.ru'; + $data['comment'] = !empty($order['customerComment']) ? $order['customerComment'] : ''; + $data['fax'] = ''; + $data['payment_address'] = '0'; + $data['payment_firstname'] = $order['firstName']; + $data['payment_lastname'] = (isset($order['lastName'])) ? $order['lastName'] : $order['firstName']; + $data['payment_address_1'] = $order['customer']['address']['text']; + $data['payment_address_2'] = ''; + $data['payment_company'] = ''; + $data['payment_company_id'] = ''; + $data['payment_city'] = !empty($order['customer']['address']['city']) ? $order['customer']['address']['city'] : $order['delivery']['address']['city']; + $data['payment_postcode'] = !empty($order['customer']['address']['index']) ? $order['customer']['address']['index'] : $order['delivery']['address']['index']; + + $shippingZone = ''; + + if (!empty($order['delivery']['address']['region']) && is_int($order['delivery']['address']['region'])) { + $shippingZone = $order['delivery']['address']['region']; + } else { + $shippingZone = $this->getZoneByName($order['delivery']['address']['region']); + + if ($shippingZone) { + $shipping_zone_id = $shippingZone['zone_id']; + } else { + $shipping_zone_id = 0; + } + } + + if (isset($order['customer']['address']['region'])) { + $paymentZone = $this->getZoneByName($order['customer']['address']['region']); + + if ($paymentZone) { + $payment_zone_id = $paymentZone['zone_id']; + } else { + $payment_zone_id = 0; + } + } + + if (isset($order['countryIso'])) { + $shippingCountry = $this->getCountryByIsoCode($order['countryIso']); + } + + if (isset($order['customer']['address']['countryIso'])) { + $paymentCountry = $this->getCountryByIsoCode($order['customer']['address']['countryIso']); + } + + $delivery = isset($order['delivery']['code']) ? $order['delivery']['code'] : null; + $data['payment_country_id'] = $paymentCountry ? $paymentCountry['country_id'] : 0; + $data['payment_country'] = isset($paymentCountry) ? $paymentCountry['name'] : ''; + $data['payment_zone_id'] = $payment_zone_id; + $data['payment_zone'] = isset($order['customer']['address']['region']) ? $order['customer']['address']['region'] : ''; + $data['shipping_country_id'] = isset($shippingCountry) ? $shippingCountry['country_id'] : 0; + $data['shipping_country'] = isset($shippingCountry) ? $shippingCountry['name'] : ''; + $data['shipping_zone_id'] = $shipping_zone_id; + $data['shipping_zone'] = $shippingZone ? $shippingZone['name'] : $data['payment_zone']; + $data['shipping_address'] = '0'; + $data['shipping_firstname'] = $order['firstName']; + $data['shipping_lastname'] = (isset($order['lastName'])) ? $order['lastName'] : $order['firstName']; + $data['shipping_address_1'] = $order['delivery']['address']['text']; + $data['shipping_address_2'] = ''; + $data['shipping_company'] = ''; + $data['shipping_company_id'] = ''; + $data['shipping_city'] = $order['delivery']['address']['city']; + $data['shipping_postcode'] = $order['delivery']['address']['index']; + $data['shipping'] = $delivery != null ? $this->delivery[$delivery] : $this->delivery_default; + $data['shipping_code'] = $delivery != null ? $this->delivery[$delivery] : $this->delivery_default; + + $shipping = explode('.', $data['shipping']); + $shippingModule = $shipping[0]; + + if (isset($this->ocDelivery[$shippingModule][$data['shipping']]['title'])) { + $data['shipping_method'] = $this->ocDelivery[$shippingModule][$data['shipping']]['title']; + } else { + $data['shipping_method'] = $this->ocDelivery[$shippingModule]['title']; + } + + if (isset($payment)) { + $data['payment'] = $this->payment[$payment['type']]; + $data['payment_method'] = $this->ocPayment[$data['payment']]; + $data['payment_code'] = $this->payment[$payment['type']]; + } else { + $data['payment'] = $this->payment_default; + $data['payment_method'] = $this->ocPayment[$data['payment']]; + $data['payment_code'] = $this->payment_default; + } + + // this data will not retrive from crm for now + $data['tax'] = ''; + $data['tax_id'] = ''; + $data['product'] = ''; + $data['product_id'] = ''; + $data['reward'] = ''; + $data['affiliate'] = ''; + $data['affiliate_id'] = 0; + $data['payment_tax_id'] = ''; + $data['order_product_id'] = ''; + $data['payment_company'] = ''; + $data['payment_company_id'] = ''; + $data['company'] = ''; + $data['company_id'] = ''; + + $data['order_product'] = array(); + + foreach ($order['items'] as $item) { + $productId = $item['offer']['externalId']; + $options = array(); + + if(mb_strpos($item['offer']['externalId'], '#') > 1) { + $offer = explode('#', $item['offer']['externalId']); + $productId = $offer[0]; + $optionsFromCRM = explode('_', $offer[1]); + + foreach ($optionsFromCRM as $optionFromCRM) { + $optionData = explode('-', $optionFromCRM); + $productOptionId = $optionData[0]; + $optionValueId = $optionData[1]; + + $productOptions = $this->model_catalog_product->getProductOptions($productId); + + foreach($productOptions as $productOption) { + if($productOptionId == $productOption['product_option_id']) { + foreach($productOption['product_option_value'] as $productOptionValue) { + if($productOptionValue['option_value_id'] == $optionValueId) { + $options[] = array( + 'product_option_id' => $productOptionId, + 'product_option_value_id' => $productOptionValue['product_option_value_id'], + 'value' => $this->getOptionValue($productOptionValue['option_value_id'], 'name'), + 'type' => $productOption['type'], + 'name' => $productOption['name'], + ); + } + } + } + } + } + } + + $product = $this->model_catalog_product->getProduct($productId); + $rewards = $this->model_catalog_product->getProductRewards($productId); + + $data['order_product'][] = array( + 'name' => $product['name'], + 'model' => $product['model'], + 'price' => $item['initialPrice'], + 'total' => (float)($item['initialPrice'] * $item['quantity']), + 'product_id' => $productId, + 'quantity' => $item['quantity'], + 'option' => $options, + 'reward' => $rewards[$data['customer_group_id']]['points'] * $item['quantity'] + ); + } + + if (isset($this->customFieldSetting) && $order['customFields']) { + foreach ($order['customFields'] as $code => $value) { + if (array_key_exists($code, $this->customFieldSetting)) { + $fieldCode = str_replace('o_', '', $this->customFieldSetting[$code]); + $customFields[$fieldCode] = $value; + } + } + + $data['custom_field'] = isset($customFields) ? $customFields : ''; + } + + $deliveryCost = !empty($order['delivery']['cost']) ? $order['delivery']['cost'] : 0; + + $data['total'] = $order['totalSumm']; + $data['order_total'] = array( + array( + 'order_total_id' => '', + 'code' => 'sub_total', + 'title' => $this->language->get('product_summ'), + 'value' => $order['summ'], + 'text' => $order['summ'], + 'sort_order' => $this->subtotalSettings['sub_total_sort_order'] + ), + array( + 'order_total_id' => '', + 'code' => 'shipping', + 'title' => $data['shipping_method'], + 'value' => $deliveryCost, + 'text' => $deliveryCost, + 'sort_order' => $this->shippingSettings[$this->totalTitle . 'shipping_sort_order'] + ), + array( + 'order_total_id' => '', + 'code' => 'total', + 'title' => $this->language->get('column_total'), + 'value' => !empty($order['totalSumm']) ? $order['totalSumm'] : $order['summ'] + $deliveryCost, + 'text' => isset($order['totalSumm']) ? $order['totalSumm'] : $order['summ'] + $deliveryCost, + 'sort_order' => $this->totalSettings[$this->totalTitle . 'total_sort_order'] + ) + ); + + $data['fromApi'] = true; + $data['order_status_id'] = 1; + + $order_id = $this->addOrder($data); + + $ordersIdsFix[] = array('id' => $order['id'], 'externalId' => (int) $order_id); } - return $query->row[$field]; + return array('customers' => $customersIdsFix, 'orders' => $ordersIdsFix); } - /** - * Get language - * - * @param string $code - * @param string $field (default = '') - * - * @return mixed array | string - */ - public function getLanguageByCode($code, $field = '') + protected function updateCustomers($customers) { - $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE code = '" . $code . "'"); + foreach ($customers as $customer) { + $customer_id = $customer['externalId']; + $customerData = $this->model_customer_customer->getCustomer($customer_id); + $customerData['password'] = false; - if (!$field) { - return $query->row; + $customerData['firstname'] = $customer['firstName']; + $customerData['lastname'] = isset($customer['lastName']) ? $customer['lastName'] : ''; + $customerData['email'] = $customer['email']; + $customerData['telephone'] = $customer['phones'] ? $customer['phones'][0]['number'] : ''; + + $customerAddress = $this->model_customer_customer->getAddress($customerData['address_id']); + + if (isset($customer['address']['countryIso'])) { + $customerCountry = $this->getCountryByIsoCode($customer['address']['countryIso']); + } + + if (isset($customer['address']['region'])) { + $customerZone = $this->getZoneByName($customer['address']['region']); + } + + $customerAddress['firstname'] = isset($customer['patronymic']) ? $customer['firstName'] . ' ' . $customer['patronymic'] : $customer['firstName']; + $customerAddress['lastname'] = isset($customer['lastName']) ? $customer['lastName'] : ''; + $customerAddress['address_1'] = $customer['address']['text']; + $customerAddress['city'] = $customer['address']['city']; + $customerAddress['postcode'] = isset($customer['address']['index']) ? $customer['address']['index'] : ''; + + if (isset($customerCountry)) { + $customerAddress['country_id'] = $customerCountry['country_id']; + } + + if (isset($customerZone) && isset($customerZone['zone_id'])) { + $customerAddress['zone_id'] = $customerZone['zone_id']; + } + + $customerData['address'] = array($customerAddress); + + if (isset($this->customFieldSetting) && $customer['customFields']) { + foreach ($customer['customFields'] as $code => $value) { + if (array_key_exists($code, $this->customFieldSetting)) { + $fieldCode = str_replace('c_', '', $this->customFieldSetting[$code]); + $customFields[$fieldCode] = $value; + } + } + + $customerData['custom_field'] = isset($customFields) ? $customFields : ''; + } + + $this->model_customer_customer->editCustomer($customer_id, $customerData); } - - return $query->row[$field]; - } - - /** - * Get product option value - * - * @param int $option_value_id - * @param string $field - * - * @return mixed array | string - */ - public function getOptionValue($option_value_id, $field = '') - { - $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "option_value_description` WHERE option_value_id = '" . $option_value_id . "'"); - - if (!$field) { - return $query->row; - } - - return $query->row[$field]; } } diff --git a/src/upload/admin/model/extension/retailcrm/history/v4_5.php b/src/upload/admin/model/extension/retailcrm/history/v4_5.php deleted file mode 100644 index 8d82b3f..0000000 --- a/src/upload/admin/model/extension/retailcrm/history/v4_5.php +++ /dev/null @@ -1,827 +0,0 @@ -load->library('retailcrm/retailcrm'); - $this->moduleTitle = $this->retailcrm->getModuleTitle(); - $this->opencartApiClient = $this->retailcrm->getOcApiClient($registry); - } - - /** - * Getting changes from RetailCRM - * @param \RetailcrmProxy $retailcrmApiClient - * - * @return boolean - */ - public function request($retailcrmApiClient) - { - $this->load->library('retailcrm/retailcrm'); - $this->load->model('setting/setting'); - $this->load->model('setting/store'); - $this->load->model('user/api'); - $this->load->model('sale/order'); - $this->load->model('customer/customer'); - $this->load->model('extension/retailcrm/references'); - $this->load->model('catalog/product'); - $this->load->model('catalog/option'); - $this->load->model('localisation/zone'); - - $this->load->language('extension/module/retailcrm'); - - $settings = $this->model_setting_setting->getSetting($this->moduleTitle); - $history = $this->model_setting_setting->getSetting('retailcrm_history'); - $settings['domain'] = parse_url(HTTP_SERVER, PHP_URL_HOST); - - $url = isset($settings[$this->moduleTitle . '_url']) ? $settings[$this->moduleTitle . '_url'] : null; - $key = isset($settings[$this->moduleTitle . '_apikey']) ? $settings[$this->moduleTitle . '_apikey'] : null; - - if (empty($url) || empty($key)) { - $this->log->addNotice('You need to configure retailcrm module first.'); - return false; - } - - $sinceIdOrders = $history['retailcrm_history_orders'] ? $history['retailcrm_history_orders'] : null; - $sinceIdCustomers = $history['retailcrm_history_customers'] ? $history['retailcrm_history_customers'] : null; - - $packsOrders = $retailcrmApiClient->ordersHistory(array( - 'sinceId' => $sinceIdOrders ? $sinceIdOrders : 0 - ), 1, 100); - $packsCustomers = $retailcrmApiClient->customersHistory(array( - 'sinceId' => $sinceIdCustomers ? $sinceIdCustomers : 0 - ), 1, 100); - - if(!$packsOrders->isSuccessful() && count($packsOrders->history) <= 0 && !$packsCustomers->isSuccessful() && count($packsCustomers->history) <= 0) { - return false; - } - - $generatedAt = $packsOrders['generatedAt']; - $orders = RetailcrmHistoryHelper::assemblyOrder($packsOrders->history); - $customers = RetailcrmHistoryHelper::assemblyCustomer($packsCustomers->history); - - $ordersHistory = $packsOrders->history; - $customersHistory = $packsCustomers->history; - - $lastChangeOrders = $ordersHistory ? end($ordersHistory) : null; - $lastChangeCustomers = $customersHistory ? end($customersHistory) : null; - - if ($lastChangeOrders !== null) { - $sinceIdOrders = $lastChangeOrders['id']; - } - - if ($lastChangeCustomers !== null) { - $sinceIdCustomers = $lastChangeCustomers['id']; - } - - $this->settings = $settings; - $this->totalTitle = $this->totalTitles(); - $this->subtotalSettings = $this->model_setting_setting->getSetting($this->totalTitle . 'sub_total'); - $this->totalSettings = $this->model_setting_setting->getSetting($this->totalTitle . 'total'); - $this->shippingSettings = $this->model_setting_setting->getSetting($this->totalTitle . 'shipping'); - - $this->delivery = array_flip($settings[$this->moduleTitle . '_delivery']); - $this->payment = array_flip($settings[$this->moduleTitle . '_payment']); - $this->status = array_flip($settings[$this->moduleTitle . '_status']); - $this->delivery_default = $settings[$this->moduleTitle . '_default_shipping']; - $this->payment_default = $settings[$this->moduleTitle . '_default_payment']; - $this->ocPayment = $this->model_extension_retailcrm_references - ->getOpercartPaymentTypes(); - - $this->ocDelivery = $this->model_extension_retailcrm_references - ->getOpercartDeliveryTypes(); - - $this->zones = $this->model_localisation_zone->getZones(); - - if (isset($settings[$this->moduleTitle . '_custom_field'])) { - $this->customFieldSetting = array_flip($settings[$this->moduleTitle . '_custom_field']); - } - - $updatedOrders = array(); - $newOrders = array(); - - foreach ($orders as $order) { - - if (isset($order['deleted'])) { - continue; - } - - if (isset($order['externalId'])) { - $updatedOrders[] = $order['id']; - } else { - $newOrders[] = $order['id']; - } - } - - unset($orders); - - $updateCustomers = array(); - - foreach ($customers as $customer) { - - if (isset($customer['deleted'])) { - continue; - } - - if (isset($customer['externalId'])) { - $updateCustomers[] = $customer['id']; - } - } - - unset($customers); - - if (!empty($updateCustomers)) { - $customers = $retailcrmApiClient->customersList($filter = array('ids' => $updateCustomers)); - if ($customers) { - $this->updateCustomers($customers['customers']); - } - } - - if (!empty($newOrders)) { - $orders = $retailcrmApiClient->ordersList($filter = array('ids' => $newOrders)); - if ($orders) { - $this->createResult = $this->createOrders($orders['orders']); - } - } - - if (!empty($updatedOrders)) { - $orders = $retailcrmApiClient->ordersList($filter = array('ids' => $updatedOrders)); - if ($orders) { - $this->updateOrders($orders['orders']); - } - } - - $this->model_setting_setting->editSetting( - 'retailcrm_history', - array( - 'retailcrm_history_orders' => $sinceIdOrders, - 'retailcrm_history_customers' => $sinceIdCustomers, - 'retailcrm_history_datetime' => $generatedAt - ) - ); - - if (!empty($this->createResult['customers'])) { - $retailcrmApiClient->customersFixExternalIds($this->createResult['customers']); - } - - if (!empty($this->createResult['orders'])) { - $retailcrmApiClient->ordersFixExternalIds($this->createResult['orders']); - } - - return true; - } - - /** - * Update orders from history - * - * @param array $orders - * - * @return void - */ - protected function updateOrders($orders) - { - foreach ($orders as $order) { - $ocOrder = $this->model_sale_order->getOrder($order['externalId']); - - if (isset($order['payments']) && $order['payments']) { - foreach ($order['payments'] as $orderPayment) { - if (isset($orderPayment['externalId'])) { - $payment = $orderPayment; - } - } - - if (!isset($payment) && count($order['payments']) == 1) { - $payment = end($order['payments']); - } - } elseif (isset($order['paymentType'])) { - $payment['type'] = $order['paymentType']; - } - - $data = array(); - - $mail = isset($order['email']) ? $order['email'] : $order['customer']['email']; - $phone = isset($order['phone']) ? $order['phone'] : ''; - - if (!$phone) { - $data['telephone'] = $order['customer']['phones'] ? $order['customer']['phones'][0]['number'] : '80000000000'; - } else { - $data['telephone'] = $phone; - } - - if (isset($order['customer']['externalId']) && $order['customer']['externalId']) { - $customer = $this->model_customer_customer->getCustomer($order['customer']['externalId']); - } - - $data['customer'] = $order['firstName']; - $data['customer_id'] = (isset($customer)) ? $customer['customer_id'] : 0; - $data['customer_group_id'] = (isset($customer)) ? $customer['customer_group_id'] : 1; - $data['firstname'] = $order['firstName']; - $data['lastname'] = isset($order['lastName']) ? $order['lastName'] : $order['firstName']; - $data['email'] = $mail ? $mail : uniqid() . '@retailrcm.ru'; - $data['comment'] = !empty($order['customerComment']) ? $order['customerComment'] : ''; - $data['payment_address'] = '0'; - $data['payment_firstname'] = $order['firstName']; - $data['payment_lastname'] = isset($order['lastName']) ? $order['lastName'] : $order['firstName']; - $data['payment_address_1'] = isset($order['customer']['address']) ? $order['customer']['address']['text'] : ''; - $data['payment_address_2'] = ''; - $data['payment_city'] = !empty($order['customer']['address']['city']) ? $order['customer']['address']['city'] : $order['delivery']['address']['city']; - $data['payment_postcode'] = !empty( $order['customer']['address']['index'] ) ? $order['customer']['address']['index'] : $order['delivery']['address']['index']; - - $shippingZone = ''; - - if (is_int($order['delivery']['address']['region'])) { - $shippingZone = $order['delivery']['address']['region']; - } else { - $shippingZone = $this->getZoneByName($order['delivery']['address']['region']); - - if ($shippingZone) { - $shipping_zone_id = $shippingZone['zone_id']; - } else { - $shipping_zone_id = 0; - } - } - - if (isset($order['customer']['address']['region'])) { - $paymentZone = $this->getZoneByName($order['customer']['address']['region']); - - if ($paymentZone) { - $payment_zone_id = $paymentZone['zone_id']; - } else { - $payment_zone_id = 0; - } - } - - if (isset($order['countryIso']) && !empty($order['countryIso'])) { - $shippingCountry = $this->getCountryByIsoCode($order['countryIso']); - } - - if (isset($order['customer']['address']['countryIso']) && !empty($order['customer']['address']['countryIso'])) { - $paymentCountry = $this->getCountryByIsoCode($order['customer']['address']['countryIso']); - } else { - $paymentCountry = $this->getCountryByIsoCode($order['countryIso']); - } - - $delivery = isset($order['delivery']['code']) ? $order['delivery']['code'] : null; - $data['payment_country_id'] = $paymentCountry ? $paymentCountry['country_id'] : $ocOrder['payment_country_id']; - $data['payment_country'] = isset($paymentCountry) ? $paymentCountry['name'] : $ocOrder['payment_country']; - $data['payment_zone_id'] = $payment_zone_id ? $payment_zone_id : $ocOrder['payment_zone_id']; - $data['payment_zone'] = isset($order['customer']['address']['region']) ? $order['customer']['address']['region'] : $ocOrder['payment_zone']; - $data['shipping_country_id'] = isset($shippingCountry) ? $shippingCountry['country_id'] : $ocOrder['shipping_country_id']; - $data['shipping_country'] = isset($shippingCountry) ? $shippingCountry['name'] : $ocOrder['shipping_country']; - $data['shipping_zone_id'] = $shipping_zone_id ? $shipping_zone_id : $ocOrder['shipping_zone_id']; - $data['shipping_zone'] = $shippingZone ? $shippingZone['name'] : $ocOrder['shipping_zone']; - $data['shipping_address'] = '0'; - $data['shipping_firstname'] = $order['firstName']; - $data['shipping_lastname'] = isset($order['lastName']) ? $order['lastName'] : $order['firstName']; - $data['shipping_address_1'] = $order['delivery']['address']['text']; - $data['shipping_address_2'] = ''; - $data['shipping_company'] = ''; - $data['shipping_company_id'] = ''; - $data['shipping_city'] = $order['delivery']['address']['city']; - $data['shipping_postcode'] = $order['delivery']['address']['index']; - - if ($delivery !== null) { - if (isset($this->settings[$this->moduleTitle . '_delivery'][$ocOrder['shipping_code']]) - && isset($this->delivery[$delivery]) - ) { - $data['shipping'] = $this->delivery[$delivery]; - - $shipping = explode('.', $data['shipping']); - $shippingModule = $shipping[0]; - - if (isset($this->ocDelivery[$shippingModule][$data['shipping']]['title'])) { - $data['shipping_method'] = $this->ocDelivery[$shippingModule][$data['shipping']]['title']; - } else { - $data['shipping_method'] = $this->ocDelivery[$shippingModule]['title']; - } - - $data['shipping_code'] = $data['shipping']; - } elseif (!isset($this->settings[$this->moduleTitle . '_delivery'][$ocOrder['shipping_code']]) - ) { - $data['shipping_method'] = $ocOrder['shipping_method']; - $data['shipping_code'] = $ocOrder['shipping_code']; - } - } else { - if (!isset($this->settings[$ocOrder['shipping_code']]) - || !isset($this->delivery[$delivery]) - ) { - $data['shipping_method'] = $ocOrder['shipping_method']; - $data['shipping_code'] = $ocOrder['shipping_code']; - } - } - - if (isset($payment)) { - $data['payment'] = $this->payment[$payment['type']]; - $data['payment_method'] = isset($this->ocPayment[$data['payment']]) ? $this->ocPayment[$data['payment']] : $ocOrder['payment_method']; - $data['payment_code'] = isset($this->payment[$payment['type']]) ? $this->payment[$payment['type']] : $ocOrder['payment_code']; - } else { - $data['payment_method'] = $ocOrder['payment_method']; - $data['payment_code'] = $ocOrder['payment_code']; - } - - // this data will not retrive from crm for now - $data['tax'] = ''; - $data['tax_id'] = ''; - $data['product'] = ''; - $data['product_id'] = ''; - $data['reward'] = ''; - $data['affiliate'] = ''; - $data['affiliate_id'] = ''; - $data['payment_tax_id'] = ''; - $data['order_product_id'] = ''; - $data['payment_company'] = ''; - $data['payment_company_id'] = ''; - $data['company'] = ''; - $data['company_id'] = ''; - - $data['order_product'] = array(); - - $discount = false; - - foreach ($order['items'] as $item) { - $productId = $item['offer']['externalId']; - $options = array(); - - if (isset($item['discountTotal']) && $item['discountTotal'] > 0) { - $discount = true; - } - - if (mb_strpos($item['offer']['externalId'], '#') > 1) { - $offer = explode('#', $item['offer']['externalId']); - $productId = $offer[0]; - $optionsFromCRM = explode('_', $offer[1]); - - foreach ($optionsFromCRM as $optionFromCRM) { - $optionData = explode('-', $optionFromCRM); - $productOptionId = $optionData[0]; - $optionValueId = $optionData[1]; - - $productOptions = $this->model_catalog_product->getProductOptions($productId); - - foreach($productOptions as $productOption) { - if($productOptionId == $productOption['product_option_id']) { - foreach($productOption['product_option_value'] as $productOptionValue) { - if($productOptionValue['option_value_id'] == $optionValueId) { - $options[] = array( - 'product_option_id' => $productOptionId, - 'product_option_value_id' => $productOptionValue['product_option_value_id'], - 'value' => $this->getOptionValue($productOptionValue['option_value_id'], 'name'), - 'type' => $productOption['type'], - 'name' => $productOption['name'], - ); - } - } - } - } - } - } - - $product = $this->model_catalog_product->getProduct($productId); - $rewards = $this->model_catalog_product->getProductRewards($productId); - - $data['order_product'][] = array( - 'name' => $product['name'], - 'model' => $product['model'], - 'price' => $item['initialPrice'], - 'total' => (float)($item['initialPrice'] * $item['quantity']), - 'product_id' => $productId, - 'quantity' => $item['quantity'], - 'option' => $options, - 'reward' => $rewards[$data['customer_group_id']]['points'] * $item['quantity'] - ); - } - - if (isset($this->customFieldSetting) && $order['customFields']) { - foreach ($order['customFields'] as $code => $value) { - if (array_key_exists($code, $this->customFieldSetting)) { - $fieldCode = str_replace('o_', '', $this->customFieldSetting[$code]); - $customFields[$fieldCode] = $value; - } - } - - $data['custom_field'] = isset($customFields) ? $customFields : ''; - } else { - $data['custom_field'] = $ocOrder['custom_field']; - } - - $deliveryCost = !empty($order['delivery']['cost']) ? $order['delivery']['cost'] : 0; - - $data['total'] = $order['totalSumm']; - $data['order_total'] = array( - array( - 'order_total_id' => '', - 'code' => 'sub_total', - 'title' => $this->language->get('product_summ'), - 'value' => $order['summ'], - 'text' => $order['summ'], - 'sort_order' => $this->subtotalSettings['sub_total_sort_order'] - ), - array( - 'order_total_id' => '', - 'code' => 'shipping', - 'title' => $data['shipping_method'], - 'value' => $deliveryCost, - 'text' => $deliveryCost, - 'sort_order' => $this->shippingSettings[$this->totalTitle . 'shipping_sort_order'] - ), - array( - 'order_total_id' => '', - 'code' => 'total', - 'title' => $this->language->get('column_total'), - 'value' => isset($order['totalSumm']) ? $order['totalSumm'] : $order['summ'] + $deliveryCost, - 'text' => isset($order['totalSumm']) ? $order['totalSumm'] : $order['summ'] + $deliveryCost, - 'sort_order' => $this->totalSettings[$this->totalTitle . 'total_sort_order'] - ) - ); - - if ((isset($order['discount']) - && $order['discount'] > 0) - || $discount - ) { - $orderTotals = $this->model_sale_order->getOrderTotals($order['externalId']); - foreach ($orderTotals as $orderTotal) { - if ($orderTotal['code'] == 'coupon' - || $orderTotal['code'] == 'reward' - ) { - $data['order_total'][] = $orderTotal; - } - } - } - - $data['fromApi'] = true; - - if (array_key_exists($order['status'], $this->status)) { - $data['order_status_id'] = $this->status[$order['status']]; - } else { - $tmpOrder = $this->model_sale_order->getOrder($order['externalId']); - $data['order_status_id'] = $tmpOrder['order_status_id']; - } - - $this->editOrder($order['externalId'], $data); - $this->opencartApiClient->addHistory($order['externalId'], $data['order_status_id']); - } - } - - /** - * Create orders from history - * - * @param array $orders - * - * @return array - */ - protected function createOrders($orders) - { - $customersIdsFix = array(); - $ordersIdsFix = array(); - - foreach ($orders as $order) { - $store = $this->config->get('config_store_id'); - - if (isset($order['payments']) && $order['payments']) { - $payment = end($order['payments']); - } elseif (isset($order['paymentType'])) { - $payment['type'] = $order['paymentType']; - } - - $customer_id = (!empty($order['customer']['externalId'])) - ? $order['customer']['externalId'] - : 0; - - $data = array(); - - if ($customer_id == 0) { - if (isset($order['customer']['address']['countryIso'])) { - $customerCountry = $this->getCountryByIsoCode($order['customer']['address']['countryIso']); - } else { - $customerCountry = $this->getCountryByIsoCode($order['delivery']['address']['countryIso']); - } - - if (isset($order['customer']['address']['region'])) { - $customerZone = $this->getZoneByName($order['customer']['address']['region']); - } else { - $customerZone = $this->getZoneByName($order['delivery']['address']['region']); - } - - $cData = array( - 'store_id' => 0, - 'customer_group_id' => '1', - 'firstname' => isset($order['patronymic']) ? $order['firstName'] . ' ' . $order['patronymic'] : $order['firstName'], - 'lastname' => (!empty($order['customer']['lastName'])) ? $order['customer']['lastName'] : ' ', - 'email' => $order['customer']['email'], - 'telephone' => $order['customer']['phones'] ? $order['customer']['phones'][0]['number'] : ' ', - 'fax' => '', - 'newsletter' => 0, - 'password' => 'tmppass', - 'status' => 1, - 'approved' => 1, - 'safe' => 0, - 'affiliate' => '', - 'address' => array( - array( - 'firstname' => isset($order['patronymic']) ? $order['firstName'] . ' ' . $order['patronymic'] : $order['firstName'], - 'lastname' => (!empty($order['customer']['lastName'])) ? $order['customer']['lastName'] : ' ', - 'address_1' => $order['customer']['address']['text'], - 'address_2' => ' ', - 'city' => !empty($order['customer']['address']['city']) ? $order['customer']['address']['city'] : $order['delivery']['address']['city'], - 'postcode' => isset($order['customer']['address']['index']) ? $order['customer']['address']['index'] : $order['delivery']['address']['index'], - 'tax_id' => '1', - 'company' => '', - 'company_id' => '', - 'zone_id' => $customerZone ? $customerZone['zone_id'] : 0, - 'country_id' => $customerCountry ? $customerCountry['country_id'] : 0, - 'default' => '1' - ) - ), - ); - - $customer_id = $this->model_customer_customer->addCustomer($cData); - - $customersIdsFix[] = array('id' => $order['customer']['id'], 'externalId' => (int)$customer_id); - } - - $mail = isset($order['email']) ? $order['email'] : $order['customer']['email']; - $phone = isset($order['phone']) ? $order['phone'] : ''; - - if (!$phone) { - $data['telephone'] = $order['customer']['phones'] ? $order['customer']['phones'][0]['number'] : '80000000000'; - } else { - $data['telephone'] = $phone; - } - - $data['currency_code'] = $this->config->get('config_currency'); - $data['currency_value'] = $this->getCurrencyByCode($data['currency_code'], 'value'); - $data['currency_id'] = $this->getCurrencyByCode($data['currency_code'], 'currency_id'); - $data['language_id'] = $this->getLanguageByCode($this->config->get('config_language'), 'language_id'); - $data['store_id'] = $store == null ? 0 : $store; - $data['store_name'] = $this->config->get('config_name'); - $data['customer'] = $order['firstName']; - $data['customer_id'] = $customer_id; - $data['customer_group_id'] = 1; - $data['firstname'] = $order['firstName']; - $data['lastname'] = (isset($order['lastName'])) ? $order['lastName'] : $order['firstName']; - $data['email'] = $mail ? $mail : uniqid() . '@retailrcm.ru'; - $data['comment'] = !empty($order['customerComment']) ? $order['customerComment'] : ''; - $data['fax'] = ''; - $data['payment_address'] = '0'; - $data['payment_firstname'] = $order['firstName']; - $data['payment_lastname'] = (isset($order['lastName'])) ? $order['lastName'] : $order['firstName']; - $data['payment_address_1'] = $order['customer']['address']['text']; - $data['payment_address_2'] = ''; - $data['payment_company'] = ''; - $data['payment_company_id'] = ''; - $data['payment_city'] = !empty($order['customer']['address']['city']) ? $order['customer']['address']['city'] : $order['delivery']['address']['city']; - $data['payment_postcode'] = !empty($order['customer']['address']['index']) ? $order['customer']['address']['index'] : $order['delivery']['address']['index']; - - $shippingZone = ''; - - if (!empty($order['delivery']['address']['region']) && is_int($order['delivery']['address']['region'])) { - $shippingZone = $order['delivery']['address']['region']; - } else { - $shippingZone = $this->getZoneByName($order['delivery']['address']['region']); - - if ($shippingZone) { - $shipping_zone_id = $shippingZone['zone_id']; - } else { - $shipping_zone_id = 0; - } - } - - if (isset($order['customer']['address']['region'])) { - $paymentZone = $this->getZoneByName($order['customer']['address']['region']); - - if ($paymentZone) { - $payment_zone_id = $paymentZone['zone_id']; - } else { - $payment_zone_id = 0; - } - } - - if (isset($order['countryIso'])) { - $shippingCountry = $this->getCountryByIsoCode($order['countryIso']); - } - - if (isset($order['customer']['address']['countryIso'])) { - $paymentCountry = $this->getCountryByIsoCode($order['customer']['address']['countryIso']); - } - - $delivery = isset($order['delivery']['code']) ? $order['delivery']['code'] : null; - $data['payment_country_id'] = $paymentCountry ? $paymentCountry['country_id'] : 0; - $data['payment_country'] = isset($paymentCountry) ? $paymentCountry['name'] : ''; - $data['payment_zone_id'] = $payment_zone_id; - $data['payment_zone'] = isset($order['customer']['address']['region']) ? $order['customer']['address']['region'] : ''; - $data['shipping_country_id'] = isset($shippingCountry) ? $shippingCountry['country_id'] : 0; - $data['shipping_country'] = isset($shippingCountry) ? $shippingCountry['name'] : ''; - $data['shipping_zone_id'] = $shipping_zone_id; - $data['shipping_zone'] = $shippingZone ? $shippingZone['name'] : $data['payment_zone']; - $data['shipping_address'] = '0'; - $data['shipping_firstname'] = $order['firstName']; - $data['shipping_lastname'] = (isset($order['lastName'])) ? $order['lastName'] : $order['firstName']; - $data['shipping_address_1'] = $order['delivery']['address']['text']; - $data['shipping_address_2'] = ''; - $data['shipping_company'] = ''; - $data['shipping_company_id'] = ''; - $data['shipping_city'] = $order['delivery']['address']['city']; - $data['shipping_postcode'] = $order['delivery']['address']['index']; - $data['shipping'] = $delivery != null ? $this->delivery[$delivery] : $this->delivery_default; - $data['shipping_code'] = $delivery != null ? $this->delivery[$delivery] : $this->delivery_default; - - $shipping = explode('.', $data['shipping']); - $shippingModule = $shipping[0]; - - if (isset($this->ocDelivery[$shippingModule][$data['shipping']]['title'])) { - $data['shipping_method'] = $this->ocDelivery[$shippingModule][$data['shipping']]['title']; - } else { - $data['shipping_method'] = $this->ocDelivery[$shippingModule]['title']; - } - - if (isset($payment)) { - $data['payment'] = $this->payment[$payment['type']]; - $data['payment_method'] = $this->ocPayment[$data['payment']]; - $data['payment_code'] = $this->payment[$payment['type']]; - } else { - $data['payment'] = $this->payment_default; - $data['payment_method'] = $this->ocPayment[$data['payment']]; - $data['payment_code'] = $this->payment_default; - } - - // this data will not retrive from crm for now - $data['tax'] = ''; - $data['tax_id'] = ''; - $data['product'] = ''; - $data['product_id'] = ''; - $data['reward'] = ''; - $data['affiliate'] = ''; - $data['affiliate_id'] = 0; - $data['payment_tax_id'] = ''; - $data['order_product_id'] = ''; - $data['payment_company'] = ''; - $data['payment_company_id'] = ''; - $data['company'] = ''; - $data['company_id'] = ''; - - $data['order_product'] = array(); - - foreach ($order['items'] as $item) { - $productId = $item['offer']['externalId']; - $options = array(); - - if(mb_strpos($item['offer']['externalId'], '#') > 1) { - $offer = explode('#', $item['offer']['externalId']); - $productId = $offer[0]; - $optionsFromCRM = explode('_', $offer[1]); - - foreach ($optionsFromCRM as $optionFromCRM) { - $optionData = explode('-', $optionFromCRM); - $productOptionId = $optionData[0]; - $optionValueId = $optionData[1]; - - $productOptions = $this->model_catalog_product->getProductOptions($productId); - - foreach($productOptions as $productOption) { - if($productOptionId == $productOption['product_option_id']) { - foreach($productOption['product_option_value'] as $productOptionValue) { - if($productOptionValue['option_value_id'] == $optionValueId) { - $options[] = array( - 'product_option_id' => $productOptionId, - 'product_option_value_id' => $productOptionValue['product_option_value_id'], - 'value' => $this->getOptionValue($productOptionValue['option_value_id'], 'name'), - 'type' => $productOption['type'], - 'name' => $productOption['name'], - ); - } - } - } - } - } - } - - $product = $this->model_catalog_product->getProduct($productId); - $rewards = $this->model_catalog_product->getProductRewards($productId); - - $data['order_product'][] = array( - 'name' => $product['name'], - 'model' => $product['model'], - 'price' => $item['initialPrice'], - 'total' => (float)($item['initialPrice'] * $item['quantity']), - 'product_id' => $productId, - 'quantity' => $item['quantity'], - 'option' => $options, - 'reward' => $rewards[$data['customer_group_id']]['points'] * $item['quantity'] - ); - } - - if (isset($this->customFieldSetting) && $order['customFields']) { - foreach ($order['customFields'] as $code => $value) { - if (array_key_exists($code, $this->customFieldSetting)) { - $fieldCode = str_replace('o_', '', $this->customFieldSetting[$code]); - $customFields[$fieldCode] = $value; - } - } - - $data['custom_field'] = isset($customFields) ? $customFields : ''; - } - - $deliveryCost = !empty($order['delivery']['cost']) ? $order['delivery']['cost'] : 0; - - $data['total'] = $order['totalSumm']; - $data['order_total'] = array( - array( - 'order_total_id' => '', - 'code' => 'sub_total', - 'title' => $this->language->get('product_summ'), - 'value' => $order['summ'], - 'text' => $order['summ'], - 'sort_order' => $this->subtotalSettings['sub_total_sort_order'] - ), - array( - 'order_total_id' => '', - 'code' => 'shipping', - 'title' => $data['shipping_method'], - 'value' => $deliveryCost, - 'text' => $deliveryCost, - 'sort_order' => $this->shippingSettings[$this->totalTitle . 'shipping_sort_order'] - ), - array( - 'order_total_id' => '', - 'code' => 'total', - 'title' => $this->language->get('column_total'), - 'value' => !empty($order['totalSumm']) ? $order['totalSumm'] : $order['summ'] + $deliveryCost, - 'text' => isset($order['totalSumm']) ? $order['totalSumm'] : $order['summ'] + $deliveryCost, - 'sort_order' => $this->totalSettings[$this->totalTitle . 'total_sort_order'] - ) - ); - - $data['fromApi'] = true; - $data['order_status_id'] = 1; - - $order_id = $this->addOrder($data); - - $ordersIdsFix[] = array('id' => $order['id'], 'externalId' => (int) $order_id); - } - - return array('customers' => $customersIdsFix, 'orders' => $ordersIdsFix); - } - - protected function updateCustomers($customers) - { - foreach ($customers as $customer) { - $customer_id = $customer['externalId']; - $customerData = $this->model_customer_customer->getCustomer($customer_id); - $customerData['password'] = false; - - $customerData['firstname'] = $customer['firstName']; - $customerData['lastname'] = isset($customer['lastName']) ? $customer['lastName'] : ''; - $customerData['email'] = $customer['email']; - $customerData['telephone'] = $customer['phones'] ? $customer['phones'][0]['number'] : ''; - - $customerAddress = $this->model_customer_customer->getAddress($customerData['address_id']); - - if (isset($customer['address']['countryIso'])) { - $customerCountry = $this->getCountryByIsoCode($customer['address']['countryIso']); - } - - if (isset($customer['address']['region'])) { - $customerZone = $this->getZoneByName($customer['address']['region']); - } - - $customerAddress['firstname'] = isset($customer['patronymic']) ? $customer['firstName'] . ' ' . $customer['patronymic'] : $customer['firstName']; - $customerAddress['lastname'] = isset($customer['lastName']) ? $customer['lastName'] : ''; - $customerAddress['address_1'] = $customer['address']['text']; - $customerAddress['city'] = $customer['address']['city']; - $customerAddress['postcode'] = isset($customer['address']['index']) ? $customer['address']['index'] : ''; - - if (isset($customerCountry)) { - $customerAddress['country_id'] = $customerCountry['country_id']; - } - - if (isset($customerZone) && isset($customerZone['zone_id'])) { - $customerAddress['zone_id'] = $customerZone['zone_id']; - } - - $customerData['address'] = array($customerAddress); - - if (isset($this->customFieldSetting) && $customer['customFields']) { - foreach ($customer['customFields'] as $code => $value) { - if (array_key_exists($code, $this->customFieldSetting)) { - $fieldCode = str_replace('c_', '', $this->customFieldSetting[$code]); - $customFields[$fieldCode] = $value; - } - } - - $customerData['custom_field'] = isset($customFields) ? $customFields : ''; - } - - $this->model_customer_customer->editCustomer($customer_id, $customerData); - } - } -} diff --git a/src/upload/admin/model/extension/retailcrm/icml.php b/src/upload/admin/model/extension/retailcrm/icml.php index d0afb5c..3efd10d 100644 --- a/src/upload/admin/model/extension/retailcrm/icml.php +++ b/src/upload/admin/model/extension/retailcrm/icml.php @@ -15,7 +15,7 @@ class ModelExtensionRetailcrmIcml extends Model /** * Constructor - * + * * @param Registry $registry */ public function __construct($registry) @@ -267,7 +267,7 @@ class ModelExtensionRetailcrmIcml extends Model private function generateImage($image) { $this->load->model('tool/image'); - + $currentTheme = $this->config->get('config_theme'); $width = $this->config->get($currentTheme . '_image_related_width') ? $this->config->get($currentTheme . '_image_related_width') : 200; $height = $this->config->get($currentTheme . '_image_related_height') ? $this->config->get($currentTheme . '_image_related_height') : 200; diff --git a/src/upload/admin/model/extension/retailcrm/order.php b/src/upload/admin/model/extension/retailcrm/order.php index b870b97..d065c66 100644 --- a/src/upload/admin/model/extension/retailcrm/order.php +++ b/src/upload/admin/model/extension/retailcrm/order.php @@ -1,305 +1,194 @@ load->model('setting/setting'); - $this->load->library('retailcrm/retailcrm'); + $this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET store_id = '" . (int)$order['store_id'] . "', store_name = '" . $order['store_name'] . "', customer_id = '" . (int)$order['customer_id'] . "', customer_group_id = '" . (int)$order['customer_group_id'] . "', firstname = '" . $this->db->escape($order['firstname']) . "', lastname = '" . $this->db->escape($order['lastname']) . "', email = '" . $this->db->escape($order['email']) . "', telephone = '" . $this->db->escape($order['telephone']) . "', custom_field = '" . $this->db->escape(isset($order['custom_field']) ? json_encode($order['custom_field']) : '') . "', payment_firstname = '" . $this->db->escape($order['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($order['payment_lastname']) . "', payment_address_1 = '" . $this->db->escape($order['payment_address_1']) . "', payment_city = '" . $this->db->escape($order['payment_city']) . "', payment_postcode = '" . $this->db->escape($order['payment_postcode']) . "', payment_country = '" . $this->db->escape($order['payment_country']) . "', payment_country_id = '" . (int)$order['payment_country_id'] . "', payment_zone = '" . $this->db->escape($order['payment_zone']) . "', payment_zone_id = '" . (int)$order['payment_zone_id'] . "', payment_method = '" . $this->db->escape($order['payment_method']) . "', payment_code = '" . $this->db->escape($order['payment_code']) . "', shipping_firstname = '" . $this->db->escape($order['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($order['shipping_lastname']) . "', shipping_address_1 = '" . $this->db->escape($order['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($order['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($order['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($order['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($order['shipping_country']) . "', shipping_country_id = '" . (int)$order['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($order['shipping_zone']) . "', shipping_zone_id = '" . (int)$order['shipping_zone_id'] . "', shipping_method = '" . $this->db->escape($order['shipping_method']) . "', shipping_code = '" . $this->db->escape($order['shipping_code']) . "', comment = '" . $this->db->escape($order['comment']) . "', total = '" . (float)$order['total'] . "', affiliate_id = '" . (int)$order['affiliate_id'] . "', language_id = '" . (int)$order['language_id'] . "', currency_id = '" . (int)$order['currency_id'] . "', currency_code = '" . $this->db->escape($order['currency_code']) . "', currency_value = '" . (float)$order['currency_value'] . "', order_status_id = '" . (int)$order['order_status_id'] . "', date_added = NOW(), date_modified = NOW()"); - $this->moduleTitle = $this->retailcrm->getModuleTitle(); - $this->settings = $this->model_setting_setting->getSetting($this->moduleTitle); + $order_id = $this->db->getLastId(); + + // Products + if (isset($order['order_product']) && $order['order_product']) { + $this->addOrderProducts($order_id, $order['order_product']); + } + + // Totals + if (isset($order['order_total'])) { + $this->addOrderTotals($order_id, $order['order_total']); + } + + return $order_id; } /** - * Upload orders to CRM + * Edit order in OC * - * @param array $orders - * @param \RetailcrmProxy $retailcrmApiClient + * @param int $order_id + * @param array $order * - * @return mixed + * @return void */ - public function uploadToCrm($orders, $retailcrmApiClient) + public function editOrder($order_id, $order) { - if ($retailcrmApiClient === false) { - return false; + $this->db->query("UPDATE `" . DB_PREFIX . "order` SET customer_id = '" . (int)$order['customer_id'] . "', customer_group_id = '" . (int)$order['customer_group_id'] . "', firstname = '" . $this->db->escape($order['firstname']) . "', lastname = '" . $this->db->escape($order['lastname']) . "', email = '" . $this->db->escape($order['email']) . "', telephone = '" . $this->db->escape($order['telephone']) . "', custom_field = '" . $this->db->escape(json_encode($order['custom_field'])) . "', payment_firstname = '" . $this->db->escape($order['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($order['payment_lastname']) . "', payment_address_1 = '" . $this->db->escape($order['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($order['payment_address_2']) . "', payment_city = '" . $this->db->escape($order['payment_city']) . "', payment_postcode = '" . $this->db->escape($order['payment_postcode']) . "', payment_country = '" . $this->db->escape($order['payment_country']) . "', payment_country_id = '" . (int)$order['payment_country_id'] . "', payment_zone = '" . $this->db->escape($order['payment_zone']) . "', payment_zone_id = '" . (int)$order['payment_zone_id'] . "', payment_method = '" . $this->db->escape($order['payment_method']) . "', payment_code = '" . $this->db->escape($order['payment_code']) . "', shipping_firstname = '" . $this->db->escape($order['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($order['shipping_lastname']) . "', shipping_address_1 = '" . $this->db->escape($order['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($order['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($order['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($order['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($order['shipping_country']) . "', shipping_country_id = '" . (int)$order['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($order['shipping_zone']) . "', shipping_zone_id = '" . (int)$order['shipping_zone_id'] . "', shipping_method = '" . $this->db->escape($order['shipping_method']) . "', shipping_code = '" . $this->db->escape($order['shipping_code']) . "', comment = '" . $this->db->escape($order['comment']) . "', total = '" . (float)$order['total'] . "', order_status_id = '" . (int)$order['order_status_id'] . "', date_modified = NOW() WHERE order_id = '" . (int)$order_id . "'"); + + $this->db->query("DELETE FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'"); + + // Products + if (isset($order['order_product']) && $order['order_product']) { + $this->addOrderProducts($order_id, $order['order_product']); } - $ordersToCrm = array(); + // Totals + $this->db->query("DELETE FROM " . DB_PREFIX . "order_total WHERE order_id = '" . (int)$order_id . "'"); - foreach ($orders as $order) { - $ordersToCrm[] = $this->process($order); + if (isset($order['order_total'])) { + $this->addOrderTotals($order_id, $order['order_total']); } - - $chunkedOrders = array_chunk($ordersToCrm, 50); - - foreach($chunkedOrders as $ordersPart) { - $retailcrmApiClient->ordersUpload($ordersPart); - } - - return $chunkedOrders; } /** - * Send one order by id - * - * @param array $order_data - * @param \RetailcrmProxy $retailcrmApiClient + * Add order products * - * @return mixed + * @param int $order_id + * @param array $products + * + * @return void */ - public function uploadOrder($order_data, $retailcrmApiClient) + public function addOrderProducts($order_id, $products) { - if ($retailcrmApiClient === false) { - return false; + foreach ($products as $product) { + $this->db->query("INSERT INTO " . DB_PREFIX . "order_product SET order_id = '" . (int)$order_id . "', product_id = '" . (int)$product['product_id'] . "', name = '" . $this->db->escape($product['name']) . "', model = '" . $this->db->escape($product['model']) . "', quantity = '" . (int)$product['quantity'] . "', price = '" . (float)$product['price'] . "', total = '" . (float)$product['total'] . "', reward = '" . (float)$product['reward'] . "'"); + + $order_product_id = $this->db->getLastId(); + + foreach ($product['option'] as $option) { + $this->db->query("INSERT INTO " . DB_PREFIX . "order_option SET order_id = '" . (int)$order_id . "', order_product_id = '" . (int)$order_product_id . "', product_option_id = '" . (int)$option['product_option_id'] . "', product_option_value_id = '" . (int)$option['product_option_value_id'] . "', name = '" . $this->db->escape($option['name']) . "', `value` = '" . $this->db->escape($option['value']) . "', `type` = '" . $this->db->escape($option['type']) . "'"); + } } + } - if (isset($this->request->post['fromApi'])) { - return false; + /** + * Add order totals + * + * @param int $order_id + * @param array $totals + * + * @return void + */ + public function addOrderTotals($order_id, $totals) + { + foreach ($totals as $total) { + $this->db->query("INSERT INTO " . DB_PREFIX . "order_total SET order_id = '" . (int)$order_id . "', code = '" . $this->db->escape($total['code']) . "', title = '" . $this->db->escape($total['title']) . "', `value` = '" . (float)$total['value'] . "', sort_order = '" . (int)$total['sort_order'] . "'"); } + } - $order = $this->process($order_data); - - if (isset($order['customer']['externalId'])) { - $this->load->model('extension/retailcrm/customer'); - $this->load->model('customer/customer'); - $customer = $this->model_customer_customer->getCustomer($order['customer']['externalId']); - $this->model_extension_retailcrm_customer->sendToCrm($customer, $retailcrmApiClient); + /** + * Get total titles + * + * @return string $title + */ + protected function totalTitles() + { + if (version_compare(VERSION, '3.0', '<')) { + $title = ''; } else { - $customers = $retailcrmApiClient->customersList( - array( - 'name' => $order_data['telephone'], - 'email' => $order_data['email'] - ), - 1, - 100 - ); - - if ($customers) { - foreach ($customers['customers'] as $customer) { - $order['customer']['id'] = $customer['id']; - } - } - - unset($customers); + $title = 'total_'; } - self::$lastRepsonse = $retailcrmApiClient->ordersCreate($order); - - return $order; + return $title; } /** - * Process order - * - * @param array $order_data - * - * @return array $order + * Get country by iso code 2 + * + * @param string $isoCode + * + * @return array */ - private function process($order_data) { - $order = array(); - - $this->load->model('catalog/product'); - - if (!empty($order_data['payment_code']) && isset($this->settings[$this->moduleTitle . '_payment'][$order_data['payment_code']])) { - $payment_code = $this->settings[$this->moduleTitle . '_payment'][$order_data['payment_code']]; - } else { - $payment_code = ''; - } - - if (!empty($order_data['shipping_code'])) { - $shippingCode = explode('.', $order_data['shipping_code']); - $shippingModule = $shippingCode[0]; - - if (isset($this->settings[$this->moduleTitle . '_delivery'][$order_data['shipping_code']])) { - $delivery_code = $this->settings[$this->moduleTitle . '_delivery'][$order_data['shipping_code']]; - } elseif (isset($this->settings[$this->moduleTitle . '_delivery'][$shippingModule])) { - $delivery_code = $this->settings[$this->moduleTitle . '_delivery'][$shippingModule]; - } - } - - if (!isset($delivery_code) && isset($shippingModule)) { - if (isset($this->settings[$this->moduleTitle . '_delivery']) - && $this->settings[$this->moduleTitle . '_delivery'] - ) { - $deliveries = array_keys($this->settings[$this->moduleTitle . '_delivery']); - $shipping_code = ''; - - array_walk($deliveries, function($item, $key) use ($shippingModule, &$shipping_code) { - if (strripos($item, $shippingModule) !== false) { - $shipping_code = $item; - } - }); - - $delivery_code = $this->settings[$this->moduleTitle . '_delivery'][$shipping_code]; - } - } - - if (!empty($order_data['payment_iso_code_2'])) { - $order['countryIso'] = $order_data['payment_iso_code_2']; - } - - if (isset($this->settings[$this->moduleTitle . '_order_number']) - && $this->settings[$this->moduleTitle . '_order_number'] == 1 - ) { - $order['number'] = $order_data['order_id']; - } - - $order['externalId'] = $order_data['order_id']; - $order['firstName'] = $order_data['firstname']; - $order['lastName'] = $order_data['lastname']; - $order['phone'] = $order_data['telephone']; - $order['customerComment'] = $order_data['comment']; - - if (!empty($order_data['email'])) { - $order['email'] = $order_data['email']; - } - - if ($order_data['customer_id']) { - $order['customer']['externalId'] = $order_data['customer_id']; - } - - $deliveryCost = 0; - $orderTotals = isset($order_data['totals']) ? $order_data['totals'] : $order_data['order_total'] ; - - foreach ($orderTotals as $totals) { - if ($totals['code'] == 'shipping') { - $deliveryCost = $totals['value']; - } - } - - $order['createdAt'] = $order_data['date_added']; - - if ($this->settings[$this->moduleTitle . '_apiversion'] != 'v5') { - $order['paymentType'] = $payment_code; - } - - $country = (isset($order_data['shipping_country'])) ? $order_data['shipping_country'] : '' ; - - $order['delivery'] = array( - 'code' => isset($delivery_code) ? $delivery_code : '', - 'cost' => $deliveryCost, - 'address' => array( - 'countryIso' => $order_data['shipping_iso_code_2'], - 'index' => $order_data['shipping_postcode'], - 'city' => $order_data['shipping_city'], - 'region' => $order_data['shipping_zone'], - 'text' => implode(', ', array( - $order_data['shipping_postcode'], - $country, - $order_data['shipping_city'], - $order_data['shipping_address_1'], - $order_data['shipping_address_2'] - )) - ) - ); - - $orderProducts = isset($order_data['products']) ? $order_data['products'] : $order_data['order_product']; - $offerOptions = array('select', 'radio'); - - foreach ($orderProducts as $product) { - $offerId = ''; - - if (!empty($product['option'])) { - $options = array(); - - $productOptions = $this->model_catalog_product->getProductOptions($product['product_id']); - - foreach ($product['option'] as $option) { - if ($option['type'] == 'checkbox') { - $properties[] = array( - 'code' => $option['product_option_value_id'], - 'name' => $option['name'], - 'value' => $option['value'] - ); - } - - if (!in_array($option['type'], $offerOptions)) continue; - foreach($productOptions as $productOption) { - if($productOption['product_option_id'] = $option['product_option_id']) { - foreach($productOption['product_option_value'] as $productOptionValue) { - if($productOptionValue['product_option_value_id'] == $option['product_option_value_id']) { - $options[$option['product_option_id']] = $productOptionValue['option_value_id']; - } - } - } - } - } - - ksort($options); - - $offerId = array(); - foreach($options as $optionKey => $optionValue) { - $offerId[] = $optionKey.'-'.$optionValue; - } - $offerId = implode('_', $offerId); - } - - if ($this->settings[$this->moduleTitle . '_apiversion'] != 'v3') { - $item = array( - 'offer' => array( - 'externalId' => !empty($offerId) ? $product['product_id'].'#'.$offerId : $product['product_id'] - ), - 'productName' => $product['name'], - 'initialPrice' => $product['price'], - 'quantity' => $product['quantity'], - ); - } else { - $item = array( - 'productName' => $product['name'], - 'initialPrice' => $product['price'], - 'quantity' => $product['quantity'], - 'productId' => !empty($offerId) ? $product['product_id'].'#'.$offerId : $product['product_id'] - ); - } - - if (isset($properties)) $item['properties'] = $properties; - $order['items'][] = $item; - } - - if (isset($order_data['order_status_id']) && $order_data['order_status_id'] > 0) { - $order['status'] = $this->settings[$this->moduleTitle . '_status'][$order_data['order_status_id']]; - } - - if ($this->settings[$this->moduleTitle . '_apiversion'] == 'v5') { - if ($payment_code) { - $payment = array( - 'externalId' => $order_data['order_id'], - 'type' => $payment_code - ); - - $order['payments'][] = $payment; - } - } - - if (isset($this->settings[$this->moduleTitle . '_custom_field']) && $order_data['custom_field']) { - $customFields = json_decode($order_data['custom_field']); - - foreach ($customFields as $key => $value) { - if (isset($this->settings[$this->moduleTitle . '_custom_field']['o_' . $key])) { - $customFieldsToCrm[$this->settings[$this->moduleTitle . '_custom_field']['o_' . $key]] = $value; - } - } - - if (isset($customFieldsToCrm)) { - $order['customFields'] = $customFieldsToCrm; - } - } - - return $order; - } - - /** - * @return mixed - */ - public static function getLastResponse() + public function getCountryByIsoCode($isoCode) { - return self::$lastRepsonse; + $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "country` WHERE iso_code_2 = '" . $isoCode . "'"); + + return $query->row; + } + + /** + * Get zone by name + * + * @param string $name + * + * @return array + */ + public function getZoneByName($name) + { + $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "zone` WHERE name = '" . $name . "'"); + + return $query->row; + } + + /** + * Get currency + * + * @param string $code + * @param string $field (default = '') + * + * @return mixed array | string + */ + public function getCurrencyByCode($code, $field = '') + { + $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "currency` WHERE code = '" . $code . "'"); + + if (!$field) { + return $query->row; + } + + return $query->row[$field]; + } + + /** + * Get language + * + * @param string $code + * @param string $field (default = '') + * + * @return mixed array | string + */ + public function getLanguageByCode($code, $field = '') + { + $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "language` WHERE code = '" . $code . "'"); + + if (!$field) { + return $query->row; + } + + return $query->row[$field]; + } + + /** + * Get product option value + * + * @param int $option_value_id + * @param string $field + * + * @return mixed array | string + */ + public function getOptionValue($option_value_id, $field = '') + { + $query = $this->db->query("SELECT * FROM `" . DB_PREFIX . "option_value_description` WHERE option_value_id = '" . $option_value_id . "'"); + + if (!$field) { + return $query->row; + } + + return $query->row[$field]; } } diff --git a/src/upload/admin/model/extension/retailcrm/products.php b/src/upload/admin/model/extension/retailcrm/products.php new file mode 100644 index 0000000..d179650 --- /dev/null +++ b/src/upload/admin/model/extension/retailcrm/products.php @@ -0,0 +1,9 @@ +load->model('catalog/product_option'); + + return $this->model_catalog_product_option->getProductOptionsByProductId($product_id); + } +} diff --git a/src/upload/admin/view/stylesheet/retailcrm.css b/src/upload/admin/view/stylesheet/retailcrm.css index fba27ff..34a1123 100644 --- a/src/upload/admin/view/stylesheet/retailcrm.css +++ b/src/upload/admin/view/stylesheet/retailcrm.css @@ -1,5 +1,5 @@ .retailcrm_unit {margin-bottom: 10px;} -.retailcrm_unit input {width: 30%;} +.retailcrm_unit input {width: 60%;} .checkbox input{width: auto;} .retailcrm_unit input[type=checkbox] {width: 13px;} .retailcrm_unit select {max-width: 500px;} \ No newline at end of file diff --git a/src/upload/admin/view/template/extension/module/retailcrm.twig b/src/upload/admin/view/template/extension/module/retailcrm.twig index 25062be..75561c4 100644 --- a/src/upload/admin/view/template/extension/module/retailcrm.twig +++ b/src/upload/admin/view/template/extension/module/retailcrm.twig @@ -2,19 +2,19 @@
@@ -35,14 +35,14 @@
@@ -50,8 +50,8 @@
{{ retailcrm_base_settings }} -
- +
+
-
- +
+
-
- +
+
@@ -75,10 +75,10 @@
{{ retailcrm_countries_settings }} -
- +
+
-
+
{% for country in countries %}