Commit 622d0396225c54c607485cd89413b4de497ec394

Authored by Yarik
1 parent c616c474

Artbox great prepairings

composer.json
... ... @@ -6,7 +6,8 @@
6 6 "type": "yii2-extension",
7 7 "require": {
8 8 "php": ">=7.0",
9   - "yiisoft/yii2": "~2.0"
  9 + "yiisoft/yii2": "~2.0",
  10 + "artweb/artbox-core": "~0.0.1"
10 11 },
11 12 "autoload": {
12 13 "psr-4": {
... ...
controllers/OrderController.php
... ... @@ -2,7 +2,6 @@
2 2  
3 3 namespace artbox\order\controllers;
4 4  
5   - use artbox\catalog\models\Product;
6 5 use artbox\catalog\models\Variant;
7 6 use artbox\order\models\Delivery;
8 7 use artbox\order\models\Label;
... ... @@ -12,7 +11,6 @@
12 11 use artbox\order\models\Order;
13 12 use artbox\order\models\OrderSearch;
14 13 use yii\base\InvalidParamException;
15   - use yii\base\Model;
16 14 use yii\web\Controller;
17 15 use yii\web\NotFoundHttpException;
18 16 use yii\filters\VerbFilter;
... ...
models/Customer.php
... ... @@ -13,9 +13,8 @@
13 13  
14 14 /**
15 15 * This is the model class for table "customer".
16   -
17   -*
18   -*@property integer $id
  16 + *
  17 + * @property integer $id
19 18 * @property string $username
20 19 * @property string $auth_key
21 20 * @property string $password_hash
... ...
models/DeliverySearch.php
... ... @@ -2,10 +2,8 @@
2 2  
3 3 namespace artbox\order\models;
4 4  
5   - use Yii;
6 5 use yii\base\Model;
7 6 use yii\data\ActiveDataProvider;
8   - use artbox\order\models\Delivery;
9 7  
10 8 /**
11 9 * DeliverySearch represents the model behind the search form about `artbox\order\models\Delivery`.
... ...
models/LabelSearch.php
... ... @@ -2,10 +2,8 @@
2 2  
3 3 namespace artbox\order\models;
4 4  
5   - use Yii;
6 5 use yii\base\Model;
7 6 use yii\data\ActiveDataProvider;
8   - use artbox\order\models\Label;
9 7  
10 8 /**
11 9 * LabelSearch represents the model behind the search form about `artbox\order\models\Label`.
... ...
models/OrderProductSearch.php
... ... @@ -2,10 +2,8 @@
2 2  
3 3 namespace artbox\order\models;
4 4  
5   - use Yii;
6 5 use yii\base\Model;
7 6 use yii\data\ActiveDataProvider;
8   - use artbox\order\models\OrderProduct;
9 7  
10 8 /**
11 9 * OrderProductSearch represents the model behind the search form about `artbox\order\models\OrderProduct`.
... ...
models/OrderSearch.php
... ... @@ -2,10 +2,8 @@
2 2  
3 3 namespace artbox\order\models;
4 4  
5   - use Yii;
6 5 use yii\base\Model;
7 6 use yii\data\ActiveDataProvider;
8   - use artbox\order\models\Order;
9 7  
10 8 /**
11 9 * OrderSearch represents the model behind the search form about `artbox\order\models\Order`.
... ...
models/PasswordForm.php
... ... @@ -10,7 +10,10 @@
10 10 public $oldpass;
11 11 public $newpass;
12 12 public $repeatnewpass;
13   -
  13 +
  14 + /**
  15 + * @inheritdoc
  16 + */
14 17 public function rules()
15 18 {
16 19 return [
... ... @@ -36,22 +39,29 @@
36 39  
37 40 public function validatePassword($attribute)
38 41 {
  42 + /**
  43 + * @var \artbox\core\models\User $identity
  44 + */
  45 + $identity = \Yii::$app->user->identity;
39 46 if (!Yii::$app->getSecurity()
40 47 ->validatePassword(
41 48 $this->oldpass,
42   - \Yii::$app->user->identity->password_hash
  49 + $identity->password_hash
43 50 )
44 51 ) {
45 52 $this->addError($attribute, 'Old password is incorrect');
46 53 }
47 54 }
48   -
  55 +
  56 + /**
  57 + * @inheritdoc
  58 + */
49 59 public function attributeLabels()
50 60 {
51 61 return [
52   - 'oldpass' => \Yii::t('app', 'Старый пароль'),
53   - 'newpass' => \Yii::t('app', 'Новый пароль'),
54   - 'repeatnewpass' => \Yii::t('app', 'Повторите новый пароль'),
  62 + 'oldpass' => \Yii::t('order', 'Старый пароль'),
  63 + 'newpass' => \Yii::t('order', 'Новый пароль'),
  64 + 'repeatnewpass' => \Yii::t('order', 'Повторите новый пароль'),
55 65 ];
56 66 }
57 67 }
58 68 \ No newline at end of file
... ...
models/Payment.php
... ... @@ -6,6 +6,7 @@
6 6 use artbox\core\models\Language;
7 7 use Yii;
8 8 use yii\db\ActiveQuery;
  9 + use yii\db\ActiveRecord;
9 10 use yii\web\Request;
10 11  
11 12 /**
... ... @@ -41,7 +42,7 @@
41 42 * * End language behavior *
42 43 * @see LanguageBehavior
43 44 */
44   - class Payment extends \yii\db\ActiveRecord
  45 + class Payment extends ActiveRecord
45 46 {
46 47 /**
47 48 * @inheritdoc
... ...
models/PaymentLang.php
... ... @@ -4,7 +4,8 @@
4 4  
5 5 use artbox\core\models\Language;
6 6 use Yii;
7   -
  7 + use yii\db\ActiveRecord;
  8 +
8 9 /**
9 10 * This is the model class for table "payment_lang".
10 11 *
... ... @@ -15,7 +16,7 @@
15 16 * @property Language $language
16 17 * @property Payment $payment
17 18 */
18   - class PaymentLang extends \yii\db\ActiveRecord
  19 + class PaymentLang extends ActiveRecord
19 20 {
20 21 /**
21 22 * @inheritdoc
... ...
models/PaymentSearch.php
... ... @@ -2,10 +2,8 @@
2 2  
3 3 namespace artbox\order\models;
4 4  
5   - use Yii;
6 5 use yii\base\Model;
7 6 use yii\data\ActiveDataProvider;
8   - use artbox\order\models\Payment;
9 7  
10 8 /**
11 9 * PaymentSearch represents the model behind the search form about `artbox\order\models\Payment`.
... ...