Completed
Push — master ( 6b0f1e...2f7716 )
by Alexey
13:51 queued 08:58
created
system/modules/Ecommerce/models/Category.php 1 patch
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -13,50 +13,50 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Category extends \Model {
15 15
 
16
-  public static $objectName = 'Категория магазина';
17
-  public static $treeCategory = 'Ecommerce\Item';
18
-  public static $cols = [
19
-      //Основные параметры
20
-      'parent_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'parent'],
21
-      'name' => ['type' => 'text'],
22
-      'alias' => ['type' => 'text'],
23
-      'viewer' => ['type' => 'select', 'source' => 'method', 'method' => 'viewsCategoryList', 'module' => 'Ecommerce'],
24
-      'template' => ['type' => 'select', 'source' => 'method', 'method' => 'templatesCategoryList', 'module' => 'Ecommerce'],
25
-      'description' => ['type' => 'html'],
26
-      'image_file_id' => ['type' => 'image'],
27
-      'options_inherit' => ['type' => 'bool'],
28
-      //Системные
29
-      'imported' => ['type' => 'bool'],
30
-      'weight' => ['type' => 'number'],
31
-      'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'],
32
-      'tree_path' => ['type' => 'text'],
33
-      'date_create' => ['type' => 'dateTime'],
34
-      //Менеджеры
35
-      'options' => ['type' => 'dataManager', 'relation' => 'options'],
36
-  ];
37
-  public static $labels = [
38
-      'name' => 'Название',
39
-      'alias' => 'Алиас',
40
-      'parent_id' => 'Родительская категория',
41
-      'image_file_id' => 'Изображение',
42
-      'description' => 'Описание',
43
-      'options_inherit' => 'Наследовать набор свойств',
44
-      'options' => 'Свойства товаров',
45
-  ];
46
-  public static $forms = [
47
-      'manager' => [
48
-          'map' => [
49
-              ['name', 'alias'],
50
-              ['parent_id', 'image_file_id'],
51
-              ['viewer', 'template'],
52
-              ['options_inherit'],
53
-              ['options'],
54
-              ['description']
55
-          ]
56
-      ]
57
-  ];
16
+    public static $objectName = 'Категория магазина';
17
+    public static $treeCategory = 'Ecommerce\Item';
18
+    public static $cols = [
19
+        //Основные параметры
20
+        'parent_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'parent'],
21
+        'name' => ['type' => 'text'],
22
+        'alias' => ['type' => 'text'],
23
+        'viewer' => ['type' => 'select', 'source' => 'method', 'method' => 'viewsCategoryList', 'module' => 'Ecommerce'],
24
+        'template' => ['type' => 'select', 'source' => 'method', 'method' => 'templatesCategoryList', 'module' => 'Ecommerce'],
25
+        'description' => ['type' => 'html'],
26
+        'image_file_id' => ['type' => 'image'],
27
+        'options_inherit' => ['type' => 'bool'],
28
+        //Системные
29
+        'imported' => ['type' => 'bool'],
30
+        'weight' => ['type' => 'number'],
31
+        'user_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'user'],
32
+        'tree_path' => ['type' => 'text'],
33
+        'date_create' => ['type' => 'dateTime'],
34
+        //Менеджеры
35
+        'options' => ['type' => 'dataManager', 'relation' => 'options'],
36
+    ];
37
+    public static $labels = [
38
+        'name' => 'Название',
39
+        'alias' => 'Алиас',
40
+        'parent_id' => 'Родительская категория',
41
+        'image_file_id' => 'Изображение',
42
+        'description' => 'Описание',
43
+        'options_inherit' => 'Наследовать набор свойств',
44
+        'options' => 'Свойства товаров',
45
+    ];
46
+    public static $forms = [
47
+        'manager' => [
48
+            'map' => [
49
+                ['name', 'alias'],
50
+                ['parent_id', 'image_file_id'],
51
+                ['viewer', 'template'],
52
+                ['options_inherit'],
53
+                ['options'],
54
+                ['description']
55
+            ]
56
+        ]
57
+    ];
58 58
 
59
-  public static function indexes() {
59
+    public static function indexes() {
60 60
     return [
61 61
         'ecommerce_category_category_parent_id' => [
62 62
             'type' => 'INDEX',
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
             ]
72 72
         ],
73 73
     ];
74
-  }
74
+    }
75 75
 
76
-  public static function relations() {
76
+    public static function relations() {
77 77
     return [
78 78
         'items' => [
79 79
             'type' => 'many',
@@ -103,50 +103,50 @@  discard block
 block discarded – undo
103 103
             'col' => 'parent_id',
104 104
         ]
105 105
     ];
106
-  }
106
+    }
107 107
 
108
-  public static $dataManagers = [
109
-      'manager' => [
110
-          'name' => 'Категории товаров',
111
-          'cols' => [
112
-              'name',
113
-              'parent_id',
114
-          ],
115
-          'sortMode' => true
116
-      ]
117
-  ];
108
+    public static $dataManagers = [
109
+        'manager' => [
110
+            'name' => 'Категории товаров',
111
+            'cols' => [
112
+                'name',
113
+                'parent_id',
114
+            ],
115
+            'sortMode' => true
116
+        ]
117
+    ];
118 118
 
