@@ -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 |
@@ -34,7 +34,7 @@ |
||
34 | 34 | |
35 | 35 | $data = array('product' => $product, 'groups' => $groups); |
36 | 36 | |
37 | - $smarty = $this->template->create(dirname(__FILE__) . '/tpl/productattributegroup'); |
|
37 | + $smarty = $this->template->create(dirname(__FILE__).'/tpl/productattributegroup'); |
|
38 | 38 | return $smarty->render($this, $data); |
39 | 39 | } |
40 | 40 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | |
93 | 93 | $data = array('products' => $list); |
94 | 94 | |
95 | - $smarty = $this->template->create(dirname(__FILE__) . '/tpl/selectproduct'); |
|
95 | + $smarty = $this->template->create(dirname(__FILE__).'/tpl/selectproduct'); |
|
96 | 96 | return $smarty->render($this, $data); |
97 | 97 | } |
98 | 98 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <div id="colOne"> |
2 | 2 | |
3 | 3 | <div class="box"> |
4 | - <h2><?php e(t('Product')); ?> #<?php e($product->get('number')); ?> <?php e($product->get('name')); ?></h2> |
|
5 | - <h2><?php e(t('Variation')); ?> #<?php e($variation->getNumber()); ?> <?php e($variation->getName()); ?></h2> |
|
4 | + <h2><?php e(t('Product')); ?> #<?php e($product->get('number')); ?> <?php e($product->get('name')); ?></h2> |
|
5 | + <h2><?php e(t('Variation')); ?> #<?php e($variation->getNumber()); ?> <?php e($variation->getName()); ?></h2> |
|
6 | 6 | <ul class="options"> |
7 | 7 | <li><a href="<?php e(url('../../')); ?>"><?php e(t('close')); ?></a></li> |
8 | 8 | </ul> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <div id="colOne"> |
2 | 2 | |
3 | 3 | <div class="box"> |
4 | - <h2>#<?php e($product->get('number')); ?> <?php e($product->get('name')); ?></h2> |
|
4 | + <h2>#<?php e($product->get('number')); ?> <?php e($product->get('name')); ?></h2> |
|
5 | 5 | <ul class="options"> |
6 | 6 | <?php if ($product->get('locked') != 1) { ?> |
7 | 7 | <li><a href="<?php e(url(null, array('edit'))); ?>"><?php e(t('Edit')); ?></a></li> |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | <td> |
40 | 40 | <?php |
41 | 41 | // getting settings |
42 | - $unit_choises = Product::getUnits(); |
|
42 | + $unit_choises = Product::getUnits(); |
|
43 | 43 | e(t($unit_choises[$product->get('unit_id')]['combined'])); |
44 | 44 | ?> |
45 | 45 | </td> |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } else { |
94 | 94 | $account = Account::factory($year, $product->get('state_account_id')); |
95 | 95 | if ($account->get('name')) { |
96 | - e($account->get('number') . ' ' . $account->get('name')); |
|
96 | + e($account->get('number').' '.$account->get('name')); |
|
97 | 97 | } else { |
98 | 98 | echo t('Not set'); |
99 | 99 | } |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | <td><?php e($variation->getNumber()); ?></td> |
166 | 166 | <td><?php e($variation->getName()); ?></td> |
167 | 167 | <td><?php e($variation->getDetail()->getPrice($product)->getAsLocal('da_dk', 2)); ?> </td> |
168 | - <td><?php e($product->get('weight')+$variation->getDetail()->getWeightDifference()); ?></td> |
|
168 | + <td><?php e($product->get('weight') + $variation->getDetail()->getWeightDifference()); ?></td> |
|
169 | 169 | <?php if ($kernel->user->hasModuleAccess("stock") and $product->get('stock')) : ?> |
170 | 170 | <td><?php e($variation->getStock($product)->get('actual_stock')); ?></td> |
171 | - <td><a href="<?php e(url('variation/' . $variation->getId())); ?>"><?php e(t('Details')); ?></a></td> |
|
171 | + <td><a href="<?php e(url('variation/'.$variation->getId())); ?>"><?php e(t('Details')); ?></a></td> |
|
172 | 172 | <?php endif; ?> |
173 | 173 | |
174 | 174 | </tr> |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | $related = $product->getRelatedProducts(); |
198 | 198 | if (!empty($related) and count($related) > 0) { |
199 | 199 | foreach ($related as $p) { |
200 | - echo '<li>'. $p['name']; |
|
200 | + echo '<li>'.$p['name']; |
|
201 | 201 | if ($p['locked'] == 0) { |
202 | - echo ' <a class="delete" href="'.url('related', array('delete', 'del_related' => $p['related_id'])) .'">'.t('remove').'</a>'; |
|
202 | + echo ' <a class="delete" href="'.url('related', array('delete', 'del_related' => $p['related_id'])).'">'.t('remove').'</a>'; |
|
203 | 203 | } |
204 | 204 | echo '</li>'; |
205 | 205 | } |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | <?php $category_type = new Intraface_Category_Type('shop', $shop->getId()); ?> |
255 | 255 | <h3><?php e($shop->getName()); ?></h3> |
256 | 256 | <ul class="options"> |
257 | - <li><a href="<?php e(url('shop/'. $shop->getId() . '/categories/', array('product_id' => $product->getId()))); ?>"><?php e(t('Add product to categories')); ?></a></li> |
|
257 | + <li><a href="<?php e(url('shop/'.$shop->getId().'/categories/', array('product_id' => $product->getId()))); ?>"><?php e(t('Add product to categories')); ?></a></li> |
|
258 | 258 | </ul> |
259 | 259 | <?php |
260 | 260 | $category = new Intraface_Category($kernel, $db, $category_type); |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | </tr> |
7 | 7 | <tr> |
8 | 8 | <td><?php e(t('Number')); ?></td> |
9 | - <td><?php e($product->get('number')); ?></td> |
|
9 | + <td><?php e($product->get('number')); ?></td> |
|
10 | 10 | </tr> |
11 | 11 | <tr> |
12 | 12 | <td><?php e(t('Name')); ?></td> |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | <td><?php e($variation->getNumber()); ?></td> |
88 | 88 | <td><?php e($variation->getName()); ?></td> |
89 | 89 | <td><?php e($variation->getDetail()->getPrice($product)->getAsLocal('da_dk', 2)); ?> </td> |
90 | - <td><?php e($product->get('weight')+$variation->getDetail()->getWeightDifference()); ?></td> |
|
90 | + <td><?php e($product->get('weight') + $variation->getDetail()->getWeightDifference()); ?></td> |
|
91 | 91 | <?php if ($kernel->user->hasModuleAccess("stock") and $product->get('stock')) : ?> |
92 | 92 | <td><?php e($variation->getStock($product)->get('actual_stock')); ?></td> |
93 | 93 | <?php endif; ?> |
@@ -65,7 +65,7 @@ |
||
65 | 65 | <tr> |
66 | 66 | <td> |
67 | 67 | <?php if ($p['has_variation']) : ?> |
68 | - <a href="<?php e(url($p['id'] . '/selectvariation', array('set_quantity' => $context->quantity, 'multiple' => $context->multiple))); ?>" /><?php echo '<img class="variation" src="/images/icons/silk/table_multiple.png" title="'.t("See the product's variations").'"/> '; ?></a> |
|
68 | + <a href="<?php e(url($p['id'].'/selectvariation', array('set_quantity' => $context->quantity, 'multiple' => $context->multiple))); ?>" /><?php echo '<img class="variation" src="/images/icons/silk/table_multiple.png" title="'.t("See the product's variations").'"/> '; ?></a> |
|
69 | 69 | <?php elseif ($context->multiple && $context->quantity) : ?> |
70 | 70 | <input id="<?php e($p['id']); ?>" type="text" name="selected[<?php e($p['id']); ?>]" value="<?php if (isset($selected_products[$p['id']])) : |
71 | 71 | e($selected_products[$p['id']]); |
@@ -152,7 +152,7 @@ |
||
152 | 152 | $year->loadActiveYear(); |
153 | 153 | |
154 | 154 | $account = new Account($year); |
155 | - $accounts = $account->getList('sale'); |
|
155 | + $accounts = $account->getList('sale'); |
|
156 | 156 | |
157 | 157 | ?> |
158 | 158 | <fieldset> |
@@ -53,7 +53,7 @@ |
||
53 | 53 | 'product' => $product |
54 | 54 | ); |
55 | 55 | |
56 | - $smarty = $this->template->create(dirname(__FILE__) . '/tpl/selectproductvariation'); |
|
56 | + $smarty = $this->template->create(dirname(__FILE__).'/tpl/selectproductvariation'); |
|
57 | 57 | return $smarty->render($this, $data); |
58 | 58 | } |
59 | 59 |