<commit_before><?php

namespace Ecommerce;

class Cart extends \Model {

    static $objectName = 'Корзины';

    static function relations() {
        return [
            'user' => [
                'model' => 'Users\User',
                'col' => 'user_id'
            ],
            'cartItems' => [
                'type' => 'many',
                'model' => 'Ecommerce\Cart\Item',
                'col' => 'cart_id',
            ],
            'events' => [
                'type' => 'many',
                'model' => 'Ecommerce\Cart\Event',
                'col' => 'cart_id',
            ],
            'status' => [
                'model' => 'Ecommerce\Cart\Status',
                'col' => 'cart_status_id'
            ],
            'delivery' => [
                'model' => 'Ecommerce\Delivery',
                'col' => 'delivery_id'
            ],
            'payType' => [
                'model' => 'Ecommerce\PayType',
                'col' => 'paytype_id'
            ],
            'infos' => [
                'type' => 'many',
                'model' => 'Ecommerce\Cart\Info',
                'col' => 'cart_id'
            ],
            'extras' => [
                'type' => 'many',
                'model' => 'Ecommerce\Cart\Extra',
                'col' => 'cart_id'
            ],
            'card' => [
                'model' => 'Ecommerce\Card\Item',
                'col' => 'card_item_id'
            ]
        ];
    }