119
-  public function beforeSave() {
119
+    public function beforeSave() {
120 120
     if ($this->id && $this->id == $this->parent_id) {
121
-      $this->parent_id = 0;
122
-      \Msg::add('Категория не может быть сама себе родителем');
121
+        $this->parent_id = 0;
122
+        \Msg::add('Категория не может быть сама себе родителем');
123
+    }
123 124
     }
124
-  }
125 125
 
126
-  public function beforeDelete() {
126
+    public function beforeDelete() {
127 127
     foreach ($this->catalogs as $category) {
128
-      $category->delete();
128
+        $category->delete();
129
+    }
129 130
     }
130
-  }
131 131
 
132
-  public function resolveTemplate() {
132
+    public function resolveTemplate() {
133 133
     if ($this->template !== 'inherit') {
134
-      return $this->template;
134
+        return $this->template;
135 135
     } elseif ($this->template == 'inherit' && $this->category) {
136
-      return $this->category->resolveTemplate(true);
136
+        return $this->category->resolveTemplate(true);
137 137
     } else {
138
-      return (!empty(\App::$cur->ecommerce->config['defaultCategoryTemplate']) ? \App::$cur->ecommerce->config['defaultCategoryTemplate'] : 'current');
138
+        return (!empty(\App::$cur->ecommerce->config['defaultCategoryTemplate']) ? \App::$cur->ecommerce->config['defaultCategoryTemplate'] : 'current');
139
+    }
139 140
     }
140
-  }
141 141
 
142
-  public function resolveViewer() {
142
+    public function resolveViewer() {
143 143
     if ($this->viewer !== 'inherit') {
144
-      return $this->viewer;
144
+        return $this->viewer;
145 145
     } elseif ($this->viewer == 'inherit' && $this->category) {
146
-      return $this->category->resolveViewer(true);
146
+        return $this->category->resolveViewer(true);
147 147
     } else {
148
-      return (!empty(\App::$cur->ecommerce->config['defaultCategoryView']) ? \App::$cur->ecommerce->config['defaultCategoryView'] : 'itemList');
148
+        return (!empty(\App::$cur->ecommerce->config['defaultCategoryView']) ? \App::$cur->ecommerce->config['defaultCategoryView'] : 'itemList');
149
+    }
149 150
     }
150
-  }
151 151
 
152 152
 }
Please login to merge, or discard this patch.
system/modules/Exchange1c/objects/Parser/Item/Options.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -13,73 +13,73 @@
 block discarded – undo
13 13
 
14 14
 class Options extends \Migrations\Parser {
15 15
 
16
-  static $options;
16
+    static $options;
17 17
 
18
-  public function parse() {
18
+    public function parse() {
19 19
     if (!Options::$options) {
20
-      Options::$options = \Ecommerce\Item\Option::getList();
20
+        Options::$options = \Ecommerce\Item\Option::getList();
21 21
     }
22 22
     $options = [];
23 23
     $modelName = 'Ecommerce\Item\Option';
24 24
     foreach ($this->data['ЗначенияСвойства'] as $opt) {
25
-      $optionId = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option'][$opt['Ид']]->object_id;
26
-      if ($optionId && !isset(Options::$options[$optionId])) {
25
+        $optionId = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option'][$opt['Ид']]->object_id;
26
+        if ($optionId && !isset(Options::$options[$optionId])) {
27 27
         Options::$options = \Ecommerce\Item\Option::getList();
28
-      }
29
-      if (isset(Options::$options[$optionId]) && Options::$options[$optionId]->type == 'select') {
28
+        }
29
+        if (isset(Options::$options[$optionId]) && Options::$options[$optionId]->type == 'select') {
30 30
         if (empty($options[$optionId])) {
31
-          $options[$optionId] = [];
31
+            $options[$optionId] = [];
32 32
         } else {
33
-          if (!Options::$options[$optionId]->advance) {
33
+            if (!Options::$options[$optionId]->advance) {
34 34
             Options::$options[$optionId]->advance = ['multi' => true];
35 35
             Options::$options[$optionId]->save();
36
-          }
36
+            }
37 37
         }
38 38
         $options[$optionId][] = \App::$cur->migrations->ids['parseIds']['Ecommerce\Item\Option\Item'][$opt['Значение']]->object_id;
39
-      } else {
39
+        } else {
40 40
         $options[$optionId] = $opt['Значение'];
41
-      }
41
+        }
42 42
     }
43 43
     $itemParams = \Ecommerce\Item\Param::getList(['where' => ['item_id', $this->model->id]]);
44 44
     foreach ($itemParams as $itemParam) {
45
-      if ($itemParam->item_option_id && !isset(Options::$options[$itemParam->item_option_id])) {
45
+        if ($itemParam->item_option_id && !isset(Options::$options[$itemParam->item_option_id])) {
46 46
         Options::$options = \Ecommerce\Item\Option::getList();
47
-      }
48
-      if (isset(Options::$options[$itemParam->item_option_id]) && Options::$options[$itemParam->item_option_id]->type == 'select') {
47
+        }
48
+        if (isset(Options::$options[$itemParam->item_option_id]) && Options::$options[$itemParam->item_option_id]->type == 'select') {
49 49
         if (empty($options[$itemParam->item_option_id]) || !in_array($itemParam->value, $options[$itemParam->item_option_id])) {
50
-          $itemParam->delete();
50
+            $itemParam->delete();
51 51
         } else {
52
-          unset($options[$itemParam->item_option_id][array_search($itemParam->value, $options[$itemParam->item_option_id])]);
52
+            unset($options[$itemParam->item_option_id][array_search($itemParam->value, $options[$itemParam->item_option_id])]);
53 53
         }
54
-      } else {
54
+        } else {
55 55
         if (empty($options[$itemParam->item_option_id])) {
56
-          $itemParam->delete();
56
+            $itemParam->delete();
57 57
         } else {
58
-          $itemParam->value = $options[$itemParam->item_option_id];
59
-          $itemParam->save();
60
-          unset($options[$itemParam->item_option_id]);
58
+            $itemParam->value = $options[$itemParam->item_option_id];
59
+            $itemParam->save();
60
+            unset($options[$itemParam->item_option_id]);
61
+        }
61 62
         }
62
-      }
63 63
     }
64 64
     foreach ($options as $optionId => $values) {
65
-      if (is_array($values)) {
65
+        if (is_array($values)) {
66 66
         foreach ($values as $value) {
67
-          $itemParam = new \Ecommerce\Item\Param([
68
-              'item_option_id' => $optionId,
69
-              'item_id' => $this->model->id,
70
-              'value' => $value
71
-          ]);
72
-          $itemParam->save();
67
+            $itemParam = new \Ecommerce\Item\Param([
68
+                'item_option_id' => $optionId,
69
+                'item_id' => $this->model->id,
70
+                'value' => $value
71
+            ]);
72
+            $itemParam->save();
73 73
         }
74
-      } else {
74
+        } else {
75 75
         $itemParam = new \Ecommerce\Item\Param([
76 76
             'item_option_id' => $optionId,
77 77
             'item_id' => $this->model->id,
78 78
             'value' => $values
79 79
         ]);
80 80
         $itemParam->save();
81
-      }
81
+        }
82
+    }
82 83
     }
83
-  }
84 84
 
85 85
 }
