Completed
Push — master ( e57c38...c50ccd )
by Andreas
09:03
created
lib/midcom/services/rcs/backend/rcs.php 1 patch
Spacing   +19 added lines, -21 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      *      3 on missing object->guid
92 92
      *      nonzero on error in one of the commands.
93 93
      */
94
-    public function rcs_update ($object, $message)
94
+    public function rcs_update($object, $message)
95 95
     {
96 96
         if (empty($object->guid))
97 97
         {
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         }
101 101
 
102 102
         $filename = $this->_generate_rcs_filename($object->guid);
103
-        $rcsfilename =  "{$filename},v";
103
+        $rcsfilename = "{$filename},v";
104 104
 
105 105
         if (!file_exists($rcsfilename))
106 106
         {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
         $command = 'ci -q -m' . escapeshellarg($message) . " {$filename}";
119 119
         $status = $this->exec($command);
120 120
 
121
-        chmod ($rcsfilename, 0770);
121
+        chmod($rcsfilename, 0770);
122 122
 
123 123
         return $status;
124 124
     }
@@ -138,11 +138,11 @@  discard block
 block discarded – undo
138 138
         $filepath = $this->_generate_rcs_filename($this->_guid);
139 139
 
140 140
         // , must become . to work. Therefore this:
141
-        str_replace(',', '.', $revision );
141
+        str_replace(',', '.', $revision);
142 142
         // this seems to cause problems:
143 143
         //settype ($revision, "float");
144 144
 
145
-        $command = 'co -q -f -r' . escapeshellarg(trim($revision)) .  " {$filepath} 2>/dev/null";
145
+        $command = 'co -q -f -r' . escapeshellarg(trim($revision)) . " {$filepath} 2>/dev/null";
146 146
         $this->exec($command);
147 147
 
148 148
         $data = $this->rcs_readfile($this->_guid);
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     {
179 179
         $versions = $this->list_history_numeric();
180 180
 
181
-        if (   !in_array($version, $versions)
181
+        if (!in_array($version, $versions)
182 182
             || $version === end($versions))
183 183
         {
184 184
             return '';
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
         $mode = end($versions);
188 188
 
189
-        while( $mode
189
+        while ($mode
190 190
             && $mode !== $version)
191 191
         {
192 192
             $mode = prev($versions);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
     {
222 222
         $versions = $this->list_history_numeric();
223 223
 
224
-        if (   !in_array($version, $versions)
224
+        if (!in_array($version, $versions)
225 225
             || $version === current($versions))
226 226
         {
227 227
             return '';
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 
230 230
         $mode = current($versions);
231 231
 
232
-        while (   $mode
232
+        while ($mode
233 233
                && $mode !== $version)
234 234
         {
235 235
             $mode = next($versions);
@@ -282,8 +282,7 @@  discard block
 block discarded – undo
282 282
     private function rcs_parse_history_entry($entry)
283 283
     {
284 284
         // Create the empty history array
285
-        $history = array
286
-        (
285
+        $history = array(
287 286
             'revision' => null,
288 287
             'date'     => null,
289 288
             'lines'    => null,
@@ -326,7 +325,7 @@  discard block
 block discarded – undo
326 325
             {
327 326
                 $history['user'] = $message_array[0];
328 327
             }
329
-            $history['ip']   = $message_array[1];
328
+            $history['ip'] = $message_array[1];
330 329
             $history['message'] = $message_array[2];
331 330
         }
332 331
         return $history;
@@ -360,7 +359,7 @@  discard block
 block discarded – undo
360 359
 
361 360
                 $i += 3;
362 361
 
363
-                while (   $i < $total
362
+                while ($i < $total
364 363
                        && substr($lines[$i], 0, 4) != '----'
365 364
                        && substr($lines[$i], 0, 5) != '=====')
366 365
                 {
@@ -399,9 +398,9 @@  discard block
 block discarded – undo
399 398
     /**
400 399
      * Writes $data to file $guid, does not return anything.
401 400
      */
402
-    private function rcs_writefile ($guid, $data)
401
+    private function rcs_writefile($guid, $data)
403 402
     {
404
-        if (   !is_writable($this->_config->get_rcs_root())
403
+        if (!is_writable($this->_config->get_rcs_root())
405 404
             || empty($guid))
406 405
         {
407 406
             return false;
@@ -416,7 +415,7 @@  discard block
 block discarded – undo
416 415
      * @param string guid
417 416
      * @return string xml representation of guid
418 417
      */
419
-    private function rcs_readfile ($guid)
418
+    private function rcs_readfile($guid)
420 419
     {
421 420
         if (!empty($guid))
422 421
         {
@@ -475,7 +474,7 @@  discard block
 block discarded – undo
475 474
 
476 475
         if (file_exists($filename))
477 476
         {
478
-            chmod ($filename, 0770);
477
+            chmod($filename, 0770);
479 478
         }
480 479
         return $status;
481 480
     }
@@ -535,16 +534,15 @@  discard block
 block discarded – undo
535 534
                 continue;
536 535
             }
537 536
 
538
-            $return[$attribute] = array
539
-            (
537
+            $return[$attribute] = array(
540 538
                 'old' => $oldest_value,
541 539
                 'new' => $newest[$attribute]
542 540
             );
543 541
 
544 542
             if ($oldest_value != $newest[$attribute])
545 543
             {
546
-                $lines1 = explode ("\n", $oldest_value);
547
-                $lines2 = explode ("\n", $newest[$attribute]);
544
+                $lines1 = explode("\n", $oldest_value);
545
+                $lines2 = explode("\n", $newest[$attribute]);
548 546
 
549 547
                 $options = array();
550 548
                 $diff = new Diff($lines1, $lines2, $options);
Please login to merge, or discard this patch.
lib/org/openpsa/invoices/invoice.php 1 patch
Spacing   +6 added lines, -7 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;
@@ -397,7 +396,7 @@  discard block
 block discarded – undo
397 396
     public function get_billing_data()
398 397
     {
399 398
             // check if we got the billing data cached already
400
-        if (   !$this->_billing_data
399
+        if (!$this->_billing_data
401 400
             // check if there is a customer set with invoice_data
402 401
             && !($this->_billing_data = $this->_get_billing_data('org_openpsa_contacts_group_dba', $this->customer))
403 402
             // check if the customerContact is set and has invoice_data
Please login to merge, or discard this patch.