%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.136.23.239 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/sale/lib/sender/ |
Upload File : |
<? namespace Bitrix\Sale\Sender; use Bitrix\Main\Localization\Loc; use Bitrix\Main\Loader; if (!Loader::includeModule('sender')) { return; } Loc::loadMessages(__FILE__); class TriggerBasketForgotten extends \Bitrix\Sender\TriggerConnectorClosed { public function getName() { return Loc::getMessage('sender_trigger_basket_forgotten_name'); } public function getCode() { return "basket_forgotten"; } /** @return bool */ public static function canBeTarget() { return false; } /** @return bool */ public static function canRunForOldData() { return true; } public function filter() { \Bitrix\Main\Loader::includeModule('sale'); $daysBasketForgotten = $this->getFieldValue('DAYS_BASKET_FORGOTTEN'); if(!is_numeric($daysBasketForgotten)) $daysBasketForgotten = 90; $dateFrom = new \Bitrix\Main\Type\DateTime; $dateTo = new \Bitrix\Main\Type\DateTime; $dateFrom->setTime(0, 0, 0)->add('-' . $daysBasketForgotten . ' days'); $dateTo->setTime(0, 0, 0)->add('1 days')->add('-' . $daysBasketForgotten . ' days'); if($this->isRunForOldData()) { $filter = array( '<MIN_DATE_INSERT' => $dateTo->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT), ); } else { $filter = array( '>MIN_DATE_INSERT' => $dateFrom->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT), '<MIN_DATE_INSERT' => $dateTo->format(\Bitrix\Main\UserFieldTable::MULTIPLE_DATETIME_FORMAT), ); } $filter = $filter + array( '!FUSER.USER_ID' => null, '=ORDER_ID' => null, '=LID' => $this->getSiteId(), ); $userListDb = \Bitrix\Sale\Internals\BasketTable::getList(array( 'select' => array('USER_ID' => 'FUSER.USER_ID', 'EMAIL' => 'FUSER.USER.EMAIL', 'FUSER_USER_NAME' => 'FUSER.USER.NAME'), 'filter' => $filter, 'runtime' => array( new \Bitrix\Main\Entity\ExpressionField('MIN_DATE_INSERT', 'MIN(%s)', 'DATE_INSERT'), ), 'order' => array('USER_ID' => 'ASC') )); if($userListDb->getSelectedRowsCount() > 0) { $userListDb->addFetchDataModifier(array($this, 'getFetchDataModifier')); $this->recipient = $userListDb; return true; } else return false; } public function getForm() { $daysBasketForgottenInput = ' <input size=3 type="text" name="'.$this->getFieldName('DAYS_BASKET_FORGOTTEN').'" value="'.htmlspecialcharsbx($this->getFieldValue('DAYS_BASKET_FORGOTTEN', 1)).'"> '; return ' <table> <tr> <td>'.Loc::getMessage('sender_trigger_basket_forgotten_days').'</td> <td>'.$daysBasketForgottenInput.'</td> </tr> </table> '; } public function getRecipient() { return $this->recipient; } public function getFetchDataModifier($fields) { if(isset($fields['FUSER_USER_NAME'])) { $fields['NAME'] = $fields['FUSER_USER_NAME']; unset($fields['FUSER_USER_NAME']); } return $fields; } }