@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | /** |
137 | 137 | * returns possible payment types |
138 | 138 | * |
139 | - * @return array payment types |
|
139 | + * @return string[] payment types |
|
140 | 140 | * |
141 | 141 | */ |
142 | 142 | public static function getTypes() |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | /** |
150 | 150 | * returns the possible types payments can be for. |
151 | 151 | * |
152 | - * @return array payment for types |
|
152 | + * @return string[] payment for types |
|
153 | 153 | */ |
154 | 154 | private static function getPaymentForTypes() |
155 | 155 | { |
@@ -127,7 +127,7 @@ |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $db = new DB_sql; |
130 | - $db->query("UPDATE invoice_payment SET date_stated = NOW(), voucher_id = ".$voucher->get('id').' WHERE id = '. $this->id.' AND intranet_id = '.$this->kernel->intranet->getId()); |
|
130 | + $db->query("UPDATE invoice_payment SET date_stated = NOW(), voucher_id = ".$voucher->get('id').' WHERE id = '.$this->id.' AND intranet_id = '.$this->kernel->intranet->getId()); |
|
131 | 131 | |
132 | 132 | $this->load(); |
133 | 133 | return true; |
@@ -17,6 +17,9 @@ discard block |
||
17 | 17 | parent::__construct($kernel, 'invoice', $id); |
18 | 18 | } |
19 | 19 | |
20 | + /** |
|
21 | + * @param string $status |
|
22 | + */ |
|
20 | 23 | function setStatus($status) |
21 | 24 | { |
22 | 25 | if ($status == 'cancelled') { |
@@ -58,7 +61,7 @@ discard block |
||
58 | 61 | /** |
59 | 62 | * returns DebtorAccount object |
60 | 63 | * |
61 | - * @return object DebtorAccount |
|
64 | + * @return DebtorAccount DebtorAccount |
|
62 | 65 | */ |
63 | 66 | public function getDebtorAccount() |
64 | 67 | { |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $db = new DB_Sql; |
34 | 34 | $sql = "SELECT id FROM debtor |
35 | - WHERE type=3 AND status=1 AND active = 1 AND due_date < NOW() AND intranet_id = ".$this->kernel->intranet->get("id")." AND contact_id = " . $contact_id; |
|
35 | + WHERE type=3 AND status=1 AND active = 1 AND due_date < NOW() AND intranet_id = ".$this->kernel->intranet->get("id")." AND contact_id = ".$contact_id; |
|
36 | 36 | $db->query($sql); |
37 | 37 | |
38 | 38 | return $db->numRows(); |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | for ($i = 0, $max = count($items); $i < $max; $i++) { |
130 | 130 | $product = new Product($this->kernel, $items[$i]['product_id']); |
131 | 131 | if ($product->get('state_account_id') == 0) { |
132 | - $this->error->set('Produktet ' . $product->get('name') . ' ved ikke hvor den skal bogf�res'); |
|
132 | + $this->error->set('Produktet '.$product->get('name').' ved ikke hvor den skal bogf�res'); |
|
133 | 133 | } else { |
134 | 134 | require_once 'Intraface/modules/accounting/Account.php'; |
135 | 135 | $account = Account::factory($year, $product->get('state_account_id')); |
136 | 136 | if ($account->get('id') == 0 || $account->get('type') != 'operating') { |
137 | - $this->error->set('Ugyldig konto for bogføring af produktet ' . $product->get('name')); |
|
137 | + $this->error->set('Ugyldig konto for bogføring af produktet '.$product->get('name')); |
|
138 | 138 | $return = false; |
139 | 139 | } |
140 | 140 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $debet_account_number = $debet_account->get('number'); |
209 | 209 | $voucher = Voucher::factory($year, $voucher_number); |
210 | 210 | |
211 | - $amount = $item['quantity'] * $item['price']->getAsIso(2); |
|
211 | + $amount = $item['quantity']*$item['price']->getAsIso(2); |
|
212 | 212 | |
213 | 213 | // hvis bel�bet er mindre end nul, skal konti byttes om og bel�bet skal g�res positivt |
214 | 214 | if ($amount < 0) { |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | 'debet_account_number' => $debet_account_number, |
226 | 226 | 'credit_account_number' => $credit_account_number, |
227 | 227 | 'vat_off' => 1, |
228 | - 'text' => $text . ' - ' . $item['name'] |
|
228 | + 'text' => $text.' - '.$item['name'] |
|
229 | 229 | ); |
230 | 230 | |
231 | 231 | if ($credit_account->get('vat') == 'out') { |
232 | - $total_with_vat += $item["quantity"] * $item["price"]->getAsIso(2); |
|
232 | + $total_with_vat += $item["quantity"]*$item["price"]->getAsIso(2); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | if (!$voucher->saveInDaybook($input_values, true)) { |
@@ -242,16 +242,16 @@ discard block |
||
242 | 242 | if ($total_with_vat > 0) { |
243 | 243 | $voucher = Voucher::factory($year, $voucher_number); |
244 | 244 | $credit_account = new Account($year, $year->getSetting('vat_out_account_id')); |
245 | - $debet_account = new Account($year, $year->getSetting('debtor_account_id')); |
|
245 | + $debet_account = new Account($year, $year->getSetting('debtor_account_id')); |
|
246 | 246 | $input_values = array( |
247 | 247 | 'voucher_number' => $voucher_number, |
248 | 248 | 'reference' => $this->get('number'), |
249 | 249 | 'date' => $voucher_date, |
250 | - 'amount' => number_format($total_with_vat * $this->kernel->setting->get('intranet', 'vatpercent') / 100, 2, ",", "."), // opm�rksom p� at vat bliver rigtig defineret |
|
250 | + 'amount' => number_format($total_with_vat*$this->kernel->setting->get('intranet', 'vatpercent')/100, 2, ",", "."), // opm�rksom p� at vat bliver rigtig defineret |
|
251 | 251 | 'debet_account_number' => $debet_account->get('number'), |
252 | 252 | 'credit_account_number' => $credit_account->get('number'), |
253 | 253 | 'vat_off' => 1, |
254 | - 'text' => $text . ' - ' . $credit_account->get('name') |
|
254 | + 'text' => $text.' - '.$credit_account->get('name') |
|
255 | 255 | ); |
256 | 256 | if (!$voucher->saveInDaybook($input_values, true)) { |
257 | 257 | $this->error->merge($voucher->error->getMessage()); |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | require_once 'Intraface/modules/accounting/VoucherFile.php'; |
262 | 262 | $voucher_file = new VoucherFile($voucher); |
263 | - if (!$voucher_file->save(array('description' => $text, 'belong_to'=>'invoice','belong_to_id'=>$this->get('id')))) { |
|
263 | + if (!$voucher_file->save(array('description' => $text, 'belong_to'=>'invoice', 'belong_to_id'=>$this->get('id')))) { |
|
264 | 264 | $this->error->merge($voucher_file->error->getMessage()); |
265 | 265 | $this->error->set('Filen blev ikke overflyttet'); |
266 | 266 | } |
@@ -17,6 +17,9 @@ discard block |
||
17 | 17 | public $dbquery; |
18 | 18 | private $db; |
19 | 19 | |
20 | + /** |
|
21 | + * @return string |
|
22 | + */ |
|
20 | 23 | function __construct($object, $id = 0) |
21 | 24 | { |
22 | 25 | if (!is_object($object)) { |
@@ -447,7 +450,7 @@ discard block |
||
447 | 450 | /** |
448 | 451 | * returns possible payment types |
449 | 452 | * |
450 | - * @return array payment types |
|
453 | + * @return string[] payment types |
|
451 | 454 | * |
452 | 455 | */ |
453 | 456 | public static function getTypes() |
@@ -462,7 +465,7 @@ discard block |
||
462 | 465 | /** |
463 | 466 | * returns the possible types payments can be for. |
464 | 467 | * |
465 | - * @return array payment for types |
|
468 | + * @return string[] payment for types |
|
466 | 469 | */ |
467 | 470 | private static function getPaymentForTypes() |
468 | 471 | { |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | |
49 | 49 | public function load() |
50 | 50 | { |
51 | - $result = $this->db->query('SELECT id, amount, type, description, payment_date, payment_for_id, DATE_FORMAT(payment_date, "%d-%m-%Y") AS dk_payment_date, date_stated, voucher_id FROM invoice_payment ' . |
|
52 | - 'WHERE intranet_id = '.$this->kernel->intranet->get('id').' ' . |
|
53 | - 'AND payment_for = '.$this->payment_for_type_id.' ' . |
|
54 | - 'AND payment_for_id = '.$this->payment_for_id.' ' . |
|
55 | - 'AND type IN ('.implode(',', array_keys($this->getTypes())).')' . |
|
51 | + $result = $this->db->query('SELECT id, amount, type, description, payment_date, payment_for_id, DATE_FORMAT(payment_date, "%d-%m-%Y") AS dk_payment_date, date_stated, voucher_id FROM invoice_payment '. |
|
52 | + 'WHERE intranet_id = '.$this->kernel->intranet->get('id').' '. |
|
53 | + 'AND payment_for = '.$this->payment_for_type_id.' '. |
|
54 | + 'AND payment_for_id = '.$this->payment_for_id.' '. |
|
55 | + 'AND type IN ('.implode(',', array_keys($this->getTypes())).')'. |
|
56 | 56 | 'AND id = '.$this->id); |
57 | 57 | |
58 | 58 | if (PEAR::isError($result)) { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | $this->dbquery->setSorting("payment_date ASC"); |
162 | 162 | $db = $this->dbquery->getRecordset("id, amount, type, description, payment_date, payment_for_id, DATE_FORMAT(payment_date, '%d-%m-%Y') AS dk_payment_date, date_stated, voucher_id", "", false); |
163 | - while($db->nextRecord()) { |
|
163 | + while ($db->nextRecord()) { |
|
164 | 164 | $payment[$i]["id"] = $db->f("id"); |
165 | 165 | $types = $this->getTypes(); |
166 | 166 | $payment[$i]["type"] = $types[$db->f('type')]; |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | |
422 | 422 | $types = $this->getPaymentForTypes(); |
423 | 423 | // translation is needed! |
424 | - $text = $translation->get('Payment') . ' ' . $this->get('description') . ' ('.$translation->get($types[$this->payment_for_type_id]).' #'.$this->payment_for->get('number') . ')'; |
|
424 | + $text = $translation->get('Payment').' '.$this->get('description').' ('.$translation->get($types[$this->payment_for_type_id]).' #'.$this->payment_for->get('number').')'; |
|
425 | 425 | |
426 | 426 | $input_values = array( |
427 | 427 | 'voucher_number' => $voucher_number, |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | $db = new DB_sql; |
441 | - $db->query("UPDATE invoice_payment SET date_stated = NOW(), voucher_id = ".$voucher->get('id') . " WHERE intranet_id = " . $this->kernel->intranet->getId() . ' AND id = ' . $this->id); |
|
441 | + $db->query("UPDATE invoice_payment SET date_stated = NOW(), voucher_id = ".$voucher->get('id')." WHERE intranet_id = ".$this->kernel->intranet->getId().' AND id = '.$this->id); |
|
442 | 442 | |
443 | 443 | $this->load(); |
444 | 444 | return true; |
@@ -97,23 +97,31 @@ |
||
97 | 97 | $input = safeToDb($input); |
98 | 98 | $validator = new Intraface_Validator($this->error); |
99 | 99 | |
100 | - if (!isset($input["payment_date"])) $input["payment_date"] = ''; |
|
100 | + if (!isset($input["payment_date"])) { |
|
101 | + $input["payment_date"] = ''; |
|
102 | + } |
|
101 | 103 | if ($validator->isDate($input["payment_date"], "Ugyldig dato", "allow_no_year")) { |
102 | 104 | $date = new Intraface_Date($input["payment_date"]); |
103 | 105 | $date->convert2db(); |
104 | 106 | } |
105 | 107 | |
106 | - if (!isset($input["amount"])) $input["amount"] = 0; |
|
108 | + if (!isset($input["amount"])) { |
|
109 | + $input["amount"] = 0; |
|
110 | + } |
|
107 | 111 | if ($validator->isDouble($input["amount"], "Ugyldig bel�b")) { |
108 | 112 | $amount = new Intraface_Amount($input["amount"]); |
109 | 113 | $amount->convert2db(); |
110 | 114 | $amount = $amount->get(); |
111 | 115 | } |
112 | 116 | |
113 | - if (!isset($input['description'])) $input['description'] = ''; |
|
117 | + if (!isset($input['description'])) { |
|
118 | + $input['description'] = ''; |
|
119 | + } |
|
114 | 120 | $validator->isString($input["description"], "Fejl i beskrivelse", "", "allow_empty"); |
115 | 121 | |
116 | - if (!isset($input['type'])) $input['type'] = NULL; |
|
122 | + if (!isset($input['type'])) { |
|
123 | + $input['type'] = NULL; |
|
124 | + } |
|
117 | 125 | $validator->isNumeric($input["type"], "Type er ikke angivet korrekt"); |
118 | 126 | $types = $this->getTypes(); |
119 | 127 | if (!isset($types[$input["type"]])) { |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | /** |
114 | 114 | * returns possible payment types |
115 | 115 | * |
116 | - * @return array payment types |
|
116 | + * @return string[] payment types |
|
117 | 117 | * |
118 | 118 | */ |
119 | 119 | public static function getTypes() |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * returns the possible types payments can be for. |
130 | 130 | * |
131 | - * @return array payment for types |
|
131 | + * @return string[] payment for types |
|
132 | 132 | */ |
133 | 133 | private static function getPaymentForTypes() |
134 | 134 | { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | function findById($id) |
23 | 23 | { |
24 | 24 | $db = new DB_Sql; |
25 | - $db->query('SELECT * FROM invoice_payment WHERE id = ' . $id); |
|
25 | + $db->query('SELECT * FROM invoice_payment WHERE id = '.$id); |
|
26 | 26 | |
27 | 27 | if (!$db->nextRecord()) { |
28 | 28 | return false; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $this->dbquery->setSorting("payment_date ASC"); |
92 | 92 | $db = $this->dbquery->getRecordset("id, amount, payment_for, type, description, payment_date, payment_for_id, DATE_FORMAT(payment_date, '%d-%m-%Y') AS dk_payment_date, date_stated, voucher_id", "", false); |
93 | - while($db->nextRecord()) { |
|
93 | + while ($db->nextRecord()) { |
|
94 | 94 | $payment[$i]["id"] = $db->f("id"); |
95 | 95 | $types = $this->getTypes(); |
96 | 96 | $payment[$i]["type"] = $types[$db->f('type')]; |
@@ -13,6 +13,9 @@ |
||
13 | 13 | parent::__construct($translation, $file); |
14 | 14 | } |
15 | 15 | |
16 | + /** |
|
17 | + * @param Reminder $reminder |
|
18 | + */ |
|
16 | 19 | function visit($reminder) |
17 | 20 | { |
18 | 21 | if ($reminder->get('id') == 0) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $intranet_address = new Intraface_Address($reminder->get("intranet_address_id")); |
35 | 35 | $intranet = $intranet_address->get(); |
36 | 36 | |
37 | - switch($reminder->kernel->setting->get('intranet', 'debtor.sender')) { |
|
37 | + switch ($reminder->kernel->setting->get('intranet', 'debtor.sender')) { |
|
38 | 38 | case 'intranet': |
39 | 39 | // void |
40 | 40 | break; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $this->docinfo[0]["label"] = "Dato:"; |
53 | 53 | $this->docinfo[0]["value"] = $reminder->get("dk_this_date"); |
54 | 54 | |
55 | - $this->addRecieverAndSender($contact , $intranet, "Reminder about payment", $this->docinfo); |
|
55 | + $this->addRecieverAndSender($contact, $intranet, "Reminder about payment", $this->docinfo); |
|
56 | 56 | |
57 | 57 | $this->doc->setY('-20'); // space to the product list |
58 | 58 | |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | if ($line == "") { |
62 | 62 | $this->doc->setY('-'.$this->doc->get('font_spacing')); |
63 | 63 | |
64 | - if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing") * 2) { |
|
64 | + if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing")*2) { |
|
65 | 65 | $this->doc->nextPage(true); |
66 | 66 | } |
67 | 67 | } else { |
68 | - while($line != "") { |
|
68 | + while ($line != "") { |
|
69 | 69 | |
70 | 70 | $this->doc->setY('-'.($this->doc->get("font_padding_top") + $this->doc->get("font_size"))); |
71 | 71 | $line = $this->doc->addTextWrap($this->doc->get('x'), $this->doc->get('y'), $this->doc->get("right_margin_position") - $this->doc->get('x'), $this->doc->get("font_size"), $line); // $this->doc->get("right_margin_position") - $this->doc->get('x') |
72 | 72 | |
73 | 73 | $this->doc->setY('-'.$this->doc->get("font_padding_bottom")); |
74 | 74 | |
75 | - if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing") * 2) { |
|
75 | + if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing")*2) { |
|
76 | 76 | $this->doc->nextPage(true); |
77 | 77 | } |
78 | 78 | } |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $this->doc->setY('-20'); // space to product list |
85 | 85 | |
86 | - if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing") * 3) { |
|
86 | + if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing")*3) { |
|
87 | 87 | $this->doc->nextPage(true); |
88 | 88 | } |
89 | 89 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $this->doc->addText($apointX["text"], $this->doc->get('y'), $this->doc->get("font_size"), "Beskrivelse"); |
98 | 98 | $this->doc->addText($apointX["invoice_date"], $this->doc->get('y'), $this->doc->get("font_size"), "Dato"); |
99 | 99 | $this->doc->addText($apointX["due_date"], $this->doc->get('y'), $this->doc->get("font_size"), "Forfaldsdato"); |
100 | - $this->doc->addText($apointX["amount"] - $this->doc->getTextWidth($this->doc->get("font_size"), "Beløb") -3, $this->doc->get('y'), $this->doc->get("font_size"), "Bel�b"); |
|
100 | + $this->doc->addText($apointX["amount"] - $this->doc->getTextWidth($this->doc->get("font_size"), "Beløb") - 3, $this->doc->get('y'), $this->doc->get("font_size"), "Bel�b"); |
|
101 | 101 | |
102 | 102 | $this->doc->setY('-'.($this->doc->get("font_spacing") - $this->doc->get("font_size"))); |
103 | 103 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $this->doc->setY('-'.$this->doc->get("font_padding_bottom")); |
132 | 132 | $total += $items[$i]["arrears"]; |
133 | 133 | |
134 | - if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing") * 2) { |
|
134 | + if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing")*2) { |
|
135 | 135 | $this->doc->nextPage(true); |
136 | 136 | } |
137 | 137 | } |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $this->doc->setY('-'.$this->doc->get("font_padding_bottom")); |
158 | 158 | $total += $items[$i]["reminder_fee"]; |
159 | 159 | |
160 | - if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing") * 2) { |
|
160 | + if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing")*2) { |
|
161 | 161 | $this->doc->nextPage(true); |
162 | 162 | } |
163 | 163 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $this->doc->setY('-'.$this->doc->get("font_padding_bottom")); |
180 | 180 | $total += $reminder->get("reminder_fee"); |
181 | 181 | |
182 | - if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing") * 2) { |
|
182 | + if ($this->doc->get('y') < $this->doc->get("margin_bottom") + $this->doc->get("font_spacing")*2) { |
|
183 | 183 | $this->doc->nextPage(true); |
184 | 184 | } |
185 | 185 | } |
@@ -36,6 +36,9 @@ discard block |
||
36 | 36 | return $this->dbquery; |
37 | 37 | } |
38 | 38 | |
39 | + /** |
|
40 | + * @param string $type |
|
41 | + */ |
|
39 | 42 | function getItems($type = NULL) |
40 | 43 | { |
41 | 44 | $this->loadItem(); |
@@ -273,7 +276,8 @@ discard block |
||
273 | 276 | /** |
274 | 277 | * Sets status for the reminder |
275 | 278 | * |
276 | - * @return true / false |
|
279 | + * @param string $status |
|
280 | + * @return boolean / false |
|
277 | 281 | */ |
278 | 282 | function setStatus($status) { |
279 | 283 | |
@@ -331,7 +335,7 @@ discard block |
||
331 | 335 | /** |
332 | 336 | * returns DebtorAccount object |
333 | 337 | * |
334 | - * @return object DebtorAccount |
|
338 | + * @return DebtorAccount DebtorAccount |
|
335 | 339 | */ |
336 | 340 | public function getDebtorAccount() |
337 | 341 | { |
@@ -663,7 +667,7 @@ discard block |
||
663 | 667 | /** |
664 | 668 | * returns possible status types |
665 | 669 | * |
666 | - * @return array possible status types |
|
670 | + * @return string[] possible status types |
|
667 | 671 | */ |
668 | 672 | private static function getStatusTypes() |
669 | 673 | { |
@@ -678,7 +682,7 @@ discard block |
||
678 | 682 | /** |
679 | 683 | * returns possible payment methods |
680 | 684 | * |
681 | - * @return array possible payment methods |
|
685 | + * @return string[] possible payment methods |
|
682 | 686 | */ |
683 | 687 | private static function getPaymentMethods() |
684 | 688 | { |
@@ -698,9 +698,9 @@ |
||
698 | 698 | function getPaymentInformation() |
699 | 699 | { |
700 | 700 | $info = array('bank_name' => $this->kernel->setting->get("intranet", "bank_name"), |
701 | - 'bank_reg_number' => $this->kernel->setting->get("intranet", "bank_reg_number"), |
|
702 | - 'bank_account_number' => $this->kernel->setting->get("intranet", "bank_account_number"), |
|
703 | - 'giro_account_number' => $this->kernel->setting->get("intranet", "giro_account_number") |
|
701 | + 'bank_reg_number' => $this->kernel->setting->get("intranet", "bank_reg_number"), |
|
702 | + 'bank_account_number' => $this->kernel->setting->get("intranet", "bank_account_number"), |
|
703 | + 'giro_account_number' => $this->kernel->setting->get("intranet", "giro_account_number") |
|
704 | 704 | ); |
705 | 705 | |
706 | 706 | return $info; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | function isNumberFree($number) |
128 | 128 | { |
129 | - $sql = "SELECT id FROM invoice_reminder WHERE number = ".intval($number)." AND id != ".$this->id . " AND intranet_id = " . $this->kernel->intranet->get('id'); |
|
129 | + $sql = "SELECT id FROM invoice_reminder WHERE number = ".intval($number)." AND id != ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'); |
|
130 | 130 | $this->db->query($sql); |
131 | 131 | if ($this->db->nextRecord()) { |
132 | 132 | return false; |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | throw new Exception("Tried to set status the same or lower than it was before. Can be because of reload. In Reminder->setStatus"); |
297 | 297 | } |
298 | 298 | |
299 | - switch($status) { |
|
299 | + switch ($status) { |
|
300 | 300 | case "sent": |
301 | 301 | $sql = "date_sent = NOW()"; |
302 | 302 | break; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | } |
315 | 315 | |
316 | 316 | $db = new Db_Sql; |
317 | - $db->query("UPDATE invoice_reminder SET status = ".$status_id.", ".$sql." WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id')); |
|
317 | + $db->query("UPDATE invoice_reminder SET status = ".$status_id.", ".$sql." WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')); |
|
318 | 318 | $this->load(); |
319 | 319 | return true; |
320 | 320 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | } |
394 | 394 | |
395 | 395 | } else { |
396 | - switch($this->dbquery->getFilter("status")) { |
|
396 | + switch ($this->dbquery->getFilter("status")) { |
|
397 | 397 | case "0": |
398 | 398 | $to_date_field = "date_created"; |
399 | 399 | break; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | $db = $this->dbquery->getRecordset("id", "", false); |
428 | 428 | |
429 | 429 | $list = array(); |
430 | - while($db->nextRecord()) { |
|
430 | + while ($db->nextRecord()) { |
|
431 | 431 | $reminder = new Reminder($this->kernel, $db->f("id")); |
432 | 432 | $list[$i] = $reminder->get(); |
433 | 433 | if (is_object($reminder->contact->address)) { |
@@ -453,14 +453,14 @@ discard block |
||
453 | 453 | } |
454 | 454 | $db = new DB_Sql; |
455 | 455 | $db->query("SELECT id |
456 | - FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get("id")." AND active = 1 AND contact_id=" . $contact_id); |
|
456 | + FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get("id")." AND active = 1 AND contact_id=".$contact_id); |
|
457 | 457 | return $db->numRows(); |
458 | 458 | } |
459 | 459 | |
460 | 460 | function isFilledIn() |
461 | 461 | { |
462 | 462 | $db = new DB_Sql; |
463 | - $db->query("SELECT id FROM invoice_reminder WHERE intranet_id = " . $this->kernel->intranet->get('id')); |
|
463 | + $db->query("SELECT id FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get('id')); |
|
464 | 464 | return $db->numRows(); |
465 | 465 | } |
466 | 466 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | { |
477 | 477 | // FIXME - check on date |
478 | 478 | $db = new DB_Sql; |
479 | - $db->query("UPDATE invoice_reminder SET date_stated = '" . $voucher_date . "', voucher_id = '".$voucher_id."' WHERE id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id')); |
|
479 | + $db->query("UPDATE invoice_reminder SET date_stated = '".$voucher_date."', voucher_id = '".$voucher_id."' WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')); |
|
480 | 480 | return true; |
481 | 481 | } |
482 | 482 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | |
624 | 624 | require_once 'Intraface/modules/accounting/VoucherFile.php'; |
625 | 625 | $voucher_file = new VoucherFile($voucher); |
626 | - if (!$voucher_file->save(array('description' => $text, 'belong_to'=>'reminder','belong_to_id'=>$this->get('id')))) { |
|
626 | + if (!$voucher_file->save(array('description' => $text, 'belong_to'=>'reminder', 'belong_to_id'=>$this->get('id')))) { |
|
627 | 627 | $this->error->merge($voucher_file->error->getMessage()); |
628 | 628 | $this->error->set('Filen blev ikke overflyttet'); |
629 | 629 | } |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | |
642 | 642 | } |
643 | 643 | |
644 | - function pdf($type = 'stream', $filename='') |
|
644 | + function pdf($type = 'stream', $filename = '') |
|
645 | 645 | { |
646 | 646 | if ($this->get('id') == 0) { |
647 | 647 | throw new Exception('Cannot create pdf from debtor without valid id'); |
@@ -153,15 +153,21 @@ discard block |
||
153 | 153 | |
154 | 154 | $validator = new Intraface_Validator($this->error); |
155 | 155 | |
156 | - if (!isset($input['number'])) $input['number'] = 0; |
|
156 | + if (!isset($input['number'])) { |
|
157 | + $input['number'] = 0; |
|
158 | + } |
|
157 | 159 | if ($validator->isNumeric($input["number"], "Rykkernummer skal v�re et tal st�rre end nul", "greater_than_zero")) { |
158 | 160 | if (!$this->isNumberFree($input["number"])) { |
159 | 161 | $this->error->set("Rykkernummer er allerede brugt"); |
160 | 162 | } |
161 | 163 | } |
162 | 164 | |
163 | - if (!isset($input['contact_id'])) $input['contact_id'] = 0; |
|
164 | - if (!isset($input["contact_person_id"])) $input["contact_person_id"] = 0; |
|
165 | + if (!isset($input['contact_id'])) { |
|
166 | + $input['contact_id'] = 0; |
|
167 | + } |
|
168 | + if (!isset($input["contact_person_id"])) { |
|
169 | + $input["contact_person_id"] = 0; |
|
170 | + } |
|
165 | 171 | if ($validator->isNumeric($input["contact_id"], "Du skal angive en kunde", "greater_than_zero")) { |
166 | 172 | $contact = new Contact($this->kernel, (int)$input["contact_id"]); |
167 | 173 | if (is_object($contact->address)) { |
@@ -177,38 +183,56 @@ discard block |
||
177 | 183 | } |
178 | 184 | |
179 | 185 | // $validator->isString($input["attention_to"], "Fejl i att.", "", "allow_empty"); |
180 | - if (!isset($input['description'])) $input['description'] = ''; |
|
186 | + if (!isset($input['description'])) { |
|
187 | + $input['description'] = ''; |
|
188 | + } |
|
181 | 189 | $validator->isString($input["description"], "Fejl i beskrivelsen", "", "allow_empty"); |
182 | 190 | |
183 | - if (!isset($input['this_date'])) $input['this_date'] = ''; |
|
191 | + if (!isset($input['this_date'])) { |
|
192 | + $input['this_date'] = ''; |
|
193 | + } |
|
184 | 194 | if ($validator->isDate($input["this_date"], "Ugyldig dato", "allow_no_year")) { |
185 | 195 | $this_date = new Intraface_Date($input["this_date"]); |
186 | 196 | $this_date->convert2db(); |
187 | 197 | } |
188 | 198 | |
189 | - if (!isset($input['due_date'])) $input['due_date'] = ''; |
|
199 | + if (!isset($input['due_date'])) { |
|
200 | + $input['due_date'] = ''; |
|
201 | + } |
|
190 | 202 | if ($validator->isDate($input["due_date"], "Ugyldig forfaldsdato", "allow_no_year")) { |
191 | 203 | $due_date = new Intraface_Date($input["due_date"]); |
192 | 204 | $due_date->convert2db(); |
193 | 205 | } |
194 | 206 | |
195 | - if (!isset($input['reminder_fee'])) $input['reminder_fee'] = 0; |
|
207 | + if (!isset($input['reminder_fee'])) { |
|
208 | + $input['reminder_fee'] = 0; |
|
209 | + } |
|
196 | 210 | $validator->isNumeric($input["reminder_fee"], "Rykkerbebyr skal v�re et tal"); |
197 | - if (!isset($input['text'])) $input['text'] = ''; |
|
211 | + if (!isset($input['text'])) { |
|
212 | + $input['text'] = ''; |
|
213 | + } |
|
198 | 214 | $validator->isString($input["text"], "Fejl i teksten", "<b><i>", "allow_empty"); |
199 | - if (!isset($input['send_as'])) $input['send_as'] = ''; |
|
215 | + if (!isset($input['send_as'])) { |
|
216 | + $input['send_as'] = ''; |
|
217 | + } |
|
200 | 218 | $validator->isString($input["send_as"], "Ugyldig m�de at sende rykkeren p�"); |
201 | 219 | |
202 | - if (!isset($input['payment_method_key'])) $input['payment_method_key'] = 0; |
|
220 | + if (!isset($input['payment_method_key'])) { |
|
221 | + $input['payment_method_key'] = 0; |
|
222 | + } |
|
203 | 223 | $validator->isNumeric($input["payment_method_key"], "Du skal angive en betalingsmetode"); |
204 | - if (!isset($input['girocode'])) $input['girocode'] = ''; |
|
224 | + if (!isset($input['girocode'])) { |
|
225 | + $input['girocode'] = ''; |
|
226 | + } |
|
205 | 227 | if ($input["payment_method_key"] == 3) { |
206 | 228 | $validator->isString($input["girocode"], "Du skal udfylde girokode"); |
207 | 229 | } else { |
208 | 230 | $validator->isString($input["girocode"], "Ugyldig girokode", "", "allow_empty"); |
209 | 231 | } |
210 | 232 | |
211 | - if (!isset($input['checked_invoice'])) $input['checked_invoice'] = array(); |
|
233 | + if (!isset($input['checked_invoice'])) { |
|
234 | + $input['checked_invoice'] = array(); |
|
235 | + } |
|
212 | 236 | if (!is_array($input["checked_invoice"]) || count($input["checked_invoice"]) == 0) { |
213 | 237 | $this->error->set("Der er ikke valgt nogle fakturaer til rykkeren"); |
214 | 238 | } |
@@ -22,6 +22,9 @@ |
||
22 | 22 | return $this->dbquery; |
23 | 23 | } |
24 | 24 | |
25 | + /** |
|
26 | + * @param integer $id |
|
27 | + */ |
|
25 | 28 | function findById($id) |
26 | 29 | { |
27 | 30 | require_once dirname(__FILE__) . '/Reminder.php'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | function findById($id) |
26 | 26 | { |
27 | - require_once dirname(__FILE__) . '/Reminder.php'; |
|
27 | + require_once dirname(__FILE__).'/Reminder.php'; |
|
28 | 28 | return new Reminder($this->kernel, $id); |
29 | 29 | } |
30 | 30 | |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | } |
40 | 40 | $db = new DB_Sql; |
41 | 41 | $db->query("SELECT id |
42 | - FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get("id")." AND active = 1 AND contact_id=" . $contact_id); |
|
42 | + FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get("id")." AND active = 1 AND contact_id=".$contact_id); |
|
43 | 43 | return $db->numRows(); |
44 | 44 | } |
45 | 45 | |
46 | 46 | function setNewContactId($old_contact_id, $new_contact_id) |
47 | 47 | { |
48 | 48 | $db = new DB_Sql; |
49 | - $db->query('UPDATE invoice_reminder SET contact_id = ' . $new_contact_id . ' WHERE contact_id = ' . $old_contact_id); |
|
49 | + $db->query('UPDATE invoice_reminder SET contact_id = '.$new_contact_id.' WHERE contact_id = '.$old_contact_id); |
|
50 | 50 | return true; |
51 | 51 | } |
52 | 52 | |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | } else { |
109 | - switch($this->dbquery->getFilter("status")) { |
|
109 | + switch ($this->dbquery->getFilter("status")) { |
|
110 | 110 | case "0": |
111 | 111 | $to_date_field = "date_created"; |
112 | 112 | break; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $db = $this->dbquery->getRecordset("id", "", false); |
141 | 141 | |
142 | 142 | $list = array(); |
143 | - while($db->nextRecord()) { |
|
143 | + while ($db->nextRecord()) { |
|
144 | 144 | $reminder = new Reminder($this->kernel, $db->f("id")); |
145 | 145 | $list[$i] = $reminder->get(); |
146 | 146 | if (is_object($reminder->contact->address)) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | function isFilledIn() |
159 | 159 | { |
160 | 160 | $db = new DB_Sql; |
161 | - $db->query("SELECT id FROM invoice_reminder WHERE intranet_id = " . $this->kernel->intranet->get('id')); |
|
161 | + $db->query("SELECT id FROM invoice_reminder WHERE intranet_id = ".$this->kernel->intranet->get('id')); |
|
162 | 162 | return $db->numRows(); |
163 | 163 | } |
164 | 164 |
@@ -11,6 +11,9 @@ |
||
11 | 11 | private $db; |
12 | 12 | public $error; |
13 | 13 | |
14 | + /** |
|
15 | + * @param Reminder $reminder |
|
16 | + */ |
|
14 | 17 | function __construct($reminder, $id = 0) |
15 | 18 | { |
16 | 19 | $this->reminder = $reminder; |
@@ -35,7 +35,7 @@ |
||
35 | 35 | * Run the AccessUpdate and applies module access acording to module packages |
36 | 36 | * |
37 | 37 | * @param integer intranet_id id on intranet, and the access update will only run on this intranet. |
38 | - * @return boolean true on success, false on failure |
|
38 | + * @return null|boolean true on success, false on failure |
|
39 | 39 | */ |
40 | 40 | public function run($intranet_id = 0) |
41 | 41 | { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | exit; |
75 | 75 | } |
76 | 76 | |
77 | - while($row = $result->fetchRow()) { |
|
77 | + while ($row = $result->fetchRow()) { |
|
78 | 78 | $modulepackage = new Intraface_modules_modulepackage_ModulePackage($row['module_package_id']); |
79 | 79 | $intranet = new IntranetMaintenance($row['intranet_id']); |
80 | 80 | |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | exit; |
102 | 102 | } |
103 | 103 | |
104 | - while($row = $result->fetchRow()) { |
|
104 | + while ($row = $result->fetchRow()) { |
|
105 | 105 | $modulepackage = new Intraface_modules_modulepackage_ModulePackage($row['module_package_id']); |
106 | 106 | |
107 | 107 | // we prepare to give the intranet access |