Completed
Branch master (79a5f1)
by Andreas
18:48
created
lib/org/openpsa/calendar/handler/create.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
     /**
66 66
      * DM2 creation callback, binds to the current content topic.
67 67
      */
68
-    public function & dm2_create_callback (&$controller)
68
+    public function & dm2_create_callback(&$controller)
69 69
     {
70 70
         $this->_event = new org_openpsa_calendar_event_dba();
71 71
         $this->_event->up = $this->_root_event->id;
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
         {
45 45
             $person = $person->get_storage();
46 46
             $defaults['participants'][$person->id] = $person;
47
-        }
48
-        else if ($group = midcom::get()->auth->get_group($this->resource))
47
+        } else if ($group = midcom::get()->auth->get_group($this->resource))
49 48
         {
50 49
             foreach ($group->list_members() as $member)
51 50
             {
@@ -98,8 +97,7 @@  discard block
 block discarded – undo
98 97
             if (!empty($_GET['end']))
99 98
             {
100 99
                 $this->_requested_end = strtotime($_GET['end']);
101
-            }
102
-            else
100
+            } else
103 101
             {
104 102
                 $this->_requested_end = $this->_requested_start + 3600;
105 103
             }
@@ -120,8 +118,7 @@  discard block
 block discarded – undo
120 118
             $indexer = new org_openpsa_calendar_midcom_indexer($this->_topic);
121 119
             $indexer->index($data['controller']->datamanager);
122 120
             midcom::get()->head->add_jsonload('openpsa_calendar_widget.refresh_parent();');
123
-        }
124
-        else if (!empty($conflictmanager->busy_members))
121
+        } else if (!empty($conflictmanager->busy_members))
125 122
         {
126 123
             midcom::get()->uimessages->add($this->_l10n->get('event conflict'), $conflictmanager->get_message($this->_l10n->get_formatter()), 'warning');
127 124
         }
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/handler/admin.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@  discard block
 block discarded – undo
65 65
             $indexer = new org_openpsa_calendar_midcom_indexer($this->_topic);
66 66
             $indexer->index($data['controller']->datamanager);
67 67
             midcom::get()->head->add_jsonload('openpsa_calendar_widget.refresh_parent();');
68
-        }
69
-        else if (!empty($conflictmanager->busy_members))
68
+        } else if (!empty($conflictmanager->busy_members))
70 69
         {
71 70
             midcom::get()->uimessages->add($this->_l10n->get('event conflict'), $conflictmanager->get_message($this->_l10n->get_formatter()), 'warning');
72 71
         }
@@ -93,8 +92,7 @@  discard block
 block discarded – undo
93 92
         if (empty($_POST['end']))
94 93
         {
95 94
             $end = $event->end + ($start - $event->start);
96
-        }
97
-        else
95
+        } else
98 96
         {
99 97
             $end = strtotime($_POST['end']);
100 98
         }
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/conflictmanager.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
         }
138 138
         // TODO: Shared tasks need a separate check (different member object)
139 139
 
