Completed
Branch master (6ed6e7)
by Lars
07:57
created
src/Intraface/modules/product/Controller/Show/Variations.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             'existing_groups' => $existing_groups,
50 50
             'groups' => $groups);
51 51
 
52
-        $tpl = $this->template->create(dirname(__FILE__) . '/../tpl/variations');
52
+        $tpl = $this->template->create(dirname(__FILE__).'/../tpl/variations');
53 53
         return $tpl->render($this, $data);
54 54
     }
55 55
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
             'existing_groups' => $existing_groups,
70 70
             'groups' => $groups);
71 71
 
72
-        $tpl = $this->template->create(dirname(__FILE__) . '/../tpl/variations-edit');
72
+        $tpl = $this->template->create(dirname(__FILE__).'/../tpl/variations-edit');
73 73
         return $tpl->render($this, $data);
74 74
     }
75 75
 
Please login to merge, or discard this patch.
modules/product/Controller/Show/Variations/SelectAttributeGroups.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
         $content = $tpl->render($this, $data);
64 64
 
65 65
         $data = array(
66
-        	'groups' => $groups,
66
+            'groups' => $groups,
67 67
             'error' => $this->error,
68 68
             'content' => $content
69 69
         );
Please login to merge, or discard this patch.
src/Intraface/modules/product/Controller/AttributeGroups/Attribute.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@
 block discarded – undo
48 48
             try {
49 49
                 $attribute->save();
50 50
                 return new k_SeeOther($this->url());
51
-            }
52
-            catch (Doctrine_Validator_Exception $e) {
51
+            } catch (Doctrine_Validator_Exception $e) {
53 52
                 $this->attribute = $attribute;
54 53
                 $this->getError()->attachErrorStack($attribute->getErrorStack());
55 54
             }
Please login to merge, or discard this patch.
src/Intraface/modules/product/Controller/AttributeGroups/Show.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
                 $group->save();
64 64
                 $group->load();
65 65
                 return new k_SeeOther($this->url());
66
-            } catch(Doctrine_Validator_Exception $e) {
66
+            } catch (Doctrine_Validator_Exception $e) {
67 67
                 $error = new Intraface_Doctrine_ErrorRender($translation);
68 68
                 $error->attachErrorStack($group->getErrorStack());
69 69
             }
Please login to merge, or discard this patch.
src/Intraface/modules/product/Controller/BatchEdit.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
         $product->getDBQuery()->storeResult("use_stored", "products", "toplevel");
19 19
         $products = $product->getList();
20 20
 
21
-        $tpl = $this->template->create(dirname(__FILE__) . '/tpl/batchedit');
21
+        $tpl = $this->template->create(dirname(__FILE__).'/tpl/batchedit');
22 22
         return $tpl->render($this, array('products' => $products, 'product' => $product));
23 23
     }
24 24
 
Please login to merge, or discard this patch.
src/Intraface/modules/product/Controller/BatchPriceChanger.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
                     $new_price = round($new_price, 0);
35 35
                 }
36 36
                 if ($product->save(array(
37
-            		'price' => $new_price,
37
+                    'price' => $new_price,
38 38
                     'before_price' => (float)$product->get('price')
39 39
                 ))) {
40 40
                 }
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
                     $new_price = round($new_price, 0);
45 45
                 }
46 46
                 if ($product->save(array(
47
-            		'price' => $new_price,
47
+                    'price' => $new_price,
48 48
                     'before_price' => (float)$product->get('price')
49 49
                 ))) {
50 50
                 }
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                     $new_price = round($new_price, 0);
55 55
                 }
56 56
                 if ($product->save(array(
57
-            		'price' => $new_price,
57
+                    'price' => $new_price,
58 58
                     'before_price' => (float)$product->get('price')
59 59
                 ))) {
60 60
                 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 
19 19
         $data = array('products' => $products, 'product' => $product);
20 20
 
21
-        $tpl = $this->template->create(dirname(__FILE__) . '/tpl/batchpricechanger');
21
+        $tpl = $this->template->create(dirname(__FILE__).'/tpl/batchpricechanger');
22 22
         return $tpl->render($this, $data);
23 23
     }
24 24
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         foreach ($this->body('product_id') AS $key => $product_id) {
30 30
             $product = new Product($this->context->getKernel(), $product_id);
31 31
             if ($this->body('change_type') == 'percent') {
32
-                $new_price = $product->get('price') + intval($product->get('price') * ($_POST['price_change'] / 100));
32
+                $new_price = $product->get('price') + intval($product->get('price')*($_POST['price_change']/100));
33 33
                 if ($this->body('round_off') == 'yes') {
34 34
                     $new_price = round($new_price, 0);
35 35
                 }
Please login to merge, or discard this patch.
src/Intraface/modules/product/Controller/Show.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             return new k_SeeOther($this->url());
82 82
         }
83 83
 
84
-        $smarty = $this->template->create(dirname(__FILE__) . '/tpl/show');
84
+        $smarty = $this->template->create(dirname(__FILE__).'/tpl/show');
85 85
         return $smarty->render($this, $data);
86 86
     }
87 87
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         if ($this->body('choose_file') && $this->getKernel()->user->hasModuleAccess('filemanager')) {
122 122
             $redirect = Intraface_Redirect::factory($this->getKernel(), 'go');
123 123
             $module_filemanager = $this->getKernel()->useModule('filemanager');
124
-            $url = $redirect->setDestination(NET_SCHEME . NET_HOST . $this->url('filehandler/selectfile', array('images'=>1, 'multiple_choice' => 1)), NET_SCHEME . NET_HOST . $this->url());
124
+            $url = $redirect->setDestination(NET_SCHEME.NET_HOST.$this->url('filehandler/selectfile', array('images'=>1, 'multiple_choice' => 1)), NET_SCHEME.NET_HOST.$this->url());
125 125
             $redirect->setIdentifier('product');
126 126
             $redirect->askParameter('file_handler_id', 'multiple');
127 127
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
             'product' => $this->getProductDoctrine(),
140 140
         );
