Compare commits

...

19 commits

Author SHA1 Message Date
Alex Lushpai
095ebf61f1
Update README.md 2020-02-19 17:36:16 +03:00
Alex Lushpai
1436213f1c
Update Logger.php 2017-12-27 10:34:40 +03:00
Alex Lushpai
59fc87a0c5
Update settings-dist.ini 2017-12-27 10:31:18 +03:00
Alex Lushpai
be7345aaaa
Update Logger.php 2017-12-27 09:59:54 +03:00
Alex Lushpai
5d91549f01 Update settings-dist.ini 2017-08-10 11:34:26 +03:00
Alex Lushpai
b3a041482e Merge pull request #15 from cherginets/15-fix-group-concat
fix group concat setting
2016-09-05 16:49:55 +03:00
Anton Cherginets
3e08653ca9 fix group concat setting 2016-09-05 16:36:13 +03:00
Alex Lushpai
3d3a3b72ab Merge pull request #14 from VitalyArt/bugfix
fix uploadPaymentStatuses
2016-08-19 11:52:20 +03:00
Vitaly Artemev
34996d2b84 fix uploadPaymentStatuses 2016-08-19 12:49:44 +04:00
Alex Lushpai
d6dad7bd4d Merge pull request #13 from VitalyArt/bugfix
Bugfix
2016-08-19 11:28:10 +03:00
Vitaly Artemev
56ec1a7247 fix explodeUids 2016-08-09 11:14:58 +04:00
Vitaly Artemev
d19f9f7699 fix uploadPaymentStatuses 2016-08-09 10:48:51 +04:00
Alex Lushpai
7d7494ae64 Merge pull request #12 from cyradin/master
fix catalog export bug
2016-04-11 02:37:09 +04:00
cyradin
2f9596be2b fix catalog export bug 2016-03-25 19:52:31 +03:00
Alex Lushpai
e836c6ae64 Merge pull request #11 from gwinn/master
nvalidArgumentException, custom mail folder
2016-03-15 13:03:43 +03:00
Alex Lushpai
f21576b2c2 fix after upstream merge 2016-03-15 13:02:31 +03:00
Alex Lushpai
6f958c739b exception, custom mail folder 2016-03-15 12:59:19 +03:00
Alex Lushpai
1648e9f178 Update RequestProxy.php 2016-03-14 12:25:32 +03:00
Alex Lushpai
623416a85c Update Container.php 2016-02-16 16:17:18 +03:00
9 changed files with 59 additions and 32 deletions

View file

@ -1,5 +1,5 @@
Legacy
======
Legacy (устаревший, не рекомендуется к использованию)
=====================================================
Микрофреймворк для интеграции устаревших платформ (php <= 5.2.17), либо, в случае отсутствия модуля для конкретной платформы.

View file

@ -3,7 +3,8 @@ domain=site.ru
icml_file=retailcrm.xml
shop_url=http://www.site.ru
shop_name=Simple Shop
support=integration@retailcrm.ru
support=your_email@example.com
notify=noreply@example.com
[api]
url=https://demo.retailcrm.ru
@ -18,7 +19,7 @@ driver=mysql
enabled=false
[mail]
mail@example.com=login,password,imap.example.com,993,imap
mail@example.com=login,password,imap.example.com,993,imap,SpecialFolderName
mail@example.org=login,password,pop.example.org,995,pop
enabled=false

View file

@ -41,11 +41,11 @@ class CustomersBuilder extends Builder
*/
public function buildCustomersById($uidString)
{
$uids = DataHelper::explodeUids($uidString);
$query = $this->rule->getSQL('customers_uid');
$handler = $this->rule->getHandler('CustomersHandler');
$this->sql = $this->container->db->prepare($query);
$this->sql->bindParam(':orderIds', $uids);
$uids = DataHelper::explodeUids($uidString);
return $this->build($handler);
}
@ -74,11 +74,11 @@ class CustomersBuilder extends Builder
*/
public function buildCustomersUpdateById($uidString)
{
$uids = DataHelper::explodeUids($uidString);
$query = $this->rule->getSQL('customers_update_uid');
$handler = $this->rule->getHandler('CustomersHandler');
$this->sql = $this->container->db->prepare($query);
$this->sql->bindParam(':orderIds', $uids);
$uids = DataHelper::explodeUids($uidString);
return $this->build($handler);
}

View file

