Passed
Branch master (95796a)
by Andreas
38:22
created
lib/org/openpsa/products/viewer.php 2 patches
Spacing   +15 added lines, -25 removed lines patch added patch discarded remove patch
@@ -20,8 +20,7 @@  discard block
 block discarded – undo
20 20
     {
21 21
         if ($this->_config->get('search_first'))
22 22
         {
23
-            $this->_request_switch['index'] = Array
24
-            (
23
+            $this->_request_switch['index'] = Array(
25 24
                 'handler' => Array('org_openpsa_products_handler_product_search', 'search_redirect'),
26 25
             );
27 26
         }
@@ -56,9 +55,9 @@  discard block
 block discarded – undo
56 55
             if ($config->get('enable_scheduling'))
57 56
             {
58 57
                 // Check start/end for products
59
-                if (   (   $object->start != 0
58
+                if (($object->start != 0
60 59
                         && $object->start > time())
61
-                    || (   $object->end != 0
60
+                    || ($object->end != 0
62 61
                         && $object->end < time()))
63 62
                 {
64 63
                     // Not in market, remove from index
@@ -85,30 +84,27 @@  discard block
 block discarded – undo
85 84
     private function _populate_node_toolbar()
86 85
     {
87 86
         $buttons = array();
88
-        if (   $this->_topic->can_do('midgard:update')
87
+        if ($this->_topic->can_do('midgard:update')
89 88
             && $this->_topic->can_do('midgard:create'))
90 89
         {
91
-            $buttons[] = array
92
-            (
90
+            $buttons[] = array(
93 91
                 MIDCOM_TOOLBAR_URL => 'export/product/csv/',
94 92
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('export products'),
95 93
                 MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n->get('export products'),
96 94
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/editshred.png',
97 95
             );
98
-            $buttons[] = array
99
-            (
96
+            $buttons[] = array(
100 97
                 MIDCOM_TOOLBAR_URL => 'import/product/csv/',
101 98
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('import products'),
102 99
                 MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n->get('import products from csv-file'),
103 100
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/editshred.png',
104 101
             );
105 102
         }
106
-        if (   $this->_topic->can_do('midgard:update')
103
+        if ($this->_topic->can_do('midgard:update')
107 104
             && $this->_topic->can_do('midcom:component_config'))
108 105
         {
109 106
             $workflow = $this->get_workflow('datamanager2');
110
-            $buttons[] = $workflow->get_button('config/', array
111
-            (
107
+            $buttons[] = $workflow->get_button('config/', array(
112 108
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'),
113 109
                 MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'),
114 110
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png',
@@ -165,10 +161,8 @@  discard block
 block discarded – undo
165 161
             {
166 162
                 foreach ($feeds as $title => $url)
167 163
                 {
168
-                    midcom::get()->head->add_link_head
169
-                    (
170
-                        array
171
-                        (
164
+                    midcom::get()->head->add_link_head(
165
+                        array(
172 166
                             'rel'   => 'alternate',
173 167
                             'type'  => 'application/rss+xml',
174 168
                             'title' => $this->_l10n->get($title),
@@ -180,10 +174,8 @@  discard block
 block discarded – undo
180 174
         }
181 175
         else
182 176
         {
183
-            midcom::get()->head->add_link_head
184
-            (
185
-                array
186
-                (
177
+            midcom::get()->head->add_link_head(
178
+                array(
187 179
                     'rel'   => 'alternate',
188 180
                     'type'  => 'application/rss+xml',
189 181
                     'title' => $this->_l10n->get('updated products'),
@@ -197,7 +189,7 @@  discard block
 block discarded – undo
197 189
     {
198 190
         $this->_request_data['up'] = 0;
199 191
         //Check if args[0] is a product group code.
200
-        if (   (int) $args[0] == 0
192
+        if ((int) $args[0] == 0
201 193
             && strlen($args[0]) > 1)
202 194
         {
203 195
             $qb2 = org_openpsa_products_product_group_dba::new_query_builder();
@@ -264,8 +256,7 @@  discard block
 block discarded – undo
264 256
 
265 257
             if ($object instanceof org_openpsa_products_product_dba)
266 258
             {
267
-                $tmp[] = array
268
-                (
259
+                $tmp[] = array(
269 260
                     MIDCOM_NAV_URL => "product/{$object->code}/",
270 261
                     MIDCOM_NAV_NAME => $object->title,
271 262
                 );
@@ -283,8 +274,7 @@  discard block
 block discarded – undo
283 274
                     $prefix = $parent->code ?: $parent->guid;
284 275
                     $url = "{$prefix}/" . $url;
285 276
                 }
286
-                $tmp[] = array
287
-                (
277
+                $tmp[] = array(
288 278
                     MIDCOM_NAV_URL => $url . '/',
289 279
                     MIDCOM_NAV_NAME => $object->title,
290 280
                 );
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -125,8 +125,7 @@  discard block
 block discarded – undo
125 125
         if ($this->_config->get('root_group') === 0)
126 126
         {
127 127
             $this->_request_data['root_group'] = 0;
128
-        }
129
-        else
128
+        } else
130 129
         {
131 130
             $root_group = org_openpsa_products_product_group_dba::get_cached($this->_config->get('root_group'));
132 131
             $this->_request_data['root_group'] = $root_group->id;
@@ -177,8 +176,7 @@  discard block
 block discarded – undo
177 176
                     );
178 177
                 }
179 178
             }
180
-        }
181
-        else
179
+        } else
182 180
         {
183 181
             midcom::get()->head->add_link_head
184 182
             (
@@ -217,8 +215,7 @@  discard block
 block discarded – undo
217 215
                     $this->_request_data['up'] = $up_group[0]->id;
218 216
                 }
219 217
             }
220
-        }
221
-        else
218
+        } else
222 219
         {
223 220
             $this->_request_data['up'] = (int) $args[0];
224 221
         }
@@ -226,14 +223,12 @@  discard block
 block discarded – undo
226 223
         if ($this->_request_data['up'] == 0)
227 224
         {
228 225
             midcom::get()->auth->require_user_do('midgard:create', null, 'org_openpsa_products_product_dba');
229
-        }
230
-        else
226
+        } else
231 227
         {
232 228
             try
233 229
             {
234 230
                 $parent = new org_openpsa_products_product_group_dba($this->_request_data['up']);
235
-            }
236
-            catch (midcom_error $e)
231
+            } catch (midcom_error $e)
237 232
             {
238 233
                 return false;
239 234
             }
@@ -269,8 +264,7 @@  discard block
 block discarded – undo
269 264
                     MIDCOM_NAV_URL => "product/{$object->code}/",
270 265
                     MIDCOM_NAV_NAME => $object->title,
271 266
                 );
272
-            }
273
-            else
267
+            } else
274 268
             {
275 269
                 if ($object->guid === $root_group)
276 270
                 {
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/product/csvimport.php 2 patches
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
         midcom::get()->auth->require_admin_user();
22 22
         $this->_request_data['type'] = 'product';
23 23
 
24
-        $this->_request_data['import_status'] = array
25
-        (
24
+        $this->_request_data['import_status'] = array(
26 25
             'updated' => 0,
27 26
             'created' => 0,
28 27
             'failed_create' => 0,
@@ -45,7 +44,7 @@  discard block
 block discarded – undo
45 44
         // Set all given values into DM2
46 45
         foreach ($productdata as $key => $value)
47 46
         {
48
-            if (   array_key_exists($key, $this->_datamanager->types)
47
+            if (array_key_exists($key, $this->_datamanager->types)
49 48
                 && !in_array($key, $this->_request_data['fields_to_skip']))
50 49
             {
51 50
                 $this->_datamanager->types[$key]->convert_from_csv($value);
@@ -161,7 +160,7 @@  discard block
 block discarded – undo
161 160
         }
162 161
 
163 162
         // Map products without group to the "new products" group
164
-        if (   empty($product->productGroup)
163
+        if (empty($product->productGroup)
165 164
             && !empty($data['new_products_product_group']))
166 165
         {
167 166
             $product->productGroup = $data['new_products_product_group'];
@@ -298,7 +297,7 @@  discard block
 block discarded – undo
298 297
             if ($percentage >= $this->_config->get('import_csv_data_percentage'))
299 298
             {
300 299
                 $read_rows++;
301
-                if (   $limit > 0
300
+                if ($limit > 0
302 301
                     && $read_rows > ($limit + $offset))
303 302
                 {
304 303
                     break;
@@ -391,16 +390,16 @@  discard block
 block discarded – undo
391 390
                 {
392 391
                     $schema_field = $field_matching;
393 392
 
394
-                    if (   !array_key_exists($schema_field, $data['schemadb_product'][$data['schema']]->fields)
393
+                    if (!array_key_exists($schema_field, $data['schemadb_product'][$data['schema']]->fields)
395 394
                         && $schema_field != 'org_openpsa_products_import_parent_group')
396 395
                     {
397 396
                         // Invalid matching, skip
398 397
                         continue;
399 398
                     }
400 399
 
401
-                    if (   $value == ''
400
+                    if ($value == ''
402 401
                         || $value == 'NULL'
403
-                        || preg_match('/^#+$/',  $value))
402
+                        || preg_match('/^#+$/', $value))
404 403
                     {
405 404
                         // No value, skip
406 405
                         continue;
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -121,8 +121,7 @@  discard block
 block discarded – undo
121 121
             try
122 122
             {
123 123
                 $product = new org_openpsa_products_product_dba($productdata['GUID']);
124
-            }
125
-            catch (midcom_error $e)
124
+            } catch (midcom_error $e)
126 125
             {
127 126
                 $e->log();
128 127
             }
@@ -173,8 +172,7 @@  discard block
 block discarded – undo
173 172
             {
174 173
                 $product->delete();
175 174
                 $this->_request_data['import_status']['failed_create']++;
176
-            }
177
-            else
175
+            } else
178 176
             {
179 177
                 $this->_request_data['import_status']['failed_update']++;
180 178
             }
@@ -186,8 +184,7 @@  discard block
 block discarded – undo
186 184
         if ($new)
187 185
         {
188 186
             $this->_request_data['import_status']['created']++;
189
-        }
190
-        else
187
+        } else
191 188
         {
192 189
             $this->_request_data['import_status']['updated']++;
193 190
         }
@@ -237,8 +234,7 @@  discard block
 block discarded – undo
237 234
         if (isset($_POST['org_openpsa_products_import_schema']))
238 235
         {
239 236
             $data['schema'] = $_POST['org_openpsa_products_import_schema'];
240
-        }
241
-        else
237
+        } else
242 238
         {
243 239
             $data['schema'] = 'default';
244 240
         }
@@ -324,8 +320,7 @@  discard block
 block discarded – undo
324 320
             // Present user with the field matching form
325 321
             $data['schemadb'] = $data['schemadb_product'];
326 322
             midcom_show_style('show-import-csv-select');
327
-        }
328
-        else
323
+        } else
329 324
         {
330 325
             // Present user with upload form
331 326
             midcom_show_style('show-import-csv-form');
@@ -366,8 +361,7 @@  discard block
 block discarded – undo
366 361
         if (!empty($_POST['org_openpsa_products_import_new_products_product_group']))
367 362
         {
368 363
             $data['new_products_product_group'] = $_POST['org_openpsa_products_import_new_products_product_group'];
369
-        }
370
-        else
364
+        } else
371 365
         {
372 366
             $data['new_products_product_group'] = 0;
373 367
         }
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/product/view.php 2 patches
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@  discard block
 block discarded – undo
31 31
         if ($this->_product->can_do('midgard:update'))
32 32
         {
33 33
             $workflow = $this->get_workflow('datamanager2');
34
-            $this->_view_toolbar->add_item($workflow->get_button("product/edit/{$this->_product->guid}/", array
35
-            (
34
+            $this->_view_toolbar->add_item($workflow->get_button("product/edit/{$this->_product->guid}/", array(
36 35
                 MIDCOM_TOOLBAR_ACCESSKEY => 'e',
37 36
             )));
38 37
         }
@@ -63,7 +62,7 @@  discard block
 block discarded – undo
63 62
         if (midcom::get()->config->get('enable_ajax_editing'))
64 63
         {
65 64
             $data['controller'] = midcom_helper_datamanager2_controller::create('ajax');
66
-            $data['controller']->schemadb =& $data['schemadb_product'];
65
+            $data['controller']->schemadb = & $data['schemadb_product'];
67 66
             $data['controller']->set_storage($this->_product);
68 67
             $data['controller']->process_ajax();
69 68
             $data['datamanager'] = $data['controller']->datamanager;
@@ -72,7 +71,7 @@  discard block
 block discarded – undo
72 71
         {
73 72
             $data['controller'] = null;
74 73
             $data['datamanager'] = new midcom_helper_datamanager2_datamanager($data['schemadb_product']);
75
-            if (! $data['datamanager']->autoset_storage($this->_product))
74
+            if (!$data['datamanager']->autoset_storage($this->_product))
76 75
             {
77 76
                 throw new midcom_error("Failed to create a DM2 instance for product {$this->_product->guid}.");
78 77
             }
@@ -120,7 +119,7 @@  discard block
 block discarded – undo
120 119
 
121 120
             if (empty($groups))
122 121
             {
123
-                throw new midcom_error_notfound("Product group {$args[0]} not found" );
122
+                throw new midcom_error_notfound("Product group {$args[0]} not found");
124 123
             }
125 124
 
126 125
             $categories_mc = org_openpsa_products_product_group_dba::new_collector('up', $groups[0]->id);
Please login to merge, or discard this patch.
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@  discard block
 block discarded – undo
67 67
             $data['controller']->set_storage($this->_product);
68 68
             $data['controller']->process_ajax();
69 69
             $data['datamanager'] = $data['controller']->datamanager;
70
-        }
71
-        else
70
+        } else
72 71
         {
73 72
             $data['controller'] = null;
74 73
             $data['datamanager'] = new midcom_helper_datamanager2_datamanager($data['schemadb_product']);
@@ -95,8 +94,7 @@  discard block
 block discarded – undo
95 94
                 $productgroup = new org_openpsa_products_product_group_dba($this->_product->productGroup);
96 95
                 $title = str_replace('<PRODUCTGROUP_TITLE>', $productgroup->title, $title);
97 96
                 $title = str_replace('<PRODUCTGROUP_CODE>', $productgroup->code, $title);
98
-            }
99
-            catch (midcom_error $e)
97
+            } catch (midcom_error $e)
100 98
             {
101 99
                 $title = str_replace(array('<PRODUCTGROUP_TITLE>', '<PRODUCTGROUP_CODE>'), '', $title);
102 100
             }
@@ -132,15 +130,13 @@  discard block
 block discarded – undo
132 130
                  * So we can search for the application using only this group id
133 131
                  */
134 132
                 $qb->add_constraint('productGroup', 'INTREE', $groups[0]->id);
135
-            }
136
-            else
133
+            } else
137 134
             {
138 135
                 $categories_in[] = $groups[0]->id;
139 136
                 $qb->add_constraint('productGroup', 'IN', $categories_in);
140 137
             }
141 138
             $this->_add_identifier_constraint($qb, $args[1]);
142
-        }
143
-        else
139
+        } else
144 140
         {
145 141
             $this->_add_identifier_constraint($qb, $args[0]);
146 142
         }
@@ -162,14 +158,12 @@  discard block
 block discarded – undo
162 158
         if (!empty($results))
163 159
         {
164 160
             $this->_product = $results[0];
165
-        }
166
-        else
161
+        } else
167 162
         {
168 163
             if (preg_match('/^view_product_intree/', $handler_id))
169 164
             {
170 165
                 $this->_product = new org_openpsa_products_product_dba($args[1]);
171
-            }
172
-            else
166
+            } else
173 167
             {
174 168
                 $this->_product = new org_openpsa_products_product_dba($args[0]);
175 169
             }
@@ -181,8 +175,7 @@  discard block
 block discarded – undo
181 175
         if (mgd_is_guid($identifier))
182 176
         {
183 177
             $qb->add_constraint('guid', '=', $identifier);
184
-        }
185
-        else
178
+        } else
186 179
         {
187 180
             $qb->add_constraint('code', '=', $identifier);
188 181
         }
@@ -200,8 +193,7 @@  discard block
 block discarded – undo
200 193
         {
201 194
             // For AJAX handling it is the controller that renders everything
202 195
             $data['view_product'] = $data['controller']->get_content_html();
203
-        }
204
-        else
196
+        } else
205 197
         {
206 198
             $data['view_product'] = $data['datamanager']->get_content_html();
207 199
         }
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/product/latest.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
             foreach ($data['products'] as $product)
110 110
             {
111 111
                 $data['product'] = $product;
112
-                if (! $data['datamanager_product']->autoset_storage($product))
112
+                if (!$data['datamanager_product']->autoset_storage($product))
113 113
                 {
114 114
                     debug_add("The datamanager for product #{$product->id} could not be initialized, skipping it.");
115 115
                     debug_print_r('Object was:', $product);
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
             foreach ($data['products'] as $product)
179 179
             {
180 180
                 $data['product'] = $product;
181
-                if (! $data['datamanager_product']->autoset_storage($product))
181
+                if (!$data['datamanager_product']->autoset_storage($product))
182 182
                 {
183 183
                     debug_add("The datamanager for product #{$product->id} could not be initialized, skipping it.");
184 184
                     debug_print_r('Object was:', $product);
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,8 +43,7 @@  discard block
 block discarded – undo
43 43
                  * this group id
44 44
                  */
45 45
                 $product_qb->add_constraint('productGroup', 'INTREE', $groups[0]->id);
46
-            }
47
-            else
46
+            } else
48 47
             {
49 48
                 $product_qb->add_constraint('productGroup', 'IN', $categories);
50 49
             }
@@ -80,8 +79,7 @@  discard block
 block discarded – undo
80 79
         {
81 80
             $product_group = $args[0];
82 81
             $show_products = (int) $args[1];
83
-        }
84
-        else
82
+        } else
85 83
         {
86 84
             $show_products = (int) $args[0];
87 85
             $product_group = '';
@@ -147,8 +145,7 @@  discard block
 block discarded – undo
147 145
         if ($handler_id == 'updated_products_feed_intree')
148 146
         {
149 147
             $this->_list_products($this->_config->get('show_items_in_feed'), $args[0]);
150
-        }
151
-        else
148
+        } else
152 149
         {
153 150
             $this->_list_products($this->_config->get('show_items_in_feed'));
154 151
         }
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/product/search.php 2 patches
Spacing   +14 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,8 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 class org_openpsa_products_handler_product_search extends midcom_baseclasses_components_handler
15 15
 {
16
-    private $_operators = array
17
-    (
16
+    private $_operators = array(
18 17
         '<' => '<',
19 18
         'lt' => '<',
20 19
         '<=' => '<=',
@@ -76,8 +75,7 @@  discard block
 block discarded – undo
76 75
                 unset($constraints[$key]);
77 76
                 foreach ($properties as $property)
78 77
                 {
79
-                    $constraints[] = array
80
-                    (
78
+                    $constraints[] = array(
81 79
                         'property'   => $property,
82 80
                         'constraint' => $constraint['constraint'],
83 81
                         'value'      => $constraint['value'],
@@ -109,7 +107,7 @@  discard block
 block discarded – undo
109 107
 
110 108
             $constraint['constraint'] = $this->_normalize_operator($constraint['constraint']);
111 109
 
112
-            if (   !array_key_exists('value', $constraint)
110
+            if (!array_key_exists('value', $constraint)
113 111
                 || $constraint['value'] == '')
114 112
             {
115 113
                 // No value specified for this constraint, skip
@@ -205,13 +203,13 @@  discard block
 block discarded – undo
205 203
             $storage = $this->_request_data['schemadb_product'][$this->_request_data['search_schema']]->fields[$constraint['property']]['storage'];
206 204
             debug_print_r('constraint', $constraint);
207 205
             debug_print_r('storage', $storage);
208
-            if (   !is_array($storage)
206
+            if (!is_array($storage)
209 207
                 // Do not add constraint if it's all wildcards
210 208
                 || preg_match('/^%+$/', $constraint['value']))
211 209
             {
212 210
                 continue;
213 211
             }
214
-            if (   $storage['location'] == 'parameter'
212
+            if ($storage['location'] == 'parameter'
215 213
                 || $storage['location'] == 'configuration')
216 214
             {
217 215
                 $mc = new midgard_collector('midgard_parameter', 'domain', $storage['domain']);
@@ -274,13 +272,13 @@  discard block
 block discarded – undo
274 272
 
275 273
         // Determine search type (AND vs OR)
276 274
         $data['search_type'] = 'AND';
277
-        if (   !empty($_REQUEST['org_openpsa_products_search_type'])
275
+        if (!empty($_REQUEST['org_openpsa_products_search_type'])
278 276
             && $_REQUEST['org_openpsa_products_search_type'] == 'OR')
279 277
         {
280 278
             $data['search_type'] = 'OR';
281 279
         }
282 280
 
283
-        if (   array_key_exists('org_openpsa_products_search', $_REQUEST)
281
+        if (array_key_exists('org_openpsa_products_search', $_REQUEST)
284 282
             && is_array($_REQUEST['org_openpsa_products_search']))
285 283
         {
286 284
             // Normalize the constraints
@@ -292,7 +290,7 @@  discard block
 block discarded – undo
292 290
                 $data['results'] = $this->_qb_search($data['search_constraints']);
293 291
             }
294 292
         }
295
-        else if (   array_key_exists('org_openpsa_products_list_all', $_REQUEST)
293
+        else if (array_key_exists('org_openpsa_products_list_all', $_REQUEST)
296 294
                  || $this->_config->get('search_default_to_all'))
297 295
         {
298 296
             // Process search
@@ -302,7 +300,7 @@  discard block
 block discarded – undo
302 300
         // Prepare datamanager
303 301
         $data['datamanager'] = new midcom_helper_datamanager2_datamanager($data['schemadb_product']);
304 302
 
305
-        $this->add_stylesheet(MIDCOM_STATIC_URL."/midcom.helper.datamanager2/legacy.css");
303
+        $this->add_stylesheet(MIDCOM_STATIC_URL . "/midcom.helper.datamanager2/legacy.css");
306 304
 
307 305
         $this->_populate_toolbar();
308 306
 
@@ -317,10 +315,8 @@  discard block
 block discarded – undo
317 315
         {
318 316
             $buttons = array();
319 317
             $workflow = $this->get_workflow('datamanager2');
320
-            $buttons[] = $workflow->get_button("create/{$this->_request_data['root_group']}/", array
321
-            (
322
-                MIDCOM_TOOLBAR_LABEL => sprintf
323
-                (
318
+            $buttons[] = $workflow->get_button("create/{$this->_request_data['root_group']}/", array(
319
+                MIDCOM_TOOLBAR_LABEL => sprintf(
324 320
                     $this->_l10n_midcom->get('create %s'),
325 321
                     $this->_l10n->get('product group')
326 322
                 ),
@@ -329,10 +325,8 @@  discard block
 block discarded – undo
329 325
 
330 326
             foreach (array_keys($this->_request_data['schemadb_product']) as $name)
331 327
             {
332
-                $buttons[] = $workflow->get_button("product/create/{$this->_request_data['root_group']}/{$name}/", array
333
-                (
334
-                    MIDCOM_TOOLBAR_LABEL => sprintf
335
-                    (
328
+                $buttons[] = $workflow->get_button("product/create/{$this->_request_data['root_group']}/{$name}/", array(
329
+                    MIDCOM_TOOLBAR_LABEL => sprintf(
336 330
                         $this->_l10n_midcom->get('create %s'),
337 331
                         $this->_l10n->get($this->_request_data['schemadb_product'][$name]->description)
338 332
                     ),
@@ -371,7 +365,7 @@  discard block
 block discarded – undo
371 365
                 $results_counter++;
372 366
                 $data['results_counter'] = $results_counter;
373 367
 
374
-                if (! $data['datamanager']->autoset_storage($result))
368
+                if (!$data['datamanager']->autoset_storage($result))
375 369
                 {
376 370
                     debug_add("The datamanager for product {$result->id} could not be initialized, skipping it.");
377 371
                     debug_print_r('Object was:', $result);
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -166,8 +166,7 @@  discard block
 block discarded – undo
166 166
         {
167 167
             $ordering = preg_replace('/\s*reversed?\s*/', '', $ordering);
168 168
             $qb->add_order($ordering, 'DESC');
169
-        }
170
-        else
169
+        } else
171 170
         {
172 171
             $qb->add_order($ordering);
173 172
         }
@@ -225,8 +224,7 @@  discard block
 block discarded – undo
225 224
                     $qb->add_constraint('guid', 'IN', array_keys($keys));
226 225
                 }
227 226
                 unset($mc, $keys);
228
-            }
229
-            else
227
+            } else
230 228
             {
231 229
                 // Simple field storage
232 230
                 if (is_numeric($constraint['value']))
@@ -291,8 +289,7 @@  discard block
 block discarded – undo
291 289
                 // Process search
292 290
                 $data['results'] = $this->_qb_search($data['search_constraints']);
293 291
             }
294
-        }
295
-        else if (   array_key_exists('org_openpsa_products_list_all', $_REQUEST)
292
+        } else if (   array_key_exists('org_openpsa_products_list_all', $_REQUEST)
296 293
                  || $this->_config->get('search_default_to_all'))
297 294
         {
298 295
             // Process search
@@ -359,8 +356,7 @@  discard block
 block discarded – undo
359 356
         if (count($data['results']) == 0)
360 357
         {
361 358
             midcom_show_style('product_search_noresults');
362
-        }
363
-        else
359
+        } else
364 360
         {
365 361
             $data['results_count'] = count($data['results']);
366 362
             $results_counter = 0;
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/product/create.php 2 patches
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      */
43 43
     public function load_schemadb()
44 44
     {
45
-        $this->_schemadb =& $this->_request_data['schemadb_product'];
45
+        $this->_schemadb = & $this->_request_data['schemadb_product'];
46 46
 
47 47
         return $this->_schemadb;
48 48
     }
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
     /**
61 61
      * DM2 creation callback, binds to the current content topic.
62 62
      */
63
-    public function & dm2_create_callback (&$controller)
63
+    public function & dm2_create_callback(&$controller)
64 64
     {
65 65
         $this->_product = new org_openpsa_products_product_dba();
66 66
 
67 67
         $this->_request_data['up'] = $controller->formmanager->get_value('productGroup');
68 68
         $this->_product->productGroup = $this->_request_data['up'];
69 69
 
70
-        if (! $this->_product->create())
70
+        if (!$this->_product->create())
71 71
         {
72 72
             debug_print_r('We operated on this object:', $this->_product);
73 73
             throw new midcom_error("Failed to create a new product under product group #{$this->_request_data['up']}. Error: " . midcom_connection::get_error_string());
@@ -104,8 +104,7 @@  discard block
 block discarded – undo
104 104
         $data['controller'] = $this->get_controller('create');
105 105
         midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get($this->_schemadb[$this->_schema]->description)));
106 106
 
107
-        $workflow = $this->get_workflow('datamanager2', array
108
-        (
107
+        $workflow = $this->get_workflow('datamanager2', array(
109 108
             'controller' => $data['controller'],
110 109
             'save_callback' => array($this, 'save_callback')
111 110
         ));
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
             {
82 82
                 throw new midcom_error(midcom_connection::get_error_string());
83 83
             }
84
-        }
85
-        else
84
+        } else
86 85
         {
87 86
             $nodes = $object_qb->execute();
88 87
             $node = $nodes[0];
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/group/csvimport.php 2 patches
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
21 21
         midcom::get()->auth->require_admin_user();
22 22
         $this->_request_data['type'] = 'group';
23 23
 
24
-        $this->_request_data['import_status'] = array
25
-        (
24
+        $this->_request_data['import_status'] = array(
26 25
             'already_created' => 0,
27 26
             'created_new' => 0,
28 27
             'failed_create' => 0,
@@ -165,7 +164,7 @@  discard block
 block discarded – undo
165 164
                 $handle = fopen($_FILES['org_openpsa_products_import_upload']['tmp_name'], 'r');
166 165
                 $separator = $data['separator'];
167 166
                 $total_columns = 0;
168
-                while (   $read_rows < 2
167
+                while ($read_rows < 2
169 168
                        && $csv_line = fgetcsv($handle, 1000, $separator))
170 169
                 {
171 170
                     if ($total_columns == 0)
@@ -278,14 +277,14 @@  discard block
 block discarded – undo
278 277
                 {
279 278
                     $schema_field = $field_matching;
280 279
 
281
-                    if (   !array_key_exists($schema_field, $data['schemadb_group']['default']->fields)
280
+                    if (!array_key_exists($schema_field, $data['schemadb_group']['default']->fields)
282 281
                         && $schema_field != 'org_openpsa_products_import_parent_group')
283 282
                     {
284 283
                         // Invalid matching, skip
285 284
                         continue;
286 285
                     }
287 286
 
288
-                    if (   $value == ''
287
+                    if ($value == ''
289 288
                         || $value == 'NULL')
290 289
                     {
291 290
                         // No value, skip
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -81,8 +81,7 @@
 block discarded – undo
81 81
             {
82 82
                 throw new midcom_error(midcom_connection::get_error_string());
83 83
             }
84
-        }
85
-        else
84
+        } else
86 85
         {
87 86
             $nodes = $object_qb->execute();
88 87
             $node = $nodes[0];
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/group/groupsblock.php 2 patches
Spacing   +9 added lines, -14 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
         if (midcom::get()->config->get('enable_ajax_editing'))
103 103
         {
104 104
             $data['controller'] = midcom_helper_datamanager2_controller::create('ajax');
105
-            $data['controller']->schemadb =& $data['schemadb_group'];
105
+            $data['controller']->schemadb = & $data['schemadb_group'];
106 106
             $data['controller']->set_storage($data['group']);
107 107
             $data['controller']->process_ajax();
108 108
             $data['datamanager_group'] = $data['controller']->datamanager;
@@ -124,13 +124,13 @@  discard block
 block discarded – undo
124 124
         // Set the active leaf
125 125
         if ($this->_config->get('display_navigation'))
126 126
         {
127
-            $group =& $data['group'];
127
+            $group = & $data['group'];
128 128
 
129 129
             // Loop as long as it is possible to get the parent group
130 130
             while ($group->guid)
131 131
             {
132 132
                 // Break to the requested level (probably the root group of the products content topic)
133
-                if (   $group->id === $this->_config->get('root_group')
133
+                if ($group->id === $this->_config->get('root_group')
134 134
                     || $group->guid === $this->_config->get('root_group'))
135 135
                 {
136 136
                     break;
@@ -187,8 +187,7 @@  discard block
 block discarded – undo
187 187
     {
188 188
         $buttons = array();
189 189
         $workflow = $this->get_workflow('datamanager2');
190
-        $buttons[] = $workflow->get_button("edit/{$this->_request_data['group']->guid}/", array
191
-        (
190
+        $buttons[] = $workflow->get_button("edit/{$this->_request_data['group']->guid}/", array(
192 191
             MIDCOM_TOOLBAR_ENABLED => $this->_request_data['group']->can_do('midgard:update'),
193 192
             MIDCOM_TOOLBAR_ACCESSKEY => 'e',
194 193
         ));
@@ -197,10 +196,8 @@  discard block
 block discarded – undo
197 196
         $allow_create_product = $this->_request_data['group']->can_do('midgard:create');
198 197
         foreach (array_keys($this->_request_data['schemadb_group']) as $name)
199 198
         {
200
-            $buttons[] = $workflow->get_button("create/{$this->_request_data['parent_group']}/{$name}/", array
201
-            (
202
-                MIDCOM_TOOLBAR_LABEL => sprintf
203
-                (
199
+            $buttons[] = $workflow->get_button("create/{$this->_request_data['parent_group']}/{$name}/", array(
200
+                MIDCOM_TOOLBAR_LABEL => sprintf(
204 201
                     $this->_l10n_midcom->get('create %s'),
205 202
                     $this->_l10n->get($this->_request_data['schemadb_group'][$name]->description)
206 203
                 ),
@@ -211,10 +208,8 @@  discard block
 block discarded – undo
211 208
 
212 209
         foreach (array_keys($this->_request_data['schemadb_product']) as $name)
213 210
         {
214
-            $buttons[] = $workflow->get_button("product/create/{$this->_request_data['parent_group']}/{$name}/", array
215
-            (
216
-                MIDCOM_TOOLBAR_LABEL => sprintf
217
-                (
211
+            $buttons[] = $workflow->get_button("product/create/{$this->_request_data['parent_group']}/{$name}/", array(
212
+                MIDCOM_TOOLBAR_LABEL => sprintf(
218 213
                     $this->_l10n_midcom->get('create %s'),
219 214
                     $this->_l10n->get($this->_request_data['schemadb_product'][$name]->description)
220 215
                 ),
@@ -271,7 +266,7 @@  discard block
 block discarded – undo
271 266
                 $data['groups_counter'] = $groups_counter;
272 267
 
273 268
                 $data['group'] = $group;
274
-                if (! $data['datamanager_group']->autoset_storage($group))
269
+                if (!$data['datamanager_group']->autoset_storage($group))
275 270
                 {
276 271
                     debug_add("The datamanager for group #{$group->id} could not be initialized, skipping it.");
277 272
                     debug_print_r('Object was:', $group);
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -38,13 +38,11 @@  discard block
 block discarded – undo
38 38
             try
39 39
             {
40 40
                 $data['group'] = new org_openpsa_products_product_group_dba($args[0]);
41
-            }
42
-            catch (midcom_error $e)
41
+            } catch (midcom_error $e)
43 42
             {
44 43
                 return false;
45 44
             }
46
-        }
47
-        else
45
+        } else
48 46
         {
49 47
             $data['group'] = $results[0];
50 48
         }
@@ -106,8 +104,7 @@  discard block
 block discarded – undo
106 104
             $data['controller']->set_storage($data['group']);
107 105
             $data['controller']->process_ajax();
108 106
             $data['datamanager_group'] = $data['controller']->datamanager;
109
-        }
110
-        else
107
+        } else
111 108
         {
112 109
             $data['controller'] = null;
113 110
             if (!$data['datamanager_group']->autoset_storage($data['group']))
@@ -232,8 +229,7 @@  discard block
 block discarded – undo
232 229
         {
233 230
             $ordering = preg_replace('/\s*reversed?\s*/', '', $ordering);
234 231
             $qb->add_order($ordering, 'DESC');
235
-        }
236
-        else
232
+        } else
237 233
         {
238 234
             $qb->add_order($ordering);
239 235
         }
@@ -250,8 +246,7 @@  discard block
 block discarded – undo
250 246
         if ($data['controller'])
251 247
         {
252 248
             $data['view_group'] = $data['controller']->get_content_html();
253
-        }
254
-        else
249
+        } else
255 250
         {
256 251
             $data['view_group'] = $data['datamanager_group']->get_content_html();
257 252
         }
Please login to merge, or discard this patch.
lib/org/openpsa/products/handler/group/edit.php 1 patch
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         $this->_group = new org_openpsa_products_product_group_dba($args[0]);
33 33
 
34 34
         $data['controller'] = midcom_helper_datamanager2_controller::create('simple');
35
-        $data['controller']->schemadb =& $this->_request_data['schemadb_group'];
35
+        $data['controller']->schemadb = & $this->_request_data['schemadb_group'];
36 36
         $data['controller']->set_storage($this->_group);
37 37
         if (!$data['controller']->initialize())
38 38
         {
@@ -41,8 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         midcom::get()->head->set_pagetitle(sprintf($this->_l10n_midcom->get('edit %s'), $this->_group->title));
43 43
 
44
-        $workflow = $this->get_workflow('datamanager2', array
45
-        (
44
+        $workflow = $this->get_workflow('datamanager2', array(
46 45
             'controller' => $data['controller'],
47 46
             'save_callback' => array($this, 'save_callback')
48 47
         ));
Please login to merge, or discard this patch.