Blame view

backend/models/Accounts.php 4.25 KB
27ba995c   Administrator   access in admin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
  <?php
  
  namespace backend\models;
  
  use Yii;
  
  /**
   * This is the model class for table "w_accounts".
   *
   *
   * @property integer $id
   * @property integer $if_manager
   * @property string $email
   * @property string $pass
   * @property integer $margin_id
   * @property string $name
   * @property string $phones
   * @property integer $country
   * @property integer $city
   * @property string $address
   * @property string $comment
   * @property integer $rating
   * @property string $dt
   * @property integer $is_active
   * @property integer $is_firm
   * @property string $last_loginin
   * @property string $firm_inn
   * @property string $firm_bank
   * @property double $balance
   * @property integer $office_id
   * @property integer $is_scribe
   * @property integer $set_manager_id
   * @property string $phones2
   * @property string $phones3
   * @property integer $car
   * @property integer $mod
   * @property string $snumb
   * @property integer $deliveries
   * @property integer $scode
   * @property string $firm_ur_adr
   * @property string $firm_fiz_adr
   * @property string $firm_code_eg
   * @property string $firm_rs
   * @property string $firm_mfo
   * @property string $firm_site
   * @property string $company
   */
  class Accounts extends \yii\db\ActiveRecord
  {
  
27ba995c   Administrator   access in admin
51
52
53
54
55
56
57
58
59
60
61
62
  
      /**
       * @inheritdoc
       */
      public static function tableName()
      {
          return 'w_accounts';
      }
  
  
      public function beforeSave()
      {
b77421d2   Administrator   VItaliy 26.11.2015
63
          $date = \DateTime::createFromFormat('Y-m-d' , $this->dt);
27ba995c   Administrator   access in admin
64
          $this->dt = $date->getTimestamp();
c6152cd6   Administrator   VItaliy 25.11.2015
65
          return true;
27ba995c   Administrator   access in admin
66
67
68
69
70
71
72
73
74
75
  
      }
  
      /**
       * @inheritdoc
       */
      public function rules()
      {
          return [
              [['if_manager', 'margin_id', 'country', 'city', 'rating',  'is_active', 'is_firm', 'office_id', 'is_scribe', 'set_manager_id', 'car', 'mod', 'deliveries', 'scode'], 'integer'],
d95219a3   Administrator   access in admin
76
              [['email', 'pass', 'name', 'phones'], 'required'],
27ba995c   Administrator   access in admin
77
78
              [['comment'], 'string'],
              [['balance'], 'number'],
d95219a3   Administrator   access in admin
79
80
              [['email', 'name', 'firm_site'], 'string', 'max' => 150],
              [['pass'], 'string', 'max' => 30],
27ba995c   Administrator   access in admin
81
82
83
84
85
86
              [['phones', 'phones2', 'phones3'], 'string', 'max' => 50],
              [['address', 'firm_inn', 'firm_bank'], 'string', 'max' => 254],
              [['last_loginin'], 'string', 'max' => 15],
              [['snumb', 'firm_ur_adr', 'firm_fiz_adr', 'firm_code_eg', 'firm_rs', 'firm_mfo', 'company'], 'string', 'max' => 255],
              [['email'], 'unique'],
              [['email'], 'email'],
b77421d2   Administrator   VItaliy 26.11.2015
87
              ['dt', 'date', 'format' => 'php:Y-m-d']
27ba995c   Administrator   access in admin
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
          ];
      }
  
      /**
       * @inheritdoc
       */
      public function attributeLabels()
      {
          return [
              'id' => 'ID',
              'if_manager' => 'Статус менеджера',
              'email' => 'E-mail (Логин)',
              'pass' => 'Пароль',
              'margin_id' => 'Тип цены',
              'name' => 'Имя',
              'phones' => 'Телефоны',
              'country' => Yii::t('app', 'Country'),
              'city' =>'Город',
              'address' => 'Адрес',
              'comment' => 'Комментарий',
              'rating' => Yii::t('app', 'Rating'),
              'dt' =>'Дата регистрации',
              'is_active' => 'Активный',
              'is_firm' => 'Юридическое лицо',
              'last_loginin' => Yii::t('app', 'Last Loginin'),
              'firm_inn' => 'ИНН',
              'firm_bank' => 'Банк',
              'balance' => Yii::t('app', 'Balance'),
              'office_id' => Yii::t('app', 'Office ID'),
              'is_scribe' => 'Подписка',
              'set_manager_id' => 'Персональный менеджер',
              'phones2' => 'Телефоны 2',
              'phones3' => 'Телефоны 3',
              'car' => Yii::t('app', 'Car'),
              'mod' => Yii::t('app', 'Mod'),
              'snumb' => 'snumb',
              'deliveries' => Yii::t('app', 'Deliveries'),
              'scode' => 'Код в 1С',
              'firm_ur_adr' => 'Юридический адрес',
              'firm_fiz_adr' => 'Физический адрес',
              'firm_code_eg' => 'Код ЭГ',
              'firm_rs' => 'Расчётный счёт',
              'firm_mfo' => 'МФО',
              'firm_site' => 'Сайт',
              'company' => 'Название фирмы',
          ];
      }
  }