Completed
Branch master (6ed6e7)
by Lars
07:57
created
src/Intraface/modules/product/Variation/Detail.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 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 98
      * @return obejct Ilib_Variable_Float with price of the variation in given currency
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@
 block discarded – undo
65 65
 
66 66
     function getIntranetId()
67 67
     {
68
-    	return $this->intranet_id;
68
+        return $this->intranet_id;
69 69
     }
70 70
 
71 71
     /**
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/product/Variation/Gateway.php 3 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -65,6 +65,7 @@
 block discarded – undo
65 65
     /**
66 66
      * Find a variation from id
67 67
      * 
68
+     * @param integer $id
68 69
      * @return object Intraface_modules_product_Variation_OneAttributeGroup or Intraface_modules_product_Variation_TwoAttributeGroups
69 70
      */
70 71
     public function findById($id)
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
             $this->variation = new Intraface_modules_product_Variation_OneAttributeGroup;
46 46
             
47 47
         } elseif (count($this->groups) == 2) {
48
-            $this->variation =  new Intraface_modules_product_Variation_TwoAttributeGroups;
48
+            $this->variation = new Intraface_modules_product_Variation_TwoAttributeGroups;
49 49
         } else {
50 50
             throw new Exception('At the moment the system only supports up to two attribute groups!');
51 51
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -72,7 +72,9 @@  discard block
 block discarded – undo
72 72
         $query = $this->variation->getTable()->createQuery();
73 73
         
74 74
         $select = get_class($this->variation).'.*, detail.*, a1.*, a1_attribute.*, a1_attribute_group.*';
75
-        if (count($this->groups) == 2) $select .= ', a2.*, a2_attribute.*, a2_attribute_group.*';
75
+        if (count($this->groups) == 2) {
76
+            $select .= ', a2.*, a2_attribute.*, a2_attribute_group.*';
77
+        }
76 78
         $query = $query->select($select)
77 79
             ->leftJoin(get_class($this->variation).'.detail detail')
78 80
             ->innerJoin(get_class($this->variation).'.attribute1 a1 WITH a1.attribute_number = 1')
@@ -184,7 +186,9 @@  discard block
 block discarded – undo
184 186
         $query = $this->variation->getTable()->createQuery();
185 187
         
186 188
         $select = get_class($this->variation).'.*, detail.*, a1.*, a1_attribute.*, a1_attribute_group.*';
187
-        if (count($this->groups) == 2) $select .= ', a2.*, a2_attribute.*, a2_attribute_group.*';
189
+        if (count($this->groups) == 2) {
190
+            $select .= ', a2.*, a2_attribute.*, a2_attribute_group.*';
191
+        }
188 192
         
189 193
         $query = $query->select($select)
190 194
             ->leftJoin(get_class($this->variation).'.detail detail')
Please login to merge, or discard this patch.
src/Intraface/modules/shop/Basket.php 4 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  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
+     * @param Intraface_modules_shop_Coordinator $coordinator
59 60
      *
60 61
      * @return void
61 62
      */
@@ -104,7 +105,7 @@  discard block
 block discarded – undo
104 105
      * @param integer $product_id Product to remove
105 106
      * @param integer $quantity   How many should be removed
106 107
      *
107
-     * @return boelean
108
+     * @return boolean
108 109
      */
109 110
     public function remove($product_id, $product_variation_id = 0, $quantity = 1)
110 111
     {
@@ -122,6 +123,7 @@  discard block
 block discarded – undo
122 123
      * @param integer $quantity         The quantity
123 124
      * @param string  $text	            To add description to product, not yet implemented
124 125
      * @param integer $basketevaluation Wheter the product is from basketevaluation
126
+     * @param integer $product_variation_id
125 127
      *
126 128
      * @return boolean
127 129
      */
@@ -532,7 +534,7 @@  discard block
 block discarded – undo
532 534
     /**
533 535
      * Gets the total weight of the basket
534 536
      *
535
-     * @return float
537
+     * @return integer
536 538
      */
537 539
     public function getTotalWeight()
538 540
     {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
         $this->resetItemCache();
70 70
 
71 71
         $this->conditions = array(
72
-        	'session_id = ' . $this->db->quote($this->session_id, 'text'),
72
+            'session_id = ' . $this->db->quote($this->session_id, 'text'),
73 73
             'shop_id = ' . $this->db->quote($this->webshop->getId(), 'integer'),
74 74
             'intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer'));
75 75
 
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()) {
@@ -576,9 +576,9 @@  discard block
 block discarded – undo
576 576
                 ON product.id = basket.product_id
577 577
             INNER JOIN product_detail
578 578
                 ON product.id = product_detail.product_id
579
-            WHERE " . $sql_extra . "
579
+            WHERE " . $sql_extra."
580 580
                 AND product_detail.active = 1
581
-                AND basket.intranet_id = " . $this->intranet->getId() . "
581
+                AND basket.intranet_id = " . $this->intranet->getId()."
582 582
             ORDER BY product_detail.vat DESC, basket.basketevaluation_product");
583 583
 
584 584
         $i = 0;
@@ -630,16 +630,16 @@  discard block
 block discarded – undo
630 630
 
631 631
             // basket specific
632 632
             $items[$i]['quantity'] = $db->f('quantity');
633
-            $items[$i]['totalweight'] = $items[$i]['weight'] * $db->f('quantity');
634
-            $items[$i]['totalprice'] = $db->f('quantity') * $items[$i]['price'];
635
-            $items[$i]['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['price_incl_vat'];
633
+            $items[$i]['totalweight'] = $items[$i]['weight']*$db->f('quantity');
634
+            $items[$i]['totalprice'] = $db->f('quantity')*$items[$i]['price'];
635
+            $items[$i]['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['price_incl_vat'];
636 636
 
637
-            $items[$i]['currency']['DKK']['totalprice'] = $db->f('quantity') * $items[$i]['currency']['DKK']['price'];
638
-            $items[$i]['currency']['DKK']['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['currency']['DKK']['price_incl_vat'];
637
+            $items[$i]['currency']['DKK']['totalprice'] = $db->f('quantity')*$items[$i]['currency']['DKK']['price'];
638
+            $items[$i]['currency']['DKK']['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['currency']['DKK']['price_incl_vat'];
639 639
             if (is_object($currencies) && $currencies->count() > 0) {
640 640
                 foreach ($currencies AS $currency) {
641
-                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice'] = $db->f('quantity') * $items[$i]['currency'][$currency->getType()->getIsoCode()]['price'];
642
-                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice_incl_vat'] = $db->f('quantity') * $items[$i]['currency'][$currency->getType()->getIsoCode()]['price_incl_vat'];
641
+                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice'] = $db->f('quantity')*$items[$i]['currency'][$currency->getType()->getIsoCode()]['price'];
642
+                    $items[$i]['currency'][$currency->getType()->getIsoCode()]['totalprice_incl_vat'] = $db->f('quantity')*$items[$i]['currency'][$currency->getType()->getIsoCode()]['price_incl_vat'];
643 643
                 }
644 644
             }
645 645
 
@@ -668,10 +668,10 @@  discard block
 block discarded – undo
668 668
     {
669 669
         $sql_extra = implode(" AND ", $this->conditions);
670 670
         $db = new DB_Sql;
671
-        $db->query("DELETE FROM basket " .
672
-                "WHERE basketevaluation_product = 1 " .
673
-                    "AND " . $sql_extra . " " .
674
-                    "AND intranet_id = " . $this->intranet->getId());
671
+        $db->query("DELETE FROM basket ".
672
+                "WHERE basketevaluation_product = 1 ".
673
+                    "AND ".$sql_extra." ".
674
+                    "AND intranet_id = ".$this->intranet->getId());
675 675
 
676 676
         $this->resetItemCache();
677 677
 
@@ -690,8 +690,8 @@  discard block
 block discarded – undo
690 690
 
691 691
         $sql_extra = implode(" AND ", $this->conditions);
692 692
         $db = new DB_Sql;
693
-        $db->query("UPDATE basket SET session_id = '' WHERE " . $sql_extra . " AND intranet_id = " . $this->intranet->getId());
694
-        $db->query("UPDATE basket_details SET session_id = '' WHERE " . $sql_extra . " AND intranet_id = " . $this->intranet->getId());
693
+        $db->query("UPDATE basket SET session_id = '' WHERE ".$sql_extra." AND intranet_id = ".$this->intranet->getId());
694
+        $db->query("UPDATE basket_details SET session_id = '' WHERE ".$sql_extra." AND intranet_id = ".$this->intranet->getId());
695 695
 
696 696
         return true;
697 697
     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -485,8 +485,7 @@
 block discarded – undo
485 485
         foreach ($this->getItems() AS $item) {
486 486
             if ($type == 'exclusive_vat') {
487 487
                 $price += $item['totalprice'];
488
-            }
489
-            else {
488
+            } else {
490 489
                 $price += $item['totalprice_incl_vat'];
491 490
             }
492 491
         }
Please login to merge, or discard this patch.
src/Intraface/modules/shop/BasketEvaluation.php 4 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -34,7 +34,6 @@
 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
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
  */
24 24
 class Intraface_modules_shop_BasketEvaluation extends Intraface_Standard
25 25
 {
26
-     public $error;
27
-     private $db;
28
-     private $intranet;
29
-     private $shop;
30
-     private $id;
31
-     private $values;
32
-     private $settings;
26
+        public $error;
27
+        private $db;
28
+        private $intranet;
29
+        private $shop;
30
+        private $id;
31
+        private $values;
32
+        private $settings;
33 33
 
34 34
     /**
35 35
      * Constructor
@@ -147,15 +147,15 @@  discard block
 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   +23 added lines, -23 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,22 +146,22 @@  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
 
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
             $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'));
170 170
 
171 171
             if (PEAR::isError($result)) {
172
-                throw new Exception($result->getMessage() . $result->getUserInfo());
172
+                throw new Exception($result->getMessage().$result->getUserInfo());
173 173
                 return false;
174 174
             }
175 175
 
176 176
             $this->id = $this->db->lastInsertID();
177 177
             if (PEAR::isError($this->id)) {
178
-                throw new Exception($result->getMessage() . $result->getUserInfo());
178
+                throw new Exception($result->getMessage().$result->getUserInfo());
179 179
             }
180 180
         }
181 181
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     {
192 192
         $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'));
193 193
         if (PEAR::isError($result)) {
194
-            throw new Exception($result->getMessage() . $result->getUserInfo());
194
+            throw new Exception($result->getMessage().$result->getUserInfo());
195 195
             return false;
196 196
         }
197 197
         return true;
@@ -204,10 +204,10 @@  discard block
 block discarded – undo
204 204
      */
205 205
     public function getList()
206 206
     {
207
-        $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
+        $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");
208 208
 
209 209
         if (PEAR::isError($this->id)) {
210
-            throw new Exception($result->getMessage() . $result->getUserInfo());
210
+            throw new Exception($result->getMessage().$result->getUserInfo());
211 211
         }
212 212
 
213 213
         $i = 0;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 
250 250
             $evaluation_result = false;
251 251
 
252
-            switch($evaluation['evaluate_target']) {
252
+            switch ($evaluation['evaluate_target']) {
253 253
                 case 'price':
254 254
                     $evaluate = (double)$basket->getTotalPrice();
255 255
                     settype($evaluation['evaluate_value'], 'double');
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                     return false;
320 320
             }
321 321
 
322
-            switch($evaluation['evaluate_method']) {
322
+            switch ($evaluation['evaluate_method']) {
323 323
                 case 'equals':
324 324
                     if ($evaluate == $evaluation['evaluate_value']) {
325 325
                         $evaluation_result = true;
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             if ($evaluation_result) {
349 349
                 $go_to_index = $evaluation['go_to_index_after'];
350 350
 
351
-                switch($evaluation['action_unit']) {
351
+                switch ($evaluation['action_unit']) {
352 352
                     case 'pieces':
353 353
                         $quantity = $evaluation['action_quantity'];
354 354
                         break;
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
                         return false;
364 364
                 }
365 365
 
366
-                switch($evaluation['action_action']) {
366
+                switch ($evaluation['action_action']) {
367 367
                     case 'no_action':
368 368
                         // fine nothing is done
369 369
                         break;
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -290,8 +290,7 @@
 block discarded – undo
290 290
                     $countries = new Ilib_Countries('iso-8859-1');
291 291
                     if (false !== ($country = $countries->getCountryByName(trim($customer['country'])))) {
292 292
                         $evaluate = $country['region'];
293
-                    }
294
-                    else {
293
+                    } else {
295 294
                         $evaluate = 'unknown';
296 295
                     }
297 296
                     
Please login to merge, or discard this patch.
src/Intraface/modules/shop/Controller/Categories.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -82,6 +82,9 @@
 block discarded – undo
82 82
         return $this->context->getKernel();
83 83
     }
84 84
 
85
+    /**
86
+     * @return integer
87
+     */
85 88
     function getShopId()
86 89
     {
87 90
         if ($this->query('shop_id')) {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
         $shop_gateway = $this->getShopGateway();
29 29
         $shop = $shop_gateway->findById($this->context->name());
30 30
 
31
-        $this->document->setTitle('Categories for shop' . $shop->getName());
31
+        $this->document->setTitle('Categories for shop'.$shop->getName());
32 32
         $this->document->options = array(
33 33
             $redirect->getRedirect($this->url('../')) => 'Close', $this->url('create') => 'Add new category'
34 34
         );
Please login to merge, or discard this patch.
src/Intraface/modules/shop/Coordinator.php 3 patches
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -222,7 +222,6 @@  discard block
 block discarded – undo
222 222
      *
223 223
      * @param array $input    Array with customer data
224 224
      * @param array $products Array with products
225
-     * @param object $mailer mailer to send e-mail
226 225
      *
227 226
      * @return integer Order id
228 227
      */
@@ -388,9 +387,8 @@  discard block
 block discarded – undo
388 387
      * @param integer $order_id
389 388
      * @param integer $transaction_number
390 389
      * @param integer $transaction_status
391
-     * @param float   $transaction_amount
392 390
      *
393
-     * @return boolean
391
+     * @return integer
394 392
      */
395 393
     public function addOnlinePayment($order_id, $transaction_number, $transaction_status, $amount)
396 394
     {
@@ -430,6 +428,9 @@  discard block
 block discarded – undo
430 428
         }
431 429
     }
432 430
 
431
+    /**
432
+     * @param integer $payment_id
433
+     */
433 434
     private function sendEmailOnOnlinePayment($payment_id)
434 435
     {
435 436
         $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
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
 
195 195
         if (isset($input['customer_coupon']) && $input['customer_coupon'] != '') {
196 196
             if ($value['message'] != '') $value['message'] .= "\n\n";
197
-            $value['message'] .= "Kundekupon:". $input['customer_coupon'];
197
+            $value['message'] .= "Kundekupon:".$input['customer_coupon'];
198 198
         }
199 199
 
200 200
         if (isset($input['customer_comment']) && $input['customer_comment'] != '') {
201 201
             if ($value['message'] != '') $value['message'] .= "\n\n";
202
-            $value['message'] .= "Kommentar:\n". $input['customer_comment'];
202
+            $value['message'] .= "Kommentar:\n".$input['customer_comment'];
203 203
         }
204 204
 
205 205
         if (isset($input['payment_method']) && is_array($input['payment_method']) && !empty($input['payment_method'])) {
@@ -324,15 +324,15 @@  discard block
 block discarded – undo
324 324
         $email = new Email($this->kernel);
325 325
 
326 326
         if ($this->shop->getConfirmationSubject()) {
327
-            $subject = $this->shop->getConfirmationSubject() . ' (#' . $this->order->get('number') . ')';
327
+            $subject = $this->shop->getConfirmationSubject().' (#'.$this->order->get('number').')';
328 328
         } else {
329
-            $subject = 'Bekræftelse på bestilling (#' . $this->order->get('number') . ')';
329
+            $subject = 'Bekræftelse på bestilling (#'.$this->order->get('number').')';
330 330
         }
331 331
 
332 332
         $body = $this->shop->getConfirmationText();
333 333
 
334 334
         if ($this->shop->showPaymentUrl()) {
335
-            $body .=  "\n\n" . $this->shop->getPaymentUrl() . $this->order->getIdentifier();
335
+            $body .= "\n\n".$this->shop->getPaymentUrl().$this->order->getIdentifier();
336 336
         }
337 337
 
338 338
         // @todo improve this table
@@ -348,19 +348,19 @@  discard block
 block discarded – undo
348 348
                 $currency_iso_code = 'DKK';
349 349
             }
350 350
 
351
-            $table->addRow(array(round($item["quantity"]), substr($item["name"], 0, 40), $currency_iso_code.' ' . $amount));
351
+            $table->addRow(array(round($item["quantity"]), substr($item["name"], 0, 40), $currency_iso_code.' '.$amount));
352 352
         }
353 353
 
354
-        $body .= "\n\n" . $table->getTable();
354
+        $body .= "\n\n".$table->getTable();
355 355
 
356 356
         if ($this->shop->getConfirmationGreeting()) {
357
-            $body .=  "\n\n" . $this->shop->getConfirmationGreeting();
357
+            $body .= "\n\n".$this->shop->getConfirmationGreeting();
358 358
         } else {
359
-            $body .= "Venlig hilsen\n".  $this->kernel->intranet->address->get('name');
359
+            $body .= "Venlig hilsen\n".$this->kernel->intranet->address->get('name');
360 360
         }
361 361
 
362 362
         if ($this->shop->showLoginUrl()) {
363
-            $body .=  "\n\n" . $this->contact->getLoginUrl();
363
+            $body .= "\n\n".$this->contact->getLoginUrl();
364 364
         }
365 365
 
366 366
         if (!$email->save(array('contact_id' => $this->contact->get('id'),
@@ -435,9 +435,9 @@  discard block
 block discarded – undo
435 435
         $this->kernel->useShared('email');
436 436
         $email = new Email($this->kernel);
437 437
 
438
-        $subject = 'Bekræftelse på betaling (#' . $payment_id . ')';
438
+        $subject = 'Bekræftelse på betaling (#'.$payment_id.')';
439 439
         $body = 'Vi har modtaget din betaling. Hvis din ordre var afsendt inden kl. 12.00, sender vi den allerede i dag.';
440
-        $body .= "\n\nVenlig hilsen\n".  $this->kernel->intranet->address->get('name');
440
+        $body .= "\n\nVenlig hilsen\n".$this->kernel->intranet->address->get('name');
441 441
 
442 442
         if (!$email->save(array('contact_id' => $this->contact->get('id'),
443 443
                                 'subject' => $subject,
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -193,12 +193,16 @@
 block discarded – undo
193 193
         $value['message'] = $input['message'];
194 194
 
195 195
         if (isset($input['customer_coupon']) && $input['customer_coupon'] != '') {
196
-            if ($value['message'] != '') $value['message'] .= "\n\n";
196
+            if ($value['message'] != '') {
197
+                $value['message'] .= "\n\n";
198
+            }
197 199
             $value['message'] .= "Kundekupon:". $input['customer_coupon'];
198 200
         }
199 201
 
200 202
         if (isset($input['customer_comment']) && $input['customer_comment'] != '') {
201
-            if ($value['message'] != '') $value['message'] .= "\n\n";
203
+            if ($value['message'] != '') {
204
+                $value['message'] .= "\n\n";
205
+            }
202 206
             $value['message'] .= "Kommentar:\n". $input['customer_comment'];
203 207
         }
204 208
 
Please login to merge, or discard this patch.
src/Intraface/modules/shop/FeaturedProducts.php 2 patches
Doc Comments   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -33,10 +33,9 @@
 block discarded – undo
33 33
     }
34 34
 
35 35
     /**
36
-     * @param string $headline Headline
37
-     * @param object $keyword  Keyword object
36
+     * @param Keyword $keyword  Keyword object
38 37
      *
39
-     * @return integer
38
+     * @return boolean
40 39
      */
41 40
     function add($description, $keyword)
42 41
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     {
43 43
         $result = $this->db->query('SELECT id 
44 44
                                     FROM shop_featuredproducts 
45
-                                    WHERE intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer') . ' 
46
-                                        AND shop_id = ' . $this->db->quote($this->shop->getId(), 'integer') . ' 
45
+                                    WHERE intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer').' 
46
+                                        AND shop_id = ' . $this->db->quote($this->shop->getId(), 'integer').' 
47 47
                                         AND keyword_id  = ' . $this->db->quote($keyword->getId(), 'integer'));
48 48
         if (PEAR::isError($result)) {
49 49
             throw new Exception($result->getUserInfo());
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     function delete($id)
73 73
     {
74
-        $result = $this->db->query('DELETE FROM shop_featuredproducts WHERE intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer') . ' AND shop_id = ' . $this->db->quote($this->shop->getId(), 'integer') . ' AND id  = ' . $this->db->quote($id, 'integer'));
74
+        $result = $this->db->query('DELETE FROM shop_featuredproducts WHERE intranet_id = '.$this->db->quote($this->intranet->getId(), 'integer').' AND shop_id = '.$this->db->quote($this->shop->getId(), 'integer').' AND id  = '.$this->db->quote($id, 'integer'));
75 75
         if (PEAR::isError($result)) {
76 76
             throw new Exception($result->getUserInfo());
77 77
         }
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     function getAll()
82 82
     {
83 83
         $result = $this->db->query('SELECT * FROM shop_featuredproducts 
84
-                                    WHERE intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer') . ' 
84
+                                    WHERE intranet_id = ' . $this->db->quote($this->intranet->getId(), 'integer').' 
85 85
                                         AND shop_id = ' . $this->db->quote($this->shop->getId(), 'integer'));
86 86
         if (PEAR::isError($result)) {
87 87
             throw new Exception($result->getUserInfo());
Please login to merge, or discard this patch.
src/Intraface/modules/stock/Stock.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -9,6 +9,9 @@
 block discarded – undo
9 9
     public $value;
10 10
     private $kernel;
11 11
 
12
+    /**
13
+     * @param Intraface_modules_product_Variation $variation
14
+     */
12 15
     function __construct($product, $variation = NULL)
13 16
     {
14 17
         $this->product = $product;
Please login to merge, or discard this patch.
src/Intraface/modules/todo/TodoItem.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 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
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');
@@ -101,20 +101,20 @@  discard block
 block discarded – undo
101 101
         $db = new DB_Sql;
102 102
 
103 103
         if ($this->id == 0) {
104
-            $db->query("SELECT position FROM todo_item WHERE todo_list_id = " . $this->todo->get('id') . " ORDER BY position DESC LIMIT 1");
104
+            $db->query("SELECT position FROM todo_item WHERE todo_list_id = ".$this->todo->get('id')." ORDER BY position DESC LIMIT 1");
105 105
             $db->nextRecord();
106 106
             $new_position = $db->f('position') + 1;
107 107
         }
108 108
 
109 109
         if ($this->id == 0) {
110 110
             $sql_type = "INSERT INTO ";
111
-            $sql_end = ", date_created = NOW(), position = " . $new_position;
111
+            $sql_end = ", date_created = NOW(), position = ".$new_position;
112 112
         } else {
113 113
             $sql_type = "UPDATE ";
114
-            $sql_end = " WHERE id = " . $this->id;
114
+            $sql_end = " WHERE id = ".$this->id;
115 115
         }
116 116
 
117
-        $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);
117
+        $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);
118 118
 
119 119
         if ($this->id == 0) {
120 120
             $this->id = $db->insertedId();
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
             return false;
134 134
         }
135 135
         $db = new DB_Sql;
136
-        $db->query("UPDATE todo_item SET status = 1 WHERE id = " . $this->id);
136
+        $db->query("UPDATE todo_item SET status = 1 WHERE id = ".$this->id);
137 137
         return true;
138 138
     }
139 139
 
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
             return false;
149 149
         }
150 150
         $db = new DB_Sql;
151
-        $db->query("UPDATE todo_item SET active = 0 WHERE id = " . $this->id);
151
+        $db->query("UPDATE todo_item SET active = 0 WHERE id = ".$this->id);
152 152
         return true;
153 153
     }
154 154
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -94,7 +94,9 @@
 block discarded – undo
94 94
      */
95 95
     public function save($var, $user_id = 0)
96 96
     {
97
-        if (empty($var)) return;
97
+        if (empty($var)) {
98
+            return;
99
+        }
98 100
         $var = safeToDb($var);
99 101
         $user_id = intval($user_id);
100 102
 
Please login to merge, or discard this patch.