%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.145.55.39 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/sender/lib/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage sender * @copyright 2001-2012 Bitrix */ namespace Bitrix\Sender; use Bitrix\Main\Entity; use Bitrix\Main\Localization\Loc; use Bitrix\Main\Type as MainType; use Bitrix\Main\DB\SqlExpression; Loc::loadMessages(__FILE__); /** * Class ListTable * * DO NOT WRITE ANYTHING BELOW THIS * * <<< ORMENTITYANNOTATION * @method static EO_List_Query query() * @method static EO_List_Result getByPrimary($primary, array $parameters = array()) * @method static EO_List_Result getById($id) * @method static EO_List_Result getList(array $parameters = array()) * @method static EO_List_Entity getEntity() * @method static \Bitrix\Sender\EO_List createObject($setDefaultValues = true) * @method static \Bitrix\Sender\EO_List_Collection createCollection() * @method static \Bitrix\Sender\EO_List wakeUpObject($row) * @method static \Bitrix\Sender\EO_List_Collection wakeUpCollection($rows) */ class ListTable extends Entity\DataManager { /** * Get table name. * * @return string */ public static function getTableName() { return 'b_sender_list'; } /** * Get map. * * @return array */ public static function getMap() { return array( 'ID' => array( 'data_type' => 'integer', 'autocomplete' => true, 'primary' => true, ), 'CODE' => array( 'data_type' => 'string', 'validation' => array(__CLASS__, 'validateCode'), 'title' => Loc::getMessage('SENDER_ENTITY_LIST_FIELD_TITLE_CODE'), ), 'NAME' => array( 'data_type' => 'string', 'required' => true, 'default_value' => Loc::getMessage( 'SENDER_ENTITY_LIST_FIELD_NAME_PATTERN', ['%date%' => Internals\PrettyDate::formatDate()] ), 'title' => Loc::getMessage('SENDER_ENTITY_LIST_FIELD_TITLE_NAME'), ), 'SORT' => array( 'data_type' => 'integer', 'default_value' => 100, 'required' => true, 'title' => Loc::getMessage('SENDER_ENTITY_LIST_FIELD_TITLE_SORT'), ), 'CONTACT_LIST' => array( 'data_type' => 'Bitrix\Sender\ContactListTable', 'reference' => array('=this.ID' => 'ref.LIST_ID'), ), ); } /** * Returns validators for CODE field. * * @return array */ public static function validateCode() { return array( new Entity\Validator\Length(null, 60), ); } /** * On after delete. * * @param Entity\Event $event Event. * @return Entity\EventResult */ public static function onAfterDelete(Entity\Event $event) { $result = new Entity\EventResult; $data = $event->getParameters(); $primary = array('LIST_ID' => $data['primary']['ID']); ContactListTable::deleteList($primary); return $result; } /** * Add if not exist. * * @param string $code Code. * @param string $name Name. * @return bool|int * @throws \Bitrix\Main\ArgumentException */ public static function addIfNotExist($code, $name) { $id = false; if( !($arList = static::getList(array('filter' => array('CODE' => $code)))->fetch() )) { $resultAdd = static::add(array('CODE' => $code, 'NAME' => $name)); if ($resultAdd->isSuccess()) { $id = $resultAdd->getId(); } } else { $id = $arList['ID']; } return $id; } }