@@ -27,8 +27,7 @@ discard block |
||
27 | 27 | $buttons = array(); |
28 | 28 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_person_dba')) |
29 | 29 | { |
30 | - $buttons[] = $workflow->get_button('person/create/', array |
|
31 | - ( |
|
30 | + $buttons[] = $workflow->get_button('person/create/', array( |
|
32 | 31 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create person'), |
33 | 32 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_person-new.png', |
34 | 33 | )); |
@@ -36,13 +35,11 @@ discard block |
||
36 | 35 | |
37 | 36 | if (midcom::get()->auth->can_user_do('midgard:create', null, 'org_openpsa_contacts_group_dba')) |
38 | 37 | { |
39 | - $buttons[] = $workflow->get_button("group/create/organization/", array |
|
40 | - ( |
|
38 | + $buttons[] = $workflow->get_button("group/create/organization/", array( |
|
41 | 39 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create organization'), |
42 | 40 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', |
43 | 41 | )); |
44 | - $buttons[] = $workflow->get_button("group/create/group/", array |
|
45 | - ( |
|
42 | + $buttons[] = $workflow->get_button("group/create/group/", array( |
|
46 | 43 | MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_midcom->get('create %s'), $this->_l10n->get('group')), |
47 | 44 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_people-new.png', |
48 | 45 | )); |
@@ -51,8 +48,7 @@ discard block |
||
51 | 48 | $p_merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config); |
52 | 49 | if ($p_merger->merge_needed()) |
53 | 50 | { |
54 | - $buttons[] = array |
|
55 | - ( |
|
51 | + $buttons[] = array( |
|
56 | 52 | MIDCOM_TOOLBAR_URL => 'duplicates/person/', |
57 | 53 | MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('merge persons'), |
58 | 54 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/repair.png', |
@@ -61,11 +57,10 @@ discard block |
||
61 | 57 | } |
62 | 58 | $this->_view_toolbar->add_items($buttons); |
63 | 59 | |
64 | - if ( $this->_topic->can_do('midgard:update') |
|
60 | + if ($this->_topic->can_do('midgard:update') |
|
65 | 61 | && $this->_topic->can_do('midcom:component_config')) |
66 | 62 | { |
67 | - $this->_node_toolbar->add_item($workflow->get_button('config/', array |
|
68 | - ( |
|
63 | + $this->_node_toolbar->add_item($workflow->get_button('config/', array( |
|
69 | 64 | MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'), |
70 | 65 | MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'), |
71 | 66 | MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png', |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | private function load_next() |
47 | 47 | { |
48 | - $i =& $this->_request_data['loop_i']; |
|
48 | + $i = & $this->_request_data['loop_i']; |
|
49 | 49 | while ($i < 100) |
50 | 50 | { |
51 | 51 | debug_add("Loop iteration {$i}"); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | continue; |
80 | 80 | } |
81 | 81 | // Make sure we actually have enough rights to do this |
82 | - if ( !$person1->can_do('midgard:update') |
|
82 | + if (!$person1->can_do('midgard:update') |
|
83 | 83 | || !$person1->can_do('midgard:delete') |
84 | 84 | || !$person2->can_do('midgard:update') |
85 | 85 | || !$person2->can_do('midgard:delete')) |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | continue; |
90 | 90 | } |
91 | 91 | // Extra sanity check (in case of semi-successful not-duplicate mark) |
92 | - if ( $person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
92 | + if ($person1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person2->guid) |
|
93 | 93 | || $person2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $person1->guid)) |
94 | 94 | { |
95 | 95 | debug_add("It seems these two (#{$person1->id} and #{$person2->id}) have also marked as not duplicates, some cleanup might be a good thing", MIDCOM_LOG_WARN); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | |
100 | - $this->_request_data['probability'] = (float)$param->value; |
|
100 | + $this->_request_data['probability'] = (float) $param->value; |
|
101 | 101 | $this->_request_data['person1'] = $person1; |
102 | 102 | $this->_request_data['person2'] = $person2; |
103 | 103 | break; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | private function process_submit() |
108 | 108 | { |
109 | - if ( !empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) |
|
109 | + if (!empty($_POST['org_openpsa_contacts_handler_duplicates_person_keep']) |
|
110 | 110 | && !empty($_POST['org_openpsa_contacts_handler_duplicates_person_options']) |
111 | 111 | && count($_POST['org_openpsa_contacts_handler_duplicates_person_options']) == 2) |
112 | 112 | { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | { |
118 | 118 | $option1->require_do('midgard:update'); |
119 | 119 | $option2->require_do('midgard:update'); |
120 | - if ( $option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
120 | + if ($option1->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option2->guid, time()) |
|
121 | 121 | && $option2->set_parameter('org.openpsa.contacts.duplicates:not_duplicate', $option1->guid, time())) |
122 | 122 | { |
123 | 123 | // Clear the possible duplicate parameters |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | { |
142 | 142 | if ($keep == $option1->guid) |
143 | 143 | { |
144 | - $person1 =& $option1; |
|
145 | - $person2 =& $option2; |
|
144 | + $person1 = & $option1; |
|
145 | + $person2 = & $option2; |
|
146 | 146 | } |
147 | 147 | else if ($keep == $option2->guid) |
148 | 148 | { |
149 | - $person1 =& $option2; |
|
150 | - $person2 =& $option1; |
|
149 | + $person1 = & $option2; |
|
150 | + $person2 = & $option1; |
|
151 | 151 | } |
152 | 152 | else |
153 | 153 | { |
@@ -72,8 +72,7 @@ discard block |
||
72 | 72 | { |
73 | 73 | $person1 = new org_openpsa_contacts_person_dba($param->parentguid); |
74 | 74 | $person2 = new org_openpsa_contacts_person_dba($param->name); |
75 | - } |
|
76 | - catch (midcom_error $e) |
|
75 | + } catch (midcom_error $e) |
|
77 | 76 | { |
78 | 77 | $i++; |
79 | 78 | continue; |
@@ -126,8 +125,7 @@ discard block |
||
126 | 125 | |
127 | 126 | // TODO: Localize |
128 | 127 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), "Keeping both \"{$option1->name}\" and \"{$option2->name}\", they will not be marked as duplicates in the future", 'ok'); |
129 | - } |
|
130 | - else |
|
128 | + } else |
|
131 | 129 | { |
132 | 130 | $errstr = midcom_connection::get_error_string(); |
133 | 131 | // Failed to set as not duplicate, clear parameter that might have been set (could have only been the first) |
@@ -136,20 +134,17 @@ discard block |
||
136 | 134 | // TODO: Localize |
137 | 135 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), "Failed to mark #{$option1->id} and # {$option2->id} as not duplicates, errstr: {$errstr}", 'error'); |
138 | 136 | } |
139 | - } |
|
140 | - else |
|
137 | + } else |
|
141 | 138 | { |
142 | 139 | if ($keep == $option1->guid) |
143 | 140 | { |
144 | 141 | $person1 =& $option1; |
145 | 142 | $person2 =& $option2; |
146 | - } |
|
147 | - else if ($keep == $option2->guid) |
|
143 | + } else if ($keep == $option2->guid) |
|
148 | 144 | { |
149 | 145 | $person1 =& $option2; |
150 | 146 | $person2 =& $option1; |
151 | - } |
|
152 | - else |
|
147 | + } else |
|
153 | 148 | { |
154 | 149 | throw new midcom_error('Something weird happened (basically we got bogus data)'); |
155 | 150 | } |
@@ -160,8 +155,7 @@ discard block |
||
160 | 155 | { |
161 | 156 | $merger = new org_openpsa_contacts_duplicates_merge('person', $this->_config); |
162 | 157 | $merger->merge_delete($person1, $person2); |
163 | - } |
|
164 | - catch (midcom_error $e) |
|
158 | + } catch (midcom_error $e) |
|
165 | 159 | { |
166 | 160 | // TODO: Localize |
167 | 161 | midcom::get()->uimessages->add($this->_l10n->get('org.openpsa.contacts'), 'Merge failed, errstr: ' . $e->getMessage(), 'error'); |
@@ -182,8 +176,7 @@ discard block |
||
182 | 176 | if (!$this->_request_data['notfound']) |
183 | 177 | { |
184 | 178 | midcom_show_style('show-duplicate-persons'); |
185 | - } |
|
186 | - else |
|
179 | + } else |
|
187 | 180 | { |
188 | 181 | midcom_show_style('show-duplicate-persons-notfound'); |
189 | 182 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | public function __construct($identifier = null) |
24 | 24 | { |
25 | - if ( midcom::get()->config->get('person_class') != 'midgard_person' |
|
25 | + if (midcom::get()->config->get('person_class') != 'midgard_person' |
|
26 | 26 | && midcom::get()->config->get('person_class') != 'openpsa_person') |
27 | 27 | { |
28 | 28 | $this->__mgdschema_class_name__ = midcom::get()->config->get('person_class'); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public function __set($name, $value) |
34 | 34 | { |
35 | - if ( $name == 'homepage' |
|
35 | + if ($name == 'homepage' |
|
36 | 36 | && !empty($value) |
37 | 37 | && $value != $this->homepage) |
38 | 38 | { |
@@ -66,8 +66,7 @@ discard block |
||
66 | 66 | { |
67 | 67 | if ($this->_register_prober) |
68 | 68 | { |
69 | - $args = array |
|
70 | - ( |
|
69 | + $args = array( |
|
71 | 70 | 'person' => $this->guid, |
72 | 71 | ); |
73 | 72 | midcom_services_at_interface::register(time() + 60, 'org.openpsa.contacts', 'check_url', $args); |
@@ -84,12 +84,12 @@ discard block |
||
84 | 84 | |
85 | 85 | public function resolve_object_link(midcom_db_topic $topic, midcom_core_dbaobject $object) |
86 | 86 | { |
87 | - if ( $object instanceof org_openpsa_contacts_group_dba |
|
87 | + if ($object instanceof org_openpsa_contacts_group_dba |
|
88 | 88 | || $object instanceof midcom_db_group) |
89 | 89 | { |
90 | 90 | return "group/{$object->guid}/"; |
91 | 91 | } |
92 | - if ( $object instanceof org_openpsa_contacts_person_dba |
|
92 | + if ($object instanceof org_openpsa_contacts_person_dba |
|
93 | 93 | || $object instanceof midcom_db_person) |
94 | 94 | { |
95 | 95 | return "person/{$object->guid}/"; |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | |
133 | 133 | if (count($items) > 0) |
134 | 134 | { |
135 | - if ( $items[0]->get_latitude() |
|
135 | + if ($items[0]->get_latitude() |
|
136 | 136 | || $items[0]->get_longitude()) |
137 | 137 | { |
138 | 138 | // This is a GeoRSS feed |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | $hcards = @$hkit->getByURL('hcard', $url); |
145 | 145 | |
146 | - if ( is_array($hcards) |
|
146 | + if (is_array($hcards) |
|
147 | 147 | && count($hcards) > 0) |
148 | 148 | { |
149 | 149 | // We have found hCard data here |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | { |
218 | 218 | $latitude = (float) $icbm_parts[0]; |
219 | 219 | $longitude = (float) $icbm_parts[1]; |
220 | - if ( abs($latitude) < 90 |
|
220 | + if (abs($latitude) < 90 |
|
221 | 221 | && abs($longitude) < 180) |
222 | 222 | { |
223 | 223 | $location = new org_routamc_positioning_location_dba(); |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $root_groups[$name] = $group; |
61 | 61 | } |
62 | - } |
|
63 | - else |
|
62 | + } else |
|
64 | 63 | { |
65 | 64 | debug_add("OpenPSA Contacts root group could not be found", MIDCOM_LOG_WARN); |
66 | 65 | |
@@ -168,8 +167,7 @@ discard block |
||
168 | 167 | try |
169 | 168 | { |
170 | 169 | $person = new org_openpsa_contacts_person_dba($args['person']); |
171 | - } |
|
172 | - catch (midcom_error $e) |
|
170 | + } catch (midcom_error $e) |
|
173 | 171 | { |
174 | 172 | $handler->print_error("Person {$args['person']} not found, error " . $e->getMessage()); |
175 | 173 | return false; |
@@ -180,15 +178,13 @@ discard block |
||
180 | 178 | return false; |
181 | 179 | } |
182 | 180 | return $this->_check_person_url($person); |
183 | - } |
|
184 | - else if (array_key_exists('group', $args)) |
|
181 | + } else if (array_key_exists('group', $args)) |
|
185 | 182 | { |
186 | 183 | // Handling for groups |
187 | 184 | try |
188 | 185 | { |
189 | 186 | $group = new org_openpsa_contacts_group_dba($args['group']); |
190 | - } |
|
191 | - catch (midcom_error $e) |
|
187 | + } catch (midcom_error $e) |
|
192 | 188 | { |
193 | 189 | $handler->print_error("Group {$args['group']} not found, error " . $e->getMessage()); |
194 | 190 | return false; |
@@ -255,8 +251,7 @@ discard block |
||
255 | 251 | { |
256 | 252 | // GeoRSS subscription is a good way to keep track of person's location |
257 | 253 | $person->set_parameter('org.routamc.positioning:georss', 'georss_url', $data['georss_url']); |
258 | - } |
|
259 | - else if (array_key_exists('icbm', $data)) |
|
254 | + } else if (array_key_exists('icbm', $data)) |
|
260 | 255 | { |
261 | 256 | // Instead of using the ICBM position data directly we can subscribe to it so we get modifications too |
262 | 257 | $person->set_parameter('org.routamc.positioning:html', 'icbm_url', $person->homepage); |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | public $__midcom_class_name__ = __CLASS__; |
15 | 15 | public $__mgdschema_class_name__ = 'org_openpsa_organization'; |
16 | 16 | |
17 | - public $autodelete_dependents = array |
|
18 | - ( |
|
17 | + public $autodelete_dependents = array( |
|
19 | 18 | 'org_openpsa_contacts_member_dba' => 'gid' |
20 | 19 | ); |
21 | 20 | |
@@ -32,7 +31,7 @@ discard block |
||
32 | 31 | |
33 | 32 | public function __set($name, $value) |
34 | 33 | { |
35 | - if ( $name == 'homepage' |
|
34 | + if ($name == 'homepage' |
|
36 | 35 | && !empty($value) |
37 | 36 | && $value != $this->homepage) |
38 | 37 | { |
@@ -83,7 +82,7 @@ discard block |
||
83 | 82 | |
84 | 83 | public function __get($property) |
85 | 84 | { |
86 | - if ( $property == 'invoice_label' |
|
85 | + if ($property == 'invoice_label' |
|
87 | 86 | || $property == 'postal_label') |
88 | 87 | { |
89 | 88 | if (!isset($this->_address_extras[$property])) |
@@ -124,8 +123,7 @@ discard block |
||
124 | 123 | { |
125 | 124 | if ($this->_register_prober) |
126 | 125 | { |
127 | - $args = array |
|
128 | - ( |
|
126 | + $args = array( |
|
129 | 127 | 'group' => $this->guid, |
130 | 128 | ); |
131 | 129 | midcom_services_at_interface::register(time() + 60, 'org.openpsa.contacts', 'check_url', $args); |
@@ -246,8 +246,7 @@ |
||
246 | 246 | { |
247 | 247 | $result = array(); |
248 | 248 | $size = 0; |
249 | - } |
|
250 | - else |
|
249 | + } else |
|
251 | 250 | { |
252 | 251 | $result = array_slice($result, $this->_offset); |
253 | 252 | $size = $size - $this->_offset; |
@@ -48,8 +48,7 @@ discard block |
||
48 | 48 | //Search for all potential duplicates (more detailed checking is done later) |
49 | 49 | $check_persons = $this->get_person_candidates($person); |
50 | 50 | |
51 | - $person = $this->normalize_fields(array |
|
52 | - ( |
|
51 | + $person = $this->normalize_fields(array( |
|
53 | 52 | 'firstname' => $person->firstname, |
54 | 53 | 'lastname' => $person->lastname, |
55 | 54 | 'email' => $person->email, |
@@ -122,8 +121,7 @@ discard block |
||
122 | 121 | */ |
123 | 122 | function p_duplicate_person(array $person1, array $person2) |
124 | 123 | { |
125 | - $ret = array |
|
126 | - ( |
|
124 | + $ret = array( |
|
127 | 125 | 'p' => 0, |
128 | 126 | 'email_match' => false, |
129 | 127 | 'handphone_match' => false, |
@@ -144,7 +142,7 @@ discard block |
||
144 | 142 | // if user's lastname is part of the email address, check to see if the difference is only in the domain part |
145 | 143 | $email1 = preg_replace('/@.+/', '', $person1['email']); |
146 | 144 | $email2 = preg_replace('/@.+/', '', $person2['email']); |
147 | - if ( strpos($email1, $person1['lastname']) !== false |
|
145 | + if (strpos($email1, $person1['lastname']) !== false |
|
148 | 146 | && $email1 == $email2) |
149 | 147 | { |
150 | 148 | $ret['email_match'] = true; |
@@ -203,7 +201,7 @@ discard block |
||
203 | 201 | |
204 | 202 | private function match($property, array $data1, array $data2) |
205 | 203 | { |
206 | - if ( !empty($data1[$property]) |
|
204 | + if (!empty($data1[$property]) |
|
207 | 205 | && $data1[$property] == $data2[$property]) |
208 | 206 | { |
209 | 207 | return true; |
@@ -243,8 +241,7 @@ discard block |
||
243 | 241 | |
244 | 242 | $check_groups = $this->get_group_candidates($group); |
245 | 243 | |
246 | - $group = $this->normalize_fields(array |
|
247 | - ( |
|
244 | + $group = $this->normalize_fields(array( |
|
248 | 245 | 'official' => $group->official, |
249 | 246 | 'street' => $group->street, |
250 | 247 | 'phone' => $group->phone, |
@@ -303,8 +300,7 @@ discard block |
||
303 | 300 | */ |
304 | 301 | function p_duplicate_group(array $group1, array $group2) |
305 | 302 | { |
306 | - $ret = array |
|
307 | - ( |
|
303 | + $ret = array( |
|
308 | 304 | 'p' => 0, |
309 | 305 | 'homepage_match' => false, |
310 | 306 | 'phone_match' => false, |
@@ -370,7 +366,7 @@ discard block |
||
370 | 366 | $persons = $this->get_person_candidates(); |
371 | 367 | |
372 | 368 | $params = array(); |
373 | - $params['objects'] =& $persons; |
|
369 | + $params['objects'] = & $persons; |
|
374 | 370 | $params['mode'] = 'person'; |
375 | 371 | |
376 | 372 | array_walk($persons, array($this, 'check_all_arraywalk'), $params); |
@@ -442,7 +438,7 @@ discard block |
||
442 | 438 | continue; |
443 | 439 | } |
444 | 440 | |
445 | - if ( $obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid) |
|
441 | + if ($obj1->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj2->guid) |
|
446 | 442 | || $obj2->get_parameter('org.openpsa.contacts.duplicates:not_duplicate', $obj1->guid)) |
447 | 443 | { |
448 | 444 | // Not-duplicate parameter found, returning zero probability |
@@ -472,7 +468,7 @@ discard block |
||
472 | 468 | |
473 | 469 | $groups = $this->get_group_candidates(); |
474 | 470 | $params = array(); |
475 | - $params['objects'] =& $groups; |
|
471 | + $params['objects'] = & $groups; |
|
476 | 472 | $params['mode'] = 'group'; |
477 | 473 | array_walk($groups, array($this, 'check_all_arraywalk'), $params); |
478 | 474 | |
@@ -517,7 +513,7 @@ discard block |
||
517 | 513 | } |
518 | 514 | } |
519 | 515 | } |
520 | - debug_add("Done on " . time() . ", took: " . (time() - $time_start) . " seconds"); |
|
516 | + debug_add("Done on " . time() . ", took: " . (time() - $time_start) . " seconds"); |
|
521 | 517 | if ($output) |
522 | 518 | { |
523 | 519 | echo "INFO: DONE with persons. Elapsed time " . (time() - $time_start) . " seconds<br/>\n"; |
@@ -557,10 +553,10 @@ discard block |
||
557 | 553 | } |
558 | 554 | } |
559 | 555 | |
560 | - debug_add("Done on " . time() . ", took: " . (time()-$time_start) . " seconds"); |
|
556 | + debug_add("Done on " . time() . ", took: " . (time() - $time_start) . " seconds"); |
|
561 | 557 | if ($output) |
562 | 558 | { |
563 | - echo "INFO: DONE with groups. Elapsed time: " . (time()-$time_start) ." seconds<br/>\n"; |
|
559 | + echo "INFO: DONE with groups. Elapsed time: " . (time() - $time_start) . " seconds<br/>\n"; |
|
564 | 560 | flush(); |
565 | 561 | } |
566 | 562 | } |
@@ -138,8 +138,7 @@ discard block |
||
138 | 138 | { |
139 | 139 | $ret['email_match'] = true; |
140 | 140 | $ret['p'] += 1; |
141 | - } |
|
142 | - else if (!empty($person1['lastname'])) |
|
141 | + } else if (!empty($person1['lastname'])) |
|
143 | 142 | { |
144 | 143 | // if user's lastname is part of the email address, check to see if the difference is only in the domain part |
145 | 144 | $email1 = preg_replace('/@.+/', '', $person1['email']); |
@@ -435,8 +434,7 @@ discard block |
||
435 | 434 | { |
436 | 435 | $obj1 = $class::get_cached($arr1['guid']); |
437 | 436 | $obj2 = $class::get_cached($arr2['guid']); |
438 | - } |
|
439 | - catch (midcom_error $e) |
|
437 | + } catch (midcom_error $e) |
|
440 | 438 | { |
441 | 439 | $e->log(); |
442 | 440 | continue; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function merge($obj1, $obj2, $merge_mode) |
48 | 48 | { |
49 | - if ( $merge_mode !== 'all' |
|
49 | + if ($merge_mode !== 'all' |
|
50 | 50 | && $merge_mode !== 'future') |
51 | 51 | { |
52 | 52 | debug_add("invalid mode {$merge_mode}", MIDCOM_LOG_ERROR); |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | { |
98 | 98 | $dup = $this->check_duplicate($results, $result, $conf['duplicate_check']); |
99 | 99 | |
100 | - if ( is_object($dup) |
|
100 | + if (is_object($dup) |
|
101 | 101 | || $dup === false) |
102 | 102 | { |
103 | - if ( !is_object($dup) |
|
103 | + if (!is_object($dup) |
|
104 | 104 | || !array_key_exists($dup->id, $todelete)) |
105 | 105 | { |
106 | 106 | $todelete[$result->id] = $result; |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | } |
113 | 113 | } |
114 | - if ( $needs_update |
|
114 | + if ($needs_update |
|
115 | 115 | && !$result->update()) |
116 | 116 | { |
117 | 117 | throw new midcom_error("Failed to update {$classname} #{$result->id}, errstr: " . midcom_connection::get_error_string()); |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | foreach ($results as $result) |
172 | 172 | { |
173 | - if ( $result->$field === $object->$field |
|
173 | + if ($result->$field === $object->$field |
|
174 | 174 | && $result->id !== $object->id) |
175 | 175 | { |
176 | 176 | return $result; |
@@ -182,8 +182,7 @@ discard block |
||
182 | 182 | private function merge_persons($person1, $person2) |
183 | 183 | { |
184 | 184 | // Copy fields missing from person1 and present in person2 over |
185 | - $skip_properties = array |
|
186 | - ( |
|
185 | + $skip_properties = array( |
|
187 | 186 | 'id' => true, |
188 | 187 | 'guid' => true, |
189 | 188 | ); |
@@ -191,7 +190,7 @@ discard block |
||
191 | 190 | foreach ($person2 as $property => $value) |
192 | 191 | { |
193 | 192 | // Copy only simple properties not marked to be skipped missing from person1 |
194 | - if ( empty($person2->$property) |
|
193 | + if (empty($person2->$property) |
|
195 | 194 | || !empty($person1->$property) |
196 | 195 | || isset($skip_properties[$property]) |
197 | 196 | || !is_scalar($value)) |
@@ -74,10 +74,8 @@ |
||
74 | 74 | */ |
75 | 75 | public function get_calendar_options() |
76 | 76 | { |
77 | - $options = array |
|
78 | - ( |
|
79 | - 'businessHours' => array |
|
80 | - ( |
|
77 | + $options = array( |
|
78 | + 'businessHours' => array( |
|
81 | 79 | 'start' => $this->_config->get('day_start_time') . ':00', |
82 | 80 | 'end' => $this->_config->get('day_end_time') . ':00', |
83 | 81 | 'dow' => array(1, 2, 3, 4, 5) |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | //Check up |
169 | - if ( !$this->up |
|
169 | + if (!$this->up |
|
170 | 170 | && $this->title != '__org_openpsa_calendar') |
171 | 171 | { |
172 | 172 | $root_event = org_openpsa_calendar_interface::find_root_event(); |
@@ -202,9 +202,9 @@ discard block |
||
202 | 202 | private function _check_timerange() |
203 | 203 | { |
204 | 204 | //Force types |
205 | - $this->start = (int)$this->start; |
|
206 | - $this->end = (int)$this->end; |
|
207 | - if ( !$this->start |
|
205 | + $this->start = (int) $this->start; |
|
206 | + $this->end = (int) $this->end; |
|
207 | + if (!$this->start |
|
208 | 208 | || !$this->end) |
209 | 209 | { |
210 | 210 | debug_add('Event must have start and end timestamps'); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * Force start and end seconds to 1 and 0 respectively |
217 | 217 | * (to avoid stupid one second overlaps) |
218 | 218 | */ |
219 | - $this->start = mktime( date('G', $this->start), |
|
219 | + $this->start = mktime(date('G', $this->start), |
|
220 | 220 | date('i', $this->start), |
221 | 221 | 1, |
222 | 222 | date('n', $this->start), |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | private function _suspects_classes_present() |
327 | 327 | { |
328 | - return ( class_exists('org_openpsa_relatedto_dba') |
|
328 | + return (class_exists('org_openpsa_relatedto_dba') |
|
329 | 329 | && class_exists('org_openpsa_relatedto_suspect')); |
330 | 330 | } |
331 | 331 |
@@ -310,8 +310,7 @@ discard block |
||
310 | 310 | if ($linkdata['link']->create()) |
311 | 311 | { |
312 | 312 | debug_add("saved link to task #{$linkdata['other_obj']->id} (link id #{$linkdata['link']->id})", MIDCOM_LOG_INFO); |
313 | - } |
|
314 | - else |
|
313 | + } else |
|
315 | 314 | { |
316 | 315 | debug_add("could not save link to task #{$linkdata['other_obj']->id}, errstr" . midcom_connection::get_error_string(), MIDCOM_LOG_WARN); |
317 | 316 | } |
@@ -360,8 +359,7 @@ discard block |
||
360 | 359 | if ($linkdata['link']->create()) |
361 | 360 | { |
362 | 361 | debug_add("saved sales link to {$linkdata['other_obj']->guid} (link id #{$linkdata['link']->id})", MIDCOM_LOG_INFO); |
363 | - } |
|
364 | - else |
|
362 | + } else |
|
365 | 363 | { |
366 | 364 | debug_add("could not save sales link to {$linkdata['other_obj']->guid}, errstr" . midcom_connection::get_error_string(), MIDCOM_LOG_WARN); |
367 | 365 | } |
@@ -420,8 +418,7 @@ discard block |
||
420 | 418 | if ($this->orgOpenpsaAccesstype == org_openpsa_core_acl::ACCESS_PRIVATE) |
421 | 419 | { |
422 | 420 | $this->set_privilege('org.openpsa.calendar:read', 'EVERYONE', MIDCOM_PRIVILEGE_DENY); |
423 | - } |
|
424 | - else |
|
421 | + } else |
|
425 | 422 | { |
426 | 423 | $this->set_privilege('org.openpsa.calendar:read', 'EVERYONE', MIDCOM_PRIVILEGE_ALLOW); |
427 | 424 | } |