Completed
Branch master (6ed6e7)
by Lars
07:57
created
src/Intraface/modules/onlinepayment/provider/QuickPay.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
      *
96 96
      * @param string $action Which action to perform?
97 97
      *
98
-     * @return void
98
+     * @return boolean
99 99
      */
100 100
     function transactionAction($action)
101 101
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 
87 87
         return $this->eval;
88 88
     }
89
-    **/
89
+     **/
90 90
 
91 91
     /**
92 92
      * @todo does what?
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->quickpay = new quickpay;
61 61
         $this->quickpay->set_md5checkword($this->settings['md5_secret']);
62 62
         $this->quickpay->set_merchant($this->settings['merchant_id']);
63
-        $this->quickpay->set_curl_certificate(dirname(__FILE__) . '/../../../certificates/cacert.pem');
63
+        $this->quickpay->set_curl_certificate(dirname(__FILE__).'/../../../certificates/cacert.pem');
64 64
 
65 65
         // hvordan bliver disse sat - og hvad er det n�jagtigt?
66 66
         $this->quickpay->set_posc($this->posc);
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
             // henter bel�bene fra denne onlinebetaling
109 109
             $this->quickpay->set_transaction($this->get('transaction_number'));
110
-            $this->quickpay->set_amount(round($this->get('amount') * 100));
110
+            $this->quickpay->set_amount(round($this->get('amount')*100));
111 111
 
112 112
             $this->eval = $this->quickpay->capture();
113 113
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
                 return true;
136 136
 
137 137
             } else {
138
-                $this->error->set('Betalingen kunne ikke tilbagebetales: ' . $this->eval['qpstatmsg']);
138
+                $this->error->set('Betalingen kunne ikke tilbagebetales: '.$this->eval['qpstatmsg']);
139 139
                 return false;
140 140
 
141 141
             }
@@ -191,8 +191,8 @@  discard block
 block discarded – undo
191 191
      */
192 192
     function getSettings()
193 193
     {
194
-        $this->value['md5_secret'] = 	$this->kernel->setting->get('intranet', 'onlinepayment.quickpay.md5_secret');
195
-        $this->value['merchant_id'] = 	$this->kernel->setting->get('intranet', 'onlinepayment.quickpay.merchant_id');
194
+        $this->value['md5_secret'] = $this->kernel->setting->get('intranet', 'onlinepayment.quickpay.md5_secret');
195
+        $this->value['merchant_id'] = $this->kernel->setting->get('intranet', 'onlinepayment.quickpay.merchant_id');
196 196
         return $this->value;
197 197
     }
198 198
 
Please login to merge, or discard this patch.
src/Intraface/modules/procurement/Procurement.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
      *
690 690
      * @todo: duplicate in Procurement class
691 691
      *
692
-     * @return array status types
692
+     * @return string[] status types
693 693
      */
694 694
     private function getStatusTypes()
695 695
     {
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
      * returns the possible regions where procurement is bought
705 705
      * @todo: duplicate in Procurement class
706 706
      *
707
-     * @return array possible regions
707
+     * @return string[] possible regions
708 708
      */
709 709
     public function getRegionTypes()
710 710
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
 
124 124
     function loadItem($id = 0)
125 125
     {
126
-         $this->item = new ProcurementItem($this, (int)$id);
126
+            $this->item = new ProcurementItem($this, (int)$id);
127 127
     }
128 128
 
129 129
     function update($input)
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -102,13 +102,13 @@  discard block
 block discarded – undo
102 102
         $this->value["from_region"] = $region_types[$db->f("from_region_key")];
103 103
 
104 104
         $this->value["price_items"] = $db->f("price_items");
105
-        $this->value["dk_price_items"] = number_format($db->f("price_items"), 2, ",",".");
105
+        $this->value["dk_price_items"] = number_format($db->f("price_items"), 2, ",", ".");
106 106
         $this->value["price_shipment_etc"] = $db->f("price_shipment_etc");
107
-        $this->value["dk_price_shipment_etc"] = number_format($this->value["price_shipment_etc"], 2, ",",".");
107
+        $this->value["dk_price_shipment_etc"] = number_format($this->value["price_shipment_etc"], 2, ",", ".");
108 108
         $this->value["vat"] = $db->f("vat");
109
-        $this->value["dk_vat"] = number_format($db->f("vat"), 2, ",",".");
109
+        $this->value["dk_vat"] = number_format($db->f("vat"), 2, ",", ".");
110 110
         $this->value["total_price"] = round($this->value["price_items"] + $this->value["price_shipment_etc"] + $this->value["vat"], 2);
111
-        $this->value["dk_total_price"] = number_format($this->value["total_price"], 2, ",",".");
111
+        $this->value["dk_total_price"] = number_format($this->value["total_price"], 2, ",", ".");
112 112
 
113 113
         $this->value["status_key"] = $db->f("status_key");
114 114
         $types = $this->getStatusTypes();
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
             throw new Exception("Ugyldigt status: ".$status);
259 259
         }
260 260
 