@ -221,7 +221,7 @@ class Command
break;
case 'payment-statuses':
$reference = $builder->buildPaymentStatuses();
$this->requestHelper->uploadDeliveryStatuses($reference);
$this->requestHelper->uploadPaymentStatuses($reference);
break;
case 'statuses':
$reference = $builder->buildStatuses();
@ -242,7 +242,7 @@ class Command
$this->requestHelper->uploadPaymentTypes($paymentTypes);
$paymentStatuses = $builder->buildPaymentStatuses();
$this->requestHelper->uploadDeliveryStatuses($paymentStatuses);
$this->requestHelper->uploadPaymentStatuses($paymentStatuses);
$statuses = $builder->buildStatuses();
$this->requestHelper->uploadStatuses($statuses);

View file

@ -59,6 +59,7 @@ class Container
);
$this->db->exec("set names utf8");
$this->db->exec("set group_concat_max_len = 1000000");
$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
} catch (PDOException $e) {
CommandHelper::activateNotice('database');

View file

@ -6,7 +6,7 @@ class Logger
private $push;
private $files;
public function __construct($rotate = true, $push = true, $files = 5)
public function __construct($rotate = true, $push = false, $files = 5)
{
$this->rotate = $rotate;
$this->push = $push;
@ -101,10 +101,9 @@ class Logger
{
$domain = $this->container->domain;
$recipient = $this->container->support;
$subject = 'Legacy notification';
$headers = 'From: noreply@retailcrm.ru' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$message = "New log message from $domain:\n\n$message";
$subject = sprintf("Legacy notification from %s", $domain);
$headers = sprintf("From: %s\r\nX-Mailer: PHP/%s", $this->container->notify, phpversion());
$message = sprintf("New log message from %s:\n\n%s\n", $domain, $message);
mail($recipient, $subject, $message, $headers);
}

View file

@ -13,7 +13,7 @@ class Mail
$this->mailBox = $mailBox;
if (is_array($this->container->mail)) {
if(isset($this->container->mail[$mailBox])) {
if (isset($this->container->mail[$mailBox])) {
$this->mailSettings = explode(
',',
$this->container->mail[$mailBox]
@ -32,6 +32,7 @@ class Mail
public function parse()
{
$server = new Server(
$this->mailSettings[2],
$this->mailSettings[3],
@ -43,6 +44,10 @@ class Mail
$this->mailSettings[1]
);
if (!empty($this->mailSettings[5])) {
$server->setMailBox($this->mailSettings[5]);
}
$mailCriteria = $this->clean($this->mailBox, 'criteria');
$mailHandler = $this->clean($this->mailBox, 'handler');

View file

@ -46,11 +46,22 @@ class RequestProxy
"[$method] " . $e->getMessage() . "\n",
$this->container->errorLog
);
return null;
} catch (InvalidJsonException $e) {
$this->logger->write(
"[$method] " . $e->getMessage() . "\n",
$this->container->errorLog
);
return null;
} catch (InvalidArgumentException $e) {
$this->logger->write(
"[$method] " . $e->getMessage() . "\n",
$this->container->errorLog
);
return null;
}
}
}

View file

@ -23,6 +23,7 @@ class IcmlHelper
protected $offers;
protected $chunk = 500;
protected $fileLifeTime = 3600;
public function __construct($shop, $file)
{
@ -33,28 +34,37 @@ class IcmlHelper
public function generate($categories, $offers)
{
if (!file_exists($this->tmpFile)) {
if (file_exists($this->tmpFile)) {
if (filectime($this->tmpFile) + $this->fileLifeTime < time()) {
unlink($this->tmpFile);
$this->writeHead();
}
} else {
$this->writeHead();
}
if (!empty($categories)) {
$this->writeCategories($categories);
unset($categories);
try {
if (!empty($categories)) {
$this->writeCategories($categories);
unset($categories);
}
if (!empty($offers)) {
$this->writeOffers($offers);
unset($offers);
}
$dom = dom_import_simplexml(simplexml_load_file($this->tmpFile))->ownerDocument;
$dom->formatOutput = true;
$formatted = $dom->saveXML();
unset($dom, $this->xml);
file_put_contents($this->tmpFile, $formatted);
rename($this->tmpFile, $this->file);
} catch (Exception $e) {
unlink($this->tmpFile);
}
if (!empty($offers)) {
$this->writeOffers($offers);
unset($offers);
}
$dom = dom_import_simplexml(simplexml_load_file($this->tmpFile))->ownerDocument;
$dom->formatOutput = true;
$formatted = $dom->saveXML();
unset($dom, $this->xml);
file_put_contents($this->tmpFile, $formatted);
rename($this->tmpFile, $this->file);
}
private function loadXml()