mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-03 19:53:19 +03:00
Bug fix empty payment in history (#19)
This commit is contained in:
parent
77298a48a2
commit
f0582b9938
@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
/*
|
* @author Retail Driver LCC
|
||||||
|
* @copyright RetailCRM
|
||||||
|
* @license GPL
|
||||||
|
* @version 2.1.1
|
||||||
|
* @link https://retailcrm.ru
|
||||||
* The MIT License (MIT)
|
* The MIT License (MIT)
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Rob Dunham
|
* Copyright (c) 2014 Rob Dunham
|
||||||
@ -33,8 +37,7 @@
|
|||||||
*
|
*
|
||||||
* @package Autoloader
|
* @package Autoloader
|
||||||
* @license http://opensource.org/licenses/MIT MIT License
|
* @license http://opensource.org/licenses/MIT MIT License
|
||||||
* @author Rob Dunham <contact@robunham.info>
|
*
|
||||||
* @author Alex Lushpai <lushpai@gmail.com>
|
|
||||||
*/
|
*/
|
||||||
class RetailcrmAutoloader
|
class RetailcrmAutoloader
|
||||||
{
|
{
|
||||||
@ -64,11 +67,10 @@ class RetailcrmAutoloader
|
|||||||
$filename = $className . self::$fileExt;
|
$filename = $className . self::$fileExt;
|
||||||
|
|
||||||
foreach ($fileIterator as $file) {
|
foreach ($fileIterator as $file) {
|
||||||
if (strtolower($file->getFilename()) === strtolower($filename) && $file->isReadable()) {
|
if (Tools::strtolower($file->getFilename()) === Tools::strtolower($filename) && $file->isReadable()) {
|
||||||
include_once $file->getPathname();
|
include_once $file->getPathname();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,7 +93,6 @@ class RetailcrmAutoloader
|
|||||||
{
|
{
|
||||||
self::$pathTop = $path;
|
self::$pathTop = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RetailcrmAutoloader::setPath(realpath(dirname(__FILE__)));
|
RetailcrmAutoloader::setPath(realpath(dirname(__FILE__)));
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<module>
|
|
||||||
<name>retailcrm</name>
|
|
||||||
<displayName><![CDATA[RetailCRM]]></displayName>
|
|
||||||
<version><![CDATA[2.0.1]]></version>
|
|
||||||
<description><![CDATA[Integration module for RetailCRM]]></description>
|
|
||||||
<author><![CDATA[Retail Driver LCC]]></author>
|
|
||||||
<tab><![CDATA[export]]></tab>
|
|
||||||
<confirmUninstall><![CDATA[Are you sure you want to uninstall?]]></confirmUninstall>
|
|
||||||
<is_configurable>1</is_configurable>
|
|
||||||
<need_instance>1</need_instance>
|
|
||||||
<limited_countries></limited_countries>
|
|
||||||
</module>
|
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<module>
|
|
||||||
<name>retailcrm</name>
|
|
||||||
<displayName><![CDATA[RetailCRM]]></displayName>
|
|
||||||
<version><![CDATA[1.6]]></version>
|
|
||||||
<description><![CDATA[Модуль интеграции с RetailCRM]]></description>
|
|
||||||
<author><![CDATA[Retail Driver LCC]]></author>
|
|
||||||
<tab><![CDATA[export]]></tab>
|
|
||||||
<confirmUninstall><![CDATA[Вы уверены, что хотите удалить модуль?]]></confirmUninstall>
|
|
||||||
<is_configurable>1</is_configurable>
|
|
||||||
<need_instance>1</need_instance>
|
|
||||||
<limited_countries></limited_countries>
|
|
||||||
</module>
|
|
1
retailcrm/index.php
Normal file
1
retailcrm/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php // Silence is golden
|
@ -1,4 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Retail Driver LCC
|
||||||
|
* @copyright RetailCRM
|
||||||
|
* @license GPL
|
||||||
|
* @version 2.1.1
|
||||||
|
* @link https://retailcrm.ru
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
$_SERVER['HTTPS'] = 1;
|
$_SERVER['HTTPS'] = 1;
|
||||||
|
|
||||||
require(dirname(__FILE__) . '/../../../config/config.inc.php');
|
require(dirname(__FILE__) . '/../../../config/config.inc.php');
|
||||||
@ -41,7 +50,6 @@ foreach ($customerRecords as $record) {
|
|||||||
unset($customerRecords);
|
unset($customerRecords);
|
||||||
|
|
||||||
foreach ($orderRecords as $record) {
|
foreach ($orderRecords as $record) {
|
||||||
|
|
||||||
$object = new Order($record['id_order']);
|
$object = new Order($record['id_order']);
|
||||||
|
|
||||||
if (Module::getInstanceByName('advancedcheckout') === false) {
|
if (Module::getInstanceByName('advancedcheckout') === false) {
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Retail Driver LCC
|
||||||
|
* @copyright RetailCRM
|
||||||
|
* @license GPL
|
||||||
|
* @version 2.1.1
|
||||||
|
* @link https://retailcrm.ru
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
$_SERVER['HTTPS'] = 1;
|
$_SERVER['HTTPS'] = 1;
|
||||||
|
|
||||||
require(dirname(__FILE__) . '/../../../config/config.inc.php');
|
require(dirname(__FILE__) . '/../../../config/config.inc.php');
|
||||||
|
1
retailcrm/job/index.php
Normal file
1
retailcrm/job/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php // Silence is golden
|
@ -1,4 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Retail Driver LCC
|
||||||
|
* @copyright RetailCRM
|
||||||
|
* @license GPL
|
||||||
|
* @version 2.1.1
|
||||||
|
* @link https://retailcrm.ru
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
$_SERVER['HTTPS'] = 1;
|
$_SERVER['HTTPS'] = 1;
|
||||||
|
|
||||||
$shortopts = 'o:';
|
$shortopts = 'o:';
|
||||||
|
@ -1,4 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Retail Driver LCC
|
||||||
|
* @copyright RetailCRM
|
||||||
|
* @license GPL
|
||||||
|
* @version 2.1.1
|
||||||
|
* @link https://retailcrm.ru
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
$_SERVER['HTTPS'] = 1;
|
$_SERVER['HTTPS'] = 1;
|
||||||
|
|
||||||
require(dirname(__FILE__) . '/../../../config/config.inc.php');
|
require(dirname(__FILE__) . '/../../../config/config.inc.php');
|
||||||
@ -29,27 +38,25 @@ $startFrom = ($lastSync === false)
|
|||||||
|
|
||||||
$customerFix = array();
|
$customerFix = array();
|
||||||
$orderFix = array();
|
$orderFix = array();
|
||||||
|
|
||||||
$startDate = new DateTime($startFrom);
|
$startDate = new DateTime($startFrom);
|
||||||
$history = $api->ordersHistory(array(
|
$history = $api->ordersHistory(array(
|
||||||
'startDate' => $startDate->format('Y-m-d H:i:s')
|
'startDate' => $startDate->format('Y-m-d H:i:s')
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($history->isSuccessful() && count($history->history) > 0) {
|
if ($history->isSuccessful() && count($history->history) > 0) {
|
||||||
|
|
||||||
$statuses = array_flip(array_filter(json_decode(Configuration::get('RETAILCRM_API_STATUS'), true)));
|
$statuses = array_flip(array_filter(json_decode(Configuration::get('RETAILCRM_API_STATUS'), true)));
|
||||||
$deliveries = array_flip(array_filter(json_decode(Configuration::get('RETAILCRM_API_DELIVERY'), true)));
|
$deliveries = array_flip(array_filter(json_decode(Configuration::get('RETAILCRM_API_DELIVERY'), true)));
|
||||||
$payments = array_flip(array_filter(json_decode(Configuration::get('RETAILCRM_API_PAYMENT'), true)));
|
$payments = array_flip(array_filter(json_decode(Configuration::get('RETAILCRM_API_PAYMENT'), true)));
|
||||||
$deliveryDefault = json_decode(Configuration::get('RETAILCRM_API_DELIVERY_DEFAULT'), true);
|
$deliveryDefault = json_decode(Configuration::get('RETAILCRM_API_DELIVERY_DEFAULT'), true);
|
||||||
$paymentDefault = json_decode(Configuration::get('RETAILCRM_API_PAYMENT_DEFAULT'), true);
|
$paymentDefault = json_decode(Configuration::get('RETAILCRM_API_PAYMENT_DEFAULT'), true);
|
||||||
|
|
||||||
$orders = RetailcrmHistoryHelper::assemblyOrder($history->history);
|
$orders = RetailcrmHistoryHelper::assemblyOrder($history->history);
|
||||||
|
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
if (isset($order['deleted']) && $order['deleted'] == true) continue;
|
if (isset($order['deleted']) && $order['deleted'] == true) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!array_key_exists('externalId', $order)) {
|
if (!array_key_exists('externalId', $order)) {
|
||||||
|
|
||||||
$delivery = $order['delivery']['code'];
|
$delivery = $order['delivery']['code'];
|
||||||
|
|
||||||
if (array_key_exists($delivery, $deliveries) && $deliveries[$delivery] != '') {
|
if (array_key_exists($delivery, $deliveries) && $deliveries[$delivery] != '') {
|
||||||
@ -85,20 +92,22 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
if (array_key_exists($state, $statuses) && $statuses[$state] != '') {
|
if (array_key_exists($state, $statuses) && $statuses[$state] != '') {
|
||||||
$orderStatus = $statuses[$state];
|
$orderStatus = $statuses[$state];
|
||||||
}
|
}
|
||||||
|
if (!isset($paymentId) || !$paymentId) {
|
||||||
|
$paymentId = $paymentDefault;
|
||||||
|
}
|
||||||
if (!$paymentType) {
|
if (!$paymentType) {
|
||||||
if ($paymentDefault) {
|
if ($paymentDefault) {
|
||||||
|
|
||||||
if (Module::getInstanceByName($paymentDefault)) {
|
if (Module::getInstanceByName($paymentDefault)) {
|
||||||
$paymentType = Module::getModuleName($paymentDefault);
|
$paymentType = Module::getModuleName($paymentDefault);
|
||||||
} else {
|
} else {
|
||||||
$paymentType = $paymentDefault;
|
$paymentType = $paymentDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
$paymentId = $paymentDefault;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
error_log('orderHistory: set default payment(error in order where id = '.$order['id'].')', 3, _PS_ROOT_DIR_ . '/retailcrm.log');
|
error_log(
|
||||||
|
'orderHistory: set default payment(error in order where id = '.$order['id'].')',
|
||||||
|
3,
|
||||||
|
_PS_ROOT_DIR_ . '/retailcrm.log'
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -107,22 +116,28 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
if ($deliveryDefault) {
|
if ($deliveryDefault) {
|
||||||
$deliveryType = $deliveryDefault;
|
$deliveryType = $deliveryDefault;
|
||||||
} else {
|
} else {
|
||||||
error_log('orderHistory: set default delivery(error in order where id = '.$order['id'].')', 3, _PS_ROOT_DIR_ . '/retailcrm.log');
|
error_log(
|
||||||
|
'orderHistory: set default delivery(error in order where id = '.$order['id'].')',
|
||||||
|
3,
|
||||||
|
_PS_ROOT_DIR_ . '/retailcrm.log'
|
||||||
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$customer = new Customer();
|
$customer = new Customer();
|
||||||
if(!empty($order['customer']['email']))
|
if (!empty($order['customer']['email'])) {
|
||||||
$customer->getByEmail($order['customer']['email']);
|
$customer->getByEmail($order['customer']['email']);
|
||||||
|
}
|
||||||
|
|
||||||
if (!array_key_exists('externalId', $order['customer'])) {
|
if (!array_key_exists('externalId', $order['customer'])) {
|
||||||
if (!$customer->id)
|
if (!$customer->id) {
|
||||||
{
|
|
||||||
$customer->firstname = $order['customer']['firstName'];
|
$customer->firstname = $order['customer']['firstName'];
|
||||||
$customer->lastname = !empty($order['customer']['lastName']) ? $order['customer']['lastName'] : '-';
|
$customer->lastname = !empty($order['customer']['lastName']) ? $order['customer']['lastName'] : '-';
|
||||||
$customer->email = Validate::isEmail($order['customer']['email']) ? $order['customer']['email'] : md5($order['customer']['firstName']) . '@retailcrm.ru';
|
$customer->email = Validate::isEmail($order['customer']['email']) ?
|
||||||
$customer->passwd = substr(str_shuffle(strtolower(sha1(rand() . time()))),0, 5);
|
$order['customer']['email'] :
|
||||||
|
md5($order['customer']['firstName']) . '@retailcrm.ru';
|
||||||
|
$customer->passwd = Tools::substr(str_shuffle(Tools::strtolower(sha1(rand() . time()))), 0, 5);
|
||||||
|
|
||||||
$customer->add();
|
$customer->add();
|
||||||
}
|
}
|
||||||
@ -143,8 +158,10 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
$address->firstname = $customer->firstname;
|
$address->firstname = $customer->firstname;
|
||||||
$address->alias = 'default';
|
$address->alias = 'default';
|
||||||
$address->postcode = $order['delivery']['address']['index'];
|
$address->postcode = $order['delivery']['address']['index'];
|
||||||
$address->city = !empty($order['delivery']['address']['city']) ? $order['delivery']['address']['city'] : '-';
|
$address->city = !empty($order['delivery']['address']['city']) ?
|
||||||
$address->address1 = !empty($order['delivery']['address']['text']) ? $order['delivery']['address']['text'] : '-';
|
$order['delivery']['address']['city'] : '-';
|
||||||
|
$address->address1 = !empty($order['delivery']['address']['text']) ?
|
||||||
|
$order['delivery']['address']['text'] : '-';
|
||||||
$address->phone = $order['phone'];
|
$address->phone = $order['phone'];
|
||||||
$address->add();
|
$address->add();
|
||||||
|
|
||||||
@ -190,7 +207,9 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
$newOrder->id_currency = $default_currency;
|
$newOrder->id_currency = $default_currency;
|
||||||
$newOrder->id_lang = $default_lang;
|
$newOrder->id_lang = $default_lang;
|
||||||
$newOrder->id_customer = (int) $customer->id;
|
$newOrder->id_customer = (int) $customer->id;
|
||||||
if (isset($deliveryType)) $newOrder->id_carrier = (int) $deliveryType;
|
if (isset($deliveryType)) {
|
||||||
|
$newOrder->id_carrier = (int) $deliveryType;
|
||||||
|
}
|
||||||
if (isset($paymentType)) {
|
if (isset($paymentType)) {
|
||||||
$newOrder->payment = $paymentType;
|
$newOrder->payment = $paymentType;
|
||||||
$newOrder->module = $paymentId;
|
$newOrder->module = $paymentId;
|
||||||
@ -205,16 +224,19 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
$newOrder->total_shipping_tax_incl = $order['delivery']['cost'];
|
$newOrder->total_shipping_tax_incl = $order['delivery']['cost'];
|
||||||
$newOrder->total_shipping_tax_excl = $order['delivery']['cost'];
|
$newOrder->total_shipping_tax_excl = $order['delivery']['cost'];
|
||||||
$newOrder->conversion_rate = 1.000000;
|
$newOrder->conversion_rate = 1.000000;
|
||||||
if (isset($orderStatus)) $newOrder->current_state = (int) $orderStatus;
|
if (isset($orderStatus)) {
|
||||||
if (!empty($order['delivery']['date'])) $newOrder->delivery_date = $order['delivery']['date'];
|
$newOrder->current_state = (int) $orderStatus;
|
||||||
|
}
|
||||||
|
if (!empty($order['delivery']['date'])) {
|
||||||
|
$newOrder->delivery_date = $order['delivery']['date'];
|
||||||
|
}
|
||||||
$newOrder->date_add = $order['createdAt'];
|
$newOrder->date_add = $order['createdAt'];
|
||||||
$newOrder->date_upd = $order['createdAt'];
|
$newOrder->date_upd = $order['createdAt'];
|
||||||
$newOrder->invoice_date = $order['createdAt'];
|
$newOrder->invoice_date = $order['createdAt'];
|
||||||
$newOrder->valid = 1;
|
$newOrder->valid = 1;
|
||||||
$newOrder->secure_key = md5(time());
|
$newOrder->secure_key = md5(time());
|
||||||
|
|
||||||
if (isset($order['discount']))
|
if (isset($order['discount'])) {
|
||||||
{
|
|
||||||
$newOrder->total_discounts = $order['discount'];
|
$newOrder->total_discounts = $order['discount'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,8 +253,9 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($product_attribute_id != 0) {
|
if ($product_attribute_id != 0) {
|
||||||
$productName = htmlspecialchars(strip_tags(Product::getProductName($product_id, $product_attribute_id)));
|
$productName = htmlspecialchars(
|
||||||
|
strip_tags(Product::getProductName($product_id, $product_attribute_id))
|
||||||
|
);
|
||||||
$productPrice = Combination::getPrice($product_attribute_id);
|
$productPrice = Combination::getPrice($product_attribute_id);
|
||||||
$productPrice = $productPrice > 0 ? $productPrice : $product->price;
|
$productPrice = $productPrice > 0 ? $productPrice : $product->price;
|
||||||
} else {
|
} else {
|
||||||
@ -266,16 +289,13 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$paymentType = Module::getModuleName($payments[$ptype]);
|
$paymentType = Module::getModuleName($payments[$ptype]);
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'order_payment`
|
||||||
INSERT INTO `' . _DB_PREFIX_ . 'order_payment`
|
|
||||||
(`payment_method`, `order_reference` , `amount`, `date_add`)
|
(`payment_method`, `order_reference` , `amount`, `date_add`)
|
||||||
VALUES (
|
VALUES
|
||||||
\'' . $payType . '\',
|
(\'' . $payType . '\',
|
||||||
\'' . $orderToUpdate->reference . '\',
|
\'' . $newOrder->reference . '\',
|
||||||
\'' . $payment['amount'] . '\',
|
\'' . $payment['amount'] . '\',
|
||||||
\'' . $payment['paidAt'] . '\'
|
\'' . $payment['paidAt'] . '\')');
|
||||||
)'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -329,10 +349,12 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
|
|
||||||
Db::getInstance()->execute(rtrim($query, ','));
|
Db::getInstance()->execute(rtrim($query, ','));
|
||||||
|
|
||||||
if(!empty($customerFix))
|
if (!empty($customerFix)) {
|
||||||
$api->customersFixExternalIds($customerFix);
|
$api->customersFixExternalIds($customerFix);
|
||||||
if(!empty($orderFix))
|
}
|
||||||
|
if (!empty($orderFix)) {
|
||||||
$api->ordersFixExternalIds($orderFix);
|
$api->ordersFixExternalIds($orderFix);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$orderToUpdate = new Order((int) $order['externalId']);
|
$orderToUpdate = new Order((int) $order['externalId']);
|
||||||
|
|
||||||
@ -344,14 +366,13 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
$dcost = !empty($order['delivery']['cost']) ? $order['delivery']['cost'] : null;
|
$dcost = !empty($order['delivery']['cost']) ? $order['delivery']['cost'] : null;
|
||||||
|
|
||||||
if ($deliveries[$dtype] != null) {
|
if ($deliveries[$dtype] != null) {
|
||||||
if ($deliveries[$dtype] != $orderToUpdate->id_carrier OR $dcost != null) {
|
if ($deliveries[$dtype] != $orderToUpdate->id_carrier or $dcost != null) {
|
||||||
|
|
||||||
if ($dtype != null) {
|
if ($dtype != null) {
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'orders`
|
||||||
UPDATE `' . _DB_PREFIX_ . 'orders`
|
SET
|
||||||
SET `id_carrier` = \'' . $deliveries[$dtype] . '\'
|
`id_carrier` = \'' . $deliveries[$dtype] . '\'
|
||||||
WHERE `id_order` = ' . (int)$order['externalId']
|
WHERE
|
||||||
);
|
`id_order` = ' . (int)$order['externalId']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$updateCarrierFields = array();
|
$updateCarrierFields = array();
|
||||||
@ -364,11 +385,11 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
}
|
}
|
||||||
$updateCarrierFields = implode(', ', $updateCarrierFields);
|
$updateCarrierFields = implode(', ', $updateCarrierFields);
|
||||||
|
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'order_carrier`
|
||||||
UPDATE `' . _DB_PREFIX_ . 'order_carrier` SET
|
SET
|
||||||
'.$updateCarrierFields.'
|
'.$updateCarrierFields.'
|
||||||
WHERE `id_order` = \'' . $orderToUpdate->id . '\''
|
WHERE
|
||||||
);
|
`id_order` = \'' . $orderToUpdate->id . '\'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -382,17 +403,16 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
if ($payments[$ptype] != null) {
|
if ($payments[$ptype] != null) {
|
||||||
$paymentType = Module::getModuleName($payments[$ptype]);
|
$paymentType = Module::getModuleName($payments[$ptype]);
|
||||||
if ($payments[$ptype] != $orderToUpdate->payment) {
|
if ($payments[$ptype] != $orderToUpdate->payment) {
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'orders`
|
||||||
UPDATE `' . _DB_PREFIX_ . 'orders`
|
SET
|
||||||
SET `payment` = \'' . ($paymentType != null ? $paymentType : $payments[$ptype]). '\'
|
`payment` = \'' . ($paymentType != null ? $paymentType : $payments[$ptype]). '\'
|
||||||
WHERE `id_order` = ' . (int)$order['externalId']
|
WHERE
|
||||||
);
|
`id_order` = ' . (int)$order['externalId']);
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'order_payment`
|
||||||
UPDATE `' . _DB_PREFIX_ . 'order_payment`
|
SET
|
||||||
SET `payment_method` = \'' . $payments[$ptype] . '\'
|
`payment_method` = \'' . $payments[$ptype] . '\'
|
||||||
WHERE `order_reference` = \'' . $orderToUpdate->reference . '\''
|
WHERE
|
||||||
);
|
`order_reference` = \'' . $orderToUpdate->reference . '\'');
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (!empty($order['payments']) && $apiVersion == 5) {
|
} elseif (!empty($order['payments']) && $apiVersion == 5) {
|
||||||
@ -408,22 +428,19 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$paymentType = Module::getModuleName($payments[$ptype]);
|
$paymentType = Module::getModuleName($payments[$ptype]);
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'orders`
|
||||||
UPDATE `' . _DB_PREFIX_ . 'orders`
|
SET
|
||||||
SET `payment` = \'' . ($paymentType != null ? $paymentType : $payments[$ptype]). '\'
|
`payment` = \'' . ($paymentType != null ? $paymentType : $payments[$ptype]). '\'
|
||||||
WHERE `id_order` = ' . (int)$order['externalId']
|
WHERE
|
||||||
);
|
`id_order` = ' . (int)$order['externalId']);
|
||||||
|
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'order_payment`
|
||||||
INSERT INTO `' . _DB_PREFIX_ . 'order_payment`
|
|
||||||
(`payment_method`, `order_reference` , `amount`, `date_add`)
|
(`payment_method`, `order_reference` , `amount`, `date_add`)
|
||||||
VALUES (
|
VALUES
|
||||||
\'' . $payType . '\',
|
(\'' . $payType . '\',
|
||||||
\'' . $orderToUpdate->reference . '\',
|
\'' . $orderToUpdate->reference . '\',
|
||||||
\'' . $payment['amount'] . '\',
|
\'' . $payment['amount'] . '\',
|
||||||
\'' . $payment['paidAt'] . '\'
|
\'' . $payment['paidAt'] . '\')');
|
||||||
)'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -444,12 +461,11 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
$product_attribute_id = 0;
|
$product_attribute_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'order_detail`
|
||||||
DELETE FROM `'._DB_PREFIX_.'order_detail`
|
WHERE
|
||||||
WHERE `id_order` = '. $orderToUpdate->id .'
|
`id_order` = '. $orderToUpdate->id .'
|
||||||
AND `product_id` = '.$product_id. '
|
AND
|
||||||
AND `product_attribute_id` = '.$product_attribute_id
|
`product_id` = '.$product_id. ' AND `product_attribute_id` = '.$product_attribute_id);
|
||||||
);
|
|
||||||
|
|
||||||
unset($order['items'][$key]);
|
unset($order['items'][$key]);
|
||||||
$ItemDiscount = true;
|
$ItemDiscount = true;
|
||||||
@ -470,10 +486,12 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
$product_attribute_id = 0;
|
$product_attribute_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($product_id == $orderItem['product_id'] && $product_attribute_id == $orderItem['product_attribute_id']) {
|
if ($product_id == $orderItem['product_id'] &&
|
||||||
|
$product_attribute_id == $orderItem['product_attribute_id']) {
|
||||||
// discount
|
// discount
|
||||||
if (isset($item['discount']) || isset($item['discountPercent']) || isset($item['discountTotal'])) {
|
if (isset($item['discount']) ||
|
||||||
|
isset($item['discountPercent']) ||
|
||||||
|
isset($item['discountTotal'])) {
|
||||||
$product = new Product((int) $product_id, false, $default_lang);
|
$product = new Product((int) $product_id, false, $default_lang);
|
||||||
$tax = new TaxCore($product->id_tax_rules_group);
|
$tax = new TaxCore($product->id_tax_rules_group);
|
||||||
|
|
||||||
@ -492,21 +510,21 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
|
|
||||||
$productPrice = round($productPrice, 2);
|
$productPrice = round($productPrice, 2);
|
||||||
|
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'order_detail`
|
||||||
UPDATE `'._DB_PREFIX_.'order_detail`
|
SET
|
||||||
SET `unit_price_tax_incl` = '.$productPrice.'
|
`unit_price_tax_incl` = '.$productPrice.'
|
||||||
WHERE `id_order_detail` = '.$orderItem['id_order_detail']
|
WHERE
|
||||||
);
|
`id_order_detail` = '.$orderItem['id_order_detail']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// quantity
|
// quantity
|
||||||
if (isset($item['quantity']) && $item['quantity'] != $orderItem['product_quantity']) {
|
if (isset($item['quantity']) && $item['quantity'] != $orderItem['product_quantity']) {
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'order_detail`
|
||||||
UPDATE `'._DB_PREFIX_.'order_detail`
|
SET
|
||||||
SET `product_quantity` = '.$item['quantity'].',
|
`product_quantity` = '.$item['quantity'].',
|
||||||
`product_quantity_in_stock` = '.$item['quantity'].'
|
`product_quantity_in_stock` = '.$item['quantity'].'
|
||||||
WHERE `id_order_detail` = '.$orderItem['id_order_detail']
|
WHERE
|
||||||
);
|
`id_order_detail` = '.$orderItem['id_order_detail']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ItemDiscount = true;
|
$ItemDiscount = true;
|
||||||
@ -543,8 +561,9 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
$tax = new TaxCore($product->id_tax_rules_group);
|
$tax = new TaxCore($product->id_tax_rules_group);
|
||||||
|
|
||||||
if ($product_attribute_id != 0) {
|
if ($product_attribute_id != 0) {
|
||||||
$productName = htmlspecialchars(strip_tags(Product::getProductName($product_id, $product_attribute_id)));
|
$productName = htmlspecialchars(
|
||||||
|
strip_tags(Product::getProductName($product_id, $product_attribute_id))
|
||||||
|
);
|
||||||
$productPrice = Combination::getPrice($product_attribute_id);
|
$productPrice = Combination::getPrice($product_attribute_id);
|
||||||
$productPrice = $productPrice > 0 ? $productPrice : $product->price;
|
$productPrice = $productPrice > 0 ? $productPrice : $product->price;
|
||||||
} else {
|
} else {
|
||||||
@ -593,10 +612,8 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
isset($order['delivery']['cost']) ||
|
isset($order['delivery']['cost']) ||
|
||||||
isset($order['discountTotal']) ||
|
isset($order['discountTotal']) ||
|
||||||
$ItemDiscount) {
|
$ItemDiscount) {
|
||||||
|
|
||||||
$infoOrd = $api->ordersGet($order['externalId']);
|
$infoOrd = $api->ordersGet($order['externalId']);
|
||||||
$infoOrder = $infoOrd->order;
|
$infoOrder = $infoOrd->order;
|
||||||
|
|
||||||
$orderTotalProducts = $infoOrder['summ'];
|
$orderTotalProducts = $infoOrder['summ'];
|
||||||
$totalPaid = $infoOrder['totalSumm'];
|
$totalPaid = $infoOrder['totalSumm'];
|
||||||
$deliveryCost = $infoOrder['delivery']['cost'];
|
$deliveryCost = $infoOrder['delivery']['cost'];
|
||||||
@ -609,9 +626,9 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
}
|
}
|
||||||
$orderToUpdate->update();
|
$orderToUpdate->update();
|
||||||
|
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `'._DB_PREFIX_.'orders`
|
||||||
UPDATE `'._DB_PREFIX_.'orders`
|
SET
|
||||||
SET `total_discounts` = '.$totalDiscount.',
|
`total_discounts` = '.$totalDiscount.',
|
||||||
`total_discounts_tax_incl` = '.$totalDiscount.',
|
`total_discounts_tax_incl` = '.$totalDiscount.',
|
||||||
`total_discounts_tax_excl` = '.$totalDiscount.',
|
`total_discounts_tax_excl` = '.$totalDiscount.',
|
||||||
`total_shipping` = '.$deliveryCost.',
|
`total_shipping` = '.$deliveryCost.',
|
||||||
@ -621,8 +638,7 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
`total_paid_tax_incl` = '.$totalPaid.',
|
`total_paid_tax_incl` = '.$totalPaid.',
|
||||||
`total_paid_tax_excl` = '.$totalPaid.',
|
`total_paid_tax_excl` = '.$totalPaid.',
|
||||||
`total_products_wt` = '.$orderTotalProducts.'
|
`total_products_wt` = '.$orderTotalProducts.'
|
||||||
WHERE `id_order` = '.(int) $order['externalId']
|
WHERE `id_order` = '.(int) $order['externalId']);
|
||||||
);
|
|
||||||
|
|
||||||
unset($ItemDiscount);
|
unset($ItemDiscount);
|
||||||
}
|
}
|
||||||
@ -635,25 +651,21 @@ if ($history->isSuccessful() && count($history->history) > 0) {
|
|||||||
|
|
||||||
if ($statuses[$stype] != null) {
|
if ($statuses[$stype] != null) {
|
||||||
if ($statuses[$stype] != $orderToUpdate->current_state) {
|
if ($statuses[$stype] != $orderToUpdate->current_state) {
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('INSERT INTO `' . _DB_PREFIX_ . 'order_history`
|
||||||
INSERT INTO `' . _DB_PREFIX_ . 'order_history` (`id_employee`, `id_order`, `id_order_state`, `date_add`)
|
(`id_employee`, `id_order`, `id_order_state`, `date_add`)
|
||||||
VALUES (
|
VALUES
|
||||||
0,
|
(0, ' . $orderToUpdate->id . ',
|
||||||
' . $orderToUpdate->id . ',
|
|
||||||
' . $statuses[$stype] . ',
|
' . $statuses[$stype] . ',
|
||||||
"' . date('Y-m-d H:i:s') . '"
|
"' . date('Y-m-d H:i:s') . '")');
|
||||||
)
|
|
||||||
');
|
|
||||||
|
|
||||||
Db::getInstance()->execute('
|
Db::getInstance()->execute('UPDATE `' . _DB_PREFIX_ . 'orders`
|
||||||
UPDATE `' . _DB_PREFIX_ . 'orders`
|
SET
|
||||||
SET `current_state` = \'' . $statuses[$stype] . '\'
|
`current_state` = \'' . $statuses[$stype] . '\'
|
||||||
WHERE `id_order` = ' . (int)$order['externalId']
|
WHERE
|
||||||
);
|
`id_order` = ' . (int)$order['externalId']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
1
retailcrm/lib/index.php
Normal file
1
retailcrm/lib/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php // Silence is golden
|
@ -1,9 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Retail Driver LCC
|
||||||
|
* @copyright RetailCRM
|
||||||
|
* @license GPL
|
||||||
|
* @version 2.1.1
|
||||||
|
* @link https://retailcrm.ru
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
if (
|
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
|
||||||
function_exists('date_default_timezone_set') &&
|
|
||||||
function_exists('date_default_timezone_get')
|
|
||||||
) {
|
|
||||||
date_default_timezone_set(@date_default_timezone_get());
|
date_default_timezone_set(@date_default_timezone_get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,12 +21,11 @@ require_once(dirname(__FILE__) . '/bootstrap.php');
|
|||||||
class RetailCRM extends Module
|
class RetailCRM extends Module
|
||||||
{
|
{
|
||||||
|
|
||||||
function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->name = 'retailcrm';
|
$this->name = 'retailcrm';
|
||||||
$this->tab = 'export';
|
$this->tab = 'export';
|
||||||
$this->version = '2.1.1';
|
$this->version = '2.1.1';
|
||||||
$this->version = '2.1';
|
|
||||||
$this->author = 'Retail Driver LCC';
|
$this->author = 'Retail Driver LCC';
|
||||||
$this->displayName = $this->l('RetailCRM');
|
$this->displayName = $this->l('RetailCRM');
|
||||||
$this->description = $this->l('Integration module for RetailCRM');
|
$this->description = $this->l('Integration module for RetailCRM');
|
||||||
@ -33,10 +37,11 @@ class RetailCRM extends Module
|
|||||||
$this->apiKey = Configuration::get('RETAILCRM_API_TOKEN');
|
$this->apiKey = Configuration::get('RETAILCRM_API_TOKEN');
|
||||||
$this->apiVersion = Configuration::get('RETAILCRM_API_VERSION');
|
$this->apiVersion = Configuration::get('RETAILCRM_API_VERSION');
|
||||||
$this->ps_versions_compliancy = array('min' => '1.5', 'max' => _PS_VERSION_);
|
$this->ps_versions_compliancy = array('min' => '1.5', 'max' => _PS_VERSION_);
|
||||||
$this->version = substr(_PS_VERSION_, 0, 3);
|
$this->psVersion = Tools::substr(_PS_VERSION_, 0, 3);
|
||||||
$this->log = _PS_ROOT_DIR_ . '/retailcrm.log';
|
$this->log = _PS_ROOT_DIR_ . '/retailcrm.log';
|
||||||
|
$this->module_key = '149c765c6cddcf35e1f13ea6c71e9fa5';
|
||||||
|
|
||||||
if ($this->version == '1.6') {
|
if ($this->psVersion == '1.6') {
|
||||||
$this->bootstrap = true;
|
$this->bootstrap = true;
|
||||||
$this->use_new_hooks = false;
|
$this->use_new_hooks = false;
|
||||||
}
|
}
|
||||||
@ -49,7 +54,7 @@ class RetailCRM extends Module
|
|||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
function install()
|
public function install()
|
||||||
{
|
{
|
||||||
return (
|
return (
|
||||||
parent::install() &&
|
parent::install() &&
|
||||||
@ -62,7 +67,7 @@ class RetailCRM extends Module
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function uninstall()
|
public function uninstall()
|
||||||
{
|
{
|
||||||
return parent::uninstall() &&
|
return parent::uninstall() &&
|
||||||
Configuration::deleteByName('RETAILCRM_ADDRESS') &&
|
Configuration::deleteByName('RETAILCRM_ADDRESS') &&
|
||||||
@ -76,15 +81,14 @@ class RetailCRM extends Module
|
|||||||
public function getContent()
|
public function getContent()
|
||||||
{
|
{
|
||||||
$output = null;
|
$output = null;
|
||||||
|
|
||||||
$address = Configuration::get('RETAILCRM_ADDRESS');
|
$address = Configuration::get('RETAILCRM_ADDRESS');
|
||||||
$token = Configuration::get('RETAILCRM_API_TOKEN');
|
$token = Configuration::get('RETAILCRM_API_TOKEN');
|
||||||
$version = Configuration::get('RETAILCRM_API_VERSION');
|
$version = Configuration::get('RETAILCRM_API_VERSION');
|
||||||
|
|
||||||
if (Tools::isSubmit('submit' . $this->name)) {
|
if (Tools::isSubmit('submit' . $this->name)) {
|
||||||
$address = strval(Tools::getValue('RETAILCRM_ADDRESS'));
|
$address = (string)(Tools::getValue('RETAILCRM_ADDRESS'));
|
||||||
$token = strval(Tools::getValue('RETAILCRM_API_TOKEN'));
|
$token = (string)(Tools::getValue('RETAILCRM_API_TOKEN'));
|
||||||
$version = strval(Tools::getValue('RETAILCRM_API_VERSION'));
|
$version = (string)(Tools::getValue('RETAILCRM_API_VERSION'));
|
||||||
$delivery = json_encode(Tools::getValue('RETAILCRM_API_DELIVERY'));
|
$delivery = json_encode(Tools::getValue('RETAILCRM_API_DELIVERY'));
|
||||||
$status = json_encode(Tools::getValue('RETAILCRM_API_STATUS'));
|
$status = json_encode(Tools::getValue('RETAILCRM_API_STATUS'));
|
||||||
$payment = json_encode(Tools::getValue('RETAILCRM_API_PAYMENT'));
|
$payment = json_encode(Tools::getValue('RETAILCRM_API_PAYMENT'));
|
||||||
@ -150,6 +154,7 @@ class RetailCRM extends Module
|
|||||||
'name' => 'v5'
|
'name' => 'v5'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$fields_form = array();
|
||||||
/*
|
/*
|
||||||
* Network connection form
|
* Network connection form
|
||||||
*/
|
*/
|
||||||
@ -220,7 +225,9 @@ class RetailCRM extends Module
|
|||||||
*/
|
*/
|
||||||
$fields_form[4]['form'] = array(
|
$fields_form[4]['form'] = array(
|
||||||
'legend' => array('title' => $this->l('Default')),
|
'legend' => array('title' => $this->l('Default')),
|
||||||
'input' => $this->reference->getPaymentAndDeliveryForDefault(array($this->l('Delivery method'), $this->l('Payment type'))),
|
'input' => $this->reference->getPaymentAndDeliveryForDefault(
|
||||||
|
array($this->l('Delivery method'), $this->l('Payment type'))
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,7 +488,6 @@ class RetailCRM extends Module
|
|||||||
$arProp[$count]['name'] = trim($arItem[0]);
|
$arProp[$count]['name'] = trim($arItem[0]);
|
||||||
$arProp[$count]['value'] = trim($arItem[1]);
|
$arProp[$count]['value'] = trim($arItem[1]);
|
||||||
$count++;
|
$count++;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,7 +530,9 @@ class RetailCRM extends Module
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($payment)) $order['payments'][] = $payment;
|
if (isset($payment)) {
|
||||||
|
$order['payments'][] = $payment;
|
||||||
|
}
|
||||||
|
|
||||||
$statusCode = $params['orderStatus']->id;
|
$statusCode = $params['orderStatus']->id;
|
||||||
|
|
||||||
@ -543,9 +551,7 @@ class RetailCRM extends Module
|
|||||||
$order['customer']['externalId'] = $customer['externalId'];
|
$order['customer']['externalId'] = $customer['externalId'];
|
||||||
|
|
||||||
$this->api->ordersCreate($order);
|
$this->api->ordersCreate($order);
|
||||||
|
|
||||||
} elseif (isset($params['newOrderStatus'])) {
|
} elseif (isset($params['newOrderStatus'])) {
|
||||||
|
|
||||||
$statusCode = $params['newOrderStatus']->id;
|
$statusCode = $params['newOrderStatus']->id;
|
||||||
|
|
||||||
if (array_key_exists($statusCode, $status) && !empty($status[$statusCode])) {
|
if (array_key_exists($statusCode, $status) && !empty($status[$statusCode])) {
|
||||||
@ -553,14 +559,12 @@ class RetailCRM extends Module
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($orderStatus)) {
|
if (isset($orderStatus)) {
|
||||||
|
|
||||||
$this->api->ordersEdit(
|
$this->api->ordersEdit(
|
||||||
array(
|
array(
|
||||||
'externalId' => $params['id_order'],
|
'externalId' => $params['id_order'],
|
||||||
'status' => $orderStatus
|
'status' => $orderStatus
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -618,23 +622,34 @@ class RetailCRM extends Module
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validateCrmAddress($address) {
|
private function validateCrmAddress($address)
|
||||||
if(preg_match("/https:\/\/(.*).retailcrm.ru/", $address) === 1)
|
{
|
||||||
|
if (preg_match("/https:\/\/(.*).retailcrm.ru/", $address) === 1) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validateApiVersion($settings) {
|
private function validateApiVersion($settings)
|
||||||
$api = new RetailcrmProxy($settings['address'], $settings['token'], _PS_ROOT_DIR_ . '/retailcrm.log', $settings['version']);
|
{
|
||||||
$response = $api->statisticUpdate();
|
$api = new RetailcrmProxy(
|
||||||
|
$settings['address'],
|
||||||
|
$settings['token'],
|
||||||
|
_PS_ROOT_DIR_ . '/retailcrm.log',
|
||||||
|
$settings['version']
|
||||||
|
);
|
||||||
|
$response = $api->deliveryTypesList();
|
||||||
|
|
||||||
if ($response['errorMsg'] != 'API method not found') return true;
|
if ($response->isSuccessful()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validateForm($settings, $output) {
|
private function validateForm($settings, $output)
|
||||||
|
{
|
||||||
if (!$this->validateCrmAddress($settings['address']) || !Validate::isGenericName($settings['address'])) {
|
if (!$this->validateCrmAddress($settings['address']) || !Validate::isGenericName($settings['address'])) {
|
||||||
$output .= $this->displayError($this->l('Invalid or empty crm address'));
|
$output .= $this->displayError($this->l('Invalid or empty crm address'));
|
||||||
} elseif (!$settings['token'] || $settings['token'] == '') {
|
} elseif (!$settings['token'] || $settings['token'] == '') {
|
||||||
|
1
retailcrm/translations/index.php
Normal file
1
retailcrm/translations/index.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?php // Silence is golden
|
Loading…
x
Reference in New Issue
Block a user