1
0
mirror of synced 2024-12-04 19:06:03 +03:00
umi-module/classes/modules/RetailCRM/__events.php
Vitaly Artemev 90bda4ea1d update module (#5)
* add delivery price

* Update events.php

* fix cron task

* fix cron task

* fix customer

* fix order number

* update module
2017-03-13 13:58:33 +03:00

57 lines
1.4 KiB
PHP
Executable File

<?php
abstract class __RetailCRM_events
{
public function onCronGenerateICML()
{
$icml = new RCrmIcml();
$icml->generateICML();
}
public function onCronSyncHistory()
{
$history = new RCrmHistory();
$history->runCustomers();
$history->runOrders();
}
public function onOrderStatusChanged(umiEventPoint $eventPoint)
{
if ($eventPoint->getMode() != 'after') {
return;
}
$mode = $eventPoint->getParam('old-status-id') == null ? 'create' : 'edit';
/** @var order $order */
$order = $eventPoint->getRef('order');
RCrmActions::orderSend($order->getId(), $mode);
}
public function onModifyProperty(umiEventPoint $eventPoint)
{
/** @var umiEventPoint $eventPoint */
if ($eventPoint->getMode() != 'after') {
return;
}
/** @var umiObject $entity */
$entity = $eventPoint->getRef('entity');
RCrmActions::orderSend($entity->getId(), 'edit');
}
public function onModifyObject(umiEventPoint $eventPoint)
{
/** @var umiEventPoint $eventPoint */
if ($eventPoint->getMode() != 'after') {
return;
}
/** @var umiObject $object */
$object = $eventPoint->getRef('object');
RCrmActions::orderSend($object->getId(), 'edit');
}
}