    static $labels = [
        'user_id' => 'Пользователь',
        'sum' => 'Сумма',
        'cart_status_id' => 'Статус',
        'delivery_id' => 'Доставка',
        'comment' => 'Комментарий',
        'bonus_used' => 'Выгодные рубли',
        'complete_data' => 'Время заказа',
        'info' => 'Информация',
        'items' => 'Товары',
        'paytype_id' => 'Способ оплаты',
        'exported' => 'Выгружено',
        'warehouse_block' => 'Блокировка товаров',
        'extra' => 'Дополнительно',
        'card_item_id' => 'Дисконтная карта',
        'info' => 'Информация',
    ];
    static $cols = [
        'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'],
        'info' => ['type' => 'dataManager', 'relation' => 'infos'],
        'items' => ['type' => 'select', 'source' => 'relation', 'relation' => 'cartItems'],
        'sum' => ['type' => 'text'],
        'warehouse_block' => ['type' => 'bool'],
        'exported' => ['type' => 'bool'],
        'comment' => ['type' => 'textarea'],
        'complete_data' => ['type' => 'dateTime'],
        'items' => ['type' => 'dataManager', 'relation' => 'cartItems'],
        'cart_status_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'status'],
        'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],
        'paytype_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'payType'],
        'card_item_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'card'],
        'extra' => ['type' => 'dataManager', 'relation' => 'extras'],
    ];
    static $dataManagers = [
        'manager' => [
            'cols' => [
                'info',
                'items',
                'extra',
                'sum',
                'cart_status_id',
                'exported',
                'delivery_id',
                'complete_data',
            ],
            'sortable' => [
                'items',
                'sum',
                'cart_status_id',
                'exported',
                'delivery_id',
                'complete_data',
            ],
            'filters' => [
                'sum',
                'cart_status_id',
                'exported',
                'delivery_id',
                'complete_data',
            ],
            'preSort' => [
                'complete_data' => 'desc'
            ]
        ]
    ];
    static $forms = [
        'manager' => [
            'map' => [
                ['user_id', 'cart_status_id'],
                ['paytype_id', 'delivery_id'],
                ['card_item_id', 'comment'],
                ['warehouse_block', 'complete_data'],
                ['items'],
                ['extra']
            ]
        ],
    ];

    function addPacks($count = 1) {
        $this->addItem(Inji::app()->ecommerce->modConf['packItem']['ci_id'], Inji::app()->ecommerce->modConf['packItem']['ciprice_id'], $count);
    }

    function needDelivery() {
        foreach ($this->cartItems as $cartItem) {
            if (!$cartItem->item->type) {
                continue;
            }<commit_msg>no item sortable, hide exported col<commit_after><?php

namespace Ecommerce;

class Cart extends \Model {

    static $objectName = 'Корзины';

    static function relations() {
        return [
            'user' => [
                'model' => 'Users\User',
                'col' => 'user_id'
            ],
            'cartItems' => [
                'type' => 'many',
                'model' => 'Ecommerce\Cart\Item',
                'col' => 'cart_id',
            ],
            'events' => [
                'type' => 'many',
                'model' => 'Ecommerce\Cart\Event',
                'col' => 'cart_id',
            ],
            'status' => [
                'model' => 'Ecommerce\Cart\Status',
                'col' => 'cart_status_id'
            ],
            'delivery' => [
                'model' => 'Ecommerce\Delivery',
                'col' => 'delivery_id'
            ],
            'payType' => [
                'model' => 'Ecommerce\PayType',
                'col' => 'paytype_id'
            ],
            'infos' => [
                'type' => 'many',
                'model' => 'Ecommerce\Cart\Info',
                'col' => 'cart_id'
            ],
            'extras' => [
                'type' => 'many',
                'model' => 'Ecommerce\Cart\Extra',
                'col' => 'cart_id'
            ],
            'card' => [
                'model' => 'Ecommerce\Card\Item',
                'col' => 'card_item_id'
            ]
        ];
    }

    static $labels = [
        'user_id' => 'Пользователь',
        'sum' => 'Сумма',
        'cart_status_id' => 'Статус',
        'delivery_id' => 'Доставка',
        'comment' => 'Комментарий',
        'bonus_used' => 'Выгодные рубли',
        'complete_data' => 'Время заказа',
        'info' => 'Информация',
        'items' => 'Товары',
        'paytype_id' => 'Способ оплаты',
        'exported' => 'Выгружено',
        'warehouse_block' => 'Блокировка товаров',
        'extra' => 'Дополнительно',
        'card_item_id' => 'Дисконтная карта',
        'info' => 'Информация',
    ];
    static $cols = [
        'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'],
        'info' => ['type' => 'dataManager', 'relation' => 'infos'],
        'items' => ['type' => 'select', 'source' => 'relation', 'relation' => 'cartItems'],
        'sum' => ['type' => 'text'],
        'warehouse_block' => ['type' => 'bool'],
        'exported' => ['type' => 'bool'],
        'comment' => ['type' => 'textarea'],
        'complete_data' => ['type' => 'dateTime'],
        'items' => ['type' => 'dataManager', 'relation' => 'cartItems'],
        'cart_status_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'status'],
        'delivery_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'delivery'],
        'paytype_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'payType'],
        'card_item_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'card'],
        'extra' => ['type' => 'dataManager', 'relation' => 'extras'],
    ];
    static $dataManagers = [
        'manager' => [
            'cols' => [
                'info',
                'items',
                'extra',
                'sum',
                'cart_status_id',
                'delivery_id',
                'complete_data',
            ],
            'sortable' => [
                'sum',
                'cart_status_id',
                'delivery_id',
                'complete_data',
            ],
            'filters' => [
                'sum',
                'cart_status_id',
                'delivery_id',
                'complete_data',
            ],
            'preSort' => [
                'complete_data' => 'desc'
            ]
        ]
    ];
    static $forms = [
        'manager' => [
            'map' => [
                ['user_id', 'cart_status_id'],
                ['paytype_id', 'delivery_id'],
                ['card_item_id', 'comment'],
                ['warehouse_block', 'complete_data'],
                ['items'],
                ['extra']
            ]
        ],
    ];

    function addPacks($count = 1) {
        $this->addItem(Inji::app()->ecommerce->modConf['packItem']['ci_id'], Inji::app()->ecommerce->modConf['packItem']['ciprice_id'], $count);
    }

    function needDelivery() {
        foreach ($this->cartItems as $cartItem) {
            if (!$cartItem->item->type) {
                continue;
            }
{'fraction_non_alphanumeric': 0.19014778325123152, 'fraction_numerical': 0.00021893814997263274, 'mean_word_length': 1.424628450106157, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 213, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1206687', 'n_tokens_mistral': 2828, 'n_tokens_neox': 2765, 'n_words': 471}