Completed
Push — master ( 9d10c2...bf46e5 )
by Lars
05:14
created
src/Intraface/modules/accounting/Account.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -450,7 +450,7 @@
 block discarded – undo
450 450
      * @param $date_from (date) yyyy-mm-dd Der s�ges jo kun i indev�rende �r
451 451
      * @param $date_to (date) yyyy-mm-dd   Der s�ges kun i indev�rende �r
452 452
      *
453
-     * @return (array) med debet, credit og total saldo
453
+     * @return boolean med debet, credit og total saldo
454 454
      *
455 455
      *
456 456
      *
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -235,7 +235,7 @@
 block discarded – undo
235 235
             $this->error->set('Ikke en tilladt type');
236 236
         }
237 237
 
238
-         $validator->isNumeric($var['use_key'], 'Det kan en konto ikke bruges til');
238
+            $validator->isNumeric($var['use_key'], 'Det kan en konto ikke bruges til');
239 239
 
240 240
         if (!array_key_exists($var['use_key'], $this->use)) {
241 241
             $this->error->set('Ikke en tilladt brug af kontoen');
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $this->db = new DB_Sql;
95 95
         $this->mdb2 = MDB2::singleton(DB_DSN);
96 96
         if (PEAR::isError($this->mdb2)) {
97
-            throw new Exception($this->mdb2->getMessage() . $this->mdb2->getUserInfo());
97
+            throw new Exception($this->mdb2->getMessage().$this->mdb2->getUserInfo());
98 98
         }
99 99
 
100 100
         $this->error = new Intraface_Error;
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
                 account.active
151 151
             FROM
152 152
                 accounting_account account
153
-            WHERE account.id = " . $this->id . "
154
-                AND account.intranet_id = ".$this->year->kernel->intranet->get('id'). "
153
+            WHERE account.id = " . $this->id."
154
+                AND account.intranet_id = ".$this->year->kernel->intranet->get('id')."
155 155
                 AND year_id = ".$this->year->get('id')."
156 156
             LIMIT 1";
157 157
 
@@ -256,26 +256,26 @@  discard block
 block discarded – undo
256 256
 
257 257
         if ($this->id > 0) {
258 258
             $sql_type = "UPDATE accounting_account ";
259
-            $sql_end = " WHERE id = " . $this->id;
259
+            $sql_end = " WHERE id = ".$this->id;
260 260
         } else {
261 261
             $sql_type = "INSERT INTO accounting_account ";
262 262
             $sql_end = ", date_created=NOW()";
263 263
         }
264 264
 
265
-        $sql = $sql_type . "SET
265
+        $sql = $sql_type."SET
266 266
             number = '".(int)$var['number']."',
267
-            intranet_id = " . $this->year->kernel->intranet->get('id') . ",
268
-            user_id = " . $this->year->kernel->user->get("id") . ",
267
+            intranet_id = " . $this->year->kernel->intranet->get('id').",
268
+            user_id = " . $this->year->kernel->user->get("id").",
269 269
             type_key='" . $var['type_key']."',
270 270
             year_id = " . $this->year->get('id').",
271 271
             use_key = '" . $var['use_key']."',
272 272
             name = '" . $var['name']."',
273 273
             comment = '" . $var['comment']."',
274
-            vat_percent = '" . $var['vat_percent'] . "',
275
-            sum_to_account_number = " . (int)$var['sum_to'] . ",
276
-            sum_from_account_number = " . (int)$var['sum_from'] . ",
274
+            vat_percent = '" . $var['vat_percent']."',
275
+            sum_to_account_number = " . (int)$var['sum_to'].",
276
+            sum_from_account_number = " . (int)$var['sum_from'].",
277 277
             date_changed = NOW(),
278
-            vat_key=" . (int)$var['vat_key'] . " " . $sql_end;
278
+            vat_key=" . (int)$var['vat_key']." ".$sql_end;
279 279
 
280 280
         $this->db->query($sql);
281 281
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
         }
285 285
 
286 286
         if (!empty($var['created_from_id']) and is_numeric($var['created_from_id'])) {
287
-            $this->db->query("UPDATE accounting_account SET created_from_id = ".$var['created_from_id']." WHERE id = " . $this->id);
287
+            $this->db->query("UPDATE accounting_account SET created_from_id = ".$var['created_from_id']." WHERE id = ".$this->id);
288 288
         }
289 289
 
290 290
         $this->load();
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
             return false;
350 350
         }
351 351
 
352
-        $this->db->query("UPDATE accounting_account SET active = 0, date_changed=NOW() WHERE intranet_id = " . $this->year->kernel->intranet->get('id') . " AND year_id = ".$this->year->get('id')." AND id = " . $this->id);
352
+        $this->db->query("UPDATE accounting_account SET active = 0, date_changed=NOW() WHERE intranet_id = ".$this->year->kernel->intranet->get('id')." AND year_id = ".$this->year->get('id')." AND id = ".$this->id);
353 353
         $this->value['active'] = 0;
354 354
         return true;
355 355
     }
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
         $sql = "SELECT
391 391
                 id
392 392
             FROM accounting_account
