@@ -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); |
@@ -262,8 +262,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -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 | */ |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | |
| 85 | 85 | public function getCollectedErrorStack() |
| 86 | 86 | { |
| 87 | - $stack =& $this->getErrorStack(); |
|
| 87 | + $stack = & $this->getErrorStack(); |
|
| 88 | 88 | if (is_object($this->active_details)) { |
| 89 | 89 | foreach ($this->active_details->getErrorStack() AS $field => $errors) { |
| 90 | 90 | foreach ($errors AS $error) { |
@@ -65,6 +65,7 @@ |
||
| 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) |
@@ -45,7 +45,7 @@ |
||
| 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 | } |
@@ -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 | ); |
@@ -9,6 +9,9 @@ |
||
| 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; |
@@ -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 | /** |
@@ -59,6 +59,9 @@ discard block |
||
| 59 | 59 | return $this->controlpanel_files; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | + /** |
|
| 63 | + * @param string $file |
|
| 64 | + */ |
|
| 62 | 65 | function addPreloadFile($file) |
| 63 | 66 | {
|
| 64 | 67 | $this->preload_file[] = $file; |
@@ -81,6 +84,7 @@ discard block |
||
| 81 | 84 | |
| 82 | 85 | /** |
| 83 | 86 | * @todo why is this not using getPath() |
| 87 | + * @param string $file |
|
| 84 | 88 | */ |
| 85 | 89 | function includeSettingFile($file) |
| 86 | 90 | {
|
@@ -351,7 +351,7 @@ |
||
| 351 | 351 | * @param integer $file_id Id of file in the file system |
| 352 | 352 | * @param string $filename Which filename to use |
| 353 | 353 | * |
| 354 | - * @return boolean |
|
| 354 | + * @return integer |
|
| 355 | 355 | */ |
| 356 | 356 | function attachFile($file_id, $filename) |
| 357 | 357 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | $db = new DB_Sql; |
| 83 | 83 | $db->query('SET NAMES utf8'); /* To be removed when everything is in utf-8 */ |
| 84 | - $sql = "SELECT id, email.date_sent, DATE_FORMAT(date_sent, '%d-%m-%Y') as date_sent_dk, subject, from_name, from_email, user_id, body, status, contact_id, contact_person_id, type_id, belong_to_id, status, bcc_to_user FROM email WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = " . $this->id; |
|
| 84 | + $sql = "SELECT id, email.date_sent, DATE_FORMAT(date_sent, '%d-%m-%Y') as date_sent_dk, subject, from_name, from_email, user_id, body, status, contact_id, contact_person_id, type_id, belong_to_id, status, bcc_to_user FROM email WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = ".$this->id; |
|
| 85 | 85 | $db->query($sql); |
| 86 | 86 | if (!$db->nextRecord()) { |
| 87 | 87 | return false; |
@@ -174,12 +174,12 @@ discard block |
||
| 174 | 174 | if ($this->id == 0) { |
| 175 | 175 | $sql_type = "INSERT INTO "; |
| 176 | 176 | $sql_end = ", date_created = NOW(), |
| 177 | - belong_to_id = ".(int)$var['belong_to'] . ", |
|
| 178 | - type_id = ".(int)$var['type_id'] . ", |
|
| 177 | + belong_to_id = ".(int)$var['belong_to'].", |
|
| 178 | + type_id = ".(int)$var['type_id'].", |
|
| 179 | 179 | contact_id=".$var['contact_id']; |
| 180 | 180 | } else { |
| 181 | 181 | $sql_type = "UPDATE "; |
| 182 | - $sql_end = " WHERE id = " . $this->id; |
|
| 182 | + $sql_end = " WHERE id = ".$this->id; |
|
| 183 | 183 | } |
| 184 | 184 | |
| 185 | 185 | if (!empty($var['date_deadline'])) { |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | // gemme userid hvis vi er inde i systemet |
| 192 | 192 | if (is_object($this->kernel->user) AND $this->kernel->user->get('id') > 0) { |
| 193 | 193 | //$db->query("UPDATE email SET user_id = ".$this->kernel->user->get('id')." WHERE id = " . $this->id); |
| 194 | - $sql_extra = ', user_id = ' . $db->quote($this->kernel->user->get('id'), 'integer'); |
|
| 194 | + $sql_extra = ', user_id = '.$db->quote($this->kernel->user->get('id'), 'integer'); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | if (!isset($var['contact_person_id'])) { |
@@ -203,11 +203,11 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // status 1 = draft |
| 206 | - $sql = $sql_type . " email SET |
|
| 206 | + $sql = $sql_type." email SET |
|
| 207 | 207 | contact_person_id = ".(int)$var['contact_person_id'].", |
| 208 | 208 | bcc_to_user = ".(int)$var['bcc_to_user'].", |
| 209 | 209 | date_updated = NOW(), |
| 210 | - intranet_id = " . $this->kernel->intranet->get('id') . ", |
|
| 210 | + intranet_id = " . $this->kernel->intranet->get('id').", |
|
| 211 | 211 | subject = '".$var['subject']."', |
| 212 | 212 | body = '".$var['body']."', |
| 213 | 213 | date_deadline = ".$date_deadline.", |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | function saveErrorMsg($error) |
| 246 | 246 | { |
| 247 | 247 | $db = new DB_Sql; |
| 248 | - $db->query("UPDATE email SET error_msg = '".$error."' WHERE id = " . $this->id); |
|
| 248 | + $db->query("UPDATE email SET error_msg = '".$error."' WHERE id = ".$this->id); |
|
| 249 | 249 | return true; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | return false; |
| 261 | 261 | } |
| 262 | 262 | $db = new DB_Sql; |
| 263 | - $db->query("UPDATE email SET status = 3, date_sent = NOW() WHERE id = " . $this->id); |
|
| 263 | + $db->query("UPDATE email SET status = 3, date_sent = NOW() WHERE id = ".$this->id); |
|
| 264 | 264 | return true; |
| 265 | 265 | } |
| 266 | 266 | |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | |
| 292 | 292 | $db = new DB_Sql; |
| 293 | 293 | // Putter e-mailen i outboxen (status = 2) |
| 294 | - $db->query("UPDATE email SET status = 2 WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = " . $this->id); |
|
| 294 | + $db->query("UPDATE email SET status = 2 WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND id = ".$this->id); |
|
| 295 | 295 | return true; |
| 296 | 296 | } |
| 297 | 297 | |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | { |
| 300 | 300 | $contact = $this->getContact(); |
| 301 | 301 | if ($this->get('contact_id') == 0 OR !is_object($contact)) { |
| 302 | - $this->error->set('Der kunne ikke sendes e-mail til email #' . $this->get('id') . ' fordi der ikke var nogen kunde sat'); |
|
| 302 | + $this->error->set('Der kunne ikke sendes e-mail til email #'.$this->get('id').' fordi der ikke var nogen kunde sat'); |
|
| 303 | 303 | return false; |
| 304 | 304 | } |
| 305 | 305 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | { |
| 384 | 384 | $db = new DB_Sql; |
| 385 | 385 | $db->query("SELECT file_id, filename FROM email_attachment |
| 386 | - WHERE intranet_id = " .$this->kernel->intranet->get('id') . " AND email_id = " . $this->id); |
|
| 386 | + WHERE intranet_id = " .$this->kernel->intranet->get('id')." AND email_id = ".$this->id); |
|
| 387 | 387 | $file = array(); |
| 388 | 388 | $i = 0; |
| 389 | 389 | while ($db->nextRecord()) { |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | return false; |
| 416 | 416 | } |
| 417 | 417 | $db = new DB_Sql; |
| 418 | - $db->query("DELETE FROM email WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id')); |
|
| 418 | + $db->query("DELETE FROM email WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')); |
|
| 419 | 419 | return true; |
| 420 | 420 | } |
| 421 | 421 | |