141 141
 
142
-        $smarty = $this->template->create(dirname(__FILE__) . '/tpl/edit');
142
+        $smarty = $this->template->create(dirname(__FILE__).'/tpl/edit');
143 143
         return $smarty->render($this, $data);
144 144
     }
145 145
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         $this->getKernel()->module('product');
210 210
         if ($id = $this->getProduct()->copy()) {
211
-            return new k_SeeOther($this->url('../' . $id));
211
+            return new k_SeeOther($this->url('../'.$id));
212 212
         }
213 213
         return $this->render();
214 214
     }
Please login to merge, or discard this patch.
src/Intraface/modules/product/Controller/Selectproductvariation.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
         }
50 50
 
51 51
         $data = array(
52
-        	'variations' => $variations,
52
+            'variations' => $variations,
53 53
             'product' => $product
54 54
         );
55 55
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
         try {
42 42
             $variations = $product->getVariations();
43
-        } catch(Exception $e) {
43
+        } catch (Exception $e) {
44 44
             if ($e->getMessage() == 'No groups is added to the product') {
45 45
                 $variations = array();
46 46
             } else {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             'product' => $product
54 54
         );
55 55
 
56
-        $smarty = $this->template->create(dirname(__FILE__) . '/tpl/selectproductvariation');
56
+        $smarty = $this->template->create(dirname(__FILE__).'/tpl/selectproductvariation');
57 57
         return $smarty->render($this, $data);
58 58
     }
59 59
 
Please login to merge, or discard this patch.
src/Intraface/modules/product/Controller/Index.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $module = $this->getKernel()->module('product');
32 32
 
33
-        $smarty = $this->template->create(dirname(__FILE__) . '/tpl/index');
33
+        $smarty = $this->template->create(dirname(__FILE__).'/tpl/index');
34 34
         return $smarty->render($this);
35 35
     }
36 36
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             $data['product'] = $this->product_doctrine;
77 77
         }
78 78
 
79
-        $smarty = $this->template->create(dirname(__FILE__) . '/tpl/edit');
79
+        $smarty = $this->template->create(dirname(__FILE__).'/tpl/edit');
80 80
         return $smarty->render($this, $data);
81 81
     }
82 82
 
Please login to merge, or discard this patch.
Braces   +26 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
             return 'Intraface_modules_product_Controller_AttributeGroups';
22 22
         } elseif ($name == 'batchedit') {
23 23
             return 'Intraface_modules_product_Controller_BatchEdit';
24
-        }  elseif ($name == 'batchprice') {
24
+        } elseif ($name == 'batchprice') {
25 25
             return 'Intraface_modules_product_Controller_BatchPriceChanger';
26 26
         }
27 27
     }
@@ -90,15 +90,31 @@  discard block
 block discarded – undo
90 90
         $product->getDetails()->Translation['da']->name = $_POST['name'];
91 91
         $product->getDetails()->Translation['da']->description = $_POST['description'];
92 92
         $product->getDetails()->price = new Ilib_Variable_Float($_POST['price'], 'da_dk');
93
-        if (isset($_POST['before_price'])) $product->getDetails()->before_price = new Ilib_Variable_Float($_POST['before_price'], 'da_dk');
94
-        if (isset($_POST['weight'])) $product->getDetails()->weight = new Ilib_Variable_Float($_POST['weight'], 'da_dk');
95
-        if (isset($_POST['unit'])) $product->getDetails()->unit = $_POST['unit'];
96
-        if (isset($_POST['vat'])) $product->getDetails()->vat = $_POST['vat'];
97
-        if (isset($_POST['do_show'])) $product->do_show = $_POST['do_show'];
98
-        if (isset($_POST['state_account_id'])) $product->getDetails()->state_account_id = (int)$_POST['state_account_id'];
99
-
100
-        if (isset($_POST['has_variation'])) $product->has_variation = $_POST['has_variation'];
101
-        if (isset($_POST['stock'])) $product->stock = $_POST['stock'];
93
+        if (isset($_POST['before_price'])) {
94
+            $product->getDetails()->before_price = new Ilib_Variable_Float($_POST['before_price'], 'da_dk');
95
+        }
96
+        if (isset($_POST['weight'])) {
97
+            $product->getDetails()->weight = new Ilib_Variable_Float($_POST['weight'], 'da_dk');
98
+        }
99
+        if (isset($_POST['unit'])) {
100
+            $product->getDetails()->unit = $_POST['unit'];
101
+        }
102
+        if (isset($_POST['vat'])) {
103
+            $product->getDetails()->vat = $_POST['vat'];
104
+        }
105
+        if (isset($_POST['do_show'])) {
106
+            $product->do_show = $_POST['do_show'];
107
+        }
108
+        if (isset($_POST['state_account_id'])) {
109
+            $product->getDetails()->state_account_id = (int)$_POST['state_account_id'];
110
+        }
111
+
112
+        if (isset($_POST['has_variation'])) {
113
+            $product->has_variation = $_POST['has_variation'];
114
+        }
115
+        if (isset($_POST['stock'])) {
116
+            $product->stock = $_POST['stock'];
117
+        }
102 118
 
103 119
         try {
104 120
             $product->save();
Please login to merge, or discard this patch.