@@ -46,6 +46,9 @@ |
||
| 46 | 46 | ); |
| 47 | 47 | */ |
| 48 | 48 | |
| 49 | + /** |
|
| 50 | + * @param integer $id |
|
| 51 | + */ |
|
| 49 | 52 | function __construct($kernel, $id) |
| 50 | 53 | { |
| 51 | 54 | parent::__construct($kernel, $id); |
@@ -142,8 +142,8 @@ |
||
| 142 | 142 | |
| 143 | 143 | function getSettings() |
| 144 | 144 | { |
| 145 | - $this->value['password'] = $this->kernel->setting->get('intranet', 'onlinepayment.dandomain.password'); |
|
| 146 | - $this->value['merchant_id'] = $this->kernel->setting->get('intranet', 'onlinepayment.dandomain.merchant_id'); |
|
| 145 | + $this->value['password'] = $this->kernel->setting->get('intranet', 'onlinepayment.dandomain.password'); |
|
| 146 | + $this->value['merchant_id'] = $this->kernel->setting->get('intranet', 'onlinepayment.dandomain.merchant_id'); |
|
| 147 | 147 | return $this->value; |
| 148 | 148 | } |
| 149 | 149 | |
@@ -95,7 +95,7 @@ |
||
| 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 | { |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | |
| 87 | 87 | return $this->eval; |
| 88 | 88 | } |
| 89 | - **/ |
|
| 89 | + **/ |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @todo does what? |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | $this->quickpay = new quickpay; |
| 59 | 59 | $this->quickpay->set_md5checkword($this->settings['md5_secret']); |
| 60 | 60 | $this->quickpay->set_merchant($this->settings['merchant_id']); |
| 61 | - $this->quickpay->set_curl_certificate(dirname(__FILE__) . '/../../../certificates/cacert.pem'); |
|
| 61 | + $this->quickpay->set_curl_certificate(dirname(__FILE__).'/../../../certificates/cacert.pem'); |
|
| 62 | 62 | |
| 63 | 63 | // hvordan bliver disse sat - og hvad er det n�jagtigt? |
| 64 | 64 | $this->quickpay->set_posc($this->posc); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | // henter bel�bene fra denne onlinebetaling |
| 106 | 106 | $this->quickpay->set_transaction($this->get('transaction_number')); |
| 107 | - $this->quickpay->set_amount(round($this->get('amount') * 100)); |
|
| 107 | + $this->quickpay->set_amount(round($this->get('amount')*100)); |
|
| 108 | 108 | |
| 109 | 109 | $this->eval = $this->quickpay->capture(); |
| 110 | 110 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->setStatus("reversed"); |
| 131 | 131 | return true; |
| 132 | 132 | } else { |
| 133 | - $this->error->set('Betalingen kunne ikke tilbagebetales: ' . $this->eval['qpstatmsg']); |
|
| 133 | + $this->error->set('Betalingen kunne ikke tilbagebetales: '.$this->eval['qpstatmsg']); |
|
| 134 | 134 | return false; |
| 135 | 135 | } |
| 136 | 136 | } else { |
@@ -184,8 +184,8 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | function getSettings() |
| 186 | 186 | { |
| 187 | - $this->value['md5_secret'] = $this->kernel->setting->get('intranet', 'onlinepayment.quickpay.md5_secret'); |
|
| 188 | - $this->value['merchant_id'] = $this->kernel->setting->get('intranet', 'onlinepayment.quickpay.merchant_id'); |
|
| 187 | + $this->value['md5_secret'] = $this->kernel->setting->get('intranet', 'onlinepayment.quickpay.md5_secret'); |
|
| 188 | + $this->value['merchant_id'] = $this->kernel->setting->get('intranet', 'onlinepayment.quickpay.merchant_id'); |
|
| 189 | 189 | return $this->value; |
| 190 | 190 | } |
| 191 | 191 | |
@@ -182,7 +182,7 @@ discard block |
||
| 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 |
||
| 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 | { |
@@ -41,7 +41,7 @@ discard block |
||
| 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() |
@@ -158,14 +158,14 @@ discard block |
||
| 158 | 158 | function any() |
| 159 | 159 | { |
| 160 | 160 | $db = new DB_Sql; |
| 161 | - $db->query("SELECT id FROM procurement WHERE intranet_id = " . $this->kernel->intranet->get('id')); |
|
| 161 | + $db->query("SELECT id FROM procurement WHERE intranet_id = ".$this->kernel->intranet->get('id')); |
|
| 162 | 162 | return $db->numRows(); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | function anyByContact($contact_id) |
| 166 | 166 | { |
| 167 | 167 | $db = new DB_Sql; |
| 168 | - $db->query("SELECT id FROM procurement WHERE intranet_id = " . $this->kernel->intranet->get('id')." AND contact_id = ".$contact_id." AND active = 1"); |
|
| 168 | + $db->query("SELECT id FROM procurement WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND contact_id = ".$contact_id." AND active = 1"); |
|
| 169 | 169 | return $db->numRows(); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | { |
| 215 | 215 | $sql = "SELECT id |
| 216 | 216 | FROM procurement |
| 217 | - WHERE intranet_id = " . $this->kernel->intranet->get("id") . " |
|
| 217 | + WHERE intranet_id = " . $this->kernel->intranet->get("id")." |
|
| 218 | 218 | AND contact_id = ".(int)$contact_id." |
| 219 | 219 | AND active = 1"; |
| 220 | 220 | |
@@ -36,7 +36,6 @@ discard block |
||
| 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 |
||
| 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 | { |
@@ -51,7 +51,6 @@ |
||
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Creates the dbquery object |
| 54 | - |
|
| 55 | 54 | * @return void |
| 56 | 55 | */ |
| 57 | 56 | public function getDBQuery() |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | 'INNER', |
| 140 | 140 | 'ilib_category', |
| 141 | 141 | 'ilib_category_append.category_id = ilib_category.id', |
| 142 | - 'ilib_category.intranet_id = '.$this->kernel->intranet->getId(). ' ' . |
|
| 143 | - 'AND ilib_category.belong_to = '.$category_type->getBelongTo().' ' . |
|
| 142 | + 'ilib_category.intranet_id = '.$this->kernel->intranet->getId().' '. |
|
| 143 | + 'AND ilib_category.belong_to = '.$category_type->getBelongTo().' '. |
|
| 144 | 144 | 'AND ilib_category.belong_to_id = '.$category_type->getBelongToId() |
| 145 | 145 | ); |
| 146 | 146 | |
@@ -207,7 +207,7 @@ discard block |
||
| 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 | } |
@@ -594,7 +594,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 1040 | 1039 | /** |
| 1041 | 1040 | * Gets the details |
| 1042 | 1041 | * |
| 1043 | - * @return object |
|
| 1042 | + * @return ProductDetail |
|
| 1044 | 1043 | */ |
| 1045 | 1044 | function getDetails() |
| 1046 | 1045 | { |
@@ -115,7 +115,6 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * Creates the dbquery object |
| 118 | - |
|
| 119 | 118 | * @return void |
| 120 | 119 | */ |
| 121 | 120 | public function getDBQuery() |
@@ -569,7 +568,7 @@ discard block |
||
| 569 | 568 | $product_number = (int)$product_number; |
| 570 | 569 | |
| 571 | 570 | $db = new DB_Sql; |
| 572 | - $sql = "SELECT product.id FROM product |
|
| 571 | + $sql = "SELECT product.id FROM product |
|
| 573 | 572 | INNER JOIN product_detail detail |
| 574 | 573 | ON product.id = detail.product_id |
| 575 | 574 | WHERE detail.number = '" . $product_number . "' |
@@ -818,7 +817,7 @@ discard block |
||
| 818 | 817 | "AND product_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." " . |
| 819 | 818 | "WHERE product_x_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." " . |
| 820 | 819 | "AND product_x_attribute_group.product_id=" . $this->getId() . " " . |
| 821 | - "ORDER BY product_attribute_group.id"); |
|
| 820 | + "ORDER BY product_attribute_group.id"); |
|
| 822 | 821 | |
| 823 | 822 | if (PEAR::isError($result)) { |
| 824 | 823 | throw new Exception('Error in query :'.$result->getUserInfo()); |
@@ -146,8 +146,8 @@ discard block |
||
| 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; |
@@ -396,13 +396,13 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | if ($this->id > 0) { |
| 398 | 398 | $sql_type = "UPDATE "; |
| 399 | - $sql_end = " WHERE id = " . $this->id . " AND intranet_id = " . $this->intranet->getId(); |
|
| 399 | + $sql_end = " WHERE id = ".$this->id." AND intranet_id = ".$this->intranet->getId(); |
|
| 400 | 400 | } else { |
| 401 | 401 | $sql_type = "INSERT INTO"; |
| 402 | - $sql_end = ", intranet_id = " . $this->intranet->getId(); |
|
| 402 | + $sql_end = ", intranet_id = ".$this->intranet->getId(); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - $this->db->query($sql_type . " product SET ".$sql." changed_date = NOW()" . $sql_end); |
|
| 405 | + $this->db->query($sql_type." product SET ".$sql." changed_date = NOW()".$sql_end); |
|
| 406 | 406 | |
| 407 | 407 | if (empty($this->id)) { |
| 408 | 408 | $this->id = $this->db->insertedId(); |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | |
| 436 | 436 | $new_id = $product->save( |
| 437 | 437 | array( |
| 438 | - 'name' => $this->get('name') . ' (kopi)', |
|
| 438 | + 'name' => $this->get('name').' (kopi)', |
|
| 439 | 439 | 'description' => $this->get('description'), |
| 440 | 440 | 'price' => amountToForm($this->get('price')), // make sure that this is formatted to local format |
| 441 | 441 | 'weight' => (float)$this->get('weight'), |
@@ -505,8 +505,8 @@ discard block |
||
| 505 | 505 | $db = new Db_Sql; |
| 506 | 506 | $sql = "UPDATE product |
| 507 | 507 | SET active = 0 |
| 508 | - WHERE id = " . $this->id. " |
|
| 509 | - AND intranet_id = " . $this->intranet->getId() . " |
|
| 508 | + WHERE id = " . $this->id." |
|
| 509 | + AND intranet_id = " . $this->intranet->getId()." |
|
| 510 | 510 | AND locked = 0"; |
| 511 | 511 | $db->query($sql); |
| 512 | 512 | |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $db = new Db_Sql; |
| 530 | 530 | $sql = "UPDATE product |
| 531 | 531 | SET active = 1 |
| 532 | - WHERE id = " . $this->id. " |
|
| 532 | + WHERE id = " . $this->id." |
|
| 533 | 533 | AND intranet_id = " . $this->intranet->getId(); |
| 534 | 534 | $db->query($sql); |
| 535 | 535 | $this->value['active'] = 1; |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | FROM product |
| 549 | 549 | INNER JOIN product_detail |
| 550 | 550 | ON product_detail.product_id = product.id |
| 551 | - WHERE product.intranet_id = " . $this->intranet->getId() . " |
|
| 551 | + WHERE product.intranet_id = " . $this->intranet->getId()." |
|
| 552 | 552 | ORDER BY product_detail.number DESC LIMIT 1"; |
| 553 | 553 | $db->query($sql); |
| 554 | 554 | if (!$db->nextRecord()) { |
@@ -572,8 +572,8 @@ discard block |
||
| 572 | 572 | $sql = "SELECT product.id FROM product |
| 573 | 573 | INNER JOIN product_detail detail |
| 574 | 574 | ON product.id = detail.product_id |
| 575 | - WHERE detail.number = '" . $product_number . "' |
|
| 576 | - AND detail.product_id <> " . $this->id . " |
|
| 575 | + WHERE detail.number = '" . $product_number."' |
|
| 576 | + AND detail.product_id <> " . $this->id." |
|
| 577 | 577 | AND detail.active = 1 |
| 578 | 578 | AND product.active=1 |
| 579 | 579 | AND product.intranet_id = ".$this->intranet->getId()." LIMIT 1"; |
@@ -631,17 +631,17 @@ discard block |
||
| 631 | 631 | $db = new DB_Sql; |
| 632 | 632 | |
| 633 | 633 | if ($status == 'relate') { |
| 634 | - $db->query("SELECT * FROM product_related WHERE product_id=" . $this->id . " AND related_product_id = " . (int)$id . " AND intranet_id =" .$this->intranet->getId()); |
|
| 634 | + $db->query("SELECT * FROM product_related WHERE product_id=".$this->id." AND related_product_id = ".(int)$id." AND intranet_id =".$this->intranet->getId()); |
|
| 635 | 635 | if ($db->nextRecord()) { |
| 636 | 636 | return true; |
| 637 | 637 | } |
| 638 | 638 | if ($id == $this->id) { |
| 639 | 639 | return false; |
| 640 | 640 | } |
| 641 | - $db->query("INSERT INTO product_related SET product_id = " . $this->id . ", related_product_id = " . (int)$id . ", intranet_id = " . $this->intranet->getId()); |
|
| 641 | + $db->query("INSERT INTO product_related SET product_id = ".$this->id.", related_product_id = ".(int)$id.", intranet_id = ".$this->intranet->getId()); |
|
| 642 | 642 | return true; |
| 643 | 643 | } else { |
| 644 | - $db->query("DELETE FROM product_related WHERE product_id = " . $this->id . " AND intranet_id = " . $this->intranet->getId() . " AND related_product_id = " . (int)$id); |
|
| 644 | + $db->query("DELETE FROM product_related WHERE product_id = ".$this->id." AND intranet_id = ".$this->intranet->getId()." AND related_product_id = ".(int)$id); |
|
| 645 | 645 | return true; |
| 646 | 646 | } |
| 647 | 647 | } |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | public function deleteRelatedProduct($id) |
| 657 | 657 | { |
| 658 | 658 | $db = new DB_Sql; |
| 659 | - $db->query("DELETE FROM product_related WHERE product_id = " . $this->id . " AND intranet_id = " . $this->intranet->getId() . " AND related_product_id = " . (int)$id); |
|
| 659 | + $db->query("DELETE FROM product_related WHERE product_id = ".$this->id." AND intranet_id = ".$this->intranet->getId()." AND related_product_id = ".(int)$id); |
|
| 660 | 660 | return true; |
| 661 | 661 | } |
| 662 | 662 | |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | public function deleteRelatedProducts() |
| 671 | 671 | { |
| 672 | 672 | $db = new DB_Sql; |
| 673 | - $db->query("DELETE FROM product_related WHERE product_id = " . $this->id . " AND intranet_id = " . $this->intranet->getId()); |
|
| 673 | + $db->query("DELETE FROM product_related WHERE product_id = ".$this->id." AND intranet_id = ".$this->intranet->getId()); |
|
| 674 | 674 | return true; |
| 675 | 675 | } |
| 676 | 676 | |
@@ -685,12 +685,12 @@ discard block |
||
| 685 | 685 | $key = 0; |
| 686 | 686 | $ids = array(); |
| 687 | 687 | $db = new DB_Sql; |
| 688 | - $sql = "SELECT related_product_id FROM product_related WHERE product_id = " . $this->id . " AND intranet_id = " . $this->intranet->getId(); |
|
| 688 | + $sql = "SELECT related_product_id FROM product_related WHERE product_id = ".$this->id." AND intranet_id = ".$this->intranet->getId(); |
|
| 689 | 689 | $db->query($sql); |
| 690 | 690 | |
| 691 | 691 | // r�kkef�lgen er vigtig - f�rst hente fra product og bagefter tilf�je nye v�rdier til arrayet |
| 692 | 692 | while ($db->nextRecord()) { |
| 693 | - $product = new Product($this->kernel, $db->f('related_product_id')); |
|
| 693 | + $product = new Product($this->kernel, $db->f('related_product_id')); |
|
| 694 | 694 | if ($product->get('id') == 0 || $product->get('active') == 0 || ($show == 'webshop' && $product->get('do_show') == 0)) { |
| 695 | 695 | continue; |
| 696 | 696 | } |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | } |
| 726 | 726 | // den her skal vist lige kigges igennem, for den tager jo alt med p� nettet? |
| 727 | 727 | // 0 = only stock |
| 728 | - if ($this->kernel->setting->get('intranet', 'webshop.show_online') == 0 and !empty($which) and $which=='webshop') { // only stock |
|
| 728 | + if ($this->kernel->setting->get('intranet', 'webshop.show_online') == 0 and !empty($which) and $which == 'webshop') { // only stock |
|
| 729 | 729 | if (array_key_exists('for_sale', $products[$key]['stock_status']) and $products[$key]['stock_status']['for_sale'] <= 0) { |
| 730 | 730 | continue; |
| 731 | 731 | } |
@@ -754,7 +754,7 @@ discard block |
||
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | $db = MDB2::singleton(DB_DSN); |
| 757 | - $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); |
|
| 757 | + $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); |
|
| 758 | 758 | if (PEAR::isError($result)) { |
| 759 | 759 | throw new Exception('Error in query :'.$result->getUserInfo()); |
| 760 | 760 | } |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | if ($result->numRows() > 0) { |
| 763 | 763 | return true; |
| 764 | 764 | } |
| 765 | - $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()); |
|
| 765 | + $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()); |
|
| 766 | 766 | if (PEAR::isError($result)) { |
| 767 | 767 | throw new Exception('Error in insert :'.$result->getUserInfo()); |
| 768 | 768 | } |
@@ -784,7 +784,7 @@ discard block |
||
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | $db = MDB2::singleton(DB_DSN); |
| 787 | - $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); |
|
| 787 | + $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); |
|
| 788 | 788 | if (PEAR::isError($result)) { |
| 789 | 789 | throw new Exception('Error in query :'.$result->getUserInfo()); |
| 790 | 790 | } |
@@ -812,12 +812,12 @@ discard block |
||
| 812 | 812 | // NOTE: Very important that it is ordered by product_attribute_group.id so the groups |
| 813 | 813 | // does always get attached to the correct attribute number on the variation. Se above todo in method doc |
| 814 | 814 | $db = MDB2::singleton(DB_DSN); |
| 815 | - $result = $db->query("SELECT product_attribute_group.* FROM product_x_attribute_group " . |
|
| 816 | - "INNER JOIN product_attribute_group " . |
|
| 817 | - "ON product_x_attribute_group.product_attribute_group_id = product_attribute_group.id " . |
|
| 818 | - "AND product_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." " . |
|
| 819 | - "WHERE product_x_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." " . |
|
| 820 | - "AND product_x_attribute_group.product_id=" . $this->getId() . " " . |
|
| 815 | + $result = $db->query("SELECT product_attribute_group.* FROM product_x_attribute_group ". |
|
| 816 | + "INNER JOIN product_attribute_group ". |
|
| 817 | + "ON product_x_attribute_group.product_attribute_group_id = product_attribute_group.id ". |
|
| 818 | + "AND product_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." ". |
|
| 819 | + "WHERE product_x_attribute_group.intranet_id = ".$db->quote($this->intranet->getId())." ". |
|
| 820 | + "AND product_x_attribute_group.product_id=".$this->getId()." ". |
|
| 821 | 821 | "ORDER BY product_attribute_group.id"); |
| 822 | 822 | |
| 823 | 823 | if (PEAR::isError($result)) { |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | public function isFilledIn() |
| 872 | 872 | { |
| 873 | 873 | $db = new DB_Sql; |
| 874 | - $db->query("SELECT count(*) AS antal FROM product WHERE intranet_id = " . $this->intranet->getId()); |
|
| 874 | + $db->query("SELECT count(*) AS antal FROM product WHERE intranet_id = ".$this->intranet->getId()); |
|
| 875 | 875 | if ($db->nextRecord()) { |
| 876 | 876 | return $db->f('antal'); |
| 877 | 877 | } |
@@ -886,7 +886,7 @@ discard block |
||
| 886 | 886 | public function any() |
| 887 | 887 | { |
| 888 | 888 | $db = new DB_Sql; |
| 889 | - $db->query("SELECT id FROM product WHERE intranet_id = " . $this->intranet->getId()." AND active = 1"); |
|
| 889 | + $db->query("SELECT id FROM product WHERE intranet_id = ".$this->intranet->getId()." AND active = 1"); |
|
| 890 | 890 | return $db->numRows(); |
| 891 | 891 | } |
| 892 | 892 | |
@@ -43,7 +43,7 @@ discard block |
||
| 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 |
||
| 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 | { |
@@ -332,24 +332,24 @@ |
||
| 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; |
@@ -77,14 +77,14 @@ discard block |
||
| 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 |
||
| 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); |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | return true; |
| 270 | 270 | } else { |
| 271 | 271 | // vi opdaterer produktet |
| 272 | - $this->db->query("UPDATE product_detail SET active = 0 WHERE product_id = " . $this->product->get('id')); |
|
| 273 | - $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()); |
|
| 272 | + $this->db->query("UPDATE product_detail SET active = 0 WHERE product_id = ".$this->product->get('id')); |
|
| 273 | + $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()); |
|
| 274 | 274 | $this->detail_id = $this->db->insertedId(); |
| 275 | 275 | $this->db->query("INSERT INTO product_detail_translation SET name = \"".$array_var['name']."\", description = \"".$array_var['description']."\", lang = 'da', id = ".$this->detail_id); |
| 276 | 276 | |
@@ -291,17 +291,17 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | public function getPriceInCurrency($currency, $exchange_rate_id = 0) |
| 293 | 293 | { |
| 294 | - return new Ilib_Variable_Float(round($this->get('price') / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100), 2), 'iso'); |
|
| 294 | + return new Ilib_Variable_Float(round($this->get('price')/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100), 2), 'iso'); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | public function getPriceIncludingVat() |
| 298 | 298 | { |
| 299 | - return new Ilib_Variable_Float(round($this->get('price') * (1 + $this->getVatPercent()->getAsIso()/100), 2)); |
|
| 299 | + return new Ilib_Variable_Float(round($this->get('price')*(1 + $this->getVatPercent()->getAsIso()/100), 2)); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | public function getPriceIncludingVatInCurrency($currency, $exchange_rate_id = 0) |
| 303 | 303 | { |
| 304 | - 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'); |
|
| 304 | + 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'); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | public function getBeforePrice() |
@@ -311,17 +311,17 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | public function getBeforePriceInCurrency($currency, $exchange_rate_id = 0) |
| 313 | 313 | { |
| 314 | - return new Ilib_Variable_Float(round($this->get('price') / ($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso() / 100), 2), 'iso'); |
|
| 314 | + return new Ilib_Variable_Float(round($this->get('price')/($currency->getProductPriceExchangeRate((int)$exchange_rate_id)->getRate()->getAsIso()/100), 2), 'iso'); |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | public function getBeforePriceIncludingVat() |
| 318 | 318 | { |
| 319 | - return new Ilib_Variable_Float(round($this->get('before_price') * (1 + $this->getVatPercent()->getAsIso()/100), 2)); |
|
| 319 | + return new Ilib_Variable_Float(round($this->get('before_price')*(1 + $this->getVatPercent()->getAsIso()/100), 2)); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | public function getBeforePriceIncludingVatInCurrency($currency, $exchange_rate_id = 0) |
| 323 | 323 | { |
| 324 | - 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'); |
|
| 324 | + 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'); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | public function getVatPercent() |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | function setStateAccountId($id) |
| 373 | 373 | { |
| 374 | 374 | $db = new DB_Sql; |
| 375 | - $db->query('UPDATE product_detail SET state_account_id = ' . $id . ' WHERE id = ' . $this->detail_id); |
|
| 375 | + $db->query('UPDATE product_detail SET state_account_id = '.$id.' WHERE id = '.$this->detail_id); |
|
| 376 | 376 | $this->load(); |
| 377 | 377 | $this->product->load(); |
| 378 | 378 | return true; |
@@ -259,7 +259,6 @@ |
||
| 259 | 259 | /** |
| 260 | 260 | * Set attribute for product |
| 261 | 261 | * |
| 262 | - * @param integer $id Attribute id to relate to this product |
|
| 263 | 262 | * |
| 264 | 263 | * @return boolean |
| 265 | 264 | */ |
@@ -83,7 +83,7 @@ |
||
| 83 | 83 | |
| 84 | 84 | public function getCollectedErrorStack() |
| 85 | 85 | { |
| 86 | - $stack =& $this->getErrorStack(); |
|
| 86 | + $stack = & $this->getErrorStack(); |
|
| 87 | 87 | if (is_object($this->active_details)) { |
| 88 | 88 | foreach ($this->active_details->getErrorStack() as $field => $errors) { |
| 89 | 89 | foreach ($errors as $error) { |
@@ -82,6 +82,9 @@ |
||
| 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')) { |
@@ -28,7 +28,7 @@ |
||
| 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 | ); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * |
| 138 | 138 | * @param string $headerImg The filepath for the header image |
| 139 | 139 | * |
| 140 | - * @return void |
|
| 140 | + * @return false|null |
|
| 141 | 141 | */ |
| 142 | 142 | public function addHeader($headerImg = '') |
| 143 | 143 | { |
@@ -191,6 +191,7 @@ discard block |
||
| 191 | 191 | * write the document to a file |
| 192 | 192 | * |
| 193 | 193 | * @param string $data The data to write |
| 194 | + * @param string $filnavn |
|
| 194 | 195 | * |
| 195 | 196 | * @return void |
| 196 | 197 | */ |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | // Notice that the placement of the characters are different in the two tables. Placement is correct in the first. |
| 43 | 43 | |
| 44 | 44 | $diff = array(230 => 'ae', |
| 45 | - 198 => 'AE', |
|
| 46 | - 248 => 'oslash', |
|
| 47 | - 216 => 'Oslash', |
|
| 48 | - 229 => 'aring', |
|
| 49 | - 197 => 'Aring'); |
|
| 45 | + 198 => 'AE', |
|
| 46 | + 248 => 'oslash', |
|
| 47 | + 216 => 'Oslash', |
|
| 48 | + 229 => 'aring', |
|
| 49 | + 197 => 'Aring'); |
|
| 50 | 50 | |
| 51 | 51 | parent::selectFont('Helvetica.afm', array('differences' => $diff)); |
| 52 | 52 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $this->setY(0); |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - /** |
|
| 165 | + /** |
|
| 166 | 166 | * create a round rectangle |
| 167 | 167 | * |
| 168 | 168 | * @param integer $x The starting x point |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | parent::partEllipse($x+$width-$round, $y+$round, 270, 360, $round); |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - /** |
|
| 190 | + /** |
|
| 191 | 191 | * write the document to a file |
| 192 | 192 | * |
| 193 | 193 | * @param string $data The data to write |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | if (is_int($value)) { |
| 105 | 105 | $this->value['x'] = $this->get('margin_left') + $value; |
| 106 | 106 | } elseif (is_string($value) && substr($value, 0, 1) == "+") { |
| 107 | - $this->value['x'] += intval(substr($value, 1)); |
|
| 107 | + $this->value['x'] += intval(substr($value, 1)); |
|
| 108 | 108 | } elseif (is_string($value) && substr($value, 0, 1) == "-") { |
| 109 | 109 | $this->value['x'] -= intval(substr($value, 1)); |
| 110 | 110 | } else { |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | $height = $this->get('header_height'); |
| 152 | 152 | ; |
| 153 | - $width = $size[0] * ($height/$size[1]); |
|
| 153 | + $width = $size[0]*($height/$size[1]); |
|
| 154 | 154 | |
| 155 | 155 | if ($width > $this->get('content_width')) { |
| 156 | 156 | $width = $this->get('content_width'); |
| 157 | - $height = $size[1] * ($width/$size[0]); |
|
| 157 | + $height = $size[1]*($width/$size[0]); |
|
| 158 | 158 | } |
| 159 | 159 | parent::addJpegFromFile($headerImg, $this->get('right_margin_position') - $width, $this->page_height - $this->get('header_margin_top') - $height, $width, $height); // , ($this->value["page_width"] - $this->value["margin_left"])/10 |
| 160 | 160 | parent::closeObject(); |
@@ -177,15 +177,15 @@ discard block |
||
| 177 | 177 | public function roundRectangle($x, $y, $width, $height, $round) |
| 178 | 178 | { |
| 179 | 179 | parent::setLineStyle(1); |
| 180 | - parent::line($x, $y+$round, $x, $y+$height-$round); |
|
| 181 | - parent::line($x+$round, $y+$height, $x+$width-$round, $y+$height); |
|
| 182 | - parent::line($x+$width, $y+$height-$round, $x+$width, $y+$round-1); |
|
| 183 | - parent::line($x+$width-$round, $y, $x+$round, $y); |
|
| 184 | - |
|
| 185 | - parent::partEllipse($x+$round, $y+$round, 180, 270, $round); |
|
| 186 | - parent::partEllipse($x+$round, $y+$height-$round, 90, 180, $round); |
|
| 187 | - parent::partEllipse($x+$width-$round, $y+$height-$round, 0, 90, $round); |
|
| 188 | - parent::partEllipse($x+$width-$round, $y+$round, 270, 360, $round); |
|
| 180 | + parent::line($x, $y + $round, $x, $y + $height - $round); |
|
| 181 | + parent::line($x + $round, $y + $height, $x + $width - $round, $y + $height); |
|
| 182 | + parent::line($x + $width, $y + $height - $round, $x + $width, $y + $round - 1); |
|
| 183 | + parent::line($x + $width - $round, $y, $x + $round, $y); |
|
| 184 | + |
|
| 185 | + parent::partEllipse($x + $round, $y + $round, 180, 270, $round); |
|
| 186 | + parent::partEllipse($x + $round, $y + $height - $round, 90, 180, $round); |
|
| 187 | + parent::partEllipse($x + $width - $round, $y + $height - $round, 0, 90, $round); |
|
| 188 | + parent::partEllipse($x + $width - $round, $y + $round, 270, 360, $round); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |