@@ -23,6 +23,9 @@ |
||
23 | 23 | return $this->context->getKernel(); |
24 | 24 | } |
25 | 25 | |
26 | + /** |
|
27 | + * @return Invoice |
|
28 | + */ |
|
26 | 29 | function getModel() |
27 | 30 | { |
28 | 31 | return $this->context->getModel(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $depreciation = $this->getDepreciation(); |
53 | 53 | if ($id = $depreciation->update($_POST)) { |
54 | 54 | if ($this->getKernel()->user->hasModuleAccess('accounting')) { |
55 | - return new k_SeeOther($this->url($id . '/state')); |
|
55 | + return new k_SeeOther($this->url($id.'/state')); |
|
56 | 56 | } else { |
57 | 57 | return new k_SeeOther($this->url('../')); |
58 | 58 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $invoice_module = $this->getKernel()->useModule('invoice'); |
66 | 66 | $depreciation = $this->getDepreciation(); |
67 | - $smarty = $this->template->create(dirname(__FILE__) . '/templates/depreciation'); |
|
67 | + $smarty = $this->template->create(dirname(__FILE__).'/templates/depreciation'); |
|
68 | 68 | return $smarty->render($this); |
69 | 69 | } |
70 | 70 | } |
71 | 71 | \ No newline at end of file |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * |
144 | 144 | * @param object $kernel Kernel |
145 | 145 | * @param integer $id Debtor id or debtor identifier_key |
146 | - * @param type $tpye String TODO What is this used for as a last parameter? |
|
146 | + * @param type $type String TODO What is this used for as a last parameter? |
|
147 | 147 | */ |
148 | 148 | public static function factory($kernel, $id = 0, $type = "") |
149 | 149 | { |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | /** |
618 | 618 | * S�tter status for debtoren |
619 | 619 | * |
620 | - * @return true / false |
|
620 | + * @return boolean / false |
|
621 | 621 | */ |
622 | 622 | public function setStatus($status) |
623 | 623 | { |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | * @param string $from Where from |
676 | 676 | * @param integer $from_id From id |
677 | 677 | * |
678 | - * @return true / false |
|
678 | + * @return boolean / false |
|
679 | 679 | */ |
680 | 680 | private function setFrom($from = 'manuel', $from_id = 0) |
681 | 681 | { |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | /** |
1142 | 1142 | * Gets the intranet address |
1143 | 1143 | * |
1144 | - * @return object |
|
1144 | + * @return Intraface_Address |
|
1145 | 1145 | */ |
1146 | 1146 | public function getIntranetAddress() |
1147 | 1147 | { |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | /** |
1228 | 1228 | * returns the possible debtor types! |
1229 | 1229 | * |
1230 | - * @return array types |
|
1230 | + * @return string[] types |
|
1231 | 1231 | */ |
1232 | 1232 | static function getDebtorTypes() |
1233 | 1233 | { |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | /** |
1242 | 1242 | * returns the possible places where the debtor comes from |
1243 | 1243 | * |
1244 | - * @return array with the allowed froms |
|
1244 | + * @return string[] with the allowed froms |
|
1245 | 1245 | */ |
1246 | 1246 | private function getFromTypes() |
1247 | 1247 | { |
@@ -1257,7 +1257,7 @@ discard block |
||
1257 | 1257 | /** |
1258 | 1258 | * returns possible status types |
1259 | 1259 | * |
1260 | - * @return array possible status types |
|
1260 | + * @return string[] possible status types |
|
1261 | 1261 | */ |
1262 | 1262 | private function getStatusTypes() |
1263 | 1263 | { |
@@ -1272,7 +1272,7 @@ discard block |
||
1272 | 1272 | /** |
1273 | 1273 | * returns possible payment methods |
1274 | 1274 | * |
1275 | - * @return array possible payment methods |
|
1275 | + * @return string[] possible payment methods |
|
1276 | 1276 | */ |
1277 | 1277 | private function getPaymentMethods() |
1278 | 1278 | { |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | } |
390 | 390 | |
391 | 391 | if ($this->type == "invoice") { |
392 | - // Hvis det er en faktura skal der indtastes en due_date, ellers er det ligegyldigt! |
|
392 | + // Hvis det er en faktura skal der indtastes en due_date, ellers er det ligegyldigt! |
|
393 | 393 | if ($validator->isDate($input["due_date"], "Ugyldig leveringsdato", "allow_no_year")) { |
394 | 394 | $due_date = new Intraface_Date($input["due_date"]); |
395 | 395 | $due_date->convert2db(); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | $input["round_off"] = 0; |
446 | 446 | } |
447 | 447 | |
448 | - // user_id = ".$this->kernel->user->get('id').", // skal puttes p�, men kun hvis det ikke er fra webshop. |
|
448 | + // user_id = ".$this->kernel->user->get('id').", // skal puttes p�, men kun hvis det ikke er fra webshop. |
|
449 | 449 | $db = new DB_Sql; |
450 | 450 | if ($this->id == 0) { |
451 | 451 | |
@@ -717,9 +717,9 @@ discard block |
||
717 | 717 | |
718 | 718 | function getFromShopId() |
719 | 719 | { |
720 | - if ($this->value['where_from'] == 'webshop') { |
|
721 | - return $this->value['where_from_id']; |
|
722 | - } |
|
720 | + if ($this->value['where_from'] == 'webshop') { |
|
721 | + return $this->value['where_from_id']; |
|
722 | + } |
|
723 | 723 | throw new Exception('Not from a shop'); |
724 | 724 | } |
725 | 725 | |
@@ -1130,9 +1130,9 @@ discard block |
||
1130 | 1130 | function getPaymentInformation() |
1131 | 1131 | { |
1132 | 1132 | $info = array('bank_name' => $this->kernel->setting->get("intranet", "bank_name"), |
1133 | - 'bank_reg_number' => $this->kernel->setting->get("intranet", "bank_reg_number"), |
|
1134 | - 'bank_account_number' => $this->kernel->setting->get("intranet", "bank_account_number"), |
|
1135 | - 'giro_account_number' => $this->kernel->setting->get("intranet", "giro_account_number") |
|
1133 | + 'bank_reg_number' => $this->kernel->setting->get("intranet", "bank_reg_number"), |
|
1134 | + 'bank_account_number' => $this->kernel->setting->get("intranet", "bank_account_number"), |
|
1135 | + 'giro_account_number' => $this->kernel->setting->get("intranet", "giro_account_number") |
|
1136 | 1136 | ); |
1137 | 1137 | |
1138 | 1138 | return $info; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | // Bruges til at afg�re, hvor debtor er sendt hent til |
273 | 273 | $db = new DB_Sql; |
274 | - $db->query("SELECT id, type FROM debtor WHERE where_from > 2 AND where_from_id = " . $this->id . " AND active = 1"); |
|
274 | + $db->query("SELECT id, type FROM debtor WHERE where_from > 2 AND where_from_id = ".$this->id." AND active = 1"); |
|
275 | 275 | if ($db->nextRecord()) { |
276 | 276 | if ($db->f('type') > 0) { |
277 | 277 | $types = self::getDebtorTypes(); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | // @todo Currency is always loaded, should be done with left join. Oh give me more doctrine! |
306 | 306 | $currency = $this->getCurrency(); |
307 | 307 | |
308 | - for ($i = 0, $max = count($item), $total = 0, $total_currency = 0; $i<$max; $i++) { |
|
308 | + for ($i = 0, $max = count($item), $total = 0, $total_currency = 0; $i < $max; $i++) { |
|
309 | 309 | $total += $item[$i]["amount"]->getAsIso(); |
310 | 310 | if ($currency) $total_currency += $item[$i]['amount_currency']->getAsIso(); |
311 | 311 | } |
@@ -461,12 +461,12 @@ discard block |
||
461 | 461 | } while ($db->nextRecord()); |
462 | 462 | |
463 | 463 | $sql_type = "INSERT INTO "; |
464 | - $sql_after = ", date_created = NOW(), identifier_key = \"".$identifier."\", intranet_id = " . $this->kernel->intranet->get('id'); |
|
464 | + $sql_after = ", date_created = NOW(), identifier_key = \"".$identifier."\", intranet_id = ".$this->kernel->intranet->get('id'); |
|
465 | 465 | } else { |
466 | 466 | $sql_type = "UPDATE "; |
467 | - $sql_after = " WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id'); |
|
467 | + $sql_after = " WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'); |
|
468 | 468 | } |
469 | - $sql = $sql_type . "debtor SET contact_id = " . $contact->get('id') . ", |
|
469 | + $sql = $sql_type."debtor SET contact_id = ".$contact->get('id').", |
|
470 | 470 | contact_address_id = ".$contact_address_id.", |
471 | 471 | contact_person_id = ".$input['contact_person_id'].", |
472 | 472 | intranet_address_id = ".$this->kernel->intranet->address->get("address_id").", |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | currency_id = ".$currency_id.", |
482 | 482 | currency_product_price_exchange_rate_id = ".$currency_exchange_rate_id.", |
483 | 483 | payment_method=".$input['payment_method'].", |
484 | - girocode='".$input['girocode']."' " . $internal_note_sql . $sql_after; |
|
484 | + girocode='".$input['girocode']."' ".$internal_note_sql.$sql_after; |
|
485 | 485 | |
486 | 486 | // attention_to = '". $input['attention_to'] ."', |
487 | 487 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | } |
494 | 494 | |
495 | 495 | if (is_object($this->kernel->user) AND strtolower(get_class($this->kernel->user)) == 'user') { |
496 | - $db->query("UPDATE debtor SET user_id = ".$this->kernel->user->get('id')." WHERE id = " . $this->id); |
|
496 | + $db->query("UPDATE debtor SET user_id = ".$this->kernel->user->get('id')." WHERE id = ".$this->id); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | $this->load(); |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | return false; |
514 | 514 | } |
515 | 515 | $db = new DB_Sql; |
516 | - $db->query("SELECT id FROM debtor WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id'). " AND type = '".$this->type_key."' LIMIT 1"); |
|
516 | + $db->query("SELECT id FROM debtor WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')." AND type = '".$this->type_key."' LIMIT 1"); |
|
517 | 517 | if ($db->nextRecord()) { |
518 | - $db->query("UPDATE debtor SET active = 0 WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id') . " AND type = '".$this->type_key."'"); |
|
518 | + $db->query("UPDATE debtor SET active = 0 WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')." AND type = '".$this->type_key."'"); |
|
519 | 519 | return true; |
520 | 520 | } |
521 | 521 | return false; |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | |
566 | 566 | switch ($this->type) { |
567 | 567 | case "invoice": |
568 | - $values['due_date'] = date("d-m-Y", time() + 24 * 60 * 60 * $debtor_object->contact->get("paymentcondition")); |
|
568 | + $values['due_date'] = date("d-m-Y", time() + 24*60*60*$debtor_object->contact->get("paymentcondition")); |
|
569 | 569 | if (empty($values['payment_method']) AND $this->kernel->setting->get('intranet', 'bank_account_number')) { |
570 | 570 | $values['payment_method'] = 1; |
571 | 571 | } |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | if ($status_id === false) { |
627 | 627 | throw new Exception("Debtor->setStatus(): Ugyldig status (streng)"); |
628 | 628 | } |
629 | - } else{ |
|
629 | + } else { |
|
630 | 630 | $status_id = intval($status); |
631 | 631 | $status_types = $this->getStatusTypes(); |
632 | 632 | if (isset($status_types[$status_id])) { |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | } |
663 | 663 | |
664 | 664 | $db = new Db_Sql; |
665 | - $db->query("UPDATE debtor SET status = ".$status_id.", ".$sql." WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id')); |
|
665 | + $db->query("UPDATE debtor SET status = ".$status_id.", ".$sql." WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')); |
|
666 | 666 | $this->load(); |
667 | 667 | |
668 | 668 | return true; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | return false; |
690 | 690 | } |
691 | 691 | $db = new Db_Sql; |
692 | - $db->query("UPDATE debtor SET where_from = ".(int)$from.", where_from_id = " . $from_id . " WHERE id = " . $this->id); |
|
692 | + $db->query("UPDATE debtor SET where_from = ".(int)$from.", where_from_id = ".$from_id." WHERE id = ".$this->id); |
|
693 | 693 | return true; |
694 | 694 | } |
695 | 695 | |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | } |
711 | 711 | $contact_id = (int)$contact_id; |
712 | 712 | $db = new DB_Sql; |
713 | - $db->query("UPDATE debtor SET contact_id = " . $contact_id . " WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get("id") . " AND type='".$this->type_key."'"); |
|
713 | + $db->query("UPDATE debtor SET contact_id = ".$contact_id." WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get("id")." AND type='".$this->type_key."'"); |
|
714 | 714 | |
715 | 715 | return true; |
716 | 716 | } |
@@ -739,7 +739,7 @@ discard block |
||
739 | 739 | case 'contact': |
740 | 740 | $sql = "SELECT id |
741 | 741 | FROM debtor |
742 | - WHERE intranet_id = " . $this->kernel->intranet->get("id") . " |
|
742 | + WHERE intranet_id = " . $this->kernel->intranet->get("id")." |
|
743 | 743 | AND contact_id = ".(int)$type_id." |
744 | 744 | AND type='".$this->type_key."' |
745 | 745 | AND active = 1"; |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | public function isFilledIn() |
774 | 774 | { |
775 | 775 | $db = new DB_Sql; |
776 | - $db->query("SELECT id FROM debtor WHERE type = " . $this->type_key . " AND intranet_id = " . $this->kernel->intranet->get('id')); |
|
776 | + $db->query("SELECT id FROM debtor WHERE type = ".$this->type_key." AND intranet_id = ".$this->kernel->intranet->get('id')); |
|
777 | 777 | return $db->numRows(); |
778 | 778 | } |
779 | 779 | |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | { |
979 | 979 | $number = safeToDb($number); |
980 | 980 | $db = new DB_Sql; |
981 | - $sql = "SELECT id FROM debtor WHERE intranet_id = " . $this->kernel->intranet->get('id') . " AND number = '".$number."' AND type = '".$this->type_key."' AND id != " . $this->id." AND active = 1"; |
|
981 | + $sql = "SELECT id FROM debtor WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND number = '".$number."' AND type = '".$this->type_key."' AND id != ".$this->id." AND active = 1"; |
|
982 | 982 | $db->query($sql); |
983 | 983 | if ($db->numRows() == 0) { |
984 | 984 | return true; |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | { |
1064 | 1064 | // FIXME - check on date |
1065 | 1065 | $db = new DB_Sql; |
1066 | - $db->query("UPDATE debtor SET date_stated = '" . $voucher_date . "', voucher_id = '".$voucher_id."' WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id')); |
|
1066 | + $db->query("UPDATE debtor SET date_stated = '".$voucher_date."', voucher_id = '".$voucher_id."' WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')); |
|
1067 | 1067 | return true; |
1068 | 1068 | } |
1069 | 1069 | |
@@ -1307,6 +1307,6 @@ discard block |
||
1307 | 1307 | |
1308 | 1308 | function getPaymentLink($url) |
1309 | 1309 | { |
1310 | - return $url . $this->getIdentifier(); |
|
1310 | + return $url.$this->getIdentifier(); |
|
1311 | 1311 | } |
1312 | 1312 | } |
1313 | 1313 | \ No newline at end of file |
@@ -307,7 +307,9 @@ |
||
307 | 307 | |
308 | 308 | for ($i = 0, $max = count($item), $total = 0, $total_currency = 0; $i<$max; $i++) { |
309 | 309 | $total += $item[$i]["amount"]->getAsIso(); |
310 | - if ($currency) $total_currency += $item[$i]['amount_currency']->getAsIso(); |
|
310 | + if ($currency) { |
|
311 | + $total_currency += $item[$i]['amount_currency']->getAsIso(); |
|
312 | + } |
|
311 | 313 | } |
312 | 314 | |
313 | 315 | // no round off of curreny yet! |
@@ -77,7 +77,6 @@ |
||
77 | 77 | * s� man kan se, hvad folk er interesseret i. |
78 | 78 | * S�gemaskinen skal v�re tolerant for stavefejl |
79 | 79 | * |
80 | - * @param object $search |
|
81 | 80 | * |
82 | 81 | * @return object collection containing products |
83 | 82 | */ |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | ->addWhere('intranet_id = ?', $this->user->getActiveIntranetId()); |
104 | 104 | |
105 | 105 | if ($dbquery->checkFilter("contact_id")) { |
106 | - $query = $query->addWhere("contact_id = ?",intval($dbquery->getFilter("contact_id"))); |
|
106 | + $query = $query->addWhere("contact_id = ?", intval($dbquery->getFilter("contact_id"))); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if ($dbquery->checkFilter("text")) { |
@@ -204,16 +204,16 @@ discard block |
||
204 | 204 | |
205 | 205 | switch ($dbquery->getFilter("sorting")) { |
206 | 206 | case 1: |
207 | - $query = $query->addOrderBy('number ASC, item.position'); |
|
207 | + $query = $query->addOrderBy('number ASC, item.position'); |
|
208 | 208 | break; |
209 | 209 | case 2: |
210 | - $query = $query->addOrderBy('contact.number ASC, item.position'); |
|
210 | + $query = $query->addOrderBy('contact.number ASC, item.position'); |
|
211 | 211 | break; |
212 | 212 | case 3: |
213 | - $query = $query->addOrderBy('contact_address.name ASC, item.position'); |
|
213 | + $query = $query->addOrderBy('contact_address.name ASC, item.position'); |
|
214 | 214 | break; |
215 | 215 | default: |
216 | - $query = $query->addOrderBy('number DESC, item.position'); |
|
216 | + $query = $query->addOrderBy('number DESC, item.position'); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | /** |
21 | 21 | * returns the possible debtor types! |
22 | 22 | * |
23 | - * @return array types |
|
23 | + * @return string[] types |
|
24 | 24 | */ |
25 | 25 | static function getDebtorTypes() |
26 | 26 | { |
@@ -60,8 +60,6 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * Bruges til at lave en menu p� kontakten eller produktet |
62 | 62 | * |
63 | - * @param string $type contact eller product |
|
64 | - * @param integer $type_id id p� contact eller product. |
|
65 | 63 | * |
66 | 64 | * @return integer |
67 | 65 | */ |
@@ -95,6 +93,9 @@ discard block |
||
95 | 93 | return $db->numRows(); |
96 | 94 | } |
97 | 95 | |
96 | + /** |
|
97 | + * @param integer $id |
|
98 | + */ |
|
98 | 99 | function findById($id) |
99 | 100 | { |
100 | 101 | if (is_int($id) && $id != 0) { |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | function getTypeKey() |
40 | 40 | { |
41 | - return array_search( $this->type, $this->getDebtorTypes()); |
|
41 | + return array_search($this->type, $this->getDebtorTypes()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | function getDBQuery() |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $sql = "SELECT id |
71 | 71 | FROM debtor |
72 | - WHERE intranet_id = " . $this->kernel->intranet->get("id") . " |
|
72 | + WHERE intranet_id = " . $this->kernel->intranet->get("id")." |
|
73 | 73 | AND contact_id = ".(int)$contact_id." |
74 | 74 | AND type='".$this->type_key."' |
75 | 75 | AND active = 1"; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | function setNewContactId($old_contact_id, $new_contact_id) |
83 | 83 | { |
84 | 84 | $db = new DB_Sql; |
85 | - $db->query('UPDATE debtor SET contact_id = ' . $new_contact_id . ' WHERE contact_id = ' . $old_contact_id); |
|
85 | + $db->query('UPDATE debtor SET contact_id = '.$new_contact_id.' WHERE contact_id = '.$old_contact_id); |
|
86 | 86 | return true; |
87 | 87 | } |
88 | 88 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $db = new DB_Sql; |
92 | 92 | $db->query('SELECT * FROM debtor WHERE date_created >= |
93 | 93 | DATE_SUB(NOW(),INTERVAL 1 DAY) |
94 | - AND type = ' .$this->type_key . ' AND intranet_id = ' .$this->kernel->intranet->get('id')); |
|
94 | + AND type = ' .$this->type_key.' AND intranet_id = '.$this->kernel->intranet->get('id')); |
|
95 | 95 | return $db->numRows(); |
96 | 96 | } |
97 | 97 | |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | public function isFilledIn() |
404 | 404 | { |
405 | 405 | $db = new DB_Sql; |
406 | - $db->query("SELECT id FROM debtor WHERE type = " . $this->getTypeKey() . " AND intranet_id = " . $this->kernel->intranet->get('id')); |
|
406 | + $db->query("SELECT id FROM debtor WHERE type = ".$this->getTypeKey()." AND intranet_id = ".$this->kernel->intranet->get('id')); |
|
407 | 407 | return $db->numRows(); |
408 | 408 | } |
409 | 409 | } |
410 | 410 | \ No newline at end of file |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * Constructor |
66 | 66 | * |
67 | - * @param object $debtor Debtor object |
|
67 | + * @param Debtor $debtor Debtor object |
|
68 | 68 | * @param integer $id If a special item id is needed |
69 | 69 | * |
70 | 70 | * @return void |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | /** |
245 | 245 | * Gets the tax percent on the individual product |
246 | 246 | * |
247 | - * @return float |
|
247 | + * @return integer |
|
248 | 248 | */ |
249 | 249 | public function getTaxPercent() |
250 | 250 | { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $product = new Product($this->debtor->kernel, $input["product_id"], $input['product_detail_id']); |
287 | 287 | |
288 | 288 | if (!is_object($product) || $product->get('id') == 0) { |
289 | - $this->error->set("Ugyldigt produkt"); |
|
289 | + $this->error->set("Ugyldigt produkt"); |
|
290 | 290 | } else { |
291 | 291 | $product_detail_id = $product->get("detail_id"); |
292 | 292 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $product = new Product($this->debtor->kernel, $product_id); |
373 | 373 | |
374 | 374 | if (!is_object($product) || $product->get('id') == 0) { |
375 | - throw new Excetion('Invalid product id'); |
|
375 | + throw new Excetion('Invalid product id'); |
|
376 | 376 | } else { |
377 | 377 | $product_detail_id = $product->get("detail_id"); |
378 | 378 | } |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | $i++; |
501 | 501 | } |
502 | 502 | } else { |
503 | - throw new Exception("Ugyldig produktdetalje i DebtorItem->getList() on ".$db->f('product_id').'/'.$db->f('product_detail_id')); |
|
503 | + throw new Exception("Ugyldig produktdetalje i DebtorItem->getList() on ".$db->f('product_id').'/'.$db->f('product_detail_id')); |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | unset($db); |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | // TODO how do we handle vat? this should return raw prices |
229 | 229 | // and then the tax percent should return the tax to apply |
230 | 230 | // the calculator should handle the final price |
231 | - return $this->getProductPrice() * $this->get('quantity'); |
|
231 | + return $this->getProductPrice()*$this->get('quantity'); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function getWeight() |
240 | 240 | { |
241 | - return $this->getProductWeight() * $this->get('quantity'); |
|
241 | + return $this->getProductWeight()*$this->get('quantity'); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -470,14 +470,14 @@ discard block |
||
470 | 470 | $variation = $product->getVariation($db->f('product_variation_id')); |
471 | 471 | $detail = $variation->getDetail($db->f('product_variation_detail_id')); |
472 | 472 | $item["name"] = $product->get("name").' - '.$variation->getName(); |
473 | - $item["number"]= $product->get("number").'.'.$variation->getNumber(); |
|
473 | + $item["number"] = $product->get("number").'.'.$variation->getNumber(); |
|
474 | 474 | $item["price"] = $detail->getPrice($product); |
475 | 475 | if ($currency) { |
476 | 476 | $item['price_currency'] = $detail->getPriceInCurrency($currency, $this->debtor->get('currency_product_price_exchange_rate_id'), $product); |
477 | 477 | } |
478 | 478 | } else { |
479 | 479 | $item["name"] = $product->get("name"); |
480 | - $item["number"]= $product->get("number"); |
|
480 | + $item["number"] = $product->get("number"); |
|
481 | 481 | $item["price"] = $product->getDetails()->getPrice(); |
482 | 482 | if ($currency) { |
483 | 483 | $item['price_currency'] = $product->getDetails()->getPriceInCurrency($currency, $this->debtor->get('currency_product_price_exchange_rate_id')); |
@@ -486,16 +486,16 @@ discard block |
||
486 | 486 | |
487 | 487 | if ($product->get("vat") == 0) { |
488 | 488 | $item_no_vat[$j] = $item; |
489 | - $item_no_vat[$j]["amount"] = new Ilib_Variable_Float($item["quantity"] * $item["price"]->getAsIso(2)); |
|
489 | + $item_no_vat[$j]["amount"] = new Ilib_Variable_Float($item["quantity"]*$item["price"]->getAsIso(2)); |
|
490 | 490 | if ($currency) { |
491 | - $item_no_vat[$j]["amount_currency"] = new Ilib_Variable_Float($item["quantity"] * $item["price_currency"]->getAsIso(2), 'iso'); |
|
491 | + $item_no_vat[$j]["amount_currency"] = new Ilib_Variable_Float($item["quantity"]*$item["price_currency"]->getAsIso(2), 'iso'); |
|
492 | 492 | } |
493 | 493 | $j++; |
494 | 494 | } else { |
495 | 495 | $item_with_vat[$i] = $item; |
496 | - $item_with_vat[$i]["amount"] = new Ilib_Variable_Float($item["quantity"] * $item["price"]->getAsIso(2) * 1.25); |
|
496 | + $item_with_vat[$i]["amount"] = new Ilib_Variable_Float($item["quantity"]*$item["price"]->getAsIso(2)*1.25); |
|
497 | 497 | if ($currency) { |
498 | - $item_with_vat[$i]["amount_currency"] = new Ilib_Variable_Float($item["quantity"] * $item["price_currency"]->getAsIso(2) * 1.25, 'iso'); |
|
498 | + $item_with_vat[$i]["amount_currency"] = new Ilib_Variable_Float($item["quantity"]*$item["price_currency"]->getAsIso(2)*1.25, 'iso'); |
|
499 | 499 | } |
500 | 500 | $i++; |
501 | 501 | } |
@@ -166,8 +166,7 @@ discard block |
||
166 | 166 | { |
167 | 167 | if ($this->getProduct()->get('has_variation')) { |
168 | 168 | return $this->getProductVariationDetail()->getPrice($this->getProduct()); |
169 | - } |
|
170 | - else { |
|
169 | + } else { |
|
171 | 170 | return $this->getProduct()->getDetails()->getPrice(); |
172 | 171 | } |
173 | 172 | } |
@@ -181,8 +180,7 @@ discard block |
||
181 | 180 | { |
182 | 181 | if ($this->getProduct()->get('has_variation')) { |
183 | 182 | return $this->getProduct()->get("weight") + $this->getProductVariationDetail()->getWeightDifference(); |
184 | - } |
|
185 | - else { |
|
183 | + } else { |
|
186 | 184 | return $this->getProduct()->get("weight"); |
187 | 185 | } |
188 | 186 | } |
@@ -196,8 +194,7 @@ discard block |
||
196 | 194 | { |
197 | 195 | if ($this->getProduct()->get('has_variation')) { |
198 | 196 | return $this->getProduct()->get("number").'.'.$this->getProductVariation()->getNumber(); |
199 | - } |
|
200 | - else { |
|
197 | + } else { |
|
201 | 198 | return $this->getProduct()->get("number"); |
202 | 199 | } |
203 | 200 | } |
@@ -211,8 +208,7 @@ discard block |
||
211 | 208 | { |
212 | 209 | if ($this->getProduct()->get('has_variation')) { |
213 | 210 | return $this->getProduct()->get("name").' - '.$this->getProductVariation()->getName(); |
214 | - } |
|
215 | - else { |
|
211 | + } else { |
|
216 | 212 | return $this->getProduct()->get("name"); |
217 | 213 | } |
218 | 214 | } |
@@ -291,14 +287,18 @@ discard block |
||
291 | 287 | $product_detail_id = $product->get("detail_id"); |
292 | 288 | } |
293 | 289 | |
294 | - if (!isset($input['product_variation_id'])) $input['product_variation_id'] = 0; |
|
290 | + if (!isset($input['product_variation_id'])) { |
|
291 | + $input['product_variation_id'] = 0; |
|
292 | + } |
|
295 | 293 | if (intval($input['product_variation_id']) != 0) { |
296 | 294 | $variation = $product->getVariation(intval($input['product_variation_id'])); |
297 | 295 | if (!$variation->getId()) { |
298 | 296 | $this->error->set("Invalid product variation"); |
299 | 297 | } |
300 | 298 | |
301 | - if (!isset($input['product_variation_detail_id'])) $input['product_variation_detail_id'] = 0; |
|
299 | + if (!isset($input['product_variation_detail_id'])) { |
|
300 | + $input['product_variation_detail_id'] = 0; |
|
301 | + } |
|
302 | 302 | $detail = $variation->getDetail(intval($input['product_variation_detail_id'])); |
303 | 303 | if (!$detail->getId()) { |
304 | 304 | $this->error->set("Invalid product variation detail"); |
@@ -306,15 +306,16 @@ discard block |
||
306 | 306 | |
307 | 307 | $variation_id = $variation->getId(); |
308 | 308 | $variation_detail_id = $detail->getId(); |
309 | - } |
|
310 | - else { |
|
309 | + } else { |
|
311 | 310 | $variation_id = 0; |
312 | 311 | $variation_detail_id = 0; |
313 | 312 | } |
314 | 313 | |
315 | 314 | } |
316 | 315 | |
317 | - if (!isset($input["quantity"])) $input["quantity"] = 0; |
|
316 | + if (!isset($input["quantity"])) { |
|
317 | + $input["quantity"] = 0; |
|
318 | + } |
|
318 | 319 | $validator->isDouble($input["quantity"], "Du skal angive et antal", ""); |
319 | 320 | $quantity = new Intraface_Amount($input["quantity"]); |
320 | 321 | if ($quantity->convert2db()) { |
@@ -322,7 +323,9 @@ discard block |
||
322 | 323 | } else { |
323 | 324 | $this->error->set("Ugyligt antal"); |
324 | 325 | } |
325 | - if (!isset($input['description'])) $input['description'] = ''; |
|
326 | + if (!isset($input['description'])) { |
|
327 | + $input['description'] = ''; |
|
328 | + } |
|
326 | 329 | $validator->isString($input["description"], "Fejl i beskrivelse", "<b><i>", "allow_empty"); |
327 | 330 | |
328 | 331 | if ($this->error->isError()) { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * Do not change the key for the payment methods |
15 | 15 | * |
16 | - * @return array The possible payment types |
|
16 | + * @return string[] The possible payment types |
|
17 | 17 | */ |
18 | 18 | public function getTypes() |
19 | 19 | { |
@@ -30,6 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Returns specific payment method |
33 | + * @param string $method |
|
33 | 34 | */ |
34 | 35 | public function getByName($method) |
35 | 36 | { |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function getTypes() |
19 | 19 | { |
20 | - $types[0] = 'None'; |
|
20 | + $types[0] = 'None'; |
|
21 | 21 | $types[1] = 'BankTransfer'; |
22 | 22 | $types[2] = 'GiroPayment01'; |
23 | 23 | $types[3] = 'GiroPayment71'; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | $payment_methods = array(); |
88 | 88 | |
89 | - $methods = Doctrine::getTable('Intraface_modules_shop_PaymentMethods')->findByShopId($shop_id); |
|
89 | + $methods = Doctrine::getTable('Intraface_modules_shop_PaymentMethods')->findByShopId($shop_id); |
|
90 | 90 | foreach ($methods as $method) { |
91 | 91 | $gateway = new Intraface_modules_debtor_PaymentMethod(); |
92 | 92 | $m = $gateway->getByKey($method->getPaymentMethodKey()); |
@@ -26,7 +26,7 @@ |
||
26 | 26 | * @param string $belong_to Which type the file belongs to |
27 | 27 | * @param integer $belong_to_id The id this appended file belongs to |
28 | 28 | * |
29 | - * @return void |
|
29 | + * @return integer |
|
30 | 30 | */ |
31 | 31 | public function __construct($kernel, $belong_to, $belong_to_id) |
32 | 32 | { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | if ($this->dbquery) { |
100 | 100 | return $this->dbquery; |
101 | 101 | } |
102 | - $this->dbquery = new Ilib_DBQuery('filehandler_append_file', 'filehandler_append_file.active = 1 AND filehandler_append_file.intranet_id='.$this->kernel->intranet->get('id').' AND filehandler_append_file.belong_to_key = '.$this->belong_to_key.' AND filehandler_append_file.belong_to_id = ' . $this->belong_to_id); |
|
102 | + $this->dbquery = new Ilib_DBQuery('filehandler_append_file', 'filehandler_append_file.active = 1 AND filehandler_append_file.intranet_id='.$this->kernel->intranet->get('id').' AND filehandler_append_file.belong_to_key = '.$this->belong_to_key.' AND filehandler_append_file.belong_to_id = '.$this->belong_to_id); |
|
103 | 103 | $this->dbquery->createStore($this->kernel->getSessionId(), 'intranet_id = '.intval($this->kernel->intranet->get('id'))); |
104 | 104 | return $this->dbquery; |
105 | 105 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | $db = new DB_Sql(); |
117 | 117 | $db->query("SELECT id FROM filehandler_append_file |
118 | - WHERE intranet_id = " . $this->kernel->intranet->get('id') . " |
|
118 | + WHERE intranet_id = " . $this->kernel->intranet->get('id')." |
|
119 | 119 | AND belong_to_key = ".$this->belong_to_key." |
120 | 120 | AND belong_to_id = ".$this->belong_to_id." |
121 | 121 | AND file_handler_id = ".$file_id." |
@@ -358,7 +358,8 @@ discard block |
||
358 | 358 | * creates and temporary file handler |
359 | 359 | * |
360 | 360 | * @param string optional file name |
361 | - * @return object temporary file |
|
361 | + * @param string $file_name |
|
362 | + * @return TemporaryFile temporary file |
|
362 | 363 | */ |
363 | 364 | public function createTemporaryFile($file_name = NULL) |
364 | 365 | { |
@@ -691,7 +692,6 @@ discard block |
||
691 | 692 | /** |
692 | 693 | * Returns RandomKeyGenerator |
693 | 694 | * |
694 | - * @param integer $length the length of the random key |
|
695 | 695 | * @return object RandomKeyGenerator |
696 | 696 | */ |
697 | 697 | private function getRandomKeyGenerator() |
@@ -79,6 +79,9 @@ |
||
79 | 79 | { |
80 | 80 | private $file_handler; |
81 | 81 | |
82 | + /** |
|
83 | + * @param FileHandler $file_handler |
|
84 | + */ |
|
82 | 85 | function __construct($file_handler) |
83 | 86 | { |
84 | 87 | $this->file_handler = $file_handler; |
@@ -86,19 +86,19 @@ |
||
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
89 | - * Denne funktion skal printe et upload field. |
|
90 | - * |
|
91 | - * Det skal p� en eller anden m�de v�re muligt at s�tte f�lgende parameter: |
|
92 | - * @param checkbox_name: navnet p� den checkboks, som inds�ttes, n�r der er uploadet et billede |
|
93 | - * @param upload_field_name: navnet p� type="file" input-felttet. |
|
94 | - * @param submit_name: navnet p� submit-knappen, som f�rer til "V�lg fra filarkiv" |
|
95 | - * @param options: array: |
|
96 | - * image_attr (mulighed for at s�tte attributer p� img-tag); |
|
97 | - * field_description: (det som st�r foran upload feltet, standard 'Fil') |
|
98 | - * image_size: (st�rrelsen p� billedet. Standard original |
|
99 | - * type: full/only_upload |
|
100 | - * include_submit_button_name: hvis sat bliver der indsat en "Upload" knap efter fil-felt, men strengen som navn |
|
101 | - */ |
|
89 | + * Denne funktion skal printe et upload field. |
|
90 | + * |
|
91 | + * Det skal p� en eller anden m�de v�re muligt at s�tte f�lgende parameter: |
|
92 | + * @param checkbox_name: navnet p� den checkboks, som inds�ttes, n�r der er uploadet et billede |
|
93 | + * @param upload_field_name: navnet p� type="file" input-felttet. |
|
94 | + * @param submit_name: navnet p� submit-knappen, som f�rer til "V�lg fra filarkiv" |
|
95 | + * @param options: array: |
|
96 | + * image_attr (mulighed for at s�tte attributer p� img-tag); |
|
97 | + * field_description: (det som st�r foran upload feltet, standard 'Fil') |
|
98 | + * image_size: (st�rrelsen p� billedet. Standard original |
|
99 | + * type: full/only_upload |
|
100 | + * include_submit_button_name: hvis sat bliver der indsat en "Upload" knap efter fil-felt, men strengen som navn |
|
101 | + */ |
|
102 | 102 | |
103 | 103 | function printFormUploadTag($checkbox_name, $upload_field_name, $submit_name, $options = array()) |
104 | 104 | { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | echo '<label for="'.$upload_field_name.'">'.t($options['field_description'], 'filehandler').'</label>'; |
134 | 134 | echo '<input name="'.$upload_field_name.'" type="file" id="'.$upload_field_name.'" />'; |
135 | 135 | if ($options['include_submit_button_name'] != '') { |
136 | - echo ' <input type="submit" name="'.$options['include_submit_button_name'].'" value="'.t('upload', 'filehandler') . '" /> <br />'; |
|
136 | + echo ' <input type="submit" name="'.$options['include_submit_button_name'].'" value="'.t('upload', 'filehandler').'" /> <br />'; |
|
137 | 137 | } |
138 | 138 | if ($this->file_handler->kernel->user->hasModuleAccess('filemanager') AND $options['filemanager'] === true) { |
139 | 139 | echo ' '.t('or').' <input type="submit" name="'.$submit_name.'" value="'.t('choose from filemanager', 'filehandler').'" />'; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $this->file_handler->createInstance('small'); |
156 | 156 | |
157 | 157 | if ($options['div_style'] == '') { |
158 | - $options['div_style'] = 'height: '.($this->file_handler->instance->get('height')+10).'px;'; |
|
158 | + $options['div_style'] = 'height: '.($this->file_handler->instance->get('height') + 10).'px;'; |
|
159 | 159 | } |
160 | 160 | echo '<div class="show_file" style="'.$options['div_style'].'"><img src="'.$this->file_handler->instance->get('file_uri').'" style="width: '.$this->file_handler->instance->get('width').'px; height: '.$this->file_handler->instance->get('height').'px" /> '.$this->file_handler->get('file_name'); |
161 | 161 | if ($delete_link != '') { |