261
-        switch($status) {
261
+        switch ($status) {
262 262
             case "ordered":
263 263
                 $sql = "";
264 264
                 break;
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
         }
416 416
 
417 417
 
418
-        $text = $translation->get('procurement').'# ' . $this->get('number') . ': ' . $this->get('description');
418
+        $text = $translation->get('procurement').'# '.$this->get('number').': '.$this->get('description');
419 419
         require_once 'Intraface/modules/accounting/Voucher.php';
420 420
         $voucher = Voucher::factory($year, $voucher_number);
421 421
         $voucher->save(array(
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
             $credit_total += $amount;
435 435
 
436 436
             if (!empty($line['text'])) {
437
-                $line_text = $text. ' - ' . $line['text'];
437
+                $line_text = $text.' - '.$line['text'];
438 438
             } else {
439 439
                 $line_text = $text;
440 440
             }
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
             $voucher_date->convert2db();
490 490
         }
491 491
 
492
-        $db->query("UPDATE procurement SET date_stated = '".$voucher_date->get()."', voucher_id = ".intval($voucher_number)." WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id'));
492
+        $db->query("UPDATE procurement SET date_stated = '".$voucher_date->get()."', voucher_id = ".intval($voucher_number)." WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'));
493 493
         return 1;
494 494
     }
495 495
 
@@ -572,16 +572,16 @@  discard block
 block discarded – undo
572 572
         $total = 0;
573 573
         $vat = 0;
574 574
         foreach ($debet_accounts AS $key => $debet_account) {
575
-            if ($validator->isNumeric($debet_account['amount'], 'Ugyldig beløb i linje ' . ($key + 1) . ' "' . $debet_account['text'] . '"', 'greater_than_zero')) {
575
+            if ($validator->isNumeric($debet_account['amount'], 'Ugyldig beløb i linje '.($key + 1).' "'.$debet_account['text'].'"', 'greater_than_zero')) {
576 576
 
577 577
                 $amount = new Intraface_Amount($debet_account['amount']);
578 578
                 $amount->convert2db();
579 579
                 $total += $amount->get();
580 580
 
581
-                $validator->isString($debet_account['text'], 'Ugyldig tekst i linje ' . ($key + 1) . ' "' . $debet_account['text'] . '"', '', 'allow_empty');
581
+                $validator->isString($debet_account['text'], 'Ugyldig tekst i linje '.($key + 1).' "'.$debet_account['text'].'"', '', 'allow_empty');
582 582
 
583
-                if (empty($debet_account['state_account_id']) ) {
584
-                    $this->error->set('Linje ' . ($key + 1) . ' "' . $debet_account['text'] . '" ved ikke hvor den skal bogføres');
583
+                if (empty($debet_account['state_account_id'])) {
584
+                    $this->error->set('Linje '.($key + 1).' "'.$debet_account['text'].'" ved ikke hvor den skal bogføres');
585 585
                 } else {
586 586
                     require_once 'Intraface/modules/accounting/Account.php';
587 587
                     $account = Account::factory($year, $debet_account['state_account_id']);
@@ -589,9 +589,9 @@  discard block
 block discarded – undo
589 589
                     // @todo check this. I changed it to make sure that we are able to state varekøb til videresalg
590 590
                     // || $account->get('type') != 'operating'
591 591
                     if ($account->get('id') == 0) {
592
-                        $this->error->set('Ugyldig konto for bogføring af linje ' . ($key + 1) . ' "' . $debet_account['text'] . '"');
592
+                        $this->error->set('Ugyldig konto for bogføring af linje '.($key + 1).' "'.$debet_account['text'].'"');
593 593
                     } elseif ($account->get('vat') == 'in') {
594
-                        $vat += $amount->get() / 100 * $account->get('vat_percent');
594
+                        $vat += $amount->get()/100*$account->get('vat_percent');
595 595
                     }
596 596
                 }
597 597
             }
@@ -608,8 +608,8 @@  discard block
 block discarded – undo
608 608
             }
609 609
 
610 610
             if (round($vat, 2) != $this->get('vat')) {
611
-                $expected = number_format($this->get('vat') * 4, 2, ',', '.');
612
-                $this->error->set('Momsen af de beløb du bogfører på konti med moms stemmer ikke overens med momsen på det samlede indkøb (vi forventede '.number_format($vat, 2, ',', '.').' i moms og det samlede beløb burde have været ' . $expected . '). Har du fået alle varer med? Har du husket at skrive beløbet uden moms for varerne?');
611
+                $expected = number_format($this->get('vat')*4, 2, ',', '.');
612
+                $this->error->set('Momsen af de beløb du bogfører på konti med moms stemmer ikke overens med momsen på det samlede indkøb (vi forventede '.number_format($vat, 2, ',', '.').' i moms og det samlede beløb burde have været '.$expected.'). Har du fået alle varer med? Har du husket at skrive beløbet uden moms for varerne?');
613 613
             }
614 614
         }
615 615
 
@@ -638,16 +638,16 @@  discard block
 block discarded – undo
638 638
         $total = 0;
639 639
         $vat = 0;
640 640
         foreach ($debet_accounts AS $key => $debet_account) {
641
-            if ($validator->isNumeric($debet_account['amount'], 'Ugyldig beløb i linje ' . ($key + 1) . ' "' . $debet_account['text'] . '"', 'greater_than_zero')) {
641
+            if ($validator->isNumeric($debet_account['amount'], 'Ugyldig beløb i linje '.($key + 1).' "'.$debet_account['text'].'"', 'greater_than_zero')) {
642 642
 
643 643
                 $amount = new Intraface_Amount($debet_account['amount']);
644 644
                 $amount->convert2db();
645 645
                 $total += $amount->get();
646 646
 
647
-                $validator->isString($debet_account['text'], 'Ugyldig tekst i linje ' . ($key + 1) . ' "' . $debet_account['text'] . '"', '', 'allow_empty');
647
+                $validator->isString($debet_account['text'], 'Ugyldig tekst i linje '.($key + 1).' "'.$debet_account['text'].'"', '', 'allow_empty');
648 648
 
649
-                if (empty($debet_account['state_account_id']) ) {
650
-                    $this->error->set('Linje ' . ($key + 1) . ' "' . $debet_account['text'] . '" ved ikke hvor den skal bogføres');
649
+                if (empty($debet_account['state_account_id'])) {
650
+                    $this->error->set('Linje '.($key + 1).' "'.$debet_account['text'].'" ved ikke hvor den skal bogføres');
651 651
                 } else {
652 652
                     require_once 'Intraface/modules/accounting/Account.php';
653 653
                     $account = Account::factory($year, $debet_account['state_account_id']);
@@ -655,9 +655,9 @@  discard block
 block discarded – undo
655 655
                     // @todo check this. I changed it to make sure that we are able to state varekøb til videresalg
656 656
                     // || $account->get('type') != 'operating'
657 657
                     if ($account->get('id') == 0) {
658
-                        $this->error->set('Ugyldig konto for bogføring af linje ' . ($key + 1) . ' "' . $debet_account['text'] . '"');
658
+                        $this->error->set('Ugyldig konto for bogføring af linje '.($key + 1).' "'.$debet_account['text'].'"');
659 659
                     } elseif ($account->get('vat') == 'in') {
660
-                        $vat += $amount->get() / 100 * $account->get('vat_percent');
660
+                        $vat += $amount->get()/100*$account->get('vat_percent');
661 661
                     }
662 662
                 }
663 663
             }
@@ -674,8 +674,8 @@  discard block
 block discarded – undo
674 674
 
675 675
         if (round($vat, 2) != $this->get('vat')) {
676 676
             $expected_vat = number_format($vat, 2, ',', '.');
677
-            $expected_value = number_format($this->get('vat') * 4, 2, ',', '.');
678
-            $this->error->set('Momsen af de beløb du bogfører på konti med moms stemmer ikke overens med momsen på det samlede indkøb (vi forventede ' . $expected_vat . ' i moms og det samlede beløb burde have været ' . $expected_value . '). Har du fået alle varer med? Har du husket at skrive beløbet uden moms for varerne?');
677
+            $expected_value = number_format($this->get('vat')*4, 2, ',', '.');
678
+            $this->error->set('Momsen af de beløb du bogfører på konti med moms stemmer ikke overens med momsen på det samlede indkøb (vi forventede '.$expected_vat.' i moms og det samlede beløb burde have været '.$expected_value.'). Har du fået alle varer med? Har du husket at skrive beløbet uden moms for varerne?');
679 679
         }
680 680
         
681 681
         if ($this->error->isError()) {
Please login to merge, or discard this patch.
src/Intraface/modules/procurement/ProcurementGateway.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
      * returns possible status types
183 183
      * @todo: duplicate in Procurement class
184 184
      *
185
-     * @return array status types
185
+     * @return string[] status types
186 186
      */
187 187
     public function getStatusTypes()
188 188
     {
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
      * returns the possible regions where procurement is bought
198 198
      * @todo: duplicate in Procurement class
199 199
      *
200
-     * @return array possible regions
200
+     * @return string[] possible regions
201 201
      */
202 202
     public function getRegionTypes()
203 203
     {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     function setNewContactId($old_id, $new_id)
42 42
     {
43 43
         $db = MDB2::singleton();
44
-        $db->query('UPDATE procurement SET contact_id = ' . $new_id . ' WHERE contact_id = ' . $old_id);
44
+        $db->query('UPDATE procurement SET contact_id = '.$new_id.' WHERE contact_id = '.$old_id);
45 45
     }
46 46
 
47 47
     function find()
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
                 $this->dbquery->setCondition("status_key < 1 OR (status_key = 1 AND paid_date = \"0000-00-00\")");
82 82
             } else {
83 83
                 if ($this->dbquery->checkFilter("to_date")) {
84
-                    switch($this->dbquery->getFilter("status")) {
84
+                    switch ($this->dbquery->getFilter("status")) {
85 85
                         case "0":
86 86
                             $to_date_field = "date_created";
87 87
                             break;
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
             $list[$i]["contact_id"] = $db->f("contact_id");
148 148
 
149
-            $list[$i]["total_price"] = round($db->f("price_items") + $db->f("price_shipment_etc") + $db->f("vat"), 2);;
149
+            $list[$i]["total_price"] = round($db->f("price_items") + $db->f("price_shipment_etc") + $db->f("vat"), 2); ;
150 150
 
151 151
             $i++;
152 152
         }
@@ -157,14 +157,14 @@  discard block
 block discarded – undo
157 157
     function any()
158 158
     {
159 159
         $db = new DB_Sql;
160
-        $db->query("SELECT id FROM procurement WHERE intranet_id = " . $this->kernel->intranet->get('id'));
160
+        $db->query("SELECT id FROM procurement WHERE intranet_id = ".$this->kernel->intranet->get('id'));
161 161
         return $db->numRows();
162 162
     }
163 163
 
164 164
     function anyByContact($contact_id)
165 165
     {
166 166
         $db = new DB_Sql;
167
-        $db->query("SELECT id FROM procurement WHERE intranet_id = " . $this->kernel->intranet->get('id')." AND contact_id = ".$contact_id." AND active = 1");
167
+        $db->query("SELECT id FROM procurement WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND contact_id = ".$contact_id." AND active = 1");
168 168
         return $db->numRows();
169 169
     }
170 170
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
     {
214 214
         $sql = "SELECT id
215 215
                 FROM procurement
216
-                WHERE intranet_id = " . $this->kernel->intranet->get("id") . "
216
+                WHERE intranet_id = " . $this->kernel->intranet->get("id")."
217 217
                     AND contact_id = ".(int)$contact_id."
218 218
                     AND active = 1";
219 219
 
Please login to merge, or discard this patch.
src/Intraface/modules/procurement/ProcurementItem.php 3 patches
Doc Comments   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
57 57
      * Constructor
58 58
      *
59 59
      * @param object Procurement
60
-     * @param integer item id
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
             }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         $product = new Product($this->procurement->kernel, $product_id);
347 347
 
348 348
         if (!is_object($product) || $product->get('id') == 0) {
349
-             throw new Excetion('Invalid product id');
349
+                throw new Excetion('Invalid product id');
350 350
         } else {
351 351
             $product_detail_id = $product->get("detail_id");
352 352
         }
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;
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
             return false;
323 323
         }
324 324
 
325
-        $sql = "unit_purchase_price = " . $unit_purchase_price->get();
325
+        $sql = "unit_purchase_price = ".$unit_purchase_price->get();
326 326
 
327 327
         $db = new DB_Sql;
328
-        $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"));
328
+        $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 329
         return true;
330 330
     }
331 331
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
             product_variation_detail_id = ".$variation_detail_id;
376 376
 
377 377
         $db = new DB_Sql;
378
-        $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"));
378
+        $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 379
 
380 380
         return true;
381 381
     }
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
     public function delete()
388 388
     {
389 389
         $db = new DB_Sql;
390
-        $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"));
390
+        $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 391
         $this->id = 0;
392 392
 
393 393
         return 1;
@@ -401,13 +401,13 @@  discard block
 block discarded – undo
401 401
     public function getList()
402 402
     {
403 403
         $db = new DB_Sql;
404
-        $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");
404
+        $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 405
         $i = 0;
406
-        $item = array ();
406
+        $item = array();
407 407
 
408 408
         if ($this->procurement->get("price_items") > 0) {
409 409
             // calculates shipment etc per item price kr
410
-            $calculated = $this->procurement->get("price_shipment_etc") / $this->procurement->get("price_items");
410
+            $calculated = $this->procurement->get("price_shipment_etc")/$this->procurement->get("price_items");
411 411
         } else {
412 412
             $calculated = 0;
413 413
         }
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
                 $item[$i]["unit"] = $unit['plural'];
424 424
             }
425 425
             $item[$i]["unit_purchase_price"] = $db->f("unit_purchase_price");
426
-            $item[$i]["calculated_unit_price"] = $db->f("unit_purchase_price") + $db->f("unit_purchase_price") * $calculated;
426
+            $item[$i]["calculated_unit_price"] = $db->f("unit_purchase_price") + $db->f("unit_purchase_price")*$calculated;
427 427
             $item[$i]["quantity"] = $db->f("quantity");
428 428
             $item[$i]["vat"] = $product->get("vat");
429 429
             $item[$i]["product_id"] = $product->get("id");
430
-            $item[$i]["amount"] = $db->f("quantity") * $db->f("unit_purchase_price");
430
+            $item[$i]["amount"] = $db->f("quantity")*$db->f("unit_purchase_price");
431 431
 
432 432
             if ($product->get('has_variation')) {
433 433
                 $variation = $product->getVariation($db->f('product_variation_id'));
434 434
                 $detail = $variation->getDetail($db->f('product_variation_detail_id'));
435 435
                 $item[$i]["name"] = $product->get("name").' - '.$variation->getName();
436
-                $item[$i]["number"]= $product->get("number").'.'.$variation->getNumber();
436
+                $item[$i]["number"] = $product->get("number").'.'.$variation->getNumber();
437 437
                 $item[$i]["price"] = $detail->getPrice($product);
438 438
 
439 439
             } else {
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
      */
453 453
     public function getQuantity($status, $product_id, $product_variation_id, $from_date = "")
454 454
     {
455
-        if (!in_array($status, array (
455
+        if (!in_array($status, array(
456 456
                 'ordered',
457 457
                 'delivered'
458 458
             ))) {
@@ -466,8 +466,8 @@  discard block
 block discarded – undo
466 466
                         FROM procurement_item INNER JOIN procurement
467 467
                             ON procurement_item.procurement_id = procurement.id
468 468
                         WHERE procurement_item.active = 1 AND procurement.active = 1
469
-                            AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id") . " AND procurement.intranet_id = " . $this->procurement->kernel->intranet->get("id") . "
470
-                            AND procurement_item.product_id = " . $product_id . " AND procurement.status_key = 0
469
+                            AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id")." AND procurement.intranet_id = ".$this->procurement->kernel->intranet->get("id")."
470
+                            AND procurement_item.product_id = " . $product_id." AND procurement.status_key = 0
471 471
                             AND procurement_item.product_variation_id = ".$product_variation_id);
472 472
             $db->nextRecord(); // a post will always be present
473 473
             return intval($db->f("on_order"));
@@ -477,11 +477,11 @@  discard block
 block discarded – undo
477 477
                         FROM procurement_item INNER JOIN procurement
478 478
                             ON procurement_item.procurement_id = procurement.id
479 479
                         WHERE procurement_item.active = 1 AND procurement.active = 1
480
-                            AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id") . " AND procurement.intranet_id = " . $this->procurement->kernel->intranet->get("id") . "
481
-                            AND procurement_item.product_id = " . $product_id . "
480
+                            AND procurement_item.intranet_id = " . $this->procurement->kernel->intranet->get("id")." AND procurement.intranet_id = ".$this->procurement->kernel->intranet->get("id")."
481
+                            AND procurement_item.product_id = " . $product_id."
482 482
                             AND procurement_item.product_variation_id = ".$product_variation_id."
483 483
                             AND procurement.status_key = 1
484
-                            AND procurement.date_recieved > \"" . $from_date . "\"");
484
+                            AND procurement.date_recieved > \"" . $from_date."\"");
485 485
             $db->nextRecord(); // a post will always be present
486 486
             return intval($db->f("stock_in"));
487 487
         }
Please login to merge, or discard this patch.
src/Intraface/modules/product/Attribute/Group/Gateway.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      * @todo $doctrine should not be optional
22 22
      * 
23 23
      * @param object $doctrine Doctrine_Connection 
24
-     * @return void
24
+     * @return integer
25 25
      */
26 26
     public function __construct($doctrine = NULL) 
27 27
     {
Please login to merge, or discard this patch.
src/Intraface/modules/product/Gateway.php 3 patches
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,6 @@  discard block
 block discarded – undo
36 36
     /**
37 37
      * Constructor
38 38
      *
39
-     * @param object  $user                Userobject
40 39
      *
41 40
      * @return void
42 41
      */
@@ -77,9 +76,8 @@  discard block
 block discarded – undo
77 76
     /**
78 77
      * Finds a product with an id
79 78
      *
80
-     * @param integer $id product id
81 79
      *
82
-     * @return object
80
+     * @return Product
83 81
      */
84 82
     function getById($product_id, $old_product_detail_id = 0)
85 83
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,6 @@  discard block
 block discarded – undo
51 51
 
52 52
     /**
53 53
      * Creates the dbquery object
54
-
55 54
      * @return void
56 55
      */
57 56
     public function getDBQuery()
@@ -168,7 +167,7 @@  discard block
 block discarded – undo
168 167
             case 'all': // fall through
169 168
             default:
170 169
                 $sql = '';
171
-             break;
170
+                break;
172 171
         }
173 172
 
174 173
         $i        = 0; // til at give arrayet en key
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
                 'INNER',
139 139
                 'ilib_category',
140 140
                 'ilib_category_append.category_id = ilib_category.id',
141
-                'ilib_category.intranet_id = '.$this->kernel->intranet->getId(). ' ' .
142
-                    'AND ilib_category.belong_to = '.$category_type->getBelongTo().' ' .
141
+                'ilib_category.intranet_id = '.$this->kernel->intranet->getId().' '.
142
+                    'AND ilib_category.belong_to = '.$category_type->getBelongTo().' '.
143 143
                     'AND ilib_category.belong_to_id = '.$category_type->getBelongToId());
144 144
 
145 145
             $this->getDBQuery()->setCondition('ilib_category.id = '.$this->getDBQuery()->getFilter("category"));
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 
208 208
             // den her skal vist lige kigges igennem, for den tager jo alt med p� nettet?
209 209
             // 0 = only stock
210
-            if ($this->kernel->setting->get('intranet', 'webshop.show_online') == 0 AND $which=='webshop') { // only stock
210
+            if ($this->kernel->setting->get('intranet', 'webshop.show_online') == 0 AND $which == 'webshop') { // only stock
211 211
                 if (array_key_exists('for_sale', $products[$i]['stock_status']) AND $products[$i]['stock_status']['for_sale'] <= 0) {
212 212
                     continue;
213 213
                 }
Please login to merge, or discard this patch.
src/Intraface/modules/product/Product.php 4 patches
Doc Comments   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
      *
595 595
      * @deprecated
596 596
      *
597
-     * @return object
597
+     * @return Keyword
598 598
      */
599 599
     public function getKeywords()
600 600
     {
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
     /**
605 605
      * Get keywords object
606 606
      *
607
-     * @return object
607
+     * @return Keyword
608 608
      */
609 609
     public function getKeyword()
610 610
     {
@@ -660,7 +660,6 @@  discard block
 block discarded – undo
660 660
     /**
661 661
      * Delete all related product
662 662
      *
663
-     * @param integer $id     Product id to relate to this product
664 663
      *
665 664
      * @return boolean
666 665
      */
@@ -1040,7 +1039,7 @@  discard block
 block discarded – undo
1040 1039
     /**
1041 1040
      * Gets the details
1042 1041
      *
1043
-     * @return object
1042
+     * @return ProductDetail
1044 1043
      */
1045 1044
     function getDetails()
1046 1045
     {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -115,7 +115,6 @@  discard block
 block discarded – undo
115 115
 
116 116
     /**
117 117
      * Creates the dbquery object
118
-
119 118
      * @return void
120 119
      */
121 120
     public function getDBQuery()
@@ -223,7 +222,7 @@  discard block
 block discarded – undo
223 222
 
224 223
     function getKernel()
225 224
     {
226
-    	return $this->kernel;
225
+        return $this->kernel;
227 226
     }
228 227
 
229 228
     /**
@@ -572,7 +571,7 @@  discard block
 block discarded – undo
572 571
         $product_number = (int)$product_number;
573 572
 
574 573
         $db = new DB_Sql;
575
-         $sql = "SELECT product.id FROM product
574
+            $sql = "SELECT product.id FROM product
576 575
           INNER JOIN product_detail detail
577 576
             ON product.id = detail.product_id
578 577
             WHERE detail.number = '" . $product_number . "'
@@ -814,7 +813,7 @@  discard block
 block discarded – undo
814 813
                     "AND product_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." " .
815 814
                 "WHERE product_x_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." " .
816 815
                     "AND product_x_attribute_group.product_id=" . $this->getId()  . " " .
817
-                 "ORDER BY product_attribute_group.id");
816
+                    "ORDER BY product_attribute_group.id");
818 817
 
819 818
         if (PEAR::isError($result)) {
820 819
             throw new Exception('Error in query :'.$result->getUserInfo());
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
     public function load()
147 147
     {
148 148
         $this->db->query("SELECT id, active, locked, changed_date, ".implode(',', $this->fields)." FROM product
149
-                WHERE intranet_id = " . $this->kernel->intranet->getId() . "
150
-                    AND id = " . $this->id . " LIMIT 1");
149
+                WHERE intranet_id = " . $this->kernel->intranet->getId()."
150
+                    AND id = " . $this->id." LIMIT 1");
151 151
 
152 152
         if (!$this->db->nextRecord()) {
153 153
             $this->value['id'] = 0;
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 
400 400
         if ($this->id > 0) {
401 401
             $sql_type = "UPDATE ";
402
-            $sql_end  = " WHERE id = " . $this->id . " AND intranet_id = " . $this->intranet->getId();
402
+            $sql_end  = " WHERE id = ".$this->id." AND intranet_id = ".$this->intranet->getId();
403 403
         } else {
404 404
             $sql_type = "INSERT INTO";
405
-            $sql_end  = ", intranet_id = " . $this->intranet->getId();
405
+            $sql_end  = ", intranet_id = ".$this->intranet->getId();
406 406
         }
407 407
 
408
-        $this->db->query($sql_type . " product SET ".$sql." changed_date = NOW()"	 . $sql_end);
408
+        $this->db->query($sql_type." product SET ".$sql." changed_date = NOW()".$sql_end);
409 409
 
410 410
         if (empty($this->id)) {
411 411
             $this->id = $this->db->insertedId();
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
         $new_id = $product->save(
440 440
             array(
441
-                'name' => $this->get('name') . ' (kopi)',
441
+                'name' => $this->get('name').' (kopi)',
442 442
                 'description' => $this->get('description'),
443 443
                 'price' => amountToForm($this->get('price')), // make sure that this is formatted to local format
444 444
                 'weight' => (float)$this->get('weight'),
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
         $db = new Db_Sql;
509 509
         $sql = "UPDATE product
510 510
             SET active = 0
511
-            WHERE id = " . $this->id. "
512
-                AND intranet_id = " . $this->intranet->getId() . "
511
+            WHERE id = " . $this->id."
512
+                AND intranet_id = " . $this->intranet->getId()."
513 513
                 AND locked = 0";
514 514
         $db->query($sql);
515 515
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         $db = new Db_Sql;
533 533
         $sql = "UPDATE product
534 534
             SET active = 1
535
-            WHERE id = " . $this->id. "
535
+            WHERE id = " . $this->id."
536 536
                 AND intranet_id = " . $this->intranet->getId();
537 537
         $db->query($sql);
538 538
         $this->value['active'] = 1;
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
             FROM product
552 552
             INNER JOIN product_detail
553 553
                 ON product_detail.product_id = product.id
554
-            WHERE product.intranet_id = " . $this->intranet->getId() . "
554
+            WHERE product.intranet_id = " . $this->intranet->getId()."
555 555
             ORDER BY product_detail.number DESC LIMIT 1";
556 556
         $db->query($sql);
557 557
         if (!$db->nextRecord()) {
@@ -575,8 +575,8 @@  discard block
 block discarded – undo
575 575
          $sql = "SELECT product.id FROM product
576 576
           INNER JOIN product_detail detail
577 577
             ON product.id = detail.product_id
578
-            WHERE detail.number = '" . $product_number . "'
579
-                AND detail.product_id <> " . $this->id . "
578
+            WHERE detail.number = '" . $product_number."'
579
+                AND detail.product_id <> " . $this->id."
580 580
                 AND detail.active = 1
581 581
                 AND product.active=1
582 582
                 AND product.intranet_id = ".$this->intranet->getId()." LIMIT 1";
@@ -632,13 +632,13 @@  discard block
 block discarded – undo
632 632
         $db = new DB_Sql;
633 633
 
634 634
         if ($status == 'relate') {
635
-            $db->query("SELECT * FROM product_related WHERE product_id=" . $this->id  . " AND related_product_id = " . (int)$id . " AND intranet_id =" .$this->intranet->getId());
635
+            $db->query("SELECT * FROM product_related WHERE product_id=".$this->id." AND related_product_id = ".(int)$id." AND intranet_id =".$this->intranet->getId());
636 636
             if ($db->nextRecord()) return true;
637 637
             if ($id == $this->id) return false;
638
-            $db->query("INSERT INTO product_related SET product_id = " . $this->id . ", related_product_id = " . (int)$id . ", intranet_id = " . $this->intranet->getId());
638
+            $db->query("INSERT INTO product_related SET product_id = ".$this->id.", related_product_id = ".(int)$id.", intranet_id = ".$this->intranet->getId());
639 639
             return true;
640 640
         } else {
641
-            $db->query("DELETE FROM product_related WHERE product_id = " . $this->id . " AND intranet_id = " . $this->intranet->getId() . " AND related_product_id = " . (int)$id);
641
+            $db->query("DELETE FROM product_related WHERE product_id = ".$this->id." AND intranet_id = ".$this->intranet->getId()." AND related_product_id = ".(int)$id);
642 642
             return true;
643 643
         }
644 644
     }
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     public function deleteRelatedProduct($id)
654 654
     {
655 655
         $db = new DB_Sql;
656
-        $db->query("DELETE FROM product_related WHERE product_id = " . $this->id . " AND intranet_id = " . $this->intranet->getId() . " AND related_product_id = " . (int)$id);
656
+        $db->query("DELETE FROM product_related WHERE product_id = ".$this->id." AND intranet_id = ".$this->intranet->getId()." AND related_product_id = ".(int)$id);
657 657
         return true;
658 658
     }
659 659
 
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
     public function deleteRelatedProducts()
668 668
     {
669 669
         $db = new DB_Sql;
670
-        $db->query("DELETE FROM product_related WHERE product_id = " . $this->id . " AND intranet_id = " . $this->intranet->getId());
670
+        $db->query("DELETE FROM product_related WHERE product_id = ".$this->id." AND intranet_id = ".$this->intranet->getId());
671 671
         return true;
672 672
     }
673 673
 
@@ -682,12 +682,12 @@  discard block
 block discarded – undo
682 682
         $key      = 0;
683 683
         $ids      = array();
684 684
         $db       = new DB_Sql;
685
-        $sql      = "SELECT related_product_id FROM product_related WHERE product_id = " . $this->id . " AND intranet_id = " . $this->intranet->getId();
685
+        $sql      = "SELECT related_product_id FROM product_related WHERE product_id = ".$this->id." AND intranet_id = ".$this->intranet->getId();
686 686
         $db->query($sql);
687 687
 
688 688
         // r�kkef�lgen er vigtig - f�rst hente fra product og bagefter tilf�je nye v�rdier til arrayet
689 689
         while ($db->nextRecord()) {
690
-            $product                      = new Product($this->kernel, $db->f('related_product_id'));
690
+            $product = new Product($this->kernel, $db->f('related_product_id'));
691 691
             if ($product->get('id') == 0 || $product->get('active') == 0 || ($show == 'webshop' && $product->get('do_show') == 0)) {
692 692
                 CONTINUE;
693 693
             }
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
             }
723 723
             // den her skal vist lige kigges igennem, for den tager jo alt med p� nettet?
724 724
             // 0 = only stock
725
-            if ($this->kernel->setting->get('intranet', 'webshop.show_online') == 0 AND !empty($which) AND $which=='webshop') { // only stock
725
+            if ($this->kernel->setting->get('intranet', 'webshop.show_online') == 0 AND !empty($which) AND $which == 'webshop') { // only stock
726 726
                 if (array_key_exists('for_sale', $products[$key]['stock_status']) AND $products[$key]['stock_status']['for_sale'] <= 0) {
727 727
                     continue;
728 728
                 }
@@ -752,13 +752,13 @@  discard block
 block discarded – undo
752 752
         }
753 753
 
754 754
         $db = MDB2::singleton(DB_DSN);
755
-        $result = $db->query("SELECT id FROM product_x_attribute_group WHERE intranet_id = ".$db->quote($this->intranet->getId())." AND product_id=" . $this->getId()  . " AND product_attribute_group_id = " . (int)$id );
755
+        $result = $db->query("SELECT id FROM product_x_attribute_group WHERE intranet_id = ".$db->quote($this->intranet->getId())." AND product_id=".$this->getId()." AND product_attribute_group_id = ".(int)$id);
756 756
         if (PEAR::isError($result)) {
757 757
             throw new Exception('Error in query :'.$result->getUserInfo());
758 758
         }
759 759
 
760 760
         if ($result->numRows() > 0) return true;
761
-        $result = $db->exec("INSERT INTO product_x_attribute_group SET product_id = " . $this->getId() . ", product_attribute_group_id = " . (int)$id . ", intranet_id = " . $this->intranet->getId());
761
+        $result = $db->exec("INSERT INTO product_x_attribute_group SET product_id = ".$this->getId().", product_attribute_group_id = ".(int)$id.", intranet_id = ".$this->intranet->getId());
762 762
         if (PEAR::isError($result)) {
763 763
             throw new Exception('Error in insert :'.$result->getUserInfo());
764 764
         }
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
         }
781 781
 
782 782
         $db = MDB2::singleton(DB_DSN);
783
-        $result = $db->exec("DELETE FROM product_x_attribute_group WHERE intranet_id = ".$db->quote($this->intranet->getId())." AND product_id=" . $this->getId()  . " AND product_attribute_group_id = " . (int)$id );
783
+        $result = $db->exec("DELETE FROM product_x_attribute_group WHERE intranet_id = ".$db->quote($this->intranet->getId())." AND product_id=".$this->getId()." AND product_attribute_group_id = ".(int)$id);
784 784
         if (PEAR::isError($result)) {
785 785
             throw new Exception('Error in query :'.$result->getUserInfo());
786 786
         }
@@ -808,12 +808,12 @@  discard block
 block discarded – undo
808 808
         // NOTE: Very important that it is ordered by product_attribute_group.id so the groups
809 809
         // does always get attached to the correct attribute number on the variation. Se above todo in method doc
810 810
         $db = MDB2::singleton(DB_DSN);
811
-        $result = $db->query("SELECT product_attribute_group.* FROM product_x_attribute_group " .
812
-                "INNER JOIN product_attribute_group " .
813
-                    "ON product_x_attribute_group.product_attribute_group_id = product_attribute_group.id " .
814
-                    "AND product_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." " .
815
-                "WHERE product_x_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." " .
816
-                    "AND product_x_attribute_group.product_id=" . $this->getId()  . " " .
811
+        $result = $db->query("SELECT product_attribute_group.* FROM product_x_attribute_group ".
812
+                "INNER JOIN product_attribute_group ".
813
+                    "ON product_x_attribute_group.product_attribute_group_id = product_attribute_group.id ".
814
+                    "AND product_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." ".
815
+                "WHERE product_x_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." ".
816
+                    "AND product_x_attribute_group.product_id=".$this->getId()." ".
817 817
                  "ORDER BY product_attribute_group.id");
818 818
 
819 819
         if (PEAR::isError($result)) {
@@ -867,7 +867,7 @@  discard block
 block discarded – undo
867 867
     public function isFilledIn()
868 868
     {
869 869
         $db = new DB_Sql;
870
-        $db->query("SELECT count(*) AS antal FROM product WHERE intranet_id = " . $this->intranet->getId());
870
+        $db->query("SELECT count(*) AS antal FROM product WHERE intranet_id = ".$this->intranet->getId());
871 871
         if ($db->nextRecord()) {
872 872
             return $db->f('antal');
873 873
         }
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
     public function any()
883 883
     {
884 884
         $db = new DB_Sql;
885
-        $db->query("SELECT id FROM product WHERE intranet_id = " . $this->intranet->getId()." AND active = 1");
885
+        $db->query("SELECT id FROM product WHERE intranet_id = ".$this->intranet->getId()." AND active = 1");
886 886
         return $db->numRows();
887 887
     }
888 888
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -627,14 +627,20 @@  discard block
 block discarded – undo
627 627
      */
628 628
     public function setRelatedProduct($id, $status = 'relate')
629 629
     {
630
-        if (empty($status)) $status = 'remove';
630
+        if (empty($status)) {
631
+            $status = 'remove';
632
+        }
631 633
 
632 634
         $db = new DB_Sql;
633 635
 
634 636
         if ($status == 'relate') {
635 637
             $db->query("SELECT * FROM product_related WHERE product_id=" . $this->id  . " AND related_product_id = " . (int)$id . " AND intranet_id =" .$this->intranet->getId());
636
-            if ($db->nextRecord()) return true;
637
-            if ($id == $this->id) return false;
638
+            if ($db->nextRecord()) {
639
+                return true;
640
+            }
641
+            if ($id == $this->id) {
642
+                return false;
643
+            }
638 644
             $db->query("INSERT INTO product_related SET product_id = " . $this->id . ", related_product_id = " . (int)$id . ", intranet_id = " . $this->intranet->getId());
639 645
             return true;
640 646
         } else {
@@ -757,7 +763,9 @@  discard block
 block discarded – undo
757 763
             throw new Exception('Error in query :'.$result->getUserInfo());
758 764
         }
759 765
 
760
-        if ($result->numRows() > 0) return true;
766
+        if ($result->numRows() > 0) {
767
+            return true;
768
+        }
761 769
         $result = $db->exec("INSERT INTO product_x_attribute_group SET product_id = " . $this->getId() . ", product_attribute_group_id = " . (int)$id . ", intranet_id = " . $this->intranet->getId());
762 770
         if (PEAR::isError($result)) {
763 771
             throw new Exception('Error in insert :'.$result->getUserInfo());
Please login to merge, or discard this patch.
src/Intraface/modules/product/Product/Details.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
      * Returns the price of the product in given currency
208 208
      *
209 209
      * @param object $currency Intraface_modules_currency_Currency
210
-     * @param integer $exchange_rage_id
210
+     * @param integer $exchange_rate_id
211 211
      *
212 212
      * @return obejct Ilib_Variable_Float with price of the variation in given currency
213 213
      */
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
      * Returns the before price of the product in given currency
258 258
      *
259 259
      * @param object $currency Intraface_modules_currency_Currency
260
-     * @param integer $exchange_rage_id
260
+     * @param integer $exchange_rate_id
261 261
      *
262 262
      * @return obejct Ilib_Variable_Float with price of the variation in given currency
263 263
      */
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -319,23 +319,23 @@
 block discarded – undo
319 319
     {
320 320
         $units = array(
321 321
             1 => array('singular' => '',
322
-                      'plural' => '',
323
-                      'combined' => ''),
322
+                        'plural' => '',
323
+                        'combined' => ''),
324 324
             2 => array('singular' => 'unit',
325
-                      'plural' => 'units',
326
-                      'combined' => 'unit(s)'),
325
+                        'plural' => 'units',
326
+                        'combined' => 'unit(s)'),
327 327
             3 => array('singular' => 'day',
328
-                      'plural' => 'days',
329
-                      'combined' => 'day(s)'),
328
+                        'plural' => 'days',
329
+                        'combined' => 'day(s)'),
330 330
             4 => array('singular' => 'month (singular)',
331
-                      'plural' => 'month (plural)',
332
-                      'combined' => 'month (combined)'),
331
+                        'plural' => 'month (plural)',
332
+                        'combined' => 'month (combined)'),
333 333
             5 => array('singular' => 'year',
334
-                      'plural' => 'years',
335
-                      'combined' => 'year(s)'),
334
+                        'plural' => 'years',
335
+                        'combined' => 'year(s)'),
336 336
             6 => array('singular' => 'hour',
337
-                      'plural' => 'hours',
338
-                      'combined' => 'hour(s)')
337
+                        'plural' => 'hours',
338
+                        'combined' => 'hour(s)')
339 339
         );
340 340
 
341 341
         if ($key === null) {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -74,15 +74,15 @@  discard block
 block discarded – undo
74 74
             //->innerJoin('Intraface_modules_product_ProductDoctrine.details AS details')
75 75
             //->addWhere('active = 1')
76 76
             ->addWhere('active = 1')
77
-            ->addWhere('number = ' . $this->number)
78
-            ->addWhere('intranet_id = ' . $this->intranet_id)
79
-            ->addWhere('product_id <> ' . $product_id);
77
+            ->addWhere('number = '.$this->number)
78
+            ->addWhere('intranet_id = '.$this->intranet_id)
79
+            ->addWhere('product_id <> '.$product_id);
80 80
 
81 81
         // not necessary to execute query when counting
82 82
         //$collection = $dql->execute();
83 83
 
84 84
         if ($dql->count() > 0) {
85
-            $this->getErrorStack()->add('number', $this->number . ' has already been added');
85
+            $this->getErrorStack()->add('number', $this->number.' has already been added');
86 86
         }
87 87
 
88 88
         return true;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      */
214 214
     public function getPriceInCurrency($currency, $exchange_rate_id = 0)
215 215
     {
216
-        return new Ilib_Variable_Float(round($this->getPrice()->getAsIso() / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100) , 2));
216
+        return new Ilib_Variable_Float(round($this->getPrice()->getAsIso()/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100), 2));
217 217
     }
218 218
 
219 219
     /**
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
      */
224 224
     public function getPriceIncludingVat()
225 225
     {
226
-        return new Ilib_Variable_Float($this->getPrice()->getAsIso(2) * (1 + $this->getVatPercent()->getAsIso()/100));
226
+        return new Ilib_Variable_Float($this->getPrice()->getAsIso(2)*(1 + $this->getVatPercent()->getAsIso()/100));
227 227
     }
228 228
 
229 229
     /**
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
      */
236 236
     public function getPriceIncludingVatInCurrency($currency, $exchange_rate_id)
237 237
     {
238
-        return new Ilib_Variable_Float($this->getPriceIncludingVat()->getAsIso() / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100));
238
+        return new Ilib_Variable_Float($this->getPriceIncludingVat()->getAsIso()/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100));
239 239
     }
240 240
 
241 241
     public function setBeforePrice(Ilib_Variable_Float $value)
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
      */
264 264
     public function getBeforePriceInCurrency($currency, $exchange_rate_id = 0)
265 265
     {
266
-        return new Ilib_Variable_Float(round($this->getBeforePrice($product)->getAsIso() / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100) , 2));
266
+        return new Ilib_Variable_Float(round($this->getBeforePrice($product)->getAsIso()/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100), 2));
267 267
     }
268 268
 
269 269
     /**
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
      */
274 274
     public function getBeforePriceIncludingVat()
275 275
     {
276
-        return new Ilib_Variable_Float($this->getBeforePrice()->getAsIso(2) * (1 + $this->getVatPercent()->getAsIso()/100));
276
+        return new Ilib_Variable_Float($this->getBeforePrice()->getAsIso(2)*(1 + $this->getVatPercent()->getAsIso()/100));
277 277
     }
278 278
 
279 279
     /**
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
      */
286 286
     public function getBeforePriceIncludingVatInCurrency($currency, $exchange_rate_id)
287 287
     {
288
-        return new Ilib_Variable_Float($this->getBeforePriceIncludingVat()->getAsIso() / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100));
288
+        return new Ilib_Variable_Float($this->getBeforePriceIncludingVat()->getAsIso()/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100));
289 289
     }
290 290
 
291 291
     /**
Please login to merge, or discard this patch.
src/Intraface/modules/product/ProductDetail.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     /**
44 44
      * Constructor
45 45
      *
46
-     * @param object  $product       Product object
46
+     * @param Product  $product       Product object
47 47
      * @param integer $old_detail_id Only used with old product details
48 48
      *
49 49
      * @return void
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
      *
156 156
      * @param array $array_var An array with data to save, @see $this->fields
157 157
      *
158
-     * @return integer
158
+     * @return boolean
159 159
      */
160 160
     public function save($array_var)
161 161
     {
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -332,24 +332,24 @@
 block discarded – undo
332 332
     public static function getUnits($key = null)
333 333
     {
334 334
         $units = array(1 => array('singular' => '',
335
-                                  'plural' => '',
336
-                                  'combined' => ''),
337
-                       2 => array('singular' => 'unit',
338
-                                  'plural' => 'units',
339
-                                  'combined' => 'unit(s)'),
340
-                       3 => array('singular' => 'day',
341
-                                  'plural' => 'days',
342
-                                  'combined' => 'day(s)'),
343
-                       4 => array('singular' => 'month (singular)',
344
-                                  'plural' => 'month (plural)',
345
-                                  'combined' => 'month (combined)'),
346
-                       5 => array('singular' => 'year',
347
-                                  'plural' => 'years',
348
-                                  'combined' => 'year(s)'),
349
-                       6 => array('singular' => 'hour',
350
-                                  'plural' => 'hours',
351
-                                  'combined' => 'hour(s)')
352
-                 );
335
+                                    'plural' => '',
336
+                                    'combined' => ''),
337
+                        2 => array('singular' => 'unit',
338
+                                    'plural' => 'units',
339
+                                    'combined' => 'unit(s)'),
340
+                        3 => array('singular' => 'day',
341
+                                    'plural' => 'days',
342
+                                    'combined' => 'day(s)'),
343
+                        4 => array('singular' => 'month (singular)',
344
+                                    'plural' => 'month (plural)',
345
+                                    'combined' => 'month (combined)'),
346
+                        5 => array('singular' => 'year',
347
+                                    'plural' => 'years',
348
+                                    'combined' => 'year(s)'),
349
+                        6 => array('singular' => 'hour',
350
+                                    'plural' => 'hours',
351
+                                    'combined' => 'hour(s)')
352
+                    );
353 353
 
354 354
         if ($key === null) {
355 355
             return $units;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -77,14 +77,14 @@  discard block
 block discarded – undo
77 77
 
78 78
         $sql = "SELECT product_detail.id, product_detail.unit AS unit_key,".implode(',', $this->fields).", product_detail_translation.name, product_detail_translation.description FROM product_detail
79 79
             LEFT JOIN product_detail_translation ON product_detail.id = product_detail_translation.id AND product_detail_translation.lang = 'da'
80
-            WHERE ".$sql . "
81
-            AND product_id = " . $this->product->get('id') . ' AND intranet_id = ' . $this->product->intranet->getId();
80
+            WHERE ".$sql."
81
+            AND product_id = " . $this->product->get('id').' AND intranet_id = '.$this->product->intranet->getId();
82 82
         $this->db->query($sql);
83 83
         if ($this->db->numRows() > 1) {
84 84
             throw new Exception('Der er mere end en aktiv produktdetalje');
85 85
         } elseif ($this->db->nextRecord()) {
86 86
             // hardcoded udtr�k af nogle vigtige oplysnigner, som vi ikke kan have i feltlisten
87
-            for ($i = 0, $max = count($this->fields); $i<$max; $i++) {
87
+            for ($i = 0, $max = count($this->fields); $i < $max; $i++) {
88 88
                 $this->value[$this->fields[$i]] = $this->db->f($this->fields[$i]);
89 89
             }
90 90
             $this->value['name'] = $this->db->f('name');
@@ -100,13 +100,13 @@  discard block
 block discarded – undo
100 100
                 exit;
101 101
             }
102 102
 
103
-            $this->value['unit_id']   = $this->db->f('unit_key');
104
-            $this->value['unit']     = $unit;
103
+            $this->value['unit_id'] = $this->db->f('unit_key');
104
+            $this->value['unit'] = $unit;
105 105
 
106 106
             // udregne moms priser ud fra prisen, men kun hvis der er moms p� den
107 107
             if ($this->db->f('vat') == 1) {
108 108
                 $this->value['vat_percent'] = 25;
109
-                $this->value['price_incl_vat'] = round((float)$this->db->f('price') + ((float)$this->db->f('price') * 0.25), 2);
109
+                $this->value['price_incl_vat'] = round((float)$this->db->f('price') + ((float)$this->db->f('price')*0.25), 2);
110 110
             } else {
111 111
                 $this->value['vat_percent'] = 0;
112 112
                 $this->value['price_incl_vat'] = round((float)$this->db->f('price'), 2);
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
         } else {
263 263
 
264 264
             // vi opdaterer produktet
265
-            $this->db->query("UPDATE product_detail SET active = 0 WHERE product_id = " . $this->product->get('id'));
266
-            $this->db->query("INSERT INTO product_detail SET ".$sql." active = 1, changed_date = NOW(), product_id = " . $this->product->get('id') . ", intranet_id = " . $this->product->intranet->getId());
265
+            $this->db->query("UPDATE product_detail SET active = 0 WHERE product_id = ".$this->product->get('id'));
266
+            $this->db->query("INSERT INTO product_detail SET ".$sql." active = 1, changed_date = NOW(), product_id = ".$this->product->get('id').", intranet_id = ".$this->product->intranet->getId());
267 267
             $this->detail_id = $this->db->insertedId();
268 268
             $this->db->query("INSERT INTO product_detail_translation SET name = \"".$array_var['name']."\", description = \"".$array_var['description']."\", lang = 'da', id = ".$this->detail_id);
269 269
 
@@ -284,17 +284,17 @@  discard block
 block discarded – undo
284 284
 
285 285
     public function getPriceInCurrency($currency, $exchange_rate_id = 0)
286 286
     {
287
-        return new Ilib_Variable_Float(round($this->get('price') / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100), 2), 'iso');
287
+        return new Ilib_Variable_Float(round($this->get('price')/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100), 2), 'iso');
288 288
     }
289 289
 
290 290
     public function getPriceIncludingVat()
291 291
     {
292
-        return new Ilib_Variable_Float(round($this->get('price') * (1 + $this->getVatPercent()->getAsIso()/100), 2));
292
+        return new Ilib_Variable_Float(round($this->get('price')*(1 + $this->getVatPercent()->getAsIso()/100), 2));
293 293
     }
294 294
 
295 295
     public function getPriceIncludingVatInCurrency($currency, $exchange_rate_id = 0)
296 296
     {
297
-        return new Ilib_Variable_Float(round($this->get('price') / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100) * (1 + $this->getVatPercent()->getAsIso()/100), 2), 'iso');
297
+        return new Ilib_Variable_Float(round($this->get('price')/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100)*(1 + $this->getVatPercent()->getAsIso()/100), 2), 'iso');
298 298
     }
299 299
 
300 300
     public function getBeforePrice()
@@ -304,17 +304,17 @@  discard block
 block discarded – undo
304 304
 
305 305
     public function getBeforePriceInCurrency($currency, $exchange_rate_id = 0)
306 306
     {
307
-        return new Ilib_Variable_Float(round($this->get('price') / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100), 2), 'iso');
307
+        return new Ilib_Variable_Float(round($this->get('price')/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100), 2), 'iso');
308 308
     }
309 309
 
310 310
     public function getBeforePriceIncludingVat()
311 311
     {
312
-        return new Ilib_Variable_Float(round($this->get('before_price') * (1 + $this->getVatPercent()->getAsIso()/100), 2));
312
+        return new Ilib_Variable_Float(round($this->get('before_price')*(1 + $this->getVatPercent()->getAsIso()/100), 2));
313 313
     }
314 314
 
315 315
     public function getBeforePriceIncludingVatInCurrency($currency, $exchange_rate_id = 0)
316 316
     {
317
-        return new Ilib_Variable_Float(round($this->get('before_price') / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100) * (1 + $this->getVatPercent()->getAsIso()/100), 2), 'iso');
317
+        return new Ilib_Variable_Float(round($this->get('before_price')/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100)*(1 + $this->getVatPercent()->getAsIso()/100), 2), 'iso');
318 318
     }
319 319
 
320 320
     public function getVatPercent()
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     function setStateAccountId($id)
366 366
     {
367 367
         $db = new DB_Sql;
368
-        $db->query('UPDATE product_detail SET state_account_id = ' . $id . ' WHERE id = ' . $this->detail_id);
368
+        $db->query('UPDATE product_detail SET state_account_id = '.$id.' WHERE id = '.$this->detail_id);
369 369
         $this->load();
370 370
         $this->product->load();
371 371
         return true;
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -137,8 +137,12 @@  discard block
 block discarded – undo
137 137
         $validator->isNumeric($array_var['pic_id'], 'Fejl i billedid', 'allow_empty');
138 138
         $validator->isNumeric($array_var['weight'], 'Fejl i vægt - skal være et helt tal', 'allow_empty');
139 139
 
140
-        if (isset($array_var['price'])) $validator->isNumeric($array_var['price'], 'Fejl i pris', 'allow_empty');
141
-        if (isset($array_var['before_price'])) $validator->isNumeric($array_var['before_price'], 'Fejl i førpris', 'allow_empty');
140
+        if (isset($array_var['price'])) {
141
+            $validator->isNumeric($array_var['price'], 'Fejl i pris', 'allow_empty');
142
+        }
143
+        if (isset($array_var['before_price'])) {
144
+            $validator->isNumeric($array_var['before_price'], 'Fejl i førpris', 'allow_empty');
145
+        }
142 146
 
143 147
         if ($this->product->error->isError()) {
144 148
             return false;
@@ -236,11 +240,17 @@  discard block
 block discarded – undo
236 240
             $do_update = 1;
237 241
             $sql       = '';
238 242
             // we make sure that unit is set to a valid unit.
239
-            if (empty($array_var['unit'])) $array_var['unit'] = 1;
243
+            if (empty($array_var['unit'])) {
244
+                $array_var['unit'] = 1;
245
+            }
240 246
             $sql .= "unit = ".intval($array_var['unit']).", ";
241 247
 
242
-            if (!isset($array_var['name'])) $array_var['name'] = '';
243
-            if (!isset($array_var['description'])) $array_var['description'] = '';
248
+            if (!isset($array_var['name'])) {
249
+                $array_var['name'] = '';
250
+            }
251
+            if (!isset($array_var['description'])) {
252
+                $array_var['description'] = '';
253
+            }
244 254
 
245 255
             foreach ($this->fields as $field) {
246 256
                 if (!array_key_exists($field, $array_var)) {
Please login to merge, or discard this patch.