393
-            WHERE number = " . $account_number . "
394
-                AND intranet_id = " . $this->year->kernel->intranet->get('id') . "
395
-                AND year_id = " .$this->year->get('id'). "
396
-                AND id <> " . $this->id . " AND active = 1";
393
+            WHERE number = " . $account_number."
394
+                AND intranet_id = " . $this->year->kernel->intranet->get('id')."
395
+                AND year_id = " .$this->year->get('id')."
396
+                AND id <> " . $this->id." AND active = 1";
397 397
         $result = $this->mdb2->query($sql);
398 398
         if (PEAR::isError($result)) {
399 399
             throw new Exception('Error in query: '.$result->getUserInfo());
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
     {
419 419
         $sql = "SELECT primosaldo_debet, primosaldo_credit
420 420
             FROM accounting_account
421
-            WHERE year_id = " . $this->year->get('id') . "
422
-                AND id = ".$this->id . "
421
+            WHERE year_id = " . $this->year->get('id')."
422
+                AND id = ".$this->id."
423 423
                 AND active = 1
424 424
                 AND intranet_id = ".$this->year->kernel->intranet->get('id');
425 425
 
@@ -499,9 +499,9 @@  discard block
 block discarded – undo
499 499
         if ($this->get('type_key') == array_search('sum', $this->types)) {
500 500
             $db2 = new DB_Sql;
501 501
             $sql = "SELECT id FROM accounting_account
502
-                    WHERE number >= " . $this->get('sum_from') . "
502
+                    WHERE number >= " . $this->get('sum_from')."
503 503
                         AND type_key != ".array_search('sum', $this->types)."
504
-                        AND number <= " . $this->get('sum_to') . "
504
+                        AND number <= " . $this->get('sum_to')."
505 505
                         AND year_id = ".$this->year->get('id')."
506 506
                         AND intranet_id = " . $this->year->kernel->intranet->get('id');
507 507
             $db2->query($sql);
@@ -567,9 +567,9 @@  discard block
 block discarded – undo
567 567
         $this->db->query("SELECT
568 568
                 id
569 569
             FROM accounting_post post
570
-            WHERE (post.account_id = ". $this->id . ")
570
+            WHERE (post.account_id = ". $this->id.")
571 571
                 AND intranet_id = ".$this->year->kernel->intranet->get('id')."
572
-                AND year_id = " . $this->year->get('id') . "
572
+                AND year_id = " . $this->year->get('id')."
573 573
                 LIMIT 1");
574 574
         return $this->db->numRows();
575 575
     }
@@ -590,9 +590,9 @@  discard block
 block discarded – undo
590 590
                     debet,
591 591
                     credit
592 592
                 FROM accounting_post post
593
-                WHERE (post.account_id = ". $this->get('id') . ")
593
+                WHERE (post.account_id = ". $this->get('id').")
594 594
                     AND intranet_id = ".$this->year->kernel->intranet->get('id')."
595
-                    AND year_id = " . $this->year->get('id') . "
595
+                    AND year_id = " . $this->year->get('id')."
596 596
                     AND stated = 1
597 597
                     ORDER BY date ASC, id ASC");
598 598
         $i = 1;
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
     public function calculateVat($amount, $vat_percent)
627 627
     {
628 628
         $amount = (float)$amount;
629
-        $vat_percent = (float)$vat_percent / 100;
629
+        $vat_percent = (float)$vat_percent/100;
630 630
 
631
-        return $amount * ($vat_percent / (1 + $vat_percent));
631
+        return $amount*($vat_percent/(1 + $vat_percent));
632 632
     }
633 633
 
634 634
     public function getId()
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Post.php 2 patches
Doc Comments   +10 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,6 +36,9 @@  discard block
 block discarded – undo
36 36
         }
37 37
     }
38 38
 
39
+    /**
40
+     * @param integer $post_id
41
+     */
39 42
     public function factory($year, $post_id)
40 43
     {
41 44
         return Intraface_modules_accounting_PostGateway::getFromYearAndPostId($year, $post_id);
@@ -76,6 +79,13 @@  discard block
 block discarded – undo
76 79
         return 1;
77 80
     }
78 81
 
82
+    /**
83
+     * @param string $date
84
+     * @param integer $account_id
85
+     * @param string $text
86
+     * @param double $debet
87
+     * @param double $credit
88
+     */
79 89
     private function validate($date, $account_id, $text, $debet, $credit)
80 90
     {
81 91
         $validator = new Intraface_Validator($this->error);
@@ -99,9 +109,7 @@  discard block
 block discarded – undo
99 109
     /**
100 110
      * States the posts
101 111
      *
102
-     * @param integer $year_id
103 112
      * @param string  $date
104
-     * @param string  $voucher_number
105 113
      * @param string  $text
106 114
      * @param integer $account_id
107 115
      * @param float   $debet
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     private function load()
45 45
     {
46 46
         $db = new DB_Sql;
47
-        $db->query("SELECT *, DATE_FORMAT(date, '%d-%m-%Y') AS date_dk FROM accounting_post WHERE id = " . $this->id . " AND intranet_id=" .$this->voucher->year->kernel->intranet->get('id'));
47
+        $db->query("SELECT *, DATE_FORMAT(date, '%d-%m-%Y') AS date_dk FROM accounting_post WHERE id = ".$this->id." AND intranet_id=".$this->voucher->year->kernel->intranet->get('id'));
48 48
         if (!$db->nextRecord()) {
49 49
             return 0;
50 50
         }
@@ -125,14 +125,14 @@  discard block
 block discarded – undo
125 125
 
126 126
         if ($this->id > 0) {
127 127
             $sql_type = "UPDATE";
128
-            $sql_end = " WHERE id = " . $this->id;
128
+            $sql_end = " WHERE id = ".$this->id;
129 129
         } else {
130 130
             $sql_type = "INSERT INTO";
131 131
             $sql_end = "";
132 132
         }
133 133
 
134 134
         $db = new DB_Sql;
135
-        $sql = $sql_type . " accounting_post
135
+        $sql = $sql_type." accounting_post
136 136
                  SET
137 137
                     voucher_id = '".$this->voucher->get('id')."',
138 138
                     intranet_id = ".$this->
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                     account_id = '".(int)$account_id."',
148 148
                     text = '".(string)$text."',
149 149
                     debet = '".$debet."',
150
-                    credit = '".$credit."'"  . $sql_end;
150
+                    credit = '".$credit."'".$sql_end;
151 151
         $db->query($sql);
152 152
 
153 153
         $this->id = $db->insertedId();
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         }
175 175
 
176 176
         $db = new DB_Sql;
177
-        $db->query("UPDATE accounting_post SET stated = 1 WHERE id = " . $this->id . " AND intranet_id =" .$this->voucher->year->kernel->intranet->get('id'));
177
+        $db->query("UPDATE accounting_post SET stated = 1 WHERE id = ".$this->id." AND intranet_id =".$this->voucher->year->kernel->intranet->get('id'));
178 178
 
179 179
         return true;
180 180
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         }
187 187
 
188 188
         $db = new DB_Sql;
189
-        $db->query("DELETE FROM accounting_post WHERE id = " . $this->id);
189
+        $db->query("DELETE FROM accounting_post WHERE id = ".$this->id);
190 190
         return true;
191 191
 
192 192
     }
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Voucher.php 2 patches
Doc Comments   +1 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,6 @@  discard block
 block discarded – undo
22 22
      * Constructor
23 23
      *
24 24
      * @param object  $year_object
25
-     * @param integer $post_id (optional)
26 25
      *
27 26
      * @return void
28 27
      */
@@ -45,7 +44,7 @@  discard block
 block discarded – undo
45 44
      * @param object $year
46 45
      * @param string $voucher_number
47 46
      *
48
-     * @return void
47
+     * @return Voucher
49 48
      */
50 49
     function factory($year, $voucher_number)
51 50
     {
@@ -339,9 +338,7 @@  discard block
 block discarded – undo
339 338
     /**
340 339
      * Prepares amounts for stating, e.g. whether the accounts needs vat calculations
341 340
      *
342
-     * @param integer $year_id
343 341
      * @param string  $date
344
-     * @param string  $voucher_number
345 342
      * @param string  $text
346 343
      * @param integer $account_id
347 344
      * @param float   $debet
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                     voucher.date,
69 69
                     voucher.reference
70 70
             FROM accounting_voucher voucher
71
-            WHERE voucher.id = " . $this->id. " AND intranet_id = ". $this->year->kernel->intranet->getId();
71
+            WHERE voucher.id = " . $this->id." AND intranet_id = ".$this->year->kernel->intranet->getId();
72 72
 
73 73
         $db = new DB_Sql;
74 74
         $db->query($sql);
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
             $sql_end = ", date_created = NOW()";
144 144
         } else {
145 145
             $sql_type = "UPDATE";
146
-            $sql_end = " WHERE id = " . (int)$this->id;
146
+            $sql_end = " WHERE id = ".(int)$this->id;
147 147
         }
148 148
 
149 149
         $db = new DB_Sql;
150
-        $sql = $sql_type . " accounting_voucher
150
+        $sql = $sql_type." accounting_voucher
151 151
             SET intranet_id = ".$this->year->kernel->intranet->get('id').",
152 152
                 year_id = ".$this->year->get('id').",
153 153
                 user_id = ".$this->year->kernel->user->get('id').",
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                 number = '".$var['voucher_number']."',
156 156
                 date = '".$post_date->get()."',
157 157
                 reference = '".$var['reference']."',
158
-                text = '".$var['text']."'" . $sql_end;
158
+                text = '".$var['text']."'".$sql_end;
159 159
 
160 160
         $db->query($sql);
161 161
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
             $buy_all_abroad = $buy_abroad;
310 310
         }
311 311
 
312
-        $amount = $this->get('amount') * ($this->vatpercent / 100);
312
+        $amount = $this->get('amount')*($this->vatpercent/100);
313 313
 
314 314
         // I det omfang du har fradragsret for momsen, kan du medregne det beregnede
315 315
         // momsbeløb til konto for indgående moms. Det beregnede momsbeløb af EU-varekøb
@@ -374,13 +374,13 @@  discard block
 block discarded – undo
374 374
                         $debet = $debet - $vat_amount;
375 375
                         // bogfør momsen
376 376
                         $post = new Post($this);
377
-                        $post->save($date, $vat_account_id, $text . " - købsmoms", $vat_amount, 0, $skip_draft);
377
+                        $post->save($date, $vat_account_id, $text." - købsmoms", $vat_amount, 0, $skip_draft);
378 378
                     } else {
379 379
                         $vat_amount = $this->calculateVat($credit, $vat_percent);
380 380
                         $credit = $credit - $vat_amount;
381 381
                         // bogføre udgående moms
382 382
                         $post = new Post($this);
383
-                        $post->save($date, $vat_account_id, $text . " - tilbageført moms", 0, $vat_amount, $skip_draft);
383
+                        $post->save($date, $vat_account_id, $text." - tilbageført moms", 0, $vat_amount, $skip_draft);
384 384
                     }
385 385
 
386 386
                         // bogføre selve posten
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
                         $credit = $credit - $vat_amount;
397 397
                         // bogføre udgående moms
398 398
                         $post = new Post($this);
399
-                        $post->save($date, $vat_account_id, $text . " - salgsmoms", 0, $vat_amount, $skip_draft);
399
+                        $post->save($date, $vat_account_id, $text." - salgsmoms", 0, $vat_amount, $skip_draft);
400 400
                     } else {
401 401
                         // tilbagefører momsen hvis det er et debet beløb
402 402
                         $vat_amount = $this->calculateVat($debet, $vat_percent);
@@ -455,7 +455,7 @@  discard block
 block discarded – undo
455 455
             $post = new Post($this, $p['id']);
456 456
 
457 457
             if (!$post->setStated()) {
458
-                $this->error->set('id#' .$p['id'] . ': Det lykkedes ikke at bogføre denne post.');
458
+                $this->error->set('id#'.$p['id'].': Det lykkedes ikke at bogføre denne post.');
459 459
             }
460 460
 
461 461
             // tjekker om der har været nogle fejl i bogføringen
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
         }
480 480
 
481 481
         if ($this->get('saldo') <> 0) {
482
-            $this->error->set('Du kan kun bogføre et bilag, hvis det stemmer. Saldoen på dette bilag er ' . $this->get('saldo') . '.');
482
+            $this->error->set('Du kan kun bogføre et bilag, hvis det stemmer. Saldoen på dette bilag er '.$this->get('saldo').'.');
483 483
         }
484 484
 
485 485
         if ($this->error->isError()) {
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
             }
496 496
 
497 497
             if (!$post->setStated()) {
498
-                $this->error->set('id#' .$p['id'] . ': Det lykkedes ikke at bogføre denne post.');
498
+                $this->error->set('id#'.$p['id'].': Det lykkedes ikke at bogføre denne post.');
499 499
             }
500 500
         }
501 501
         // tjekker om der har været nogle fejl i bogføringen
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
     function getPosts()
510 510
     {
511 511
         $db = new DB_Sql;
512
-        $db->query("SELECT id, text, debet, credit, account_id, stated, date, DATE_FORMAT(date, '%d-%m-%Y') AS date_dk FROM accounting_post WHERE voucher_id = " . $this->id . " AND intranet_id=".$this->year->kernel->intranet->get('id'));
512
+        $db->query("SELECT id, text, debet, credit, account_id, stated, date, DATE_FORMAT(date, '%d-%m-%Y') AS date_dk FROM accounting_post WHERE voucher_id = ".$this->id." AND intranet_id=".$this->year->kernel->intranet->get('id'));
513 513
         $list = array();
514 514
         $i = 0;
515 515
         $this->value['saldo'] = 0;
Please login to merge, or discard this patch.
src/Intraface/modules/accounting/Year.php 2 patches
Doc Comments   +13 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     /**
44 44
      * Funktion til at sætte et regnskabsår, som brugeren redigerer i.
45 45
      *
46
-     * @return true
46
+     * @return boolean
47 47
      */
48 48
     function setYear()
49 49
     {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
      *
86 86
      * @param boolean $redirect Set to true if a redirect should occur if no year isset
87 87
      *
88
-     * @return boolean
88
+     * @return null|boolean
89 89
      */
90 90
     function checkYear($redirect = true)
91 91
     {
@@ -439,11 +439,17 @@  discard block
 block discarded – undo
439 439
         return $this->kernel->getSetting()->set('intranet', 'accounting.'.$setting, $value, $this->get('id'));
440 440
     }
441 441
 
442
+    /**
443
+     * @param string $setting
444
+     */
442 445
     function getSetting($setting)
443 446
     {
444 447
         return $this->kernel->getSetting()->get('intranet', 'accounting.' . $setting, $this->get('id'));
445 448
     }
446 449
 
450
+    /**
451
+     * @param string $type
452
+     */
447 453
     function createAccounts($type, $last_year_id = 0)
448 454
     {
449 455
         if ($this->getId() == 0) {
@@ -742,7 +748,8 @@  discard block
 block discarded – undo
742 748
 
743 749
     /**
744 750
      * @param $from->year (object)
745
-     * @param $setting (string)
751
+     * @param string $setting (string)
752
+     * @param Year $from_year
746 753
      */
747 754
     function transferAccountSetting($from_year, $setting)
748 755
     {
@@ -874,6 +881,9 @@  discard block
 block discarded – undo
874 881
         return true;
875 882
     }
876 883
 
884
+    /**
885
+     * @return string
886
+     */
877 887
     public function getId()
878 888
     {
879 889
         return $this->get('id');
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                 DATE_FORMAT(to_date, '%d-%m-%Y') AS to_date_dk,
145 145
                 last_year_id, from_date, to_date, locked, label, vat
146 146
             FROM accounting_year
147
-            WHERE id = '" . $this->id . "'
147
+            WHERE id = '" . $this->id."'
148 148
                 AND intranet_id = ".$this->kernel->intranet->get('id')."
149 149
             LIMIT 1";
150 150
 
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
         }
213 213
 
214 214
         if ($this->id > 0) {
215
-            $sql="UPDATE accounting_year ";
216
-            $sql_after=" WHERE id='".$this->id."' AND intranet_id = ".$this->kernel->intranet->get('id')."";
215
+            $sql = "UPDATE accounting_year ";
216
+            $sql_after = " WHERE id='".$this->id."' AND intranet_id = ".$this->kernel->intranet->get('id')."";
217 217
         } else {
218
-            $sql="INSERT INTO accounting_year ";
218
+            $sql = "INSERT INTO accounting_year ";
219 219
             $sql_after = ', date_created = NOW()';
220 220
         }
221
-        $sql.=" SET
221
+        $sql .= " SET
222 222
             intranet_id='".$this->kernel->intranet->get('id')."',
223 223
             user_id='".$this->kernel->user->get('id')."',
224 224
             last_year_id='".$var['last_year_id']."',
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     {
260 260
         $sql = "SELECT id FROM accounting_year
261 261
             WHERE id = ".$this->id."
262
-                AND intranet_id = ". $this->kernel->intranet->get('id') . " AND active = 1";
262
+                AND intranet_id = ". $this->kernel->intranet->get('id')." AND active = 1";
263 263
 
264 264
         $db = new DB_Sql;
265 265
         $db->query($sql);
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
     public function isYearOpen()
292 292
     {
293 293
         $db = new Db_Sql;
294
-        $db->query("SELECT locked FROM accounting_year WHERE id = " . $this->id . " AND intranet_id = ".$this->kernel->intranet->get('id'));
294
+        $db->query("SELECT locked FROM accounting_year WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'));
295 295
         if ($db->nextRecord()) {
296 296
             if ($db->f('locked') == 1) {
297 297
                 return false;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
         $date = safeToDb($date);
317 317
 
318 318
         $db = new Db_Sql;
319
-        $db->query("SELECT from_date, to_date FROM accounting_year WHERE id= " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id') . " LIMIT 1");
319
+        $db->query("SELECT from_date, to_date FROM accounting_year WHERE id= ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')." LIMIT 1");
320 320
         if ($db->nextRecord()) {
321 321
             if ($db->f('from_date') <= $date and $date <= $db->f('to_date')) {
322 322
                 return true;
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 
404 404
         if (!empty($balance_accounts) and count($balance_accounts) > 0) {
405 405
             foreach ($balance_accounts as $account) {
406
-                $sql_where .= "id = " . $account . " OR ";
406
+                $sql_where .= "id = ".$account." OR ";
407 407
             }
408 408
         }
409 409
         // hvis der ikke er nogen balance_accounts skal den ikke v�lge nogen poster
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         $db = new DB_Sql;
413 413
         $db->query("SELECT id FROM accounting_account
414 414
             WHERE (".$sql_where.")
415
-            	AND intranet_id = " . $this->kernel->intranet->get('id') . "
415
+            	AND intranet_id = " . $this->kernel->intranet->get('id')."
416 416
             	AND year_id = " . $this->get('id'));
417 417
 
418 418
         $accounts = array(); // afstemningskonti
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
 
442 442
     function getSetting($setting)
443 443
     {
444
-        return $this->kernel->getSetting()->get('intranet', 'accounting.' . $setting, $this->get('id'));
444
+        return $this->kernel->getSetting()->get('intranet', 'accounting.'.$setting, $this->get('id'));
445 445
     }
446 446
 
447 447
     function createAccounts($type, $last_year_id = 0)
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 
489 489
                     // settings
490 490
                     if (!empty($input['setting'])) {
491
-                        $this->setSetting($input['setting'] . '_account_id', $id);
491
+                        $this->setSetting($input['setting'].'_account_id', $id);
492 492
                     }
493 493
                     if (!empty($input['balance_account']) and $input['balance_account'] == 1) {
494 494
                         $balance_accounts[] = $id;
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 
570 570
                 if (is_array($balance_accounts)) {
571 571
                     foreach ($balance_accounts as $key => $id) {
572
-                        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND created_from_id = " . (int)$id);
572
+                        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND created_from_id = ".(int)$id);
573 573
                         while ($db->nextRecord()) {
574 574
                             $new_balance_accounts[] = $db->f('id');
575 575
                         }
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 
585 585
                 if (is_array($buy_eu_accounts)) {
586 586
                     foreach ($buy_eu_accounts as $key => $id) {
587
-                        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND created_from_id = " . (int)$id);
587
+                        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND created_from_id = ".(int)$id);
588 588
                         while ($db->nextRecord()) {
589 589
                             $new_buy_eu_accounts[] = $db->f('id');
590 590
                         }
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 
600 600
                 if (is_array($buy_abroad_accounts)) {
601 601
                     foreach ($buy_abroad_accounts as $key => $id) {
602
-                        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND created_from_id = " . (int)$id);
602
+                        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND created_from_id = ".(int)$id);
603 603
                         while ($db->nextRecord()) {
604 604
                             $new_buy_abroad_accounts[] = $db->f('id');
605 605
                         }
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
     {
749 749
         $account_id = $from_year->getSetting($setting);
750 750
         $db = new DB_Sql;
751
-        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND created_from_id = " . $account_id);
751
+        $db->query("SELECT id FROM accounting_account WHERE year_id = ".$this->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND created_from_id = ".$account_id);
752 752
         if ($db->nextRecord()) {
753 753
             $this->setSetting($setting, $db->f('id'));
754 754
         }
@@ -826,9 +826,9 @@  discard block
 block discarded – undo
826 826
         }
827 827
         $db = new DB_Sql;
828 828
         $sql = "SELECT id FROM debtor
829
-            WHERE type= " . $type_key . "
830
-                AND intranet_id = " .$this->kernel->intranet->get('id') . "
831
-                AND (this_date BETWEEN '" . $date_start . "' AND '" .$date_end . "')
829
+            WHERE type= " . $type_key."
830
+                AND intranet_id = " .$this->kernel->intranet->get('id')."
831
+                AND (this_date BETWEEN '" . $date_start."' AND '".$date_end."')
832 832
                 AND voucher_id = 0
833 833
                 AND active = 1";
834 834
         $db->query($sql);
@@ -842,8 +842,8 @@  discard block
 block discarded – undo
842 842
     {
843 843
         $db = new DB_Sql;
844 844
         $sql = "SELECT id FROM invoice_payment
845
-            WHERE intranet_id = " .$this->kernel->intranet->get('id') . "
846
-                AND (payment_date BETWEEN '" . $date_start . "' AND '" .$date_end . "')
845
+            WHERE intranet_id = " .$this->kernel->intranet->get('id')."
846
+                AND (payment_date BETWEEN '" . $date_start."' AND '".$date_end."')
847 847
                 AND voucher_id = 0";
848 848
         $db->query($sql);
849 849
         if ($db->numRows() == 0) {
@@ -856,8 +856,8 @@  discard block
 block discarded – undo
856 856
     {
857 857
         $db = new DB_Sql;
858 858
         $sql = "SELECT id FROM procurement
859
-            WHERE intranet_id = " .$this->kernel->intranet->get('id') . "
860
-                AND (invoice_date BETWEEN '" . $date_start . "' AND '" .$date_end . "')
859
+            WHERE intranet_id = " .$this->kernel->intranet->get('id')."
860
+                AND (invoice_date BETWEEN '" . $date_start."' AND '".$date_end."')
861 861
                 AND voucher_id = 0
862 862
                 AND active = 1";
863 863
         $db->query($sql);
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
     function lock()
871 871
     {
872 872
         $db = new DB_Sql;
873
-        $db->query("UPDATE accounting_year SET locked = 1 WHERE id = " . $this->id);
873
+        $db->query("UPDATE accounting_year SET locked = 1 WHERE id = ".$this->id);
874 874
         return true;
875 875
     }
876 876
 
Please login to merge, or discard this patch.
src/Intraface/modules/administration/UserAdministration.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -8,6 +8,9 @@
 block discarded – undo
8 8
 
9 9
 class OnlinePaymentDefault extends OnlinePayment
10 10
 {
11
+    /**
12
+     * @param integer $id
13
+     */
11 14
     function __construct($kernel, $id) {
12 15
 
13 16
         parent::__construct($kernel, $id);
Please login to merge, or discard this patch.
src/Intraface/modules/cms/CKEditor.php 2 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -468,6 +468,7 @@
 block discarded – undo
468 468
 
469 469
     /**
470 470
      * Return path to ckeditor.js.
471
+     * @return string
471 472
      */
472 473
     private function ckeditorPath()
473 474
     {
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * When %CKEditor is created with the editor() method, a HTML &lt;textarea&gt; element is created,
74 74
      * it will be displayed to anyone with JavaScript disabled or with incompatible browser.
75 75
      */
76
-    public $textareaAttributes = array( "rows" => 8, "cols" => 60 );
76
+    public $textareaAttributes = array("rows" => 8, "cols" => 60);
77 77
     /**
78 78
      * A string indicating the creation date of %CKEditor.
79 79
      * Do not change it unless you want to force browsers to not use previously cached version of %CKEditor.
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $attr = "";
135 135
         foreach ($this->textareaAttributes as $key => $val) {
136
-            $attr.= " " . $key . '="' . str_replace('"', '&quot;', $val) . '"';
136
+            $attr .= " ".$key.'="'.str_replace('"', '&quot;', $val).'"';
137 137
         }
138
-        $out = "<textarea name=\"" . $name . "\"" . $attr . ">" . htmlspecialchars($value) . "</textarea>\n";
138
+        $out = "<textarea name=\"".$name."\"".$attr.">".htmlspecialchars($value)."</textarea>\n";
139 139
         if (!$this->initialized) {
140 140
             $out .= $this->init();
141 141
         }
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
             $classDetection = "";
235 235
             $js .= "CKEDITOR.replaceAll( function(textarea, config) {\n";
236 236
             if (!empty($className)) {
237
-                $js .= "    var classRegex = new RegExp('(?:^| )' + '". $className ."' + '(?:$| )');\n";
237
+                $js .= "    var classRegex = new RegExp('(?:^| )' + '".$className."' + '(?:$| )');\n";
238 238
                 $js .= "    if (!classRegex.test(textarea.className))\n";
239 239
                 $js .= "        return false;\n";
240 240
             }
241
-            $js .= "    CKEDITOR.tools.extend(config, ". $this->jsEncode($_config) .", true);";
241
+            $js .= "    CKEDITOR.tools.extend(config, ".$this->jsEncode($_config).", true);";
242 242
             $js .= "} );";
243 243
         }
244 244
 
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                     }
413 413
                     // Return only new events
414 414
                     if (!in_array($code, $returnedEvents[$eventName])) {
415
-                        $out .= ($code ? "\n" : "") . "CKEDITOR.on('". $eventName ."', $code);";
415
+                        $out .= ($code ? "\n" : "")."CKEDITOR.on('".$eventName."', $code);";
416 416
                         $returnedEvents[$eventName][] = $code;
417 417
                     }
418 418
                 }
@@ -443,19 +443,19 @@  discard block
 block discarded – undo
443 443
         $ckeditorPath = $this->ckeditorPath();
444 444
 
445 445
         if (!empty($this->timestamp) && $this->timestamp != "%"."TIMESTAMP%") {
446
-            $args = '?t=' . $this->timestamp;
446
+            $args = '?t='.$this->timestamp;
447 447
         }
448 448
 
449 449
         // Skip relative paths...
450 450
         if (strpos($ckeditorPath, '..') !== 0) {
451
-            $out .= $this->script("window.CKEDITOR_BASEPATH='". $ckeditorPath ."';");
451
+            $out .= $this->script("window.CKEDITOR_BASEPATH='".$ckeditorPath."';");
452 452
         }
453 453
 
454
-        $out .= "<script type=\"text/javascript\" src=\"" . $ckeditorPath . 'ckeditor.js' . $args . "\"></script>\n";
454
+        $out .= "<script type=\"text/javascript\" src=\"".$ckeditorPath.'ckeditor.js'.$args."\"></script>\n";
455 455
 
456 456
         $extraCode = "";
457 457
         if ($this->timestamp != self::timestamp) {
458
-            $extraCode .= ($extraCode ? "\n" : "") . "CKEDITOR.timestamp = '". $this->timestamp ."';";
458
+            $extraCode .= ($extraCode ? "\n" : "")."CKEDITOR.timestamp = '".$this->timestamp."';";
459 459
         }
460 460
         if ($extraCode) {
461 461
             $out .= $this->script($extraCode);
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
             /**
487 487
              * realpath — Returns canonicalized absolute pathname
488 488
              */
489
-            $realPath = realpath('./') ;
489
+            $realPath = realpath('./');
490 490
         }
491 491
 
492 492
         /**
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 
547 547
                 $val = str_replace($jsonReplaces[0], $jsonReplaces[1], $val);
548 548
 
549
-                return '"' . $val . '"';
549
+                return '"'.$val.'"';
550 550
             }
551 551
         }
552 552
         $isList = true;
@@ -561,12 +561,12 @@  discard block
 block discarded – undo
561 561
             foreach ($val as $v) {
562 562
                 $result[] = $this->jsEncode($v);
563 563
             }
564
-            return '[ ' . join(', ', $result) . ' ]';
564
+            return '[ '.join(', ', $result).' ]';
565 565
         } else {
566 566
             foreach ($val as $k => $v) {
567 567
                 $result[] = $this->jsEncode($k).': '.$this->jsEncode($v);
568 568
             }
569
-            return '{ ' . join(', ', $result) . ' }';
569
+            return '{ '.join(', ', $result).' }';
570 570
         }
571 571
     }
572 572
 }
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Controller/Templates.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -82,6 +82,9 @@
 block discarded – undo
82 82
         return $this->context->getKernel();
83 83
     }
84 84
 
85
+    /**
86
+     * @return integer
87
+     */
85 88
     function getShopId()
86 89
     {
87 90
         if ($this->query('shop_id')) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
 
20 20
     function getSiteId()
21 21
     {
22
-         return $this->context->name();
22
+            return $this->context->name();
23 23
     }
24 24
 
25 25
     function renderHtml()
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             'templates' => $templates
38 38
         );
39 39
 
40
-        $tpl = $this->template->create(dirname(__FILE__) . '/templates/templates');
40
+        $tpl = $this->template->create(dirname(__FILE__).'/templates/templates');
41 41
         return $tpl->render($this, $data);
42 42
     }
43 43
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
             'translation' => $this->getKernel()->getTranslation()
55 55
         );
56 56
 
57
-        $tpl = $this->template->create(dirname(__FILE__) . '/templates/template-edit');
57
+        $tpl = $this->template->create(dirname(__FILE__).'/templates/template-edit');
58 58
         return $tpl->render($this, $data);
59 59
     }
60 60
 
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Element.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
     /**
70 70
      * Creates a parameter
71 71
      *
72
-     * @return object
72
+     * @return CMS_Parameter
73 73
      */
74 74
     function createParameter()
75 75
     {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
      */
42 42
     function __construct($section, $id = 0)
43 43
     {
44
-        $this->value['identify_as'] = 'cms_element';  // bruges af parameter
44
+        $this->value['identify_as'] = 'cms_element'; // bruges af parameter
45 45
 
46
-        $this->id        = (int) $id;
46
+        $this->id        = (int)$id;
47 47
         $this->kernel    = $section->kernel;
48 48
         $this->section   = $section;
49 49
         $this->error     = new Intraface_Error;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     function getPosition(DB_Sql $db)
65 65
     {
66
-        return new Ilib_Position($db, "cms_element", $this->id, "section_id=".$this->section->get('id')." AND active = 1 AND intranet_id = " . $this->kernel->intranet->get('id'), "position", "id");
66
+        return new Ilib_Position($db, "cms_element", $this->id, "section_id=".$this->section->get('id')." AND active = 1 AND intranet_id = ".$this->kernel->intranet->get('id'), "position", "id");
67 67
     }
68 68
 
69 69
     /**
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         }
126 126
 
127 127
         $db = new DB_Sql;
128
-        $db->query("SELECT id, section_id, date_expire, date_publish, type_key, position FROM cms_element WHERE intranet_id = ".$this->section->kernel->intranet->get('id')." AND id = " . $this->id);
128
+        $db->query("SELECT id, section_id, date_expire, date_publish, type_key, position FROM cms_element WHERE intranet_id = ".$this->section->kernel->intranet->get('id')." AND id = ".$this->id);
129 129
         if (!$db->nextRecord()) {
130 130
             return 0;
131 131
         }
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         $this->value['extra_class'] = '';
148 148
 
149 149
         if ($this->get('elm_width')) {
150
-            $this->value['extra_style'] .= 'width: ' . $this->get('elm_width') . ';';
150
+            $this->value['extra_style'] .= 'width: '.$this->get('elm_width').';';
151 151
         }
152 152
 
153 153
         if ($this->get('elm_properties') == 'float') {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
             $this->value['extra_style'] .= ' clear: both;';
162 162
         }
163 163
         if ($this->get('elm_adjust')) {
164
-            $this->value['extra_class'] .= ' cms-align-' . $this->get('elm_adjust');
164
+            $this->value['extra_class'] .= ' cms-align-'.$this->get('elm_adjust');
165 165
         }
166 166
 
167 167
         if ($this->get('elm_box') == 'box') {
@@ -237,11 +237,11 @@  discard block
 block discarded – undo
237 237
             $sql_end = ", date_created = NOW()";
238 238
         } else {
239 239
             $sql_type = "UPDATE ";
240
-            $sql_end = " WHERE id = " . $this->id;
240
+            $sql_end = " WHERE id = ".$this->id;
241 241
         }
242
-        $sql = $sql_type . " cms_element SET
242
+        $sql = $sql_type." cms_element SET
243 243
                 intranet_id = ".$this->section->kernel->intranet->get('id').",
244
-                section_id=". (int)$this->section->get('id') . ",
244
+                section_id=". (int)$this->section->get('id').",
245 245
                 type_key = ".safeToDb($this->value['type_key']).",
246 246
                 date_changed = NOW(),
247 247
                 date_publish = ".$date_publish.",
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
             $this->id = $db->insertedId();
255 255
 
256 256
             $next_pos = $this->getPosition($db)->getMaxPosition() + 1;
257
-            $db->query("UPDATE cms_element SET position = " . $next_pos . " WHERE id = " . $this->id);
257
+            $db->query("UPDATE cms_element SET position = ".$next_pos." WHERE id = ".$this->id);
258 258
         }
259 259
 
260 260
         $this->load();
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     public function delete()
291 291
     {
292 292
         $db = new DB_Sql;
293
-        $db->query("UPDATE cms_element SET active = 0 WHERE id = " . $this->id);
293
+        $db->query("UPDATE cms_element SET active = 0 WHERE id = ".$this->id);
294 294
         return true;
295 295
     }
296 296
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     public function undelete()
303 303
     {
304 304
         $db = new DB_Sql;
305
-        $db->query("UPDATE cms_element SET active = 1 WHERE id = " . $this->id);
305
+        $db->query("UPDATE cms_element SET active = 1 WHERE id = ".$this->id);
306 306
         return true;
307 307
     }
308 308
 
Please login to merge, or discard this patch.
src/Intraface/modules/cms/element/Pagelist.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -5,6 +5,9 @@
 block discarded – undo
5 5
 class Intraface_modules_cms_element_Pagelist extends CMS_Element
6 6
 {
7 7
 
8
+    /**
9
+     * @param FakeCMSSection $section
10
+     */
8 11
     function __construct($section, $id = 0)
9 12
     {
10 13
         $this->value['type'] = 'pagelist';
Please login to merge, or discard this patch.