@@ -174,7 +174,7 @@ |
||
174 | 174 | } |
175 | 175 | if (!midcom::get()->auth->admin) { |
176 | 176 | $user_id = midcom::get()->auth->acl->get_user_id(); |
177 | - if ( !$this->data[$type . '_guid'] |
|
177 | + if (!$this->data[$type . '_guid'] |
|
178 | 178 | || !midcom::get()->auth->acl->can_do_byguid('midgard:read', $this->data[$type . '_guid'], 'midcom_db_topic', $user_id)) { |
179 | 179 | return null; |
180 | 180 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | public function _on_reindex($topic, $config, &$indexer) |
52 | 52 | { |
53 | - if ( !$config->get('index_products') |
|
53 | + if (!$config->get('index_products') |
|
54 | 54 | && !$config->get('index_groups')) { |
55 | 55 | debug_add("No indexing to groups and products, skipping", MIDCOM_LOG_WARN); |
56 | 56 | return true; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // Set all given values into DM2 |
43 | 43 | foreach ($productdata as $key => $value) { |
44 | - if ( array_key_exists($key, $this->_datamanager->types) |
|
44 | + if (array_key_exists($key, $this->_datamanager->types) |
|
45 | 45 | && !in_array($key, $this->_request_data['fields_to_skip'])) { |
46 | 46 | $this->_datamanager->types[$key]->convert_from_csv($value); |
47 | 47 | } |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | // Map products without group to the "new products" group |
143 | - if ( empty($product->productGroup) |
|
143 | + if (empty($product->productGroup) |
|
144 | 144 | && !empty($data['new_products_product_group'])) { |
145 | 145 | $product->productGroup = $data['new_products_product_group']; |
146 | 146 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | if ($percentage >= $this->_config->get('import_csv_data_percentage')) { |
246 | 246 | $read_rows++; |
247 | - if ( $limit > 0 |
|
247 | + if ($limit > 0 |
|
248 | 248 | && $read_rows > ($limit + $offset)) { |
249 | 249 | break; |
250 | 250 | } |
@@ -320,15 +320,15 @@ discard block |
||
320 | 320 | if ($field_matching = $_POST['org_openpsa_products_import_csv_field'][$field]) { |
321 | 321 | $schema_field = $field_matching; |
322 | 322 | |
323 | - if ( !array_key_exists($schema_field, $data['schemadb_product'][$data['schema']]->fields) |
|
323 | + if (!array_key_exists($schema_field, $data['schemadb_product'][$data['schema']]->fields) |
|
324 | 324 | && $schema_field != 'org_openpsa_products_import_parent_group') { |
325 | 325 | // Invalid matching, skip |
326 | 326 | continue; |
327 | 327 | } |
328 | 328 | |
329 | - if ( $value == '' |
|
329 | + if ($value == '' |
|
330 | 330 | || $value == 'NULL' |
331 | - || preg_match('/^#+$/', $value)) { |
|
331 | + || preg_match('/^#+$/', $value)) { |
|
332 | 332 | // No value, skip |
333 | 333 | continue; |
334 | 334 | } |
@@ -107,7 +107,8 @@ |
||
107 | 107 | if (!empty($productdata['GUID'])) { |
108 | 108 | try { |
109 | 109 | $product = new org_openpsa_products_product_dba($productdata['GUID']); |
110 | - } catch (midcom_error $e) { |
|
110 | + } |
|
111 | + catch (midcom_error $e) { |
|
111 | 112 | $e->log(); |
112 | 113 | } |
113 | 114 | } |
@@ -51,7 +51,7 @@ |
||
51 | 51 | |
52 | 52 | function _load_data($handler_id, &$args, &$data) |
53 | 53 | { |
54 | - if ( empty($_POST) |
|
54 | + if (empty($_POST) |
|
55 | 55 | && $data['session']->exists('POST_data')) { |
56 | 56 | $_POST = $data['session']->get('POST_data'); |
57 | 57 | $data['session']->remove('POST_data'); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $handle = fopen($_FILES['org_openpsa_products_import_upload']['tmp_name'], 'r'); |
136 | 136 | $separator = $data['separator']; |
137 | 137 | $total_columns = 0; |
138 | - while ( $read_rows < 2 |
|
138 | + while ($read_rows < 2 |
|
139 | 139 | && $csv_line = fgetcsv($handle, 1000, $separator)) { |
140 | 140 | if ($total_columns == 0) { |
141 | 141 | $total_columns = count($csv_line); |
@@ -226,13 +226,13 @@ discard block |
||
226 | 226 | if ($field_matching = $_POST['org_openpsa_products_import_csv_field'][$field]) { |
227 | 227 | $schema_field = $field_matching; |
228 | 228 | |
229 | - if ( !array_key_exists($schema_field, $data['schemadb_group']['default']->fields) |
|
229 | + if (!array_key_exists($schema_field, $data['schemadb_group']['default']->fields) |
|
230 | 230 | && $schema_field != 'org_openpsa_products_import_parent_group') { |
231 | 231 | // Invalid matching, skip |
232 | 232 | continue; |
233 | 233 | } |
234 | 234 | |
235 | - if ( $value == '' |
|
235 | + if ($value == '' |
|
236 | 236 | || $value == 'NULL') { |
237 | 237 | // No value, skip |
238 | 238 | continue; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | $result_cache[$cache_key] = array(); |
77 | - $ret =& $result_cache[$cache_key]; |
|
77 | + $ret = & $result_cache[$cache_key]; |
|
78 | 78 | |
79 | 79 | if (empty($up)) { |
80 | 80 | // TODO: use reflection to see what kind of property this is ? |
@@ -94,14 +94,14 @@ discard block |
||
94 | 94 | $value_properties[] = $keyproperty; |
95 | 95 | } |
96 | 96 | foreach ($label_fields as $fieldname) { |
97 | - if ( $fieldname != 'id' |
|
97 | + if ($fieldname != 'id' |
|
98 | 98 | && $fieldname != $keyproperty) { |
99 | 99 | $value_properties[] = $fieldname; |
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
104 | - $mc = org_openpsa_products_product_group_dba::new_collector('up', (int)$up); |
|
104 | + $mc = org_openpsa_products_product_group_dba::new_collector('up', (int) $up); |
|
105 | 105 | if ($order_by_score) { |
106 | 106 | $mc->add_order('metadata.score', 'DESC'); |
107 | 107 | } |
@@ -29,11 +29,11 @@ |
||
29 | 29 | $object = $dm->storage->object; |
30 | 30 | |
31 | 31 | $document = $indexer->new_document($dm); |
32 | - if ( $config->get('enable_scheduling') |
|
32 | + if ($config->get('enable_scheduling') |
|
33 | 33 | && midcom::get()->dbfactory->is_a($object, 'org_openpsa_products_product_dba')) { |
34 | 34 | // Check start/end for products |
35 | - if ( $object->start > time() |
|
36 | - || ( $object->end != 0 |
|
35 | + if ($object->start > time() |
|
36 | + || ($object->end != 0 |
|
37 | 37 | && $object->end < time())) { |
38 | 38 | // Not in market, remove from index |
39 | 39 | $indexer->delete($document->RI); |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | midcom::get()->auth->require_admin_user(); |
3 | 3 | |
4 | -if ( !isset($_POST['address']) |
|
4 | +if (!isset($_POST['address']) |
|
5 | 5 | || !strstr($_POST['address'], '__PRODUCT_CODE__')) { |
6 | 6 | ?> |
7 | 7 | <h1>Import product images</h1> |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | public function _on_watched_dba_delete($object) |
18 | 18 | { |
19 | 19 | $qb = org_openpsa_directmarketing_campaign_member_dba::new_query_builder(); |
20 | - if ( is_a($object, 'midcom_db_person') |
|
20 | + if (is_a($object, 'midcom_db_person') |
|
21 | 21 | || is_a($object, 'org_openpsa_contacts_person_dba')) { |
22 | 22 | $qb->add_constraint('person', '=', $object->id); |
23 | 23 | } elseif (is_a($object, 'org_openpsa_directmarketing_campaign_dba')) { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function background_send_message(array $args, midcom_baseclasses_components_cron_handler $handler) |
45 | 45 | { |
46 | - if ( !isset($args['url_base']) |
|
46 | + if (!isset($args['url_base']) |
|
47 | 47 | || !isset($args['batch'])) { |
48 | 48 | $handler->print_error('url_base or batch number not set, aborting'); |
49 | 49 | return false; |
@@ -57,7 +57,8 @@ discard block |
||
57 | 57 | try { |
58 | 58 | midcom::get()->dynamic_load($batch_url); |
59 | 59 | $ret = true; |
60 | - } catch (midcom_error $e) { |
|
60 | + } |
|
61 | + catch (midcom_error $e) { |
|
61 | 62 | $ret = $e->getMessage(); |
62 | 63 | } |
63 | 64 | ob_end_clean(); |
@@ -83,7 +84,8 @@ discard block |
||
83 | 84 | midcom::get()->auth->request_sudo($this->_component); |
84 | 85 | try { |
85 | 86 | $campaign = new org_openpsa_directmarketing_campaign_dba($args['campaign_guid']); |
86 | - } catch (midcom_error $e) { |
|
87 | + } |
|
88 | + catch (midcom_error $e) { |
|
87 | 89 | $handler->print_error("{$args['campaign_guid']} is not a valid campaign GUID"); |
88 | 90 | return false; |
89 | 91 | } |