Completed
Pull Request — master (#26)
by Lars
10:03
created
src/Intraface/modules/invoice/Reminder.php 3 patches
Doc Comments   +13 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,6 +36,9 @@  discard block
 block discarded – undo
36 36
         return $this->dbquery;
37 37
     }
38 38
 
39
+    /**
40
+     * @param string $type
41
+     */
39 42
     function getItems($type = null)
40 43
     {
41 44
         $this->loadItem();
@@ -297,7 +300,8 @@  discard block
 block discarded – undo
297 300
     /**
298 301
      * Sets status for the reminder
299 302
      *
300
-     * @return true / false
303
+     * @param string $status
304
+     * @return boolean / false
301 305
      */
302 306
     function setStatus($status)
303 307
     {
@@ -356,7 +360,7 @@  discard block
 block discarded – undo
356 360
     /**
357 361
      * returns DebtorAccount object
358 362
      *
359
-     * @return object DebtorAccount
363
+     * @return DebtorAccount DebtorAccount
360 364
      */
361 365
     public function getDebtorAccount()
362 366
     {
@@ -575,6 +579,11 @@  discard block
 block discarded – undo
575 579
      * @param object year stating year
576 580
      * @param integer voucher_number
577 581
      * @param string voucher_date
582
+     * @param Year $year
583
+     * @param integer $voucher_number
584
+     * @param string $voucher_date
585
+     * @param integer $credit_account_number
586
+     * @param Stub_Translation $translation
578 587
      * @return boolean true or false
579 588
      */
580 589
     function state($year, $voucher_number, $voucher_date, $credit_account_number, $translation)
@@ -687,7 +696,7 @@  discard block
 block discarded – undo
687 696
     /**
688 697
      * returns possible status types
689 698
      *
690
-     * @return array possible status types
699
+     * @return string[] possible status types
691 700
      */
692 701
     private static function getStatusTypes()
693 702
     {
@@ -702,7 +711,7 @@  discard block
 block discarded – undo
702 711
     /**
703 712
      * returns possible payment methods
704 713
      *
705
-     * @return array possible payment methods
714
+     * @return string[] possible payment methods
706 715
      */
707 716
     private static function getPaymentMethods()
708 717
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -722,9 +722,9 @@
 block discarded – undo
722 722
     function getPaymentInformation()
723 723
     {
724 724
         $info = array('bank_name'    => $this->kernel->setting->get("intranet", "bank_name"),
725
-                      'bank_reg_number' => $this->kernel->setting->get("intranet", "bank_reg_number"),
726
-                      'bank_account_number' => $this->kernel->setting->get("intranet", "bank_account_number"),
727
-                      'giro_account_number' => $this->kernel->setting->get("intranet", "giro_account_number")
725
+                        'bank_reg_number' => $this->kernel->setting->get("intranet", "bank_reg_number"),
726
+                        'bank_account_number' => $this->kernel->setting->get("intranet", "bank_account_number"),
727
+                        'giro_account_number' => $this->kernel->setting->get("intranet", "giro_account_number")
728 728
         );
729 729
 
730 730
         return $info;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     function isNumberFree($number)
128 128
     {
129
-        $sql = "SELECT id FROM invoice_reminder WHERE number = ".intval($number)." AND id != ".$this->id . " AND intranet_id = " . $this->kernel->intranet->get('id');
129
+        $sql = "SELECT id FROM invoice_reminder WHERE number = ".intval($number)." AND id != ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id');
130 130
         $this->db->query($sql);
131 131
         if ($this->db->nextRecord()) {
132 132
             return false;
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         }
340 340
 
341 341
         $db = new Db_Sql;
342
-        $db->query("UPDATE invoice_reminder SET status = ".$status_id.", ".$sql."  WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id'));
342
+        $db->query("UPDATE invoice_reminder SET status = ".$status_id.", ".$sql."  WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'));
343 343
         $this->load();
344 344
         return true;
345 345
     }
@@ -477,14 +477,14 @@  discard block
 block discarded – undo
477 477
         }
478 478
         $db = new DB_Sql;
479 479
         $db->query("SELECT id
480
-            FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get("id")." AND active = 1 AND contact_id=" . $contact_id);
480
+            FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get("id")." AND active = 1 AND contact_id=".$contact_id);
481 481
         return $db->numRows();
482 482
     }
483 483
 
484 484
     function isFilledIn()
485 485
     {
486 486
         $db = new DB_Sql;
487
-        $db->query("SELECT id FROM invoice_reminder WHERE intranet_id = " . $this->kernel->intranet->get('id'));
487
+        $db->query("SELECT id FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get('id'));
488 488
         return $db->numRows();
489 489
     }
490 490
 
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
     {
501 501
         // FIXME - check on date
502 502
         $db = new DB_Sql;
503
-        $db->query("UPDATE invoice_reminder SET date_stated = '" . $voucher_date . "', voucher_id = '".$voucher_id."' WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id'));
503
+        $db->query("UPDATE invoice_reminder SET date_stated = '".$voucher_date."', voucher_id = '".$voucher_id."' WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'));
504 504
         return true;
505 505
     }
506 506
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 
648 648
         require_once 'Intraface/modules/accounting/VoucherFile.php';
649 649
         $voucher_file = new VoucherFile($voucher);
650
-        if (!$voucher_file->save(array('description' => $text, 'belong_to'=>'reminder','belong_to_id'=>$this->get('id')))) {
650
+        if (!$voucher_file->save(array('description' => $text, 'belong_to'=>'reminder', 'belong_to_id'=>$this->get('id')))) {
651 651
             $this->error->merge($voucher_file->error->getMessage());
652 652
             $this->error->set('Filen blev ikke overflyttet');
653 653
         }
Please login to merge, or discard this patch.
src/Intraface/modules/newsletter/NewsletterSubscriber.php 2 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     /**
177 177
      * Adds an existing contact
178 178
      *
179
-     * @param integer $contact_id Contact id
179
+     * @param integer $contact Contact id
180 180
      *
181 181
      * @return integer of the id of the subscriber
182 182
      */
@@ -489,6 +489,9 @@  discard block
 block discarded – undo
489 489
         }
490 490
     }
491 491
 
492
+    /**
493
+     * @param Contact $contact
494
+     */
492 495
     private function getLoginUrl($contact)
493 496
     {
494 497
         if (!$link = $this->list->get('optin_link')) {
@@ -548,7 +551,7 @@  discard block
 block discarded – undo
548 551
     }
549 552
 
550 553
     /**
551
-     * @param object $observer Must implement an update() method
554
+     * @param FakeObserver $observer Must implement an update() method
552 555
      */
553 556
     public function addObserver($observer)
554 557
     {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
             return $this->dbquery;
53 53
         }
54 54
         // optin = 1 should not be set here
55
-        $this->dbquery = new Intraface_DBQuery($this->list->kernel, "newsletter_subscriber", "newsletter_subscriber.list_id=". $this->list->get("id") . " AND newsletter_subscriber.intranet_id = " . $this->list->kernel->intranet->get('id'));
55
+        $this->dbquery = new Intraface_DBQuery($this->list->kernel, "newsletter_subscriber", "newsletter_subscriber.list_id=".$this->list->get("id")." AND newsletter_subscriber.intranet_id = ".$this->list->kernel->intranet->get('id'));
56 56
         $this->dbquery->setJoin("LEFT", "contact", "newsletter_subscriber.contact_id = contact.id AND contact.intranet_id = ".$this->list->kernel->intranet->get("id"), '');
57 57
         $this->dbquery->setJoin("LEFT", "address", "address.belong_to_id = contact.id AND address.active = 1 AND address.type = 3", '');
58 58
         $this->dbquery->useErrorObject($this->error);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     private function load()
136 136
     {
137 137
         $db = new DB_Sql;
138
-        $db->query("SELECT * FROM newsletter_subscriber WHERE id = " . $this->id." and active = 1");
138
+        $db->query("SELECT * FROM newsletter_subscriber WHERE id = ".$this->id." and active = 1");
139 139
         if (!$db->nextRecord()) {
140 140
             $this->id = 0;
141 141
             $this->value['id'] = 0;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
     public function delete()
159 159
     {
160 160
         $db = new DB_Sql;
161
-        $db->query('UPDATE newsletter_subscriber SET active = 0 WHERE id = ' . $this->id);
161
+        $db->query('UPDATE newsletter_subscriber SET active = 0 WHERE id = '.$this->id);
162 162
         return true;
163 163
     }
164 164
 
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
     {
185 185
         $db = new DB_sql;
186 186
 
187
-        $db->query("SELECT id FROM newsletter_subscriber WHERE contact_id = '".$contact->getId()."' AND list_id = " . $this->list->get("id") . " AND intranet_id = ".$this->list->kernel->intranet->get('id')." AND active = 1");
187
+        $db->query("SELECT id FROM newsletter_subscriber WHERE contact_id = '".$contact->getId()."' AND list_id = ".$this->list->get("id")." AND intranet_id = ".$this->list->kernel->intranet->get('id')." AND active = 1");
188 188
         if ($db->nextRecord()) {
189 189
             return $db->f('id');
190 190
         }
@@ -192,10 +192,10 @@  discard block
 block discarded – undo
192 192
         // Spørgsmålet er om vedkommende bør få en e-mail, hvor man kan acceptere?
193 193
         $db->query("INSERT INTO newsletter_subscriber SET
194 194
                     contact_id = '".$contact->getId()."',
195
-                    list_id = " . $this->list->get("id") . ",
195
+                    list_id = " . $this->list->get("id").",
196 196
                     date_submitted=NOW(),
197 197
                     optin = 1,
198
-                    code = '".md5($this->list->get("id") . $this->list->kernel->intranet->get('id') . date('Y-m-d H:i:s') . $contact->getId())."',
198
+                    code = '".md5($this->list->get("id").$this->list->kernel->intranet->get('id').date('Y-m-d H:i:s').$contact->getId())."',
199 199
                     intranet_id = ".$this->list->kernel->intranet->get('id'));
200 200
 
201 201
         return $db->insertedId();
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
         $input = array_map('strip_tags', $input);
215 215
 
216 216
         $validator = new Intraface_Validator($this->error);
217
-        $validator->isEmail($input['email'], $input['email'] . ' er ikke en gyldig e-mail');
217
+        $validator->isEmail($input['email'], $input['email'].' er ikke en gyldig e-mail');
218 218
 
219 219
         if (empty($input['name'])) {
220 220
             $input['name'] = $input['email'];
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
                     date_submitted = NOW(),
283 283
                     ip_submitted = '".$input['ip']."'
284 284
                 WHERE id = ".$this->id."
285
-                    AND list_id = " . $this->list->get("id") . "
285
+                    AND list_id = " . $this->list->get("id")."
286 286
                     AND intranet_id = " . $this->list->kernel->intranet->get('id'));
287 287
             //code =  '" . md5($input['email'] . date('Y-m-d H:i:s') . $input['ip'])."'
288 288
         } else {
@@ -305,10 +305,10 @@  discard block
 block discarded – undo
305 305
                     contact_id = '".$contact->get('id')."',
306 306
                     email = '".$input['email']."',
307 307
                     name='".$input['name']."',
308
-                    list_id = " . $this->list->get("id") . ",
308
+                    list_id = " . $this->list->get("id").",
309 309
                     ip_submitted='".$input['ip']."',
310 310
                     date_submitted=NOW(),
311
-                    code= '" . md5($input['email'] . date('Y-m-d H:i:s') . $input['ip'])."',
311
+                    code= '" . md5($input['email'].date('Y-m-d H:i:s').$input['ip'])."',
312 312
                     intranet_id = ".$this->list->kernel->intranet->get('id'));
313 313
         }
314 314
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             return false;
343 343
         }
344 344
         $db = new DB_Sql;
345
-        $db->query("SELECT * FROM newsletter_subscriber WHERE id = " . $this->id." and active = 1");
345
+        $db->query("SELECT * FROM newsletter_subscriber WHERE id = ".$this->id." and active = 1");
346 346
         if (!$db->nextRecord()) {
347 347
             return false;
348 348
         }
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
         $this->load();
381 381
 
382 382
         $db = new DB_Sql;
383
-        $db->query("UPDATE newsletter_subscriber SET active = 0, date_unsubscribe = '".date('Y-m-d H:i:s')."' WHERE id=".$this->id." AND list_id = " . $this->list->get("id") . " AND intranet_id = " . $this->list->kernel->intranet->get('id'));
383
+        $db->query("UPDATE newsletter_subscriber SET active = 0, date_unsubscribe = '".date('Y-m-d H:i:s')."' WHERE id=".$this->id." AND list_id = ".$this->list->get("id")." AND intranet_id = ".$this->list->kernel->intranet->get('id'));
384 384
         return true;
385 385
     }
386 386
 
@@ -398,16 +398,16 @@  discard block
 block discarded – undo
398 398
         // optin really wants to optin, so we will not make that a part of the select query
399 399
         // and we will set it in the update query
400 400
         $db = new DB_Sql;
401
-        $db->query("SELECT id, ip_submitted FROM newsletter_subscriber WHERE code = '".$code."' AND list_id = " . $this->list->get('id'));
401
+        $db->query("SELECT id, ip_submitted FROM newsletter_subscriber WHERE code = '".$code."' AND list_id = ".$this->list->get('id'));
402 402
         if (!$db->nextRecord()) {
403 403
             return false;
404 404
         }
405 405
 
406
-        $db->query("UPDATE newsletter_subscriber SET optin = 1, ip_optin = '".$ip."', date_optin = NOW(), active = 1 WHERE code = '" . $code . "' AND list_id = " . $this->list->get('id'));
406
+        $db->query("UPDATE newsletter_subscriber SET optin = 1, ip_optin = '".$ip."', date_optin = NOW(), active = 1 WHERE code = '".$code."' AND list_id = ".$this->list->get('id'));
407 407
 
408 408
         // makes sure that the submitted ip is also set - not really a part of this method.
409 409
         if ($db->f('ip_submitted')) {
410
-            $db->query("UPDATE newsletter_subscriber SET ip_submitted = '".$ip."' WHERE id = " . $db->f("id"));
410
+            $db->query("UPDATE newsletter_subscriber SET ip_submitted = '".$ip."' WHERE id = ".$db->f("id"));
411 411
         }
412 412
         return true;
413 413
     }
@@ -452,8 +452,8 @@  discard block
 block discarded – undo
452 452
         $data = array(
453 453
                 'subject' => $subscribe_subject,
454 454
                 'body' =>
455
-                    $this->list->get('subscribe_message') . "\n\n" .
456
-                    $this->getLoginUrl($contact) .
455
+                    $this->list->get('subscribe_message')."\n\n".
456
+                    $this->getLoginUrl($contact).
457 457
                     "\n\n".$this->list->get('sender_name'),
458 458
                 'contact_id' => $this->get('contact_id'),
459 459
                 'from_email' => $this->list->get('reply_email'),
@@ -463,16 +463,16 @@  discard block
 block discarded – undo
463 463
             );
464 464
 
465 465
         if (!$email->save($data)) {
466
-            $this->error->set('could not send the e-mail' . implode(',', $email->error->messages));
466
+            $this->error->set('could not send the e-mail'.implode(',', $email->error->messages));
467 467
             return false;
468 468
         }
469 469
 
470 470
         if ($email->queue()) {
471 471
             $db = new DB_Sql;
472
-            $db->query("UPDATE newsletter_subscriber SET date_optin_email_sent = NOW() WHERE id = " . $this->id);
472
+            $db->query("UPDATE newsletter_subscriber SET date_optin_email_sent = NOW() WHERE id = ".$this->id);
473 473
             return true;
474 474
         }
475
-        $this->error->set('could not send the e-mail' . implode(',', $email->error->message));
475
+        $this->error->set('could not send the e-mail'.implode(',', $email->error->message));
476 476
         return false;
477 477
     }
478 478
 
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
     {
485 485
         if ($this->sendOptInEmail()) {
486 486
             $db = new DB_Sql;
487
-            $db->query("UPDATE newsletter_subscriber SET resend_optin_email_count = resend_optin_email_count + 1 WHERE id = " . $this->id);
487
+            $db->query("UPDATE newsletter_subscriber SET resend_optin_email_count = resend_optin_email_count + 1 WHERE id = ".$this->id);
488 488
             return true;
489 489
         }
490 490
     }
@@ -492,9 +492,9 @@  discard block
 block discarded – undo
492 492
     private function getLoginUrl($contact)
493 493
     {
494 494
         if (!$link = $this->list->get('optin_link')) {
495
-            return $contact->getLoginUrl() . '&optin=' . $this->get('code');
495
+            return $contact->getLoginUrl().'&optin='.$this->get('code');
496 496
         }
497
-        return $link . '?optin=' . $this->get('code');
497
+        return $link.'?optin='.$this->get('code');
498 498
     }
499 499
 
500 500
     /**
Please login to merge, or discard this patch.
src/Intraface/modules/onlinepayment/OnlinePayment.php 3 patches
Doc Comments   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -298,6 +298,10 @@  discard block
 block discarded – undo
298 298
         return $this->id;
299 299
     }
300 300
 
301
+    /**
302
+     * @param string $belong_to
303
+     * @param integer $belong_to_id
304
+     */
301 305
     function changeBelongTo($belong_to, $belong_to_id)
302 306
     {
303 307
         if ($this->id == 0) {
@@ -321,6 +325,9 @@  discard block
 block discarded – undo
321 325
 
322 326
     }
323 327
 
328
+    /**
329
+     * @param string $status
330
+     */
324 331
     function setStatus($status)
325 332
     {
326 333
         if ($this->id == 0) {
@@ -582,7 +589,7 @@  discard block
 block discarded – undo
582 589
     /**
583 590
      * returns the possible status types
584 591
      *
585
-     * @return array with status types
592
+     * @return string[] with status types
586 593
      */
587 594
     static function getStatusTypes()
588 595
     {
@@ -598,7 +605,7 @@  discard block
 block discarded – undo
598 605
     /**
599 606
      * returns possible belong to types
600 607
      *
601
-     * @return array with belong to types
608
+     * @return string[] with belong to types
602 609
      */
603 610
     private function getBelongToTypes()
604 611
     {
@@ -611,7 +618,7 @@  discard block
 block discarded – undo
611 618
     /**
612 619
      * returns the implemented providers
613 620
      *
614
-     * @return array with providers
621
+     * @return string[] with providers
615 622
      */
616 623
     static function getImplementedProviders()
617 624
     {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      * @param array $input (belong_to, belong_to_id, transaction_number, transaction_status, amount)
134 134
      *
135 135
      * @return integer
136
-      */
136
+     */
137 137
     public function save($input)
138 138
     {
139 139
         $input = safeToDb($input);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         }
164 164
 
165 165
         if ($input['transaction_status'] == $this->transaction_status_authorized) {
166
-             $status_key = 2;
166
+                $status_key = 2;
167 167
         } else {
168 168
             $status_key = 1;
169 169
         }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -664,7 +664,7 @@
 block discarded – undo
664 664
 
665 665
     function getStatus()
666 666
     {
667
-        $status =  $this->getStatusTypes();
667
+        $status = $this->getStatusTypes();
668 668
         return $status[$this->value['status_key']];
669 669
     }
670 670
 }
Please login to merge, or discard this patch.
src/Intraface/modules/procurement/ProcurementItem.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,6 +58,8 @@  discard block
 block discarded – undo
58 58
      *
59 59
      * @param object Procurement
60 60
      * @param integer item id
61
+     * @param Procurement $procurement
62
+     * @param integer $id
61 63
      * @return void
62 64
      */
63 65
     public function __construct($procurement, $id)
@@ -201,7 +203,7 @@  discard block
 block discarded – undo
201 203
     /**
202 204
      * Gets the tax percent on the individual product
203 205
      *
204
-     * @return float
206
+     * @return integer
205 207
      */
206 208
     public function getProductTaxPercent()
207 209
     {
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
             $product = new Product($this->procurement->kernel, $input["product_id"], $input['product_detail_id']);
235 235
 
236 236
             if (!is_object($product) || $product->get('id') == 0) {
237
-                 $this->error->set("Ugyldigt produkt");
237
+                    $this->error->set("Ugyldigt produkt");
238 238
             } else {
239 239
                 $product_detail_id = $product->get("detail_id");
240 240
             }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
         $product = new Product($this->procurement->kernel, $product_id);
348 348
 
349 349
         if (!is_object($product) || $product->get('id') == 0) {
350
-             throw new Excetion('Invalid product id');
350
+                throw new Excetion('Invalid product id');
351 351
         } else {
352 352
             $product_detail_id = $product->get("detail_id");
353 353
         }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $this->procurement = $procurement;
66 66
         $this->error = new Intraface_Error;
67
-        $this->id = (int) $id;
67
+        $this->id = (int)$id;
68 68
 
69 69
         if ($this->id > 0) {
70 70
             $this->load();
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 
87 87
         $db->query("SELECT procurement_item.* FROM procurement_item
88 88
                     INNER JOIN procurement ON procurement_item.procurement_id = procurement.id
89
-                    WHERE procurement_item.id = " . $this->id . " AND procurement.id = " . $this->procurement->get('id') . " AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id"));
89
+                    WHERE procurement_item.id = " . $this->id." AND procurement.id = ".$this->procurement->get('id')." AND procurement_item.intranet_id = ".$this->procurement->kernel->intranet->get("id"));
90 90
         if ($db->nextRecord()) {
91 91
             $this->value["id"] = $db->f("id");
92 92
             $this->value["product_id"] = $db->f("product_id");
@@ -282,20 +282,20 @@  discard block
 block discarded – undo
282 282
             exit;
283 283
         }
284 284
 
285
-        $sql = "product_id = " . $product->getId() . ",
286
-                product_detail_id = " . $product_detail_id . ",
287
-                product_variation_id = " . $variation_id . ",
288
-                product_variation_detail_id = " . $variation_detail_id . ",
289
-                quantity = " . $input["quantity"] . ",
285
+        $sql = "product_id = ".$product->getId().",
286
+                product_detail_id = " . $product_detail_id.",
287
+                product_variation_id = " . $variation_id.",
288
+                product_variation_detail_id = " . $variation_detail_id.",
289
+                quantity = " . $input["quantity"].",
290 290
                 unit_purchase_price = " . $input["unit_purchase_price"];
291 291
 
292 292
         $db = new DB_Sql;
293 293
 
294 294
         if ($this->id == 0) {
295
-            $db->query("INSERT INTO procurement_item SET " . $sql . ", intranet_id = " . $this->procurement->kernel->intranet->get("id") . ", procurement_id = " . $this->procurement->get("id") . ", active = 1");
295
+            $db->query("INSERT INTO procurement_item SET ".$sql.", intranet_id = ".$this->procurement->kernel->intranet->get("id").", procurement_id = ".$this->procurement->get("id").", active = 1");
296 296
             $this->id = $db->InsertedId();
297 297
         } else {
298
-            $db->query("UPDATE procurement_item SET " . $sql . " WHERE id = " . $this->id . " AND procurement_id = " . $this->procurement->get("id") . " AND intranet_id = " . $this->procurement->kernel->intranet->get("id"));
298
+            $db->query("UPDATE procurement_item SET ".$sql." WHERE id = ".$this->id." AND procurement_id = ".$this->procurement->get("id")." AND intranet_id = ".$this->procurement->kernel->intranet->get("id"));
299 299
         }
300 300
 
301 301
         return $this->id;
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
             return false;
324 324
         }
325 325
 
326
-        $sql = "unit_purchase_price = " . $unit_purchase_price->get();
326
+        $sql = "unit_purchase_price = ".$unit_purchase_price->get();
327 327
 
328 328
         $db = new DB_Sql;
329
-        $db->query("UPDATE procurement_item SET " . $sql . " WHERE id = " . $this->id . " AND procurement_id = " . $this->procurement->get("id") . " AND intranet_id = " . $this->procurement->kernel->intranet->get("id"));
329
+        $db->query("UPDATE procurement_item SET ".$sql." WHERE id = ".$this->id." AND procurement_id = ".$this->procurement->get("id")." AND intranet_id = ".$this->procurement->kernel->intranet->get("id"));
330 330
         return true;
331 331
     }
332 332
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
             product_variation_detail_id = ".$variation_detail_id;
377 377
 
378 378
         $db = new DB_Sql;
379
-        $db->query("UPDATE procurement_item SET " . $sql . " WHERE id = " . $this->id . " AND procurement_id = " . $this->procurement->get("id") . " AND intranet_id = " . $this->procurement->kernel->intranet->get("id"));
379
+        $db->query("UPDATE procurement_item SET ".$sql." WHERE id = ".$this->id." AND procurement_id = ".$this->procurement->get("id")." AND intranet_id = ".$this->procurement->kernel->intranet->get("id"));
380 380
 
381 381
         return true;
382 382
     }
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
     public function delete()
389 389
     {
390 390
         $db = new DB_Sql;
391
-        $db->query("UPDATE procurement_item SET active = 0 WHERE intranet_id = " . $this->procurement->kernel->intranet->get('id') . " AND id = " . $this->id . " AND procurement_id = " . $this->procurement->get("id"));
391
+        $db->query("UPDATE procurement_item SET active = 0 WHERE intranet_id = ".$this->procurement->kernel->intranet->get('id')." AND id = ".$this->id." AND procurement_id = ".$this->procurement->get("id"));
392 392
         $this->id = 0;
393 393
 
394 394
         return 1;
@@ -402,13 +402,13 @@  discard block
 block discarded – undo
402 402
     public function getList()
403 403
     {
404 404
         $db = new DB_Sql;
405
-        $db->query("SELECT * FROM procurement_item WHERE active = 1 AND intranet_id = " . $this->procurement->kernel->intranet->get("id") . " AND procurement_id = " . $this->procurement->get("id") . " ORDER BY id ASC");
405
+        $db->query("SELECT * FROM procurement_item WHERE active = 1 AND intranet_id = ".$this->procurement->kernel->intranet->get("id")." AND procurement_id = ".$this->procurement->get("id")." ORDER BY id ASC");
406 406
         $i = 0;
407
-        $item = array ();
407
+        $item = array();
408 408
 
409 409
         if ($this->procurement->get("price_items") > 0) {
410 410
             // calculates shipment etc per item price kr
411
-            $calculated = $this->procurement->get("price_shipment_etc") / $this->procurement->get("price_items");
411
+            $calculated = $this->procurement->get("price_shipment_etc")/$this->procurement->get("price_items");
412 412
         } else {
413 413
             $calculated = 0;
414 414
         }
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
                 $item[$i]["unit"] = $unit['plural'];
425 425
             }
426 426
             $item[$i]["unit_purchase_price"] = $db->f("unit_purchase_price");
427
-            $item[$i]["calculated_unit_price"] = $db->f("unit_purchase_price") + $db->f("unit_purchase_price") * $calculated;
427
+            $item[$i]["calculated_unit_price"] = $db->f("unit_purchase_price") + $db->f("unit_purchase_price")*$calculated;
428 428
             $item[$i]["quantity"] = $db->f("quantity");
429 429
             $item[$i]["vat"] = $product->get("vat");
430 430
             $item[$i]["product_id"] = $product->get("id");
431
-            $item[$i]["amount"] = $db->f("quantity") * $db->f("unit_purchase_price");
431
+            $item[$i]["amount"] = $db->f("quantity")*$db->f("unit_purchase_price");
432 432
 
433 433
             if ($product->get('has_variation')) {
434 434
                 $variation = $product->getVariation($db->f('product_variation_id'));
435 435
                 $detail = $variation->getDetail($db->f('product_variation_detail_id'));
436 436
                 $item[$i]["name"] = $product->get("name").' - '.$variation->getName();
437
-                $item[$i]["number"]= $product->get("number").'.'.$variation->getNumber();
437
+                $item[$i]["number"] = $product->get("number").'.'.$variation->getNumber();
438 438
                 $item[$i]["price"] = $detail->getPrice($product);
439 439
             } else {
440 440
                 $item[$i]["name"] = $product->get("name");
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
      */
452 452
     public function getQuantity($status, $product_id, $product_variation_id, $from_date = "")
453 453
     {
454
-        if (!in_array($status, array (
454
+        if (!in_array($status, array(
455 455
                 'ordered',
456 456
                 'delivered'
457 457
             ))) {
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
                         FROM procurement_item INNER JOIN procurement
466 466
                             ON procurement_item.procurement_id = procurement.id
467 467
                         WHERE procurement_item.active = 1 AND procurement.active = 1
468
-                            AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id") . " AND procurement.intranet_id = " . $this->procurement->kernel->intranet->get("id") . "
469
-                            AND procurement_item.product_id = " . $product_id . " AND procurement.status_key = 0
468
+                            AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id")." AND procurement.intranet_id = ".$this->procurement->kernel->intranet->get("id")."
469
+                            AND procurement_item.product_id = " . $product_id." AND procurement.status_key = 0
470 470
                             AND procurement_item.product_variation_id = ".$product_variation_id);
471 471
             $db->nextRecord(); // a post will always be present
472 472
             return intval($db->f("on_order"));
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
                         FROM procurement_item INNER JOIN procurement
477 477
                             ON procurement_item.procurement_id = procurement.id
478 478
                         WHERE procurement_item.active = 1 AND procurement.active = 1
479
-                            AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id") . " AND procurement.intranet_id = " . $this->procurement->kernel->intranet->get("id") . "
480
-                            AND procurement_item.product_id = " . $product_id . "
479
+                            AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id")." AND procurement.intranet_id = ".$this->procurement->kernel->intranet->get("id")."
480
+                            AND procurement_item.product_id = " . $product_id."
481 481
                             AND procurement_item.product_variation_id = ".$product_variation_id."
482 482
                             AND procurement.status_key = 1
483
-                            AND procurement.date_recieved > \"" . $from_date . "\"");
483
+                            AND procurement.date_recieved > \"" . $from_date."\"");
484 484
             $db->nextRecord(); // a post will always be present
485 485
             return intval($db->f("stock_in"));
486 486
         }
Please login to merge, or discard this patch.
src/Intraface/modules/product/Variation/Detail.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      *
76 76
      * @param object Product
77 77
      *
78
-     * @return object Ilib_Variable_Float with price
78
+     * @return Ilib_Variable_Float Ilib_Variable_Float with price
79 79
      */
80 80
     public function getPrice($product)
81 81
     {
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
      * @todo Product should not be given as parameter, but defined as relation. Product needs to be made in doctrine
93 93
      *
94 94
      * @param object $currency Intraface_modules_currency_Currency
95
-     * @param integer $exchange_rage_id
95
+     * @param integer $exchange_rate_id
96 96
      * @param object $product Product
97 97
      *
98
-     * @return obejct Ilib_Variable_Float with price of the variation in given currency
98
+     * @return Ilib_Variable_Float Ilib_Variable_Float with price of the variation in given currency
99 99
      */
100 100
     public function getPriceInCurrency($currency, $exchange_rate_id = 0, $product)
101 101
     {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
      *
110 110
      * @param object $product Product
111 111
      *
112
-     * @return object Ilib_Variable_Float with price including vat
112
+     * @return Ilib_Variable_Float Ilib_Variable_Float with price including vat
113 113
      */
114 114
     public function getPriceIncludingVat($product)
115 115
     {
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
      * @param integer $exchange_rate_id
130 130
      * @param object product Product
131 131
      *
132
-     * @return object Ilib_Variable_Float with price including vat in given currency
132
+     * @return Ilib_Variable_Float Ilib_Variable_Float with price including vat in given currency
133 133
      */
134 134
     public function getPriceIncludingVatInCurrency($currency, $exchange_rate_id, $product)
135 135
     {
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
      *
144 144
      * @param object Product
145 145
      *
146
-     * @return object Ilib_Variable_Float with price
146
+     * @return Ilib_Variable_Float Ilib_Variable_Float with price
147 147
      */
148 148
     public function getWeight($product)
149 149
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
      */
100 100
     public function getPriceInCurrency($currency, $exchange_rate_id = 0, $product)
101 101
     {
102
-        return new Ilib_Variable_Float(round($this->getPrice($product)->getAsIso() / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100), 2));
102
+        return new Ilib_Variable_Float(round($this->getPrice($product)->getAsIso()/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100), 2));
103 103
     }
104 104
 
105 105
     /**
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
     public function getPriceIncludingVat($product)
115 115
     {
116 116
         if (get_class($product) == 'Intraface_modules_product_ProductDoctrine') {
117
-            return new Ilib_Variable_Float($this->getPrice($product)->getAsIso(2) * (1 + $product->getDetails()->getVatPercent()->getAsIso()/100));
117
+            return new Ilib_Variable_Float($this->getPrice($product)->getAsIso(2)*(1 + $product->getDetails()->getVatPercent()->getAsIso()/100));
118 118
         } else {
119
-            return new Ilib_Variable_Float($this->getPrice($product)->getAsIso(2) * (1 + $product->get('vat_percent')/100));
119
+            return new Ilib_Variable_Float($this->getPrice($product)->getAsIso(2)*(1 + $product->get('vat_percent')/100));
120 120
         }
121 121
     }
122 122
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
      */
134 134
     public function getPriceIncludingVatInCurrency($currency, $exchange_rate_id, $product)
135 135
     {
136
-        return new Ilib_Variable_Float($this->getPriceIncludingVat($product)->getAsIso() / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100));
136
+        return new Ilib_Variable_Float($this->getPriceIncludingVat($product)->getAsIso()/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100));
137 137
     }
138 138
 
139 139
     /**
Please login to merge, or discard this patch.
src/Intraface/modules/shop/Basket.php 2 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      *
55 55
      * @param object $db         The webshop object
56 56
      * @param object $intranet   The webshop object
57
-     * @param object $webshop    The webshop object
57
+     * @param object $shop    The webshop object
58 58
      * @param string $session_id A session id
59 59
      *
60 60
      * @return void
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
      * @param integer $product_id Product to remove
105 105
      * @param integer $quantity   How many should be removed
106 106
      *
107
-     * @return boelean
107
+     * @return boolean
108 108
      */
109 109
     public function remove($product_id, $product_variation_id = 0, $quantity = 1)
110 110
     {
@@ -122,6 +122,7 @@  discard block
 block discarded – undo
122 122
      * @param integer $quantity         The quantity
123 123
      * @param string  $text             To add description to product, not yet implemented
124 124
      * @param integer $basketevaluation Wheter the product is from basketevaluation
125
+     * @param integer $product_variation_id
125 126
      *
126 127
      * @return boolean
127 128
      */
@@ -530,7 +531,7 @@  discard block
 block discarded – undo
530 531
     /**
531 532
      * Gets the total weight of the basket
532 533
      *
533
-     * @return float
534
+     * @return integer
534 535
      */
535 536
     public function getTotalWeight()
536 537
     {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -69,16 +69,16 @@  discard block
 block discarded – undo
69 69
         $this->resetItemCache();
70 70
 
71 71
         $this->conditions = array(
72
-            'session_id = ' . $this->db->quote($this->session_id, 'text'),
73
-            'shop_id = ' . $this->db->quote($this->webshop->getId(), 'integer'),
74
-            'intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer'));
72
+            'session_id = '.$this->db->quote($this->session_id, 'text'),
73
+            'shop_id = '.$this->db->quote($this->webshop->getId(), 'integer'),
74
+            'intranet_id = '.$this->db->quote($this->intranet->getId(), 'integer'));
75 75
 
76 76
         $this->cleanUp();
77 77
     }
78 78
 
79 79
     private function cleanUp()
80 80
     {
81
-        return $this->db->query("DELETE FROM basket WHERE DATE_ADD(date_changed, INTERVAL " . $this->db->quote(self::CLEAN_UP_AFTER, 'integer') . " HOUR) < NOW()");
81
+        return $this->db->query("DELETE FROM basket WHERE DATE_ADD(date_changed, INTERVAL ".$this->db->quote(self::CLEAN_UP_AFTER, 'integer')." HOUR) < NOW()");
82 82
     }
83 83
 
84 84
     /**
@@ -165,23 +165,23 @@  discard block
 block discarded – undo
165 165
                 FROM basket
166 166
                 WHERE product_id = ".$product_id."
167 167
                     AND product_variation_id = ".$product_variation_id."
168
-                    AND product_detail_id = " . $product_detail_id . "
169
-                    AND basketevaluation_product = " . $basketevaluation . "
168
+                    AND product_detail_id = " . $product_detail_id."
169
+                    AND basketevaluation_product = " . $basketevaluation."
170 170
                     AND " . $sql_extra);
171 171
 
172 172
         if ($db->nextRecord()) {
173 173
             if ($quantity == 0) {
174 174
                 $db->query("DELETE FROM basket
175
-                    WHERE id = ".$db->f('id') . "
176
-                        AND basketevaluation_product = " . $basketevaluation . "
175
+                    WHERE id = ".$db->f('id')."
176
+                        AND basketevaluation_product = " . $basketevaluation."
177 177
                         AND " . $sql_extra);
178 178
             } else {
179 179
                 $db->query("UPDATE basket SET
180 180
                     quantity = $quantity,
181 181
                     date_changed = NOW(),
182 182
                     text = '".$text."'
183
-                    WHERE id = ".$db->f('id') . "
184
-                        AND basketevaluation_product = " . $basketevaluation . "
183
+                    WHERE id = ".$db->f('id')."
184
+                        AND basketevaluation_product = " . $basketevaluation."
185 185
                         AND " . $sql_extra);
186 186
             }
187 187
             return true;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
                         quantity = $quantity,
193 193
                         date_changed = NOW(),
194 194
                         text = '".$text."',
195
-                        basketevaluation_product = " . $basketevaluation . ",
195
+                        basketevaluation_product = " . $basketevaluation.",
196 196
                         product_id = ".$product_id.",
197 197
                         product_variation_id = ".$product_variation_id.",
198 198
                         product_detail_id = ".$product_detail_id.",
@@ -220,10 +220,10 @@  discard block
 block discarded – undo
220 220
         settype($input['email'], 'string');
221 221
         settype($input['phone'], 'string');
222 222
 
223
-        $sql = "name = \"".safeToDb($input['name'])."\"," .
224
-            "contactperson = \"".safeToDb($input['contactperson'])."\", " .
225
-            "address = \"".safeToDb($input['address'])."\", " .
226
-            "postcode = \"".safeToDb($input['postcode'])."\", " .
223
+        $sql = "name = \"".safeToDb($input['name'])."\",".
224
+            "contactperson = \"".safeToDb($input['contactperson'])."\", ".
225
+            "address = \"".safeToDb($input['address'])."\", ".
226
+            "postcode = \"".safeToDb($input['postcode'])."\", ".
227 227
             "city = \"".safeToDb($input['city'])."\", ".
228 228
             "country = \"".safeToDb($input['country'])."\", ".
229 229
             "cvr = \"".safeToDb($input['cvr'])."\", ".
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
         $sql_extra = implode(" AND ", $this->conditions);
306 306
 
307 307
         $db = new DB_Sql;
308
-        $db->query("SELECT id FROM basket_details WHERE " . $sql_extra. "
308
+        $db->query("SELECT id FROM basket_details WHERE ".$sql_extra."
309 309
                 AND intranet_id = " . $this->intranet->getId());
310 310
         if ($db->nextRecord()) {
311 311
             $db->query("UPDATE basket_details SET ".$sql.",
312 312
                 date_changed = NOW()
313
-                WHERE id = ".$db->f('id') . "
314
-                    AND " . $sql_extra . "
313
+                WHERE id = ".$db->f('id')."
314
+                    AND " . $sql_extra."
315 315
                     AND intranet_id = " . $this->intranet->getId());
316 316
             return true;
317 317
         } else {
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
         $db = new DB_Sql;
340 340
         $db->query("SELECT *
341 341
             FROM basket_details
342
-            WHERE " . $sql_extra . "
342
+            WHERE " . $sql_extra."
343 343
                 AND intranet_id = " . $this->intranet->getId());
344 344
         if (!$db->nextRecord()) {
345 345
             return array();
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
         $db = new DB_Sql;
370 370
         $db->query("SELECT customer_coupon
371 371
             FROM basket_details
372
-            WHERE " . $sql_extra . "
372
+            WHERE " . $sql_extra."
373 373
                 AND intranet_id = " . $this->intranet->getId());
374 374
         if (!$db->nextRecord()) {
375 375
             return array();
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         $db = new DB_Sql;
392 392
         $db->query("SELECT customer_ean
393 393
             FROM basket_details
394
-            WHERE " . $sql_extra . "
394
+            WHERE " . $sql_extra."
395 395
                 AND intranet_id = " . $this->intranet->getId());
396 396
         if (!$db->nextRecord()) {
397 397
             return array();
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
         $db = new DB_Sql;
414 414
         $db->query("SELECT customer_comment
415 415
             FROM basket_details
416
-            WHERE " . $sql_extra . "
416
+            WHERE " . $sql_extra."
417 417
                 AND intranet_id = " . $this->intranet->getId());
418 418
         if (!$db->nextRecord()) {
419 419
             return array();
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
         $db = new DB_Sql;
436 436
         $db->query("SELECT payment_method_key
437 437
             FROM basket_details
438
-            WHERE " . $sql_extra . "
438
+            WHERE " . $sql_extra."
439 439
                 AND intranet_id = " . $this->intranet->getId());
440 440
         if (!$db->nextRecord() || $db->f('payment_method_key') == 0) {
441 441
             return array();
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
         $db = new DB_Sql;
461 461
         $db->query("SELECT *
462 462
             FROM basket
463
-            WHERE " . $sql_extra . "
464
-                AND product_id = " . $product_id . "
463
+            WHERE " . $sql_extra."
464
+                AND product_id = " . $product_id."
465 465
                 AND product_variation_id = ".$product_variation_id."
466
-                AND intranet_id = " . $this->intranet->getId() . "
466
+                AND intranet_id = " . $this->intranet->getId()."
467 467
       AND quantity > 0 LIMIT 1");
468 468
 
469 469
         if (!$db->nextRecord()) {
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
                 ON product.id = basket.product_id
575 575
             INNER JOIN product_detail
576 576
                 ON product.id = product_detail.product_id
577
-            WHERE " . $sql_extra . "
577
+            WHERE " . $sql_extra."
578 578
                 AND product_detail.active = 1
579
-                AND basket.intranet_id = " . $this->intranet->getId() . "
579
+                AND basket.intranet_id = " . $this->intranet->getId()."
580 580
             ORDER BY product_detail.vat DESC, basket.basketevaluation_product");
581 581
 
582 582
         $i = 0;
@@ -627,16 +627,16 @@  discard block
 block discarded – undo
627 627
 
628 628
             // basket specific
629 629
             $items[$i]['quantity'] = $db->f('quantity');
630
-            $items[$i]['totalweight'] = $items[$i]['weight'] * $db->f('quantity');
631
-            $items[$i]['totalprice'] = $db->f('quantity') * $items[$i]['price'];
632
-            $items[$i]['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['price_incl_vat'];
630
+            $items[$i]['totalweight'] = $items[$i]['weight']*$db->f('quantity');
631
+            $items[$i]['totalprice'] = $db->f('quantity')*$items[$i]['price'];
632
+            $items[$i]['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['price_incl_vat'];
633 633
 
634
-            $items[$i]['currency']['DKK']['totalprice'] = $db->f('quantity') * $items[$i]['currency']['DKK']['price'];
635
-            $items[$i]['currency']['DKK']['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['currency']['DKK']['price_incl_vat'];
634
+            $items[$i]['currency']['DKK']['totalprice'] = $db->f('quantity')*$items[$i]['currency']['DKK']['price'];
635
+            $items[$i]['currency']['DKK']['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['currency']['DKK']['price_incl_vat'];
636 636
             if (is_object($currencies) && $currencies->count() > 0) {
637 637
                 foreach ($currencies as $currency) {
638
-                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice'] = $db->f('quantity') * $items[$i]['currency'][$currency->getType()->getIsoCode()]['price'];
639
-                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['currency'][$currency->getType()->getIsoCode()]['price_incl_vat'];
638
+                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice'] = $db->f('quantity')*$items[$i]['currency'][$currency->getType()->getIsoCode()]['price'];
639
+                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['currency'][$currency->getType()->getIsoCode()]['price_incl_vat'];
640 640
                 }
641 641
             }
642 642
 
@@ -665,10 +665,10 @@  discard block
 block discarded – undo
665 665
     {
666 666
         $sql_extra = implode(" AND ", $this->conditions);
667 667
         $db = new DB_Sql;
668
-        $db->query("DELETE FROM basket " .
669
-                "WHERE basketevaluation_product = 1 " .
670
-                    "AND " . $sql_extra . " " .
671
-                    "AND intranet_id = " . $this->intranet->getId());
668
+        $db->query("DELETE FROM basket ".
669
+                "WHERE basketevaluation_product = 1 ".
670
+                    "AND ".$sql_extra." ".
671
+                    "AND intranet_id = ".$this->intranet->getId());
672 672
 
673 673
         $this->resetItemCache();
674 674
 
@@ -687,8 +687,8 @@  discard block
 block discarded – undo
687 687
 
688 688
         $sql_extra = implode(" AND ", $this->conditions);
689 689
         $db = new DB_Sql;
690
-        $db->query("UPDATE basket SET session_id = '' WHERE " . $sql_extra . " AND intranet_id = " . $this->intranet->getId());
691
-        $db->query("UPDATE basket_details SET session_id = '' WHERE " . $sql_extra . " AND intranet_id = " . $this->intranet->getId());
690
+        $db->query("UPDATE basket SET session_id = '' WHERE ".$sql_extra." AND intranet_id = ".$this->intranet->getId());
691
+        $db->query("UPDATE basket_details SET session_id = '' WHERE ".$sql_extra." AND intranet_id = ".$this->intranet->getId());
692 692
 
693 693
         return true;
694 694
     }
Please login to merge, or discard this patch.
src/Intraface/modules/shop/BasketEvaluation.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * Constructor
36 36
      *
37
-     * @param object $kernel Kernel registry
38 37
      * @param int    $id     Id of the BasketEvaluation
39 38
      *
40 39
      * @return void
@@ -106,6 +105,9 @@  discard block
 block discarded – undo
106 105
         return true;
107 106
     }
108 107
 
108
+    /**
109
+     * @param Struct $input
110
+     */
109 111
     function validate($input)
110 112
     {
111 113
         $validator = new Intraface_Validator($this->error);
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -147,15 +147,15 @@
 block discarded – undo
147 147
         }
148 148
 
149 149
         $sql = "running_index = ".$this->db->quote($input['running_index'], 'integer').", " .
150
-                 "evaluate_target_key = ".$this->db->quote($input['evaluate_target_key'], 'integer').", " .
151
-                 "evaluate_method_key = ".$this->db->quote($input['evaluate_method_key'], 'integer').", " .
152
-                 "evaluate_value = ".$this->db->quote($input['evaluate_value'], 'text').", " .
153
-                 "evaluate_value_case_sensitive = ".$this->db->quote($input['evaluate_value_case_sensitive'], 'integer').", " .
154
-                 "go_to_index_after = ".$this->db->quote($input['go_to_index_after'], 'integer').", " .
155
-                 "action_action_key = ".$this->db->quote($input['action_action_key'], 'integer').", " .
156
-                 "action_value = ".$this->db->quote($input['action_value'], 'text').", " .
157
-                 "action_quantity = ".$this->db->quote($input['action_quantity'], 'integer').", " .
158
-                 "action_unit_key = ".$this->db->quote($input['action_unit_key'], 'integer');
150
+                    "evaluate_target_key = ".$this->db->quote($input['evaluate_target_key'], 'integer').", " .
151
+                    "evaluate_method_key = ".$this->db->quote($input['evaluate_method_key'], 'integer').", " .
152
+                    "evaluate_value = ".$this->db->quote($input['evaluate_value'], 'text').", " .
153
+                    "evaluate_value_case_sensitive = ".$this->db->quote($input['evaluate_value_case_sensitive'], 'integer').", " .
154
+                    "go_to_index_after = ".$this->db->quote($input['go_to_index_after'], 'integer').", " .
155
+                    "action_action_key = ".$this->db->quote($input['action_action_key'], 'integer').", " .
156
+                    "action_value = ".$this->db->quote($input['action_value'], 'text').", " .
157
+                    "action_quantity = ".$this->db->quote($input['action_quantity'], 'integer').", " .
158
+                    "action_unit_key = ".$this->db->quote($input['action_unit_key'], 'integer');
159 159
 
160 160
         if ($this->id != 0) {
161 161
             $result = $this->db->exec("UPDATE webshop_basket_evaluation SET ".$sql." WHERE intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer')." AND id = ".$this->db->quote($this->id, 'integer')  . " AND shop_id = ".$this->db->quote($this->shop->getId(), 'integer'));
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
         $this->shop     = $shop;
48 48
         $this->id       = (int)$id;
49 49
 
50
-        $this->value['settings'] = array (
50
+        $this->value['settings'] = array(
51 51
             'evaluate_target' => array(
52 52
                 0 => 'price',
53 53
                 1 => 'weight',
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
      */
86 86
     private function load()
87 87
     {
88
-        $result = $this->db->query("SELECT * FROM webshop_basket_evaluation WHERE active = 1 AND intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer')." AND id = ".$this->db->quote($this->id, 'integer') . " AND shop_id = ".$this->db->quote($this->shop->getId(), 'integer'));
88
+        $result = $this->db->query("SELECT * FROM webshop_basket_evaluation WHERE active = 1 AND intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer')." AND id = ".$this->db->quote($this->id, 'integer')." AND shop_id = ".$this->db->quote($this->shop->getId(), 'integer'));
89 89
 
90 90
         if (PEAR::isError($result)) {
91
-            throw new Exception($result->getMessage() . $result->getUserInfo());
91
+            throw new Exception($result->getMessage().$result->getUserInfo());
92 92
         }
93 93
 
94 94
         if ($result->numRows() == 0) {
@@ -146,35 +146,35 @@  discard block
 block discarded – undo
146 146
             return false;
147 147
         }
148 148
 
149
-        $sql = "running_index = ".$this->db->quote($input['running_index'], 'integer').", " .
150
-                 "evaluate_target_key = ".$this->db->quote($input['evaluate_target_key'], 'integer').", " .
151
-                 "evaluate_method_key = ".$this->db->quote($input['evaluate_method_key'], 'integer').", " .
152
-                 "evaluate_value = ".$this->db->quote($input['evaluate_value'], 'text').", " .
153
-                 "evaluate_value_case_sensitive = ".$this->db->quote($input['evaluate_value_case_sensitive'], 'integer').", " .
154
-                 "go_to_index_after = ".$this->db->quote($input['go_to_index_after'], 'integer').", " .
155
-                 "action_action_key = ".$this->db->quote($input['action_action_key'], 'integer').", " .
156
-                 "action_value = ".$this->db->quote($input['action_value'], 'text').", " .
157
-                 "action_quantity = ".$this->db->quote($input['action_quantity'], 'integer').", " .
149
+        $sql = "running_index = ".$this->db->quote($input['running_index'], 'integer').", ".
150
+                 "evaluate_target_key = ".$this->db->quote($input['evaluate_target_key'], 'integer').", ".
151
+                 "evaluate_method_key = ".$this->db->quote($input['evaluate_method_key'], 'integer').", ".
152
+                 "evaluate_value = ".$this->db->quote($input['evaluate_value'], 'text').", ".
153
+                 "evaluate_value_case_sensitive = ".$this->db->quote($input['evaluate_value_case_sensitive'], 'integer').", ".
154
+                 "go_to_index_after = ".$this->db->quote($input['go_to_index_after'], 'integer').", ".
155
+                 "action_action_key = ".$this->db->quote($input['action_action_key'], 'integer').", ".
156
+                 "action_value = ".$this->db->quote($input['action_value'], 'text').", ".
157
+                 "action_quantity = ".$this->db->quote($input['action_quantity'], 'integer').", ".
158 158
                  "action_unit_key = ".$this->db->quote($input['action_unit_key'], 'integer');
159 159
 
160 160
         if ($this->id != 0) {
161
-            $result = $this->db->exec("UPDATE webshop_basket_evaluation SET ".$sql." WHERE intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer')." AND id = ".$this->db->quote($this->id, 'integer')  . " AND shop_id = ".$this->db->quote($this->shop->getId(), 'integer'));
161
+            $result = $this->db->exec("UPDATE webshop_basket_evaluation SET ".$sql." WHERE intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer')." AND id = ".$this->db->quote($this->id, 'integer')." AND shop_id = ".$this->db->quote($this->shop->getId(), 'integer'));
162 162
 
163 163
             if (PEAR::isError($result)) {
164
-                throw new Exception($result->getMessage() . $result->getUserInfo());
164
+                throw new Exception($result->getMessage().$result->getUserInfo());
165 165
                 return false;
166 166
             }
167 167
         } else {
168 168
             $result = $this->db->query("INSERT INTO webshop_basket_evaluation SET ".$sql.", intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer').", id = ".$this->db->quote($this->id, 'integer').", shop_id = ".$this->db->quote($this->shop->getId(), 'integer'));
169 169
 
170 170
             if (PEAR::isError($result)) {
171
-                throw new Exception($result->getMessage() . $result->getUserInfo());
171
+                throw new Exception($result->getMessage().$result->getUserInfo());
172 172
                 return false;
173 173
             }
174 174
 
175 175
             $this->id = $this->db->lastInsertID();
176 176
             if (PEAR::isError($this->id)) {
177
-                throw new Exception($result->getMessage() . $result->getUserInfo());
177
+                throw new Exception($result->getMessage().$result->getUserInfo());
178 178
             }
179 179
         }
180 180
 
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
     {
191 191
         $result = $this->db->exec("UPDATE webshop_basket_evaluation SET active = 0 WHERE intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer')." AND id = ".$this->db->quote($this->id, 'integer'));
192 192
         if (PEAR::isError($result)) {
193
-            throw new Exception($result->getMessage() . $result->getUserInfo());
193
+            throw new Exception($result->getMessage().$result->getUserInfo());
194 194
             return false;
195 195
         }
196 196
         return true;
@@ -203,10 +203,10 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function getList()
205 205
     {
206
-        $result = $this->db->query("SELECT * FROM webshop_basket_evaluation WHERE active = 1 AND intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer'). " AND shop_id = ".$this->db->quote($this->shop->getId(), 'integer')." ORDER BY running_index");
206
+        $result = $this->db->query("SELECT * FROM webshop_basket_evaluation WHERE active = 1 AND intranet_id = ".$this->db->quote($this->intranet->getId(), 'integer')." AND shop_id = ".$this->db->quote($this->shop->getId(), 'integer')." ORDER BY running_index");
207 207
 
208 208
         if (PEAR::isError($this->id)) {
209
-            throw new Exception($result->getMessage() . $result->getUserInfo());
209
+            throw new Exception($result->getMessage().$result->getUserInfo());
210 210
         }
211 211
 
212 212
         $i = 0;
Please login to merge, or discard this patch.
src/Intraface/modules/shop/Coordinator.php 2 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -226,7 +226,6 @@  discard block
 block discarded – undo
226 226
      *
227 227
      * @param array $input    Array with customer data
228 228
      * @param array $products Array with products
229
-     * @param object $mailer mailer to send e-mail
230 229
      *
231 230
      * @return integer Order id
232 231
      */
@@ -392,9 +391,9 @@  discard block
 block discarded – undo
392 391
      * @param integer $order_id
393 392
      * @param integer $transaction_number
394 393
      * @param integer $transaction_status
395
-     * @param float   $transaction_amount
394
+     * @param integer $amount
396 395
      *
397
-     * @return boolean
396
+     * @return integer
398 397
      */
399 398
     public function addOnlinePayment($order_id, $transaction_number, $transaction_status, $amount)
400 399
     {
@@ -434,6 +433,9 @@  discard block
 block discarded – undo
434 433
         }
435 434
     }
436 435
 
436
+    /**
437
+     * @param integer $payment_id
438
+     */
437 439
     private function sendEmailOnOnlinePayment($payment_id)
438 440
     {
439 441
         $this->kernel->useShared('email');
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
             if ($value['message'] != '') {
197 197
                 $value['message'] .= "\n\n";
198 198
             }
199
-            $value['message'] .= "Kundekupon:". $input['customer_coupon'];
199
+            $value['message'] .= "Kundekupon:".$input['customer_coupon'];
200 200
         }
201 201
 
202 202
         if (isset($input['customer_comment']) && $input['customer_comment'] != '') {
203 203
             if ($value['message'] != '') {
204 204
                 $value['message'] .= "\n\n";
205 205
             }
206
-            $value['message'] .= "Kommentar:\n". $input['customer_comment'];
206
+            $value['message'] .= "Kommentar:\n".$input['customer_comment'];
207 207
         }
208 208
 
209 209
         if (isset($input['payment_method']) && is_array($input['payment_method']) && !empty($input['payment_method'])) {
@@ -328,15 +328,15 @@  discard block
 block discarded – undo
328 328
         $email = new Email($this->kernel);
329 329
 
330 330
         if ($this->shop->getConfirmationSubject()) {
331
-            $subject = $this->shop->getConfirmationSubject() . ' (#' . $this->order->get('number') . ')';
331
+            $subject = $this->shop->getConfirmationSubject().' (#'.$this->order->get('number').')';
332 332
         } else {
333
-            $subject = 'Bekræftelse på bestilling (#' . $this->order->get('number') . ')';
333
+            $subject = 'Bekræftelse på bestilling (#'.$this->order->get('number').')';
334 334
         }
335 335
 
336 336
         $body = $this->shop->getConfirmationText();
337 337
 
338 338
         if ($this->shop->showPaymentUrl()) {
339
-            $body .=  "\n\n" . $this->shop->getPaymentUrl() . $this->order->getIdentifier();
339
+            $body .= "\n\n".$this->shop->getPaymentUrl().$this->order->getIdentifier();
340 340
         }
341 341
 
342 342
         // @todo improve this table
@@ -352,19 +352,19 @@  discard block
 block discarded – undo
352 352
                 $currency_iso_code = 'DKK';
353 353
             }
354 354
 
355
-            $table->addRow(array(round($item["quantity"]), substr($item["name"], 0, 40), $currency_iso_code.' ' . $amount));
355
+            $table->addRow(array(round($item["quantity"]), substr($item["name"], 0, 40), $currency_iso_code.' '.$amount));
356 356
         }
357 357
 
358
-        $body .= "\n\n" . $table->getTable();
358
+        $body .= "\n\n".$table->getTable();
359 359
 
360 360
         if ($this->shop->getConfirmationGreeting()) {
361
-            $body .=  "\n\n" . $this->shop->getConfirmationGreeting();
361
+            $body .= "\n\n".$this->shop->getConfirmationGreeting();
362 362
         } else {
363
-            $body .= "Venlig hilsen\n".  $this->kernel->intranet->address->get('name');
363
+            $body .= "Venlig hilsen\n".$this->kernel->intranet->address->get('name');
364 364
         }
365 365
 
366 366
         if ($this->shop->showLoginUrl()) {
367
-            $body .=  "\n\n" . $this->contact->getLoginUrl();
367
+            $body .= "\n\n".$this->contact->getLoginUrl();
368 368
         }
369 369
 
370 370
         if (!$email->save(array('contact_id' => $this->contact->get('id'),
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
         $this->kernel->useShared('email');
440 440
         $email = new Email($this->kernel);
441 441
 
442
-        $subject = 'Bekræftelse på betaling (#' . $payment_id . ')';
442
+        $subject = 'Bekræftelse på betaling (#'.$payment_id.')';
443 443
         $body = 'Vi har modtaget din betaling. Hvis din ordre var afsendt inden kl. 12.00, sender vi den allerede i dag.';
444
-        $body .= "\n\nVenlig hilsen\n".  $this->kernel->intranet->address->get('name');
444
+        $body .= "\n\nVenlig hilsen\n".$this->kernel->intranet->address->get('name');
445 445
 
446 446
         if (!$email->save(array('contact_id' => $this->contact->get('id'),
447 447
                                 'subject' => $subject,
Please login to merge, or discard this patch.
src/Intraface/modules/todo/TodoItem.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     /**
19 19
      * Constructor
20 20
      *
21
-     * @param object  $todo Todo liste
21
+     * @param TodoList  $todo Todo liste
22 22
      * @param integer $id   Id for item
23 23
      *
24 24
      * @return void
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
      *
160 160
      * @param object $db Database object
161 161
      *
162
-     * @return object
162
+     * @return Ilib_Position
163 163
      */
164 164
     public function getPosition($db)
165 165
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             throw new Exception('Todo kr�ver Kernel');
30 30
         }
31 31
         $this->todo = $todo;
32
-        $this->id = (int) $id;
32
+        $this->id = (int)$id;
33 33
 
34 34
         if ($this->id > 0) {
35 35
             $this->load();
@@ -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 * FROM todo_item WHERE id = " . $this->id);
47
+        $db->query("SELECT * FROM todo_item WHERE id = ".$this->id);
48 48
         if ($db->nextRecord()) {
49 49
             $this->value['id'] = $db->f('id');
50 50
             $this->value['item'] = $db->f('item');
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
         $db = new DB_Sql;
104 104
 
105 105
         if ($this->id == 0) {
106
-            $db->query("SELECT position FROM todo_item WHERE todo_list_id = " . $this->todo->get('id') . " ORDER BY position DESC LIMIT 1");
106
+            $db->query("SELECT position FROM todo_item WHERE todo_list_id = ".$this->todo->get('id')." ORDER BY position DESC LIMIT 1");
107 107
             $db->nextRecord();
108 108
             $new_position = $db->f('position') + 1;
109 109
         }
110 110
 
111 111
         if ($this->id == 0) {
112 112
             $sql_type = "INSERT INTO ";
113
-            $sql_end = ", date_created = NOW(), position = " . $new_position;
113
+            $sql_end = ", date_created = NOW(), position = ".$new_position;
114 114
         } else {
115 115
             $sql_type = "UPDATE ";
116
-            $sql_end = " WHERE id = " . $this->id;
116
+            $sql_end = " WHERE id = ".$this->id;
117 117
         }
118 118
 
119
-        $db->query($sql_type. " todo_item SET intranet_id = ".$this->todo->kernel->intranet->get('id').", item = '".$var."', todo_list_id = ".(int)$this->todo->get('id').", responsible_user_id = " .$user_id. " " . $sql_end);
119
+        $db->query($sql_type." todo_item SET intranet_id = ".$this->todo->kernel->intranet->get('id').", item = '".$var."', todo_list_id = ".(int)$this->todo->get('id').", responsible_user_id = ".$user_id." ".$sql_end);
120 120
 
121 121
         if ($this->id == 0) {
122 122
             $this->id = $db->insertedId();
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             return false;
136 136
         }
137 137
         $db = new DB_Sql;
138
-        $db->query("UPDATE todo_item SET status = 1 WHERE id = " . $this->id);
138
+        $db->query("UPDATE todo_item SET status = 1 WHERE id = ".$this->id);
139 139
         return true;
140 140
     }
141 141
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             return false;
151 151
         }
152 152
         $db = new DB_Sql;
153
-        $db->query("UPDATE todo_item SET active = 0 WHERE id = " . $this->id);
153
+        $db->query("UPDATE todo_item SET active = 0 WHERE id = ".$this->id);
154 154
         return true;
155 155
     }
156 156
 
Please login to merge, or discard this patch.