140
-        if (   !empty($this->busy_members)
140
+        if (!empty($this->busy_members)
141 141
             || !empty($this->busy_resources))
142 142
         {
143 143
             //Unresolved conflicts (note return value is for conflicts not lack of them)
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
         {
152 152
             //These events have been robbed of (some of) their resources
153 153
             $creator = midcom_db_person::get_cached($event->metadata->creator);
154
-            if (   (   count($event->participants) == 0
155
-                    || (   count($event->participants) == 1
154
+            if ((count($event->participants) == 0
155
+                    || (count($event->participants) == 1
156 156
                         && array_key_exists($creator->id, $event->participants)))
157 157
                 &&  count($event->resources) == 0)
158 158
             {
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 
221 221
         if (array_key_exists($member->event, $modified_events))
222 222
         {
223
-            $event =& $modified_events[$member->event];
223
+            $event = & $modified_events[$member->event];
224 224
             $set_as_modified = false;
225 225
         }
226 226
         else
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
         }
240 240
         debug_add("overlap found in event {$event->title} (#{$event->id})");
241 241
 
242
-        if (   $event->tentative
242
+        if ($event->tentative
243 243
             && $rob_tentative)
244 244
         {
245 245
             debug_add('event is tentative, robbing resources');
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
         }
296 296
         debug_add("overlap found in event {$event->title} (#{$event->id})");
297 297
 
298
-        if (   $event->tentative
298
+        if ($event->tentative
299 299
             && $rob_tentative)
300 300
         {
301 301
             debug_add('event is tentative, robbing resources');
Please login to merge, or discard this patch.
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -161,8 +161,7 @@  discard block
 block discarded – undo
161 161
                 debug_add("event {$event->title} (#{$event->id}) has been robbed of all of its resources, calling delete");
162 162
                 //TODO: take notifications and repeats into account
163 163
                 $event->delete();
164
-            }
165
-            else
164
+            } else
166 165
             {
167 166
                 //Otherwise just commit the changes
168 167
                 //TODO: take notifications and repeats into account
@@ -222,15 +221,13 @@  discard block
 block discarded – undo
222 221
         {
223 222
             $event =& $modified_events[$member->event];
224 223
             $set_as_modified = false;
225
-        }
226
-        else
224
+        } else
227 225
         {
228 226
             try
229 227
             {
230 228
                 $event = new org_openpsa_calendar_event_dba($member->event);
231 229
                 $set_as_modified = true;
232
-            }
233
-            catch (midcom_error $e)
230
+            } catch (midcom_error $e)
234 231
             {
235 232
                 debug_add("event_resource #{$member->id} links ot bogus event #{$member->event}, skipping and removing", MIDCOM_LOG_WARN);
236 233
                 $member->delete();
@@ -252,8 +249,7 @@  discard block
 block discarded – undo
252 249
             {
253 250
                 $modified_events[$event->id] = $event;
254 251
             }
255
-        }
256
-        else
252
+        } else
257 253
         {
258 254
             debug_add('event is normal, flagging busy');
259 255
             //Non tentative event, flag busy resources
@@ -286,8 +282,7 @@  discard block
 block discarded – undo
286 282
         try
287 283
         {
288 284
             $event = new org_openpsa_calendar_event_dba($member->eid);
289
-        }
290
-        catch (midcom_error $e)
285
+        } catch (midcom_error $e)
291 286
         {
292 287
             debug_add("eventmember #{$member->id} links to bogus event #{$member->eid}, skipping and removing", MIDCOM_LOG_WARN);
293 288
             $member->delete();
@@ -305,8 +300,7 @@  discard block
 block discarded – undo
305 300
             //participants
306 301
             $event->participants = array_diff_key($event->participants, $this->_event->participants);
307 302
             $modified_events[$event->id] = $event;
308
-        }
309
-        else
303
+        } else
310 304
         {
311 305
             debug_add('event is normal, flagging busy');
312 306
             //Non tentative event, flag busy resources
Please login to merge, or discard this patch.
lib/org/openpsa/calendar/midcom/interfaces.php 2 patches
Spacing   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         $root_event = self::find_root_event();
104 104
 
105 105
         $qb = org_openpsa_calendar_event_dba::new_query_builder();
106
-        $qb->add_constraint('up', '=',  $root_event->id);
106
+        $qb->add_constraint('up', '=', $root_event->id);
107 107
         $schemadb = midcom_helper_datamanager2_schema::load_database($config->get('schemadb'));
108 108
 
109 109
         $indexer = new org_openpsa_calendar_midcom_indexer($topic, $indexer);
@@ -123,8 +123,7 @@  discard block
 block discarded – undo
123 123
         }
124 124
 
125 125
         $workflow = new midcom\workflow\datamanager2;
126
-        return $workflow->get_button("new/" . $url, array
127
-        (
126
+        return $workflow->get_button("new/" . $url, array(
128 127
             MIDCOM_TOOLBAR_LABEL => midcom::get()->i18n->get_string('create event', 'org.openpsa.calendar'),
129 128
             MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new-event.png',
130 129
         ));
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
         if (mgd_is_guid($root_guid))
64 64
         {
65 65
             $root_event = org_openpsa_calendar_event_dba::get_cached($root_guid);
66
-        }
67
-        else
66
+        } else
68 67
         {
69 68
             // Check for calendar event tree.
70 69
             $qb = org_openpsa_calendar_event_dba::new_query_builder();
@@ -74,8 +73,7 @@  discard block
 block discarded – undo
74 73
             if (!empty($ret))
75 74
             {
76 75
                 $root_event = $ret[0];
77
-            }
78
-            else
76
+            } else
79 77
             {
80 78
                 debug_add("OpenPSA Calendar root event could not be found", MIDCOM_LOG_ERROR);
81 79
                 //Attempt to auto-initialize
Please login to merge, or discard this patch.
lib/org/openpsa/slideshow/style/edit.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,8 +23,7 @@
 block discarded – undo
23 23
         $original = new midcom_db_attachment($image->attachment);
24 24
         $original_url = midcom_db_attachment::get_url($original);
25 25
         $name = $original->name;
26
-    }
27
-    catch (midcom_error $e)
26
+    } catch (midcom_error $e)
28 27
     {
29 28
         $url = MIDCOM_STATIC_URL . '/stock-icons/mime/gnome-text-blank.png';
30 29
         $name = $data['l10n']->get('attachment missing');
Please login to merge, or discard this patch.
lib/org/openpsa/slideshow/handler/index.php 2 patches
Spacing   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -42,16 +42,13 @@
 block discarded – undo
42 42
             $head->enable_jquery();
43 43
             $head->add_jsfile(MIDCOM_STATIC_URL . '/' . $this->_component . '/galleria/galleria-1.3.5.min.js');
44 44
         }
45
-        $buttons = array
46
-        (
47
-            array
48
-            (
45
+        $buttons = array(
46
+            array(
49 47
                 MIDCOM_TOOLBAR_URL => "edit/",
50 48
                 MIDCOM_TOOLBAR_LABEL => sprintf($this->_l10n_midcom->get('edit %s'), $this->_l10n->get('slideshow')),
51 49
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/configuration.png',
52 50
             ),
53
-            array
54
-            (
51
+            array(
55 52
                 MIDCOM_TOOLBAR_URL => "recreate_folder_thumbnails/",
56 53
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('recreate subfolder thumbnails'),
57 54
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_refresh.png',
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,8 +71,7 @@  discard block
 block discarded – undo
71 71
         if (sizeof($data['images']) > 0)
72 72
         {
73 73
             midcom_show_style('index');
74
-        }
75
-        else
74
+        } else
76 75
         {
77 76
             midcom_show_style('index-empty');
78 77
         }
@@ -117,8 +116,7 @@  discard block
 block discarded – undo
117 116
         if (!empty($data['subfolders']))
118 117
         {
119 118
             midcom_show_style('index-subfolders');
120
-        }
121
-        else
119
+        } else
122 120
         {
123 121
             midcom_show_style('index-empty');
124 122
         }
Please login to merge, or discard this patch.
lib/org/openpsa/slideshow/handler/edit.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -281,10 +281,10 @@
 block discarded – undo
281 281
                 break;
282 282
             case 'delete':
283 283
                  if (empty($_POST['guids']))
284
-                 {
285
-                     throw new midcom_error('Invalid request');
286
-                 }
287
-                 break;
284
+                    {
285
+                        throw new midcom_error('Invalid request');
286
+                    }
287
+                    break;
288 288
             default:
289 289
                 throw new midcom_error('Invalid request');
290 290
         }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -11 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
         $failed = 0;
67 67
         foreach ($images as $image)
68 68
         {
69
-            if (   !$image->generate_image('thumbnail', $this->_config->get('thumbnail_filter'))
69
+            if (!$image->generate_image('thumbnail', $this->_config->get('thumbnail_filter'))
70 70
                 || !$image->generate_image('image', $this->_config->get('image_filter')))
71 71
             {
72 72
                 $failed++;
@@ -102,8 +102,7 @@  discard block
 block discarded – undo
102 102
         $data['images'] = $qb->execute();
103 103
 
104 104
         $head = midcom::get()->head;
105
-        $head->enable_jquery_ui(array
106
-        (
105
+        $head->enable_jquery_ui(array(
107 106
             'mouse', 'draggable', 'droppable', 'sortable',
108 107
             'progressbar', 'button', 'position', 'dialog',
109 108
             'effect', 'effect-pulsate'
@@ -113,16 +112,13 @@  discard block
 block discarded – undo
113 112
         $head->add_jsfile(MIDCOM_STATIC_URL . '/' . $this->_component . '/edit.js');
114 113
         $head->add_stylesheet(MIDCOM_STATIC_URL . '/' . $this->_component . '/edit.css');
115 114
 
116
-        $buttons = array
117
-        (
118
-            array
119
-            (
115
+        $buttons = array(
116
+            array(
120 117
                 MIDCOM_TOOLBAR_URL => "",
121 118
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('view'),
122 119
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/view.png',
123 120
             ),
124
-            array
125
-            (
121
+            array(
126 122
                 MIDCOM_TOOLBAR_URL => "recreate/",
127 123
                 MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('recreate derived images'),
128 124
                 MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_refresh.png',
@@ -272,7 +268,7 @@  discard block
 block discarded – undo
272 268
                 }
273 269
                 //Fall-through
274 270
             case 'create':
275
-                if (   !isset($_POST['title'])
271
+                if (!isset($_POST['title'])
276 272
                     || !isset($_POST['description'])
277 273
                     || !isset($_POST['position']))
278 274
                 {
@@ -297,7 +293,7 @@  discard block
 block discarded – undo
297 293
         $attachment->title = $_POST['title'];
298 294
         $attachment->mimetype = $file['type'];
299 295
         $attachment->parentguid = $image->guid;
300
-        if (   !$attachment->create()
296
+        if (!$attachment->create()
301 297
             || !$attachment->copy_from_file($file['tmp_name']))
302 298
         {
303 299
             throw new midcom_error('Failed to create attachment: ' . midcom_connection::get_error_string());
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -77,8 +77,7 @@  discard block
 block discarded – undo
77 77
         {
78 78
             $message = sprintf($this->_l10n->get('generated derived images for %s entries'), $successful);
79 79
             $type = 'info';
80
-        }
81
-        else
80
+        } else
82 81
         {
83 82
             $message = sprintf($this->_l10n->get('generated derived images for %s entries, %s errors occurred'), $successful, $failed);
84 83
             $type = 'error';
@@ -161,8 +160,7 @@  discard block
 block discarded – undo
161 160
         {
162 161
             $this->$function();
163 162
             $this->_response->success = true;
164
-        }
165
-        catch (midcom_error $e)
163
+        } catch (midcom_error $e)
166 164
         {
167 165
             $this->_response->success = false;
168 166
             $this->_response->error = $e->getMessage();
Please login to merge, or discard this patch.
lib/org/openpsa/invoices/billing/data.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,8 +58,7 @@  discard block
 block discarded – undo
58 58
         if ($contact = $this->get_contact())
59 59
         {
60 60
             $label .= $contact->get_label() . ')';
61
-        }
62
-        else
61
+        } else
63 62
         {
64 63
             $label .= $this->linkGuid . ')';
65 64
         }
@@ -76,14 +75,12 @@  discard block
 block discarded – undo
76 75
         try
77 76
         {
78 77
             return new org_openpsa_contacts_person_dba($this->linkGuid);
79
-        }
80
-        catch (midcom_error $e)
78
+        } catch (midcom_error $e)
81 79
         {
82 80
             try
83 81
             {
84 82
                 return new org_openpsa_contacts_group_dba($this->linkGuid);
85
-            }
86
-            catch (midcom_error $e)
83
+            } catch (midcom_error $e)
87 84
             {
88 85
                 debug_add("Failed to load contact with GUID: " . $this->linkGuid . " - last error:" . $e->getMessage(), MIDCOM_LOG_ERROR);
89 86
                 return false;
Please login to merge, or discard this patch.
lib/org/openpsa/invoices/invoice.php 2 patches
Spacing   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
     public $__midcom_class_name__ = __CLASS__;
17 17
     public $__mgdschema_class_name__ = 'org_openpsa_invoice';
18 18
 
19
-    public $autodelete_dependents = array
20
-    (
19
+    public $autodelete_dependents = array(
21 20
         'org_openpsa_invoices_invoice_item_dba' => 'invoice'
22 21
     );
23 22
 
@@ -146,7 +145,7 @@  discard block
 block discarded – undo
146 145
 
147 146
     public function _on_deleting()
148 147
     {
149
-        if (! midcom::get()->auth->request_sudo('org.openpsa.invoices'))
148
+        if (!midcom::get()->auth->request_sudo('org.openpsa.invoices'))
150 149
         {
151 150
             debug_add('Failed to get SUDO privileges, skipping invoice hour deletion silently.', MIDCOM_LOG_ERROR);
152 151
             return false;
@@ -175,7 +174,7 @@  discard block
 block discarded – undo
175 174
                 $task = new org_openpsa_projects_task_dba($id);
176 175
                 $task->update_cache();
177 176
             }
178
-            catch (midcom_error $e){}
177
+            catch (midcom_error $e) {}
179 178
         }
180 179
 
181 180
         $qb = self::new_query_builder();
@@ -304,11 +303,11 @@  discard block
 block discarded – undo
304 303
             {
305 304
                 try
306 305
                 {
307
-                    $deliverable = new org_openpsa_sales_salesproject_deliverable_dba((int)$mc_task_agreement->get_subkey($key, 'agreement'));
306
+                    $deliverable = new org_openpsa_sales_salesproject_deliverable_dba((int) $mc_task_agreement->get_subkey($key, 'agreement'));
308 307
                     $invoice_item->pricePerUnit = $deliverable->pricePerUnit;
309 308
                     $invoice_item->deliverable = $deliverable->id;
310 309
                     //calculate price
311
-                    if (   $deliverable->invoiceByActualUnits
310
+                    if ($deliverable->invoiceByActualUnits
312 311
                         || $deliverable->plannedUnits == 0)
313 312
                     {
314 313
                         $invoice_item->units = $hours;
Please login to merge, or discard this patch.
Braces   +9 added lines, -18 removed lines patch added patch discarded remove patch
@@ -73,8 +73,7 @@  discard block
 block discarded – undo
73 73
         try
74 74
         {
75 75
             $invoice_sender = new midcom_db_person($invoicer);
76
-        }
77
-        catch (midcom_error $e)
76
+        } catch (midcom_error $e)
78 77
         {
79 78
             return;
80 79
         }
@@ -174,8 +173,7 @@  discard block
 block discarded – undo
174 173
             {
175 174
                 $task = new org_openpsa_projects_task_dba($id);
176 175
                 $task->update_cache();
177
-            }
178
-            catch (midcom_error $e){}
176
+            } catch (midcom_error $e){}
179 177
         }
180 178
 
181 179
         $qb = self::new_query_builder();
@@ -312,13 +310,11 @@  discard block
 block discarded – undo
312 310
                         || $deliverable->plannedUnits == 0)
313 311
                     {
314 312
                         $invoice_item->units = $hours;
315
-                    }
316
-                    else
313
+                    } else
317 314
                     {
318 315
                         $invoice_item->units = $deliverable->plannedUnits;
319 316
                     }
320
-                }
321
-                catch (midcom_error $e)
317
+                } catch (midcom_error $e)
322 318
                 {
323 319
                     $e->log();
324 320
                     $invoice_item->units = $hours;
@@ -384,8 +380,7 @@  discard block
 block discarded – undo
384 380
             // if the property useContactAddress is set
385 381
             $billing_data[0]->set_address();
386 382
             return $billing_data[0];
387
-        }
388
-        catch (midcom_error $e)
383
+        } catch (midcom_error $e)
389 384
         {
390 385
             $e->log();
391 386
         }
@@ -436,8 +431,7 @@  discard block
 block discarded – undo
436 431
             try
437 432
             {
438 433
                 return org_openpsa_contacts_group_dba::get_cached($this->customer);
439
-            }
440
-            catch (midcom_error $e)
434
+            } catch (midcom_error $e)
441 435
             {
442 436
                 $e->log();
443 437
             }
@@ -447,8 +441,7 @@  discard block
 block discarded – undo
447 441
             try
448 442
             {
449 443
                 return org_openpsa_contacts_person_dba::get_cached($this->customerContact);
450
-            }
451
-            catch (midcom_error $e)
444
+            } catch (midcom_error $e)
452 445
             {
453 446
                 $e->log();
454 447
             }
@@ -470,13 +463,11 @@  discard block
 block discarded – undo
470 463
         if (count($invoice_items) == 1)
471 464
         {
472 465
             $invoice_item = $invoice_items[0];
473
-        }
474
-        else if (count($invoice_items) > 1)
466
+        } else if (count($invoice_items) > 1)
475 467
         {
476 468
             debug_add('More than one item found for task #' . $task_id . ', only returning the first', MIDCOM_LOG_INFO);
477 469
             $invoice_item = $invoice_items[0];
478
-        }
479
-        else
470
+        } else
480 471
         {
481 472
             $invoice_item = new org_openpsa_invoices_invoice_item_dba();
482 473
             $invoice_item->task = $task_id;
Please login to merge, or discard this patch.