Please login to merge, or discard this patch.
system/modules/Ecommerce/models/Item/Image.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,22 +13,22 @@  discard block
 block discarded – undo
13 13
 
14 14
 class Image extends \Model {
15 15
 
16
-  static $objectName = 'Фото товара';
17
-  static $labels = [
18
-      'file_id' => 'Изображение',
19
-      'item_id' => 'Товар',
20
-      'name' => 'Название',
21
-      'description' => 'Описание',
22
-  ];
23
-  static $cols = [
24
-      'file_id' => ['type' => 'image'],
25
-      'item_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'item'],
26
-      'name' => ['type' => 'text'],
27
-      'description' => ['type' => 'html'],
28
-      'weight' => ['type' => 'number'],
29
-  ];
16
+    static $objectName = 'Фото товара';
17
+    static $labels = [
18
+        'file_id' => 'Изображение',
19
+        'item_id' => 'Товар',
20
+        'name' => 'Название',
21
+        'description' => 'Описание',
22
+    ];
23
+    static $cols = [
24
+        'file_id' => ['type' => 'image'],
25
+        'item_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'item'],
26
+        'name' => ['type' => 'text'],
27
+        'description' => ['type' => 'html'],
28
+        'weight' => ['type' => 'number'],
29
+    ];
30 30
 
31
-  static function relations() {
31
+    static function relations() {
32 32
     return [
33 33
         'item' => [
34 34
             'col' => 'item_id',
@@ -39,30 +39,30 @@  discard block
 block discarded – undo
39 39
             'model' => 'Files\File'
40 40
         ]
41 41
     ];
42
-  }
42
+    }
43 43
 
44
-  static $dataManagers = [
45
-      'manager' => [
46
-          'name' => 'Фото товара',
47
-          'cols' => [
48
-              'file_id', 'name'
49
-          ]
50
-      ]
51
-  ];
52
-  static $forms = [
53
-      'manager' => [
54
-          'map' => [
55
-              ['name'],
56
-              ['item_id', 'file_id'],
57
-              ['description']
58
-          ]
59
-      ]
60
-  ];
44
+    static $dataManagers = [
45
+        'manager' => [
46
+            'name' => 'Фото товара',
47
+            'cols' => [
48
+                'file_id', 'name'
49
+            ]
50
+        ]
51
+    ];
52
+    static $forms = [
53
+        'manager' => [
54
+            'map' => [
55
+                ['name'],
56
+                ['item_id', 'file_id'],
57
+                ['description']
58
+            ]
59
+        ]
60
+    ];
61 61
 
62
-  function beforeDelete() {
62
+    function beforeDelete() {
63 63
     if ($this->file) {
64
-      $this->file->delete();
64
+        $this->file->delete();
65
+    }
65 66
     }
66
-  }
67 67
 
68 68
 }
Please login to merge, or discard this patch.