Completed
Push — master ( d192c7...9930d3 )
by Alexey
05:16
created
system/modules/Migrations/objects/Parser/Object.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,9 +62,9 @@
 block discarded – undo
62 62
                         if ($param->type == 'custom') {
63 63
                             $parserName = $param->value;
64 64
                         } else {
65
-                            $parserName = '\Migrations\Parser\Object\\' . ucfirst($param->type);
65
+                            $parserName = '\Migrations\Parser\Object\\'.ucfirst($param->type);
66 66
                         }
67
-                        if (!in_array($parserName, ['\Migrations\Parser\Object\ObjectLink','Exchange1c\Parser\Item\Images', '\Migrations\Parser\Object\Value', '\Migrations\Parser\Object\Relation', '\Migrations\Parser\Object\ParamsList','Exchange1c\Parser\Item\Offer\Warehouse'])) {
67
+                        if (!in_array($parserName, ['\Migrations\Parser\Object\ObjectLink', 'Exchange1c\Parser\Item\Images', '\Migrations\Parser\Object\Value', '\Migrations\Parser\Object\Relation', '\Migrations\Parser\Object\ParamsList', 'Exchange1c\Parser\Item\Offer\Warehouse'])) {
68 68
                             var_dump($parserName);
69 69
                             exit();
70 70
                         }
Please login to merge, or discard this patch.
system/modules/Ecommerce/Ecommerce.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
         $name = '';
53 53
         foreach ($fields as $field) {
54 54
             if ($field->save && !empty($data[$field->id])) {
55
-                $name .= htmlspecialchars($data[$field->id]) . ' ';
55
+                $name .= htmlspecialchars($data[$field->id]).' ';
56 56
             }
57 57
         }
58 58
         $name = trim($name);
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
         $name = '';
110 110
         foreach ($fields as $field) {
111 111
             if ($field->save && !empty($data[$field->id])) {
112
-                $name .= htmlspecialchars($data[$field->id]) . ' ';
112
+                $name .= htmlspecialchars($data[$field->id]).' ';
113 113
             }
114 114
         }
115 115
         $name = trim($name);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             foreach ($options['sort'] as $col => $direction) {
197 197
                 switch ($col) {
198 198
                     case 'price':
199
-                        $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
199
+                        $selectOptions['order'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
200 200
                         break;
201 201
                     case 'name':
202 202
                         $selectOptions['order'][] = ['name', strtolower($direction) == 'desc' ? 'desc' : 'asc'];
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
         if (!empty($this->config['view_filter'])) {
218 218
             if (!empty($this->config['view_filter']['options'])) {
219 219
                 foreach ($this->config['view_filter']['options'] as $optionId => $optionValue) {
220
-                    $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
221
-                        'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
222
-                        'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = "' . (int) $optionValue . '"',
223
-                        'inner', 'option' . $optionId];
220
+                    $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index().' = '.'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item::index().' AND '.
221
+                        'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' = "'.(int) $optionId.'" AND '.
222
+                        'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().'value = "'.(int) $optionValue.'"',
223
+                        'inner', 'option'.$optionId];
224 224
                 }
225 225
             }
226 226
         }
@@ -230,18 +230,18 @@  discard block
 block discarded – undo
230 230
                 switch ($col) {
231 231
                     case 'price':
232 232
                         if (!empty($filter['min'])) {
233
-                            $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['min'], '>='];
233
+                            $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', (float) $filter['min'], '>='];
234 234
                         }
235 235
                         if (!empty($filter['max'])) {
236
-                            $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix() . 'price', (float) $filter['max'], '<='];
236
+                            $selectOptions['where'][] = [Ecommerce\Item\Offer\Price::colPrefix().'price', (float) $filter['max'], '<='];
237 237
                         }
238 238
                         break;
239 239
                     case 'options':
240 240
                         foreach ($filter as $optionId => $optionValue) {
241
-                            $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index() . ' = ' . 'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item::index() . ' AND ' .
242
-                                'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' = "' . (int) $optionId . '" AND ' .
243
-                                'option' . $optionId . '.' . Ecommerce\Item\Param::colPrefix() . 'value = "' . (int) $optionValue . '"',
244
-                                'inner', 'option' . $optionId];
241
+                            $selectOptions['join'][] = [Ecommerce\Item\Param::table(), Ecommerce\Item::index().' = '.'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item::index().' AND '.
242
+                                'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' = "'.(int) $optionId.'" AND '.
243
+                                'option'.$optionId.'.'.Ecommerce\Item\Param::colPrefix().'value = "'.(int) $optionValue.'"',
244
+                                'inner', 'option'.$optionId];
245 245
                         }
246 246
                         break;
247 247
                 }
@@ -256,13 +256,13 @@  discard block
 block discarded – undo
256 256
                     continue;
257 257
                 }
258 258
                 $category = \Ecommerce\Category::get($categoryId);
259
-                $where[] = ['tree_path', $category->tree_path . (int) $categoryId . '/%', 'LIKE', $first ? 'AND' : 'OR'];
259
+                $where[] = ['tree_path', $category->tree_path.(int) $categoryId.'/%', 'LIKE', $first ? 'AND' : 'OR'];
260 260
                 $first = false;
261 261
             }
262 262
             $selectOptions['where'][] = $where;
263 263
         } elseif (!empty($options['parent'])) {
264 264
             $category = \Ecommerce\Category::get($options['parent']);
265
-            $selectOptions['where'][] = ['tree_path', $category->tree_path . (int) $options['parent'] . '/%', 'LIKE'];
265
+            $selectOptions['where'][] = ['tree_path', $category->tree_path.(int) $options['parent'].'/%', 'LIKE'];
266 266
         }
267 267
 
268 268
         //search
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             foreach (explode(' ', $searchStr) as $part) {
273 273
                 $part = trim($part);
274 274
                 if ($part && strlen($part) > 2) {
275
-                    $searchArr[] = ['search_index', '%' . $part . '%', 'LIKE'];
275
+                    $searchArr[] = ['search_index', '%'.$part.'%', 'LIKE'];
276 276
                 }
277 277
             }
278 278
             if (!empty($searchArr)) {
@@ -291,19 +291,19 @@  discard block
 block discarded – undo
291 291
             }
292 292
             $selectOptions['where'][] = [
293 293
                 '(
294
-          (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . 'count`),0) 
295
-            FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Item\Offer\Warehouse::table() . ' iciw 
296
-            WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . '
297
-                ' . ($warehouseIds ? ' AND iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Warehouse::index() . ' IN(' . implode(',', $warehouseIds) . ')' : '') . '
294
+          (SELECT COALESCE(sum(`' . \Ecommerce\Item\Offer\Warehouse::colPrefix().'count`),0) 
295
+            FROM ' . \App::$cur->db->table_prefix.\Ecommerce\Item\Offer\Warehouse::table().' iciw 
296
+            WHERE iciw.' . \Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Item\Offer::index().' = '.\Ecommerce\Item\Offer::index().'
297
+                ' . ($warehouseIds ? ' AND iciw.'.\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Warehouse::index().' IN('.implode(',', $warehouseIds).')' : '').'
298 298
             )
299 299
           -
300
-          (SELECT COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix() . 'count) ,0)
301
-            FROM ' . \App::$cur->db->table_prefix . \Ecommerce\Warehouse\Block::table() . ' iewb
302
-            inner JOIN ' . \App::$cur->db->table_prefix . \Ecommerce\Cart::table() . ' icc ON icc.' . \Ecommerce\Cart::index() . ' = iewb.' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index() . ' AND (
303
-                (`' . \Ecommerce\Cart::colPrefix() . 'warehouse_block` = 1 and `' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(2,3,6)) ||
304
-                (`' . \Ecommerce\Cart::colPrefix() . \Ecommerce\Cart\Status::index() . '` in(0,1) and `' . \Ecommerce\Cart::colPrefix() . 'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE))
300
+          (SELECT COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix().'count) ,0)
301
+            FROM ' . \App::$cur->db->table_prefix.\Ecommerce\Warehouse\Block::table().' iewb
302
+            inner JOIN ' . \App::$cur->db->table_prefix.\Ecommerce\Cart::table().' icc ON icc.'.\Ecommerce\Cart::index().' = iewb.'.\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index().' AND (
303
+                (`' . \Ecommerce\Cart::colPrefix().'warehouse_block` = 1 and `'.\Ecommerce\Cart::colPrefix().'cart_status_id` in(2,3,6)) ||
304
+                (`' . \Ecommerce\Cart::colPrefix().\Ecommerce\Cart\Status::index().'` in(0,1) and `'.\Ecommerce\Cart::colPrefix().'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE))
305 305
             )
306
-            WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index() . ' = ' . \Ecommerce\Item\Offer::index() . ')
306
+            WHERE iewb.' . \Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Item\Offer::index().' = '.\Ecommerce\Item\Offer::index().')
307 307
           )',
308 308
                 0,
309 309
                 '>'
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
         }
312 312
 
313 313
 
314
-        $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index() . ' = ' . Ecommerce\Item\Offer::colPrefix() . Ecommerce\Item::index(), 'inner'];
314
+        $selectOptions['join'][] = [Ecommerce\Item\Offer::table(), Ecommerce\Item::index().' = '.Ecommerce\Item\Offer::colPrefix().Ecommerce\Item::index(), 'inner'];
315 315
         $selectOptions['join'][] = [Ecommerce\Item\Offer\Price::table(),
316
-            Ecommerce\Item\Offer::index() . ' = ' . Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer::index() . ' and ' . Ecommerce\Item\Offer\Price::colPrefix() . 'price>0', 'inner'];
316
+            Ecommerce\Item\Offer::index().' = '.Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer::index().' and '.Ecommerce\Item\Offer\Price::colPrefix().'price>0', 'inner'];
317 317
         $selectOptions['join'][] = [
318
-            Ecommerce\Item\Offer\Price\Type::table(), Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer\Price\Type::index() . ' = ' . Ecommerce\Item\Offer\Price\Type::index() .
319
-            ' and (' . Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles="" || ' . Ecommerce\Item\Offer\Price\Type::colPrefix() . 'roles LIKE "%|' . \Users\User::$cur->role_id . '|%")'
318
+            Ecommerce\Item\Offer\Price\Type::table(), Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer\Price\Type::index().' = '.Ecommerce\Item\Offer\Price\Type::index().
319
+            ' and ('.Ecommerce\Item\Offer\Price\Type::colPrefix().'roles="" || '.Ecommerce\Item\Offer\Price\Type::colPrefix().'roles LIKE "%|'.\Users\User::$cur->role_id.'|%")'
320 320
         ];
321 321
         $selectOptions['where'][] = [
322
-            [Ecommerce\Item\Offer\Price::colPrefix() . Ecommerce\Item\Offer\Price\Type::index(), 0],
322
+            [Ecommerce\Item\Offer\Price::colPrefix().Ecommerce\Item\Offer\Price\Type::index(), 0],
323 323
             [Ecommerce\Item\Offer\Price\Type::index(), 0, '>', 'OR']
324 324
         ];
325 325
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
         $items = Ecommerce\Item::getList($selectOptions);
343 343
         $items = Ecommerce\Item\Param::getList([
344 344
                     'where' => ['item_id', array_keys($items), 'IN'],
345
-                    'join' => [[Ecommerce\Item\Option::table(), Ecommerce\Item\Option::index() . ' = ' . \Ecommerce\Item\Param::colPrefix() . Ecommerce\Item\Option::index() . ' and ' . \Ecommerce\Item\Option::colPrefix() . 'searchable = 1', 'inner']],
345
+                    'join' => [[Ecommerce\Item\Option::table(), Ecommerce\Item\Option::index().' = '.\Ecommerce\Item\Param::colPrefix().Ecommerce\Item\Option::index().' and '.\Ecommerce\Item\Option::colPrefix().'searchable = 1', 'inner']],
346 346
                     'distinct' => \Ecommerce\Item\Option::index()
347 347
         ]);
348 348
         return $items;
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
         if (is_array($counts)) {
376 376
             $sum = 0;
377 377
             foreach ($counts as $count) {
378
-                $sum +=$count['count'];
378
+                $sum += $count['count'];
379 379
             }
380 380
             return $sum;
381 381
         }
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 
412 412
         if (!empty($conf['files']['aditionTemplateFiels'])) {
413 413
             foreach ($conf['files']['aditionTemplateFiels'] as $file) {
414
-                $return[$file['file']] = '- ' . $file['name'];
414
+                $return[$file['file']] = '- '.$file['name'];
415 415
             }
416 416
         }
417 417
         return $return;
Please login to merge, or discard this patch.
system/modules/Ecommerce/models/Item/Offer.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
     {
79 79
         $warehouse = Offer\Warehouse::get([['count', '0', '>'], ['item_offer_id', $this->id]]);
80 80
         if ($warehouse) {
81
-            $warehouse->count +=(float) $count;
81
+            $warehouse->count += (float) $count;
82 82
             $warehouse->save();
83 83
         } else {
84 84
             $warehouse = Offer\Warehouse::get([['item_offer_id', $this->id]]);
85 85
             if ($warehouse) {
86
-                $warehouse->count +=(float) $count;
86
+                $warehouse->count += (float) $count;
87 87
                 $warehouse->save();
88 88
             }
89 89
         }
@@ -101,21 +101,21 @@  discard block
 block discarded – undo
101 101
             }
102 102
         }
103 103
         if ($warehouseIds) {
104
-            \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Warehouse::index(), $warehouseIds, 'IN');
104
+            \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Warehouse::index(), $warehouseIds, 'IN');
105 105
         }
106
-        \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix() . \Ecommerce\Item\Offer::index(), $this->id);
107
-        \App::$cur->db->cols = 'COALESCE(sum(' . \Ecommerce\Item\Offer\Warehouse::colPrefix() . 'count),0) as `sum` ';
106
+        \App::$cur->db->where(\Ecommerce\Item\Offer\Warehouse::colPrefix().\Ecommerce\Item\Offer::index(), $this->id);
107
+        \App::$cur->db->cols = 'COALESCE(sum('.\Ecommerce\Item\Offer\Warehouse::colPrefix().'count),0) as `sum` ';
108 108
         $warehouse = \App::$cur->db->select(\Ecommerce\Item\Offer\Warehouse::table())->fetch();
109 109
 
110
-        \App::$cur->db->cols = 'COALESCE(sum(' . \Ecommerce\Warehouse\Block::colPrefix() . 'count) ,0) as `sum` ';
111
-        \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Item\Offer::index(), $this->id);
110
+        \App::$cur->db->cols = 'COALESCE(sum('.\Ecommerce\Warehouse\Block::colPrefix().'count) ,0) as `sum` ';
111
+        \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Item\Offer::index(), $this->id);
112 112
         if ($cart_id) {
113
-            \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index(), (int) $cart_id, '!=');
113
+            \App::$cur->db->where(\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index(), (int) $cart_id, '!=');
114 114
         }
115 115
         $on = '
116
-            ' . \Ecommerce\Cart::index() . ' = ' . \Ecommerce\Warehouse\Block::colPrefix() . \Ecommerce\Cart::index() . ' AND (
117
-            (`' . \Ecommerce\Cart::colPrefix() . 'warehouse_block` = 1 and `' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(2,3,6)) || 
118
-            (`' . \Ecommerce\Cart::colPrefix() . 'cart_status_id` in(0,1) and `' . \Ecommerce\Cart::colPrefix() . 'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE))
116
+            ' . \Ecommerce\Cart::index().' = '.\Ecommerce\Warehouse\Block::colPrefix().\Ecommerce\Cart::index().' AND (
117
+            (`' . \Ecommerce\Cart::colPrefix().'warehouse_block` = 1 and `'.\Ecommerce\Cart::colPrefix().'cart_status_id` in(2,3,6)) || 
118
+            (`' . \Ecommerce\Cart::colPrefix().'cart_status_id` in(0,1) and `'.\Ecommerce\Cart::colPrefix().'date_last_activ` >=subdate(now(),INTERVAL 30 MINUTE))
119 119
             )
120 120
         ';
121 121
         \App::$cur->db->join(\Ecommerce\Cart::table(), $on, 'inner');
Please login to merge, or discard this patch.