@@ -49,7 +49,7 @@ |
||
49 | 49 | * |
50 | 50 | * @param object action An action object |
51 | 51 | * |
52 | - * @return boolean true or false |
|
52 | + * @return null|string true or false |
|
53 | 53 | */ |
54 | 54 | public function store($action) |
55 | 55 | { |
@@ -189,10 +189,10 @@ |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | - * Returns the store identifier which is generated on store and restore. |
|
193 | - * |
|
194 | - * @return string action store identifier |
|
195 | - */ |
|
192 | + * Returns the store identifier which is generated on store and restore. |
|
193 | + * |
|
194 | + * @return string action store identifier |
|
195 | + */ |
|
196 | 196 | public function getIdentifier() { |
197 | 197 | return $this->identifier; |
198 | 198 | } |
@@ -63,12 +63,12 @@ discard block |
||
63 | 63 | |
64 | 64 | $identifier = md5($action->getOrderIdentifier().$this->intranet_id.time()); |
65 | 65 | |
66 | - $result = $this->db->exec('INSERT INTO module_package_action SET ' . |
|
67 | - 'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').', ' . |
|
68 | - 'identifier = '.$this->db->quote($identifier, 'text').', ' . |
|
69 | - 'order_debtor_identifier = '.$this->db->quote($action->getOrderIdentifier(), 'text').', ' . |
|
70 | - 'date_created = NOW(), ' . |
|
71 | - 'action = '.$this->db->quote($action_serialized, 'text').', ' . |
|
66 | + $result = $this->db->exec('INSERT INTO module_package_action SET '. |
|
67 | + 'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').', '. |
|
68 | + 'identifier = '.$this->db->quote($identifier, 'text').', '. |
|
69 | + 'order_debtor_identifier = '.$this->db->quote($action->getOrderIdentifier(), 'text').', '. |
|
70 | + 'date_created = NOW(), '. |
|
71 | + 'action = '.$this->db->quote($action_serialized, 'text').', '. |
|
72 | 72 | 'active = 1'); |
73 | 73 | |
74 | 74 | if (PEAR::isError($result)) { |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | public function restore($identifier) |
96 | 96 | { |
97 | 97 | |
98 | - $result = $this->db->query('SELECT id, action, identifier FROM module_package_action WHERE ' . |
|
99 | - 'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' AND ' . |
|
100 | - 'identifier = '.$this->db->quote($identifier, 'text').' AND ' . |
|
98 | + $result = $this->db->query('SELECT id, action, identifier FROM module_package_action WHERE '. |
|
99 | + 'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' AND '. |
|
100 | + 'identifier = '.$this->db->quote($identifier, 'text').' AND '. |
|
101 | 101 | 'active = 1 '); |
102 | 102 | |
103 | 103 | if (PEAR::isError($result)) { |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | static public function restoreFromIdentifier($db, $identifier) |
132 | 132 | { |
133 | 133 | |
134 | - $result = $db->query('SELECT id, action, identifier FROM module_package_action WHERE ' . |
|
135 | - 'identifier = '.$db->quote($identifier, 'text').' AND ' . |
|
134 | + $result = $db->query('SELECT id, action, identifier FROM module_package_action WHERE '. |
|
135 | + 'identifier = '.$db->quote($identifier, 'text').' AND '. |
|
136 | 136 | 'active = 1 '); |
137 | 137 | |
138 | 138 | if (PEAR::isError($result)) { |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | return false; |
168 | 168 | } |
169 | 169 | |
170 | - $result = $this->db->exec('UPDATE module_package_action SET active = 0 WHERE ' . |
|
171 | - 'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' AND ' . |
|
170 | + $result = $this->db->exec('UPDATE module_package_action SET active = 0 WHERE '. |
|
171 | + 'intranet_id = '.$this->db->quote($this->intranet_id, 'integer').' AND '. |
|
172 | 172 | 'id = '.$this->db->quote($this->id, 'integer')); |
173 | 173 | |
174 | 174 | if (PEAR::isError($result)) { |
@@ -253,6 +253,7 @@ discard block |
||
253 | 253 | * Returns on the basis of the module package which type of add this is. Can be either add, extend, or upgrade |
254 | 254 | * |
255 | 255 | * @param object modulepackage An modulepackage object |
256 | + * @param Intraface_modules_modulepackage_ModulePackage $modulepackage |
|
256 | 257 | * |
257 | 258 | * @return string either 'add', 'extend' or 'upgrade' |
258 | 259 | */ |
@@ -295,6 +296,7 @@ discard block |
||
295 | 296 | * Returns the end date of the last modulepacke in a given group |
296 | 297 | * |
297 | 298 | * @param object modulepackage |
299 | + * @return string |
|
298 | 300 | */ |
299 | 301 | public function getLastEndDateInGroup($modulepackage) |
300 | 302 | { |
@@ -400,6 +402,8 @@ discard block |
||
400 | 402 | * |
401 | 403 | * @param object modulepackage module package |
402 | 404 | * @param string duration Duration as either date 'dd-mm-yyyy' or 'yyyy-mm-dd' or 'X month' where X is any whole number |
405 | + * @param Intraface_modules_modulepackage_ModulePackage $modulepackage |
|
406 | + * @param string $duration |
|
403 | 407 | * |
404 | 408 | * @return object Action object with the actions needed to be processed |
405 | 409 | */ |
@@ -470,6 +474,8 @@ discard block |
||
470 | 474 | * |
471 | 475 | * @param object modulepackage |
472 | 476 | * @param string duration Duration as either date 'dd-mm-yyyy' or 'yyyy-mm-dd' or 'X month' where X is any whole number |
477 | + * @param Intraface_modules_modulepackage_ModulePackage $modulepackage |
|
478 | + * @param string $duration |
|
473 | 479 | * |
474 | 480 | * @return object Action object with the actions needed to be performed |
475 | 481 | */ |
@@ -628,7 +634,7 @@ discard block |
||
628 | 634 | /** |
629 | 635 | * Returns the possible types of status' |
630 | 636 | * |
631 | - * @return array status types |
|
637 | + * @return string[] status types |
|
632 | 638 | */ |
633 | 639 | static public function getStatusTypes() |
634 | 640 | { |
@@ -557,7 +557,7 @@ |
||
557 | 557 | 'month' => $parsed_duration['month'])); |
558 | 558 | |
559 | 559 | return $action; |
560 | - } |
|
560 | + } |
|
561 | 561 | |
562 | 562 | /** |
563 | 563 | * Returns an array of the packages that an intranet has. |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | // Should we rather just take intranet_id as parameter? |
48 | 48 | $this->intranet = &$intranet; |
49 | 49 | $this->db = MDB2::singleton(DB_DSN); |
50 | - $this->error = new Intraface_Error; |
|
50 | + $this->error = new Intraface_Error; |
|
51 | 51 | $this->id = (int)$id; |
52 | 52 | |
53 | 53 | if ($this->id > 0) { |
@@ -67,20 +67,20 @@ discard block |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | // TODO: This could actually easily use dbquery |
70 | - $result = $this->db->query('SELECT intranet_module_package.id, ' . |
|
71 | - 'intranet_module_package.module_package_id, ' . |
|
72 | - 'intranet_module_package.start_date, ' . |
|
73 | - 'intranet_module_package.end_date, ' . |
|
74 | - 'intranet_module_package.order_debtor_id, ' . |
|
75 | - 'intranet_module_package.status_key, ' . |
|
76 | - 'module_package_plan.plan, ' . |
|
77 | - 'module_package_group.group_name, ' . |
|
78 | - 'DATE_FORMAT(intranet_module_package.start_date, "%d-%m-%Y") AS dk_start_date, ' . |
|
79 | - 'DATE_FORMAT(intranet_module_package.end_date, "%d-%m-%Y") AS dk_end_date ' . |
|
80 | - 'FROM intranet_module_package ' . |
|
81 | - 'INNER JOIN module_package ON intranet_module_package.module_package_id = module_package.id ' . |
|
82 | - 'INNER JOIN module_package_plan ON module_package.module_package_plan_id = module_package_plan.id ' . |
|
83 | - 'INNER JOIN module_package_group ON module_package.module_package_group_id = module_package_group.id ' . |
|
70 | + $result = $this->db->query('SELECT intranet_module_package.id, '. |
|
71 | + 'intranet_module_package.module_package_id, '. |
|
72 | + 'intranet_module_package.start_date, '. |
|
73 | + 'intranet_module_package.end_date, '. |
|
74 | + 'intranet_module_package.order_debtor_id, '. |
|
75 | + 'intranet_module_package.status_key, '. |
|
76 | + 'module_package_plan.plan, '. |
|
77 | + 'module_package_group.group_name, '. |
|
78 | + 'DATE_FORMAT(intranet_module_package.start_date, "%d-%m-%Y") AS dk_start_date, '. |
|
79 | + 'DATE_FORMAT(intranet_module_package.end_date, "%d-%m-%Y") AS dk_end_date '. |
|
80 | + 'FROM intranet_module_package '. |
|
81 | + 'INNER JOIN module_package ON intranet_module_package.module_package_id = module_package.id '. |
|
82 | + 'INNER JOIN module_package_plan ON module_package.module_package_plan_id = module_package_plan.id '. |
|
83 | + 'INNER JOIN module_package_group ON module_package.module_package_group_id = module_package_group.id '. |
|
84 | 84 | 'WHERE intranet_id = '.$this->db->quote($this->intranet->get('id'), 'integer').' AND intranet_module_package.id = '.$this->db->quote($this->id, 'integer')); |
85 | 85 | |
86 | 86 | if (PEAR::isError($result)) { |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | - $sql = "module_package_id = ".$this->db->quote($modulepackage->get('id'), 'integer').", " . |
|
164 | - "start_date = ".$this->db->quote($start_date, 'date').", " . |
|
163 | + $sql = "module_package_id = ".$this->db->quote($modulepackage->get('id'), 'integer').", ". |
|
164 | + "start_date = ".$this->db->quote($start_date, 'date').", ". |
|
165 | 165 | "end_date = ".$this->db->quote($end_date, 'date'); |
166 | 166 | |
167 | 167 | $result = $this->db->exec("INSERT INTO intranet_module_package SET ".$sql.", status_key = 1, active = 1, intranet_id = ".$this->intranet->get('id')); |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | return false; |
199 | 199 | } |
200 | 200 | |
201 | - $result = $this->db->exec('UPDATE intranet_module_package ' . |
|
202 | - 'SET order_debtor_identifier = '.$this->db->quote($order_identifier, 'text').' ' . |
|
201 | + $result = $this->db->exec('UPDATE intranet_module_package '. |
|
202 | + 'SET order_debtor_identifier = '.$this->db->quote($order_identifier, 'text').' '. |
|
203 | 203 | 'WHERE intranet_id = '.$this->db->quote($this->intranet->get('id'), 'integer').' AND id = '.$this->db->quote($this->id, 'integer')); |
204 | 204 | |
205 | 205 | if (PEAR::isError($result)) { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $result = $this->db->exec("UPDATE intranet_module_package SET status_key = 3 WHERE intranet_id = ".$this->intranet->get('id')." AND id = ".intval($this->id)); |
225 | 225 | if (PEAR::isError($result)) { |
226 | - throw new Exception("Error in query in Intraface_modules_modulepackage_Manager->terminate :". $result->getUserInfo()); |
|
226 | + throw new Exception("Error in query in Intraface_modules_modulepackage_Manager->terminate :".$result->getUserInfo()); |
|
227 | 227 | exit; |
228 | 228 | } |
229 | 229 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | $result = $this->db->exec("UPDATE intranet_module_package SET active = 0 WHERE intranet_id = ".$this->intranet->get('id')." AND id = ".intval($this->id)); |
244 | 244 | if (PEAR::isError($result)) { |
245 | - throw new Exception("Error in query in Intraface_modules_modulepackage_Manager->delete :". $result->getUserInfo()); |
|
245 | + throw new Exception("Error in query in Intraface_modules_modulepackage_Manager->delete :".$result->getUserInfo()); |
|
246 | 246 | exit; |
247 | 247 | } |
248 | 248 | |
@@ -269,10 +269,10 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | // TODO: If DBQuery had not needed kernel we could have used it here! |
272 | - $result = $this->db->query('SELECT module_package_plan.plan_index FROM intranet_module_package ' . |
|
273 | - 'INNER JOIN module_package ON intranet_module_package.module_package_id = module_package.id ' . |
|
274 | - 'INNER JOIN module_package_plan ON module_package.module_package_plan_id = module_package_plan.id ' . |
|
275 | - 'WHERE intranet_module_package.intranet_id = '.$this->intranet->get('id').' AND intranet_module_package.active = 1 AND (intranet_module_package.status_key = 1 OR intranet_module_package.status_key = 2) AND module_package.module_package_group_id = '.$modulepackage->get('group_id').' ' . |
|
272 | + $result = $this->db->query('SELECT module_package_plan.plan_index FROM intranet_module_package '. |
|
273 | + 'INNER JOIN module_package ON intranet_module_package.module_package_id = module_package.id '. |
|
274 | + 'INNER JOIN module_package_plan ON module_package.module_package_plan_id = module_package_plan.id '. |
|
275 | + 'WHERE intranet_module_package.intranet_id = '.$this->intranet->get('id').' AND intranet_module_package.active = 1 AND (intranet_module_package.status_key = 1 OR intranet_module_package.status_key = 2) AND module_package.module_package_group_id = '.$modulepackage->get('group_id').' '. |
|
276 | 276 | 'ORDER BY end_date DESC'); |
277 | 277 | |
278 | 278 | if (PEAR::isError($result)) { |
@@ -310,10 +310,10 @@ discard block |
||
310 | 310 | } |
311 | 311 | |
312 | 312 | // TODO: If DBQuery had not needed kernel we could have used it here! |
313 | - $result = $this->db->query('SELECT intranet_module_package.end_date FROM intranet_module_package ' . |
|
314 | - 'INNER JOIN module_package ON intranet_module_package.module_package_id = module_package.id ' . |
|
315 | - 'INNER JOIN module_package_plan ON module_package.module_package_plan_id = module_package_plan.id ' . |
|
316 | - 'WHERE intranet_module_package.intranet_id = '.$this->intranet->get('id').' AND intranet_module_package.active = 1 AND (intranet_module_package.status_key = 1 OR intranet_module_package.status_key = 2) AND module_package.module_package_group_id = '.$modulepackage->get('group_id').' ' . |
|
313 | + $result = $this->db->query('SELECT intranet_module_package.end_date FROM intranet_module_package '. |
|
314 | + 'INNER JOIN module_package ON intranet_module_package.module_package_id = module_package.id '. |
|
315 | + 'INNER JOIN module_package_plan ON module_package.module_package_plan_id = module_package_plan.id '. |
|
316 | + 'WHERE intranet_module_package.intranet_id = '.$this->intranet->get('id').' AND intranet_module_package.active = 1 AND (intranet_module_package.status_key = 1 OR intranet_module_package.status_key = 2) AND module_package.module_package_group_id = '.$modulepackage->get('group_id').' '. |
|
317 | 317 | 'ORDER BY end_date DESC'); |
318 | 318 | |
319 | 319 | if (PEAR::isError($result)) { |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | // first we add a month to see if there is a full month left. |
362 | 362 | // If we want to give them this month for free this should be removed. |
363 | 363 | $running_start_date_integer = strtotime('+1 month', $start_date_integer); |
364 | - while($running_start_date_integer <= $end_date_integer) { |
|
364 | + while ($running_start_date_integer <= $end_date_integer) { |
|
365 | 365 | $running_start_date_integer = strtotime('+1 month', $running_start_date_integer); |
366 | 366 | $month++; |
367 | 367 | } |
@@ -499,11 +499,11 @@ discard block |
||
499 | 499 | $shop = new Intraface_modules_modulepackage_ShopExtension; |
500 | 500 | |
501 | 501 | // TODO: If DBQuery had not needed kernel we could have used it here! |
502 | - $result = $this->db->query('SELECT intranet_module_package.id, intranet_module_package.status_key, intranet_module_package.start_date, intranet_module_package.end_date, intranet_module_package.order_debtor_id, intranet_module_package.module_package_id, module_package.product_id ' . |
|
503 | - 'FROM intranet_module_package ' . |
|
504 | - 'INNER JOIN module_package ON intranet_module_package.module_package_id = module_package.id ' . |
|
505 | - 'INNER JOIN module_package_plan ON module_package.module_package_plan_id = module_package_plan.id ' . |
|
506 | - 'WHERE intranet_module_package.intranet_id = '.$this->intranet->get('id').' AND intranet_module_package.active = 1 AND (intranet_module_package.status_key = 1 OR intranet_module_package.status_key = 2) AND module_package.module_package_group_id = '.$modulepackage->get('group_id').' ' . |
|
502 | + $result = $this->db->query('SELECT intranet_module_package.id, intranet_module_package.status_key, intranet_module_package.start_date, intranet_module_package.end_date, intranet_module_package.order_debtor_id, intranet_module_package.module_package_id, module_package.product_id '. |
|
503 | + 'FROM intranet_module_package '. |
|
504 | + 'INNER JOIN module_package ON intranet_module_package.module_package_id = module_package.id '. |
|
505 | + 'INNER JOIN module_package_plan ON module_package.module_package_plan_id = module_package_plan.id '. |
|
506 | + 'WHERE intranet_module_package.intranet_id = '.$this->intranet->get('id').' AND intranet_module_package.active = 1 AND (intranet_module_package.status_key = 1 OR intranet_module_package.status_key = 2) AND module_package.module_package_group_id = '.$modulepackage->get('group_id').' '. |
|
507 | 507 | 'ORDER BY end_date DESC'); |
508 | 508 | |
509 | 509 | if (PEAR::isError($result)) { |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | exit; |
512 | 512 | } |
513 | 513 | |
514 | - while($row = $result->fetchRow()) { |
|
514 | + while ($row = $result->fetchRow()) { |
|
515 | 515 | |
516 | 516 | $add_action = array(); |
517 | 517 | |
@@ -592,22 +592,22 @@ discard block |
||
592 | 592 | $this->dbquery->setSorting('module_package_group.sorting_index, module_package_plan.plan_index, intranet_module_package.start_date'); |
593 | 593 | } |
594 | 594 | |
595 | - $db = $this->dbquery->getRecordset('intranet_module_package.id, ' . |
|
596 | - 'intranet_module_package.module_package_id, ' . |
|
597 | - 'intranet_module_package.start_date, ' . |
|
598 | - 'intranet_module_package.end_date, ' . |
|
599 | - 'intranet_module_package.order_debtor_id, ' . |
|
600 | - 'intranet_module_package.status_key, ' . |
|
601 | - 'module_package_plan.plan, ' . |
|
602 | - 'module_package_group.group_name, ' . |
|
603 | - 'DATE_FORMAT(intranet_module_package.start_date, "%d-%m-%Y") AS dk_start_date, ' . |
|
595 | + $db = $this->dbquery->getRecordset('intranet_module_package.id, '. |
|
596 | + 'intranet_module_package.module_package_id, '. |
|
597 | + 'intranet_module_package.start_date, '. |
|
598 | + 'intranet_module_package.end_date, '. |
|
599 | + 'intranet_module_package.order_debtor_id, '. |
|
600 | + 'intranet_module_package.status_key, '. |
|
601 | + 'module_package_plan.plan, '. |
|
602 | + 'module_package_group.group_name, '. |
|
603 | + 'DATE_FORMAT(intranet_module_package.start_date, "%d-%m-%Y") AS dk_start_date, '. |
|
604 | 604 | 'DATE_FORMAT(intranet_module_package.end_date, "%d-%m-%Y") AS dk_end_date', '', false); |
605 | 605 | |
606 | 606 | $modulepackages = array(); |
607 | 607 | $i = 0; |
608 | 608 | |
609 | 609 | $status_types = $this->getStatusTypes(); |
610 | - while($db->nextRecord()) { |
|
610 | + while ($db->nextRecord()) { |
|
611 | 611 | $modulepackages[$i]['id'] = $db->f('id'); |
612 | 612 | $modulepackages[$i]['module_package_id'] = $db->f('module_package_id'); |
613 | 613 | $modulepackages[$i]['start_date'] = $db->f('start_date'); |
@@ -234,7 +234,7 @@ |
||
234 | 234 | /** |
235 | 235 | * Returns order details from order identifier |
236 | 236 | * |
237 | - * @param string $order_identifier |
|
237 | + * @param string $order_identification |
|
238 | 238 | * @return array |
239 | 239 | */ |
240 | 240 | public function getOrderDetails($order_identification) |
@@ -61,7 +61,7 @@ |
||
61 | 61 | INTRAFACE_INTRANETMAINTENANCE_SHOP_ID, |
62 | 62 | INTRAFACE_XMLRPC_DEBUG, |
63 | 63 | $xmlrpc_shop_url); |
64 | - } catch(Exception $e) { |
|
64 | + } catch (Exception $e) { |
|
65 | 65 | $this->shop = NULL; |
66 | 66 | throw new Exception('Unable to connect to the intranet maintenance webshop '.$e->getMessage()); |
67 | 67 | } |
@@ -105,7 +105,7 @@ |
||
105 | 105 | } else { |
106 | 106 | return array(); |
107 | 107 | } |
108 | - } elseif (is_int($product_id)) { |
|
108 | + } elseif (is_int($product_id)) { |
|
109 | 109 | if (intval($product_id) == 0) { |
110 | 110 | return array(); |
111 | 111 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | /** |
201 | 201 | * Puts subscribers in a queue to the newsletter |
202 | 202 | * |
203 | - * @return boolean |
|
203 | + * @return null|boolean |
|
204 | 204 | */ |
205 | 205 | function queue() |
206 | 206 | { |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @param integer $id Contact id |
308 | 308 | * |
309 | - * @return object |
|
309 | + * @return Contact |
|
310 | 310 | */ |
311 | 311 | function getContact($id) |
312 | 312 | { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | private function load() |
78 | 78 | { |
79 | 79 | $db = new DB_Sql; |
80 | - $db->query("SELECT id, list_id, subject, text, deadline, sent_to_receivers, status FROM newsletter_archieve WHERE id = " . $this->id . " AND active = 1 LIMIT 1"); |
|
80 | + $db->query("SELECT id, list_id, subject, text, deadline, sent_to_receivers, status FROM newsletter_archieve WHERE id = " . $this->id . " AND active = 1 LIMIT 1"); |
|
81 | 81 | |
82 | 82 | $db2 = new DB_Sql; |
83 | 83 | if ($db->nextRecord()) { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | |
287 | 287 | // If the number of contacts can be divided evenly into 40 there will be no more params here. |
288 | 288 | if (count($params) > 0) { |
289 | - $result = $db->exec($sql . implode($params, ',')); |
|
289 | + $result = $db->exec($sql . implode($params, ',')); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | if (PEAR::isError($result)) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | private function load() |
78 | 78 | { |
79 | 79 | $db = new DB_Sql; |
80 | - $db->query("SELECT id, list_id, subject, text, deadline, sent_to_receivers, status FROM newsletter_archieve WHERE id = " . $this->id . " AND active = 1 LIMIT 1"); |
|
80 | + $db->query("SELECT id, list_id, subject, text, deadline, sent_to_receivers, status FROM newsletter_archieve WHERE id = ".$this->id." AND active = 1 LIMIT 1"); |
|
81 | 81 | |
82 | 82 | $db2 = new DB_Sql; |
83 | 83 | if ($db->nextRecord()) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | return false; |
120 | 120 | } |
121 | 121 | $db = new DB_Sql; |
122 | - $db->query("UPDATE newsletter_archieve SET active = 0 WHERE id = " . $this->get("id") . " AND intranet_id = " . $this->list->getIntranet()->getId() . " AND locked = 0"); |
|
122 | + $db->query("UPDATE newsletter_archieve SET active = 0 WHERE id = ".$this->get("id")." AND intranet_id = ".$this->list->getIntranet()->getId()." AND locked = 0"); |
|
123 | 123 | |
124 | 124 | return true; |
125 | 125 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | $sql_end = ', date_created = NOW()'; |
150 | 150 | } else { |
151 | 151 | $sql_type = "UPDATE"; |
152 | - $sql_end = " WHERE id = " . $this->id; |
|
152 | + $sql_end = " WHERE id = ".$this->id; |
|
153 | 153 | } |
154 | 154 | $db = new DB_Sql; |
155 | - $sql = $sql_type . " newsletter_archieve |
|
155 | + $sql = $sql_type." newsletter_archieve |
|
156 | 156 | SET subject = '".$var['subject']."', |
157 | 157 | text = '".$var['text']."', |
158 | 158 | intranet_id = ".$this->list->getIntranet()->getId().", |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | private function updateSent($receivers) |
183 | 183 | { |
184 | 184 | $db = new DB_Sql; |
185 | - $db->query("UPDATE newsletter_archieve SET status = 1, sent_to_receivers = '".(int)$receivers."' WHERE id = " . $this->id . " AND intranet_id = " . $this->list->getIntranet()->getId()); |
|
185 | + $db->query("UPDATE newsletter_archieve SET status = 1, sent_to_receivers = '".(int)$receivers."' WHERE id = ".$this->id." AND intranet_id = ".$this->list->getIntranet()->getId()); |
|
186 | 186 | return true; |
187 | 187 | } |
188 | 188 | |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $db = MDB2::singleton(DB_DSN); |
224 | 224 | |
225 | 225 | if (PEAR::isError($db)) { |
226 | - throw new Exception($result->getMessage() . $result->getUserInfo()); |
|
226 | + throw new Exception($result->getMessage().$result->getUserInfo()); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | $i = 0; |
@@ -260,19 +260,19 @@ discard block |
||
260 | 260 | '".$name."', |
261 | 261 | 8, |
262 | 262 | 2, |
263 | - ".$this->get('id') . ", |
|
264 | - '".$this->get('deadline'). "', |
|
265 | - " .$this->list->getIntranet()->getId(). " , |
|
266 | - " .$subscriber['contact_id']. " , |
|
263 | + ".$this->get('id').", |
|
264 | + '".$this->get('deadline')."', |
|
265 | + " .$this->list->getIntranet()->getId()." , |
|
266 | + " .$subscriber['contact_id']." , |
|
267 | 267 | " .$this->list->kernel->user->get('id').", |
268 | 268 | ".$subject.", |
269 | 269 | ".$body.")"; |
270 | 270 | |
271 | 271 | if ($i == 40) { |
272 | - $result = $db->exec($sql . implode($params, ',')); |
|
272 | + $result = $db->exec($sql.implode($params, ',')); |
|
273 | 273 | |
274 | 274 | if (PEAR::isError($result)) { |
275 | - $error[] = $result->getMessage() . $result->getUserInfo(); |
|
275 | + $error[] = $result->getMessage().$result->getUserInfo(); |
|
276 | 276 | return false; |
277 | 277 | } |
278 | 278 | |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | |
287 | 287 | // If the number of contacts can be divided evenly into 40 there will be no more params here. |
288 | 288 | if (count($params) > 0) { |
289 | - $result = $db->exec($sql . implode($params, ',')); |
|
289 | + $result = $db->exec($sql.implode($params, ',')); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | if (PEAR::isError($result)) { |
293 | - $error[] = $result->getMessage() . $result->getUserInfo(); |
|
293 | + $error[] = $result->getMessage().$result->getUserInfo(); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | if (!empty($error)) { |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | { |
323 | 323 | $list = array(); |
324 | 324 | $db = new DB_Sql; |
325 | - $db->query("SELECT * FROM newsletter_archieve WHERE active = 1 AND list_id = " . $this->list->get('id') . " ORDER BY deadline DESC"); |
|
325 | + $db->query("SELECT * FROM newsletter_archieve WHERE active = 1 AND list_id = ".$this->list->get('id')." ORDER BY deadline DESC"); |
|
326 | 326 | $i = 0; |
327 | 327 | while ($db->nextRecord()) { |
328 | 328 |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | /** |
178 | 178 | * Adds an existing contact |
179 | 179 | * |
180 | - * @param integer $contact_id Contact id |
|
180 | + * @param integer $contact Contact id |
|
181 | 181 | * |
182 | 182 | * @return integer of the id of the subscriber |
183 | 183 | */ |
@@ -493,6 +493,9 @@ discard block |
||
493 | 493 | } |
494 | 494 | } |
495 | 495 | |
496 | + /** |
|
497 | + * @param Contact $contact |
|
498 | + */ |
|
496 | 499 | private function getLoginUrl($contact) |
497 | 500 | { |
498 | 501 | if (!$link = $this->list->get('optin_link')) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return $this->dbquery; |
53 | 53 | } |
54 | 54 | // optin = 1 should not be set here |
55 | - $this->dbquery = new Intraface_DBQuery($this->list->kernel, "newsletter_subscriber", "newsletter_subscriber.list_id=". $this->list->get("id") . " AND newsletter_subscriber.intranet_id = " . $this->list->kernel->intranet->get('id')); |
|
55 | + $this->dbquery = new Intraface_DBQuery($this->list->kernel, "newsletter_subscriber", "newsletter_subscriber.list_id=".$this->list->get("id")." AND newsletter_subscriber.intranet_id = ".$this->list->kernel->intranet->get('id')); |
|
56 | 56 | $this->dbquery->setJoin("LEFT", "contact", "newsletter_subscriber.contact_id = contact.id AND contact.intranet_id = ".$this->list->kernel->intranet->get("id"), ''); |
57 | 57 | $this->dbquery->setJoin("LEFT", "address", "address.belong_to_id = contact.id AND address.active = 1 AND address.type = 3", ''); |
58 | 58 | $this->dbquery->useErrorObject($this->error); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | private function load() |
136 | 136 | { |
137 | 137 | $db = new DB_Sql; |
138 | - $db->query("SELECT * FROM newsletter_subscriber WHERE id = " . $this->id." and active = 1"); |
|
138 | + $db->query("SELECT * FROM newsletter_subscriber WHERE id = ".$this->id." and active = 1"); |
|
139 | 139 | if (!$db->nextRecord()) { |
140 | 140 | |
141 | 141 | $this->id = 0; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | public function delete() |
160 | 160 | { |
161 | 161 | $db = new DB_Sql; |
162 | - $db->query('UPDATE newsletter_subscriber SET active = 0 WHERE id = ' . $this->id); |
|
162 | + $db->query('UPDATE newsletter_subscriber SET active = 0 WHERE id = '.$this->id); |
|
163 | 163 | return true; |
164 | 164 | } |
165 | 165 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | { |
186 | 186 | $db = new DB_sql; |
187 | 187 | |
188 | - $db->query("SELECT id FROM newsletter_subscriber WHERE contact_id = '".$contact->getId()."' AND list_id = " . $this->list->get("id") . " AND intranet_id = ".$this->list->kernel->intranet->get('id')." AND active = 1"); |
|
188 | + $db->query("SELECT id FROM newsletter_subscriber WHERE contact_id = '".$contact->getId()."' AND list_id = ".$this->list->get("id")." AND intranet_id = ".$this->list->kernel->intranet->get('id')." AND active = 1"); |
|
189 | 189 | if ($db->nextRecord()) { |
190 | 190 | return $db->f('id'); |
191 | 191 | } |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | // Spørgsmålet er om vedkommende bør få en e-mail, hvor man kan acceptere? |
194 | 194 | $db->query("INSERT INTO newsletter_subscriber SET |
195 | 195 | contact_id = '".$contact->getId()."', |
196 | - list_id = " . $this->list->get("id") . ", |
|
196 | + list_id = " . $this->list->get("id").", |
|
197 | 197 | date_submitted=NOW(), |
198 | 198 | optin = 1, |
199 | - code = '".md5($this->list->get("id") . $this->list->kernel->intranet->get('id') . date('Y-m-d H:i:s') . $contact->getId())."', |
|
199 | + code = '".md5($this->list->get("id").$this->list->kernel->intranet->get('id').date('Y-m-d H:i:s').$contact->getId())."', |
|
200 | 200 | intranet_id = ".$this->list->kernel->intranet->get('id')); |
201 | 201 | |
202 | 202 | return $db->insertedId(); |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $input = array_map('strip_tags', $input); |
216 | 216 | |
217 | 217 | $validator = new Intraface_Validator($this->error); |
218 | - $validator->isEmail($input['email'], $input['email'] . ' er ikke en gyldig e-mail'); |
|
218 | + $validator->isEmail($input['email'], $input['email'].' er ikke en gyldig e-mail'); |
|
219 | 219 | |
220 | 220 | if (empty($input['name'])) { |
221 | 221 | $input['name'] = $input['email']; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | date_submitted = NOW(), |
284 | 284 | ip_submitted = '".$input['ip']."' |
285 | 285 | WHERE id = ".$this->id." |
286 | - AND list_id = " . $this->list->get("id") . " |
|
286 | + AND list_id = " . $this->list->get("id")." |
|
287 | 287 | AND intranet_id = " . $this->list->kernel->intranet->get('id')); |
288 | 288 | //code = '" . md5($input['email'] . date('Y-m-d H:i:s') . $input['ip'])."' |
289 | 289 | |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | contact_id = '".$contact->get('id')."', |
308 | 308 | email = '".$input['email']."', |
309 | 309 | name='".$input['name']."', |
310 | - list_id = " . $this->list->get("id") . ", |
|
310 | + list_id = " . $this->list->get("id").", |
|
311 | 311 | ip_submitted='".$input['ip']."', |
312 | 312 | date_submitted=NOW(), |
313 | - code= '" . md5($input['email'] . date('Y-m-d H:i:s') . $input['ip'])."', |
|
313 | + code= '" . md5($input['email'].date('Y-m-d H:i:s').$input['ip'])."', |
|
314 | 314 | intranet_id = ".$this->list->kernel->intranet->get('id')); |
315 | 315 | |
316 | 316 | } |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | return false; |
347 | 347 | } |
348 | 348 | $db = new DB_Sql; |
349 | - $db->query("SELECT * FROM newsletter_subscriber WHERE id = " . $this->id." and active = 1"); |
|
349 | + $db->query("SELECT * FROM newsletter_subscriber WHERE id = ".$this->id." and active = 1"); |
|
350 | 350 | if (!$db->nextRecord()) { |
351 | 351 | return false; |
352 | 352 | } |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $this->load(); |
385 | 385 | |
386 | 386 | $db = new DB_Sql; |
387 | - $db->query("UPDATE newsletter_subscriber SET active = 0, date_unsubscribe = '".date('Y-m-d H:i:s')."' WHERE id=".$this->id." AND list_id = " . $this->list->get("id") . " AND intranet_id = " . $this->list->kernel->intranet->get('id')); |
|
387 | + $db->query("UPDATE newsletter_subscriber SET active = 0, date_unsubscribe = '".date('Y-m-d H:i:s')."' WHERE id=".$this->id." AND list_id = ".$this->list->get("id")." AND intranet_id = ".$this->list->kernel->intranet->get('id')); |
|
388 | 388 | return true; |
389 | 389 | } |
390 | 390 | |
@@ -402,16 +402,16 @@ discard block |
||
402 | 402 | // optin really wants to optin, so we will not make that a part of the select query |
403 | 403 | // and we will set it in the update query |
404 | 404 | $db = new DB_Sql; |
405 | - $db->query("SELECT id, ip_submitted FROM newsletter_subscriber WHERE code = '".$code."' AND list_id = " . $this->list->get('id')); |
|
405 | + $db->query("SELECT id, ip_submitted FROM newsletter_subscriber WHERE code = '".$code."' AND list_id = ".$this->list->get('id')); |
|
406 | 406 | if (!$db->nextRecord()) { |
407 | 407 | return false; |
408 | 408 | } |
409 | 409 | |
410 | - $db->query("UPDATE newsletter_subscriber SET optin = 1, ip_optin = '".$ip."', date_optin = NOW(), active = 1 WHERE code = '" . $code . "' AND list_id = " . $this->list->get('id')); |
|
410 | + $db->query("UPDATE newsletter_subscriber SET optin = 1, ip_optin = '".$ip."', date_optin = NOW(), active = 1 WHERE code = '".$code."' AND list_id = ".$this->list->get('id')); |
|
411 | 411 | |
412 | 412 | // makes sure that the submitted ip is also set - not really a part of this method. |
413 | 413 | if ($db->f('ip_submitted')) { |
414 | - $db->query("UPDATE newsletter_subscriber SET ip_submitted = '".$ip."' WHERE id = " . $db->f("id")); |
|
414 | + $db->query("UPDATE newsletter_subscriber SET ip_submitted = '".$ip."' WHERE id = ".$db->f("id")); |
|
415 | 415 | } |
416 | 416 | return true; |
417 | 417 | } |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | $data = array( |
457 | 457 | 'subject' => $subscribe_subject, |
458 | 458 | 'body' => |
459 | - $this->list->get('subscribe_message') . "\n\n" . |
|
460 | - $this->getLoginUrl($contact) . |
|
459 | + $this->list->get('subscribe_message')."\n\n". |
|
460 | + $this->getLoginUrl($contact). |
|
461 | 461 | "\n\n".$this->list->get('sender_name'), |
462 | 462 | 'contact_id' => $this->get('contact_id'), |
463 | 463 | 'from_email' => $this->list->get('reply_email'), |
@@ -467,16 +467,16 @@ discard block |
||
467 | 467 | ); |
468 | 468 | |
469 | 469 | if (!$email->save($data)) { |
470 | - $this->error->set('could not send the e-mail' . implode(',', $email->error->messages)); |
|
470 | + $this->error->set('could not send the e-mail'.implode(',', $email->error->messages)); |
|
471 | 471 | return false; |
472 | 472 | } |
473 | 473 | |
474 | 474 | if ($email->queue()) { |
475 | 475 | $db = new DB_Sql; |
476 | - $db->query("UPDATE newsletter_subscriber SET date_optin_email_sent = NOW() WHERE id = " . $this->id); |
|
476 | + $db->query("UPDATE newsletter_subscriber SET date_optin_email_sent = NOW() WHERE id = ".$this->id); |
|
477 | 477 | return true; |
478 | 478 | } |
479 | - $this->error->set('could not send the e-mail' . implode(',', $email->error->message)); |
|
479 | + $this->error->set('could not send the e-mail'.implode(',', $email->error->message)); |
|
480 | 480 | return false; |
481 | 481 | } |
482 | 482 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | { |
489 | 489 | if ($this->sendOptInEmail()) { |
490 | 490 | $db = new DB_Sql; |
491 | - $db->query("UPDATE newsletter_subscriber SET resend_optin_email_count = resend_optin_email_count + 1 WHERE id = " . $this->id); |
|
491 | + $db->query("UPDATE newsletter_subscriber SET resend_optin_email_count = resend_optin_email_count + 1 WHERE id = ".$this->id); |
|
492 | 492 | return true; |
493 | 493 | } |
494 | 494 | } |
@@ -496,9 +496,9 @@ discard block |
||
496 | 496 | private function getLoginUrl($contact) |
497 | 497 | { |
498 | 498 | if (!$link = $this->list->get('optin_link')) { |
499 | - return $contact->getLoginUrl() . '&optin=' . $this->get('code'); |
|
499 | + return $contact->getLoginUrl().'&optin='.$this->get('code'); |
|
500 | 500 | } |
501 | - return $link . '?optin=' . $this->get('code'); |
|
501 | + return $link.'?optin='.$this->get('code'); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | /** |
@@ -57,6 +57,9 @@ discard block |
||
57 | 57 | return $db->numRows(); |
58 | 58 | } |
59 | 59 | |
60 | + /** |
|
61 | + * @param string $code |
|
62 | + */ |
|
60 | 63 | function findByCode($code) |
61 | 64 | { |
62 | 65 | // kernel og kode |
@@ -73,6 +76,9 @@ discard block |
||
73 | 76 | return new NewsletterSubscriber(new NewsletterList($this->kernel, $db->f('list_id')), $db->f('id')); |
74 | 77 | } |
75 | 78 | |
79 | + /** |
|
80 | + * @param string $email |
|
81 | + */ |
|
76 | 82 | function findByListAndEmail($list, $email) |
77 | 83 | { |
78 | 84 | $email = safeToDb($email); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | function getAllUnsubscribersForList($list) |
18 | 18 | { |
19 | - $this->dbquery = new Intraface_DBQuery($list->kernel, "newsletter_subscriber", "newsletter_subscriber.list_id=". $list->get('id') . " AND newsletter_subscriber.intranet_id = " . $list->kernel->intranet->get('id')); |
|
19 | + $this->dbquery = new Intraface_DBQuery($list->kernel, "newsletter_subscriber", "newsletter_subscriber.list_id=".$list->get('id')." AND newsletter_subscriber.intranet_id = ".$list->kernel->intranet->get('id')); |
|
20 | 20 | $this->dbquery->setJoin("LEFT", "contact", "newsletter_subscriber.contact_id = contact.id AND contact.intranet_id = ".$list->kernel->intranet->get("id"), ''); |
21 | 21 | $this->dbquery->setJoin("LEFT", "address", "address.belong_to_id = contact.id AND address.active = 1 AND address.type = 3", ''); |
22 | 22 | $this->dbquery->setFilter('optin', 1); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | function getByContactId($list, $id) |
32 | 32 | { |
33 | - $this->dbquery = new Intraface_DBQuery($list->kernel, "newsletter_subscriber", "newsletter_subscriber.list_id=". $list->get('id') . " AND newsletter_subscriber.intranet_id = " . $list->kernel->intranet->get('id')); |
|
33 | + $this->dbquery = new Intraface_DBQuery($list->kernel, "newsletter_subscriber", "newsletter_subscriber.list_id=".$list->get('id')." AND newsletter_subscriber.intranet_id = ".$list->kernel->intranet->get('id')); |
|
34 | 34 | $this->dbquery->setFilter('contact_id', $id); |
35 | 35 | $this->getDBQuery()->setCondition('newsletter_subscriber.contact_id = '.$this->getDBQuery()->getFilter('contact_id')); |
36 | 36 | |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | { |
42 | 42 | // @todo - make sure to delete old ones |
43 | 43 | $db = MDB2::singleton(); |
44 | - $db->query('UPDATE newsletter_subscriber SET contact_id = ' . $new_id . ' WHERE contact_id = ' . $old_id); |
|
44 | + $db->query('UPDATE newsletter_subscriber SET contact_id = '.$new_id.' WHERE contact_id = '.$old_id); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function findCountByContactId($contact_id) |
48 | 48 | { |
49 | 49 | $sql = "SELECT id |
50 | 50 | FROM newsletter_subscriber |
51 | - WHERE intranet_id = " . $this->kernel->intranet->get("id") . " |
|
51 | + WHERE intranet_id = " . $this->kernel->intranet->get("id")." |
|
52 | 52 | AND contact_id = ".(int)$contact_id." |
53 | 53 | AND active = 1"; |
54 | 54 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $code = strip_tags($code); |
66 | 66 | |
67 | 67 | $db = new DB_Sql; |
68 | - $db->query("SELECT id, list_id FROM newsletter_subscriber WHERE code = '".$code."' AND intranet_id = " . $this->kernel->intranet->get('id')." and active = 1"); |
|
68 | + $db->query("SELECT id, list_id FROM newsletter_subscriber WHERE code = '".$code."' AND intranet_id = ".$this->kernel->intranet->get('id')." and active = 1"); |
|
69 | 69 | if (!$db->nextRecord()) { |
70 | 70 | return false; |
71 | 71 | } |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | LEFT JOIN address |
85 | 85 | ON address.belong_to_id = contact.id |
86 | 86 | WHERE address.email = '".$email."' |
87 | - AND newsletter_subscriber.list_id = " . $list->get('id') . " |
|
88 | - AND newsletter_subscriber.intranet_id = " . $this->kernel->intranet->get('id') . " |
|
87 | + AND newsletter_subscriber.list_id = " . $list->get('id')." |
|
88 | + AND newsletter_subscriber.intranet_id = " . $this->kernel->intranet->get('id')." |
|
89 | 89 | AND newsletter_subscriber.active = 1 |
90 | 90 | AND contact.active = 1"); |
91 | 91 | if (!$db->nextRecord()) { |
@@ -300,6 +300,10 @@ discard block |
||
300 | 300 | return $this->id; |
301 | 301 | } |
302 | 302 | |
303 | + /** |
|
304 | + * @param string $belong_to |
|
305 | + * @param integer $belong_to_id |
|
306 | + */ |
|
303 | 307 | function changeBelongTo($belong_to, $belong_to_id) |
304 | 308 | { |
305 | 309 | if ($this->id == 0) { |
@@ -323,6 +327,9 @@ discard block |
||
323 | 327 | |
324 | 328 | } |
325 | 329 | |
330 | + /** |
|
331 | + * @param string $status |
|
332 | + */ |
|
326 | 333 | function setStatus($status) |
327 | 334 | { |
328 | 335 | if ($this->id == 0) { |
@@ -584,7 +591,7 @@ discard block |
||
584 | 591 | /** |
585 | 592 | * returns the possible status types |
586 | 593 | * |
587 | - * @return array with status types |
|
594 | + * @return string[] with status types |
|
588 | 595 | */ |
589 | 596 | static function getStatusTypes() |
590 | 597 | { |
@@ -600,7 +607,7 @@ discard block |
||
600 | 607 | /** |
601 | 608 | * returns possible belong to types |
602 | 609 | * |
603 | - * @return array with belong to types |
|
610 | + * @return string[] with belong to types |
|
604 | 611 | */ |
605 | 612 | private function getBelongToTypes() |
606 | 613 | { |
@@ -613,7 +620,7 @@ discard block |
||
613 | 620 | /** |
614 | 621 | * returns the implemented providers |
615 | 622 | * |
616 | - * @return array with providers |
|
623 | + * @return string[] with providers |
|
617 | 624 | */ |
618 | 625 | static function getImplementedProviders() |
619 | 626 | { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param array $input (belong_to, belong_to_id, transaction_number, transaction_status, amount) |
135 | 135 | * |
136 | 136 | * @return integer |
137 | - */ |
|
137 | + */ |
|
138 | 138 | public function save($input) |
139 | 139 | { |
140 | 140 | $input = safeToDb($input); |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | if (!isset($input['text'])) { |
163 | - $input['text'] = ''; |
|
163 | + $input['text'] = ''; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | if ($input['transaction_status'] == $this->transaction_status_authorized) { |
167 | - $status_key = 2; |
|
167 | + $status_key = 2; |
|
168 | 168 | } else { |
169 | 169 | $status_key = 1; |
170 | 170 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | { |
55 | 55 | $gateway = new Intraface_modules_onlinepayment_OnlinePaymentGateway($kernel); |
56 | 56 | |
57 | - switch($type) { |
|
57 | + switch ($type) { |
|
58 | 58 | case 'settings': |
59 | 59 | return $gateway->findBySettings(); |
60 | 60 | break; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | throw new Exception("Kan ikke skifte til lavere eller samme status i OnlinePayment->setStatus()"); |
341 | 341 | } |
342 | 342 | |
343 | - switch($status) { |
|
343 | + switch ($status) { |
|
344 | 344 | case "authorized": |
345 | 345 | $date_field = "date_authorized"; |
346 | 346 | break; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | |
667 | 667 | function getStatus() |
668 | 668 | { |
669 | - $status = $this->getStatusTypes(); |
|
669 | + $status = $this->getStatusTypes(); |
|
670 | 670 | return $status[$this->value['status_key']]; |
671 | 671 | } |
672 | 672 | } |
673 | 673 | \ No newline at end of file |
@@ -33,6 +33,9 @@ discard block |
||
33 | 33 | return $this->getProvider($provider, $value); |
34 | 34 | } |
35 | 35 | |
36 | + /** |
|
37 | + * @param integer $provider |
|
38 | + */ |
|
36 | 39 | public function findByProvider($provider) |
37 | 40 | { |
38 | 41 | if (!in_array($provider, $this->implemented_providers)) { |
@@ -42,6 +45,9 @@ discard block |
||
42 | 45 | return $this->getProvider($provider); |
43 | 46 | } |
44 | 47 | |
48 | + /** |
|
49 | + * @param integer $value |
|
50 | + */ |
|
45 | 51 | public function findByTransactionNumber($value) |
46 | 52 | { |
47 | 53 | $db = new DB_Sql; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | { |
26 | 26 | $type = 'id'; |
27 | 27 | $db = new DB_Sql; |
28 | - $db->query("SELECT provider_key FROM onlinepayment WHERE id = ".(int)$value. " AND intranet_id = " . $this->kernel->intranet->get('id')); |
|
28 | + $db->query("SELECT provider_key FROM onlinepayment WHERE id = ".(int)$value." AND intranet_id = ".$this->kernel->intranet->get('id')); |
|
29 | 29 | if (!$db->nextRecord()) { |
30 | 30 | throw new Exception('OnlinePayment::factory: Ikke et gyldigt id'); |
31 | 31 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function findByTransactionNumber($value) |
46 | 46 | { |
47 | 47 | $db = new DB_Sql; |
48 | - $db->query("SELECT provider_key FROM onlinepayment WHERE transaction_number = '".$value."' AND intranet_id = " . $kernel->intranet->get('id')); |
|
48 | + $db->query("SELECT provider_key FROM onlinepayment WHERE transaction_number = '".$value."' AND intranet_id = ".$kernel->intranet->get('id')); |
|
49 | 49 | if (!$db->nextRecord()) { |
50 | 50 | throw new Exception('OnlinePayment::factory: Ikke et gyldigt transactionnumber'); |
51 | 51 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | protected function getProvider($provider, $value = 0) |
58 | 58 | { |
59 | - switch(strtolower($provider)) { |
|
59 | + switch (strtolower($provider)) { |
|
60 | 60 | case 'default': |
61 | 61 | require_once 'Intraface/modules/onlinepayment/provider/Default.php'; |
62 | 62 | return new OnlinePaymentDefault($this->kernel, $value); |
@@ -46,6 +46,9 @@ |
||
46 | 46 | ); |
47 | 47 | */ |
48 | 48 | |
49 | + /** |
|
50 | + * @param integer $id |
|
51 | + */ |
|
49 | 52 | function __construct($kernel, $id) |
50 | 53 | { |
51 | 54 | parent::__construct($kernel, $id); |
@@ -145,8 +145,8 @@ |
||
145 | 145 | |
146 | 146 | function getSettings() |
147 | 147 | { |
148 | - $this->value['password'] = $this->kernel->setting->get('intranet', 'onlinepayment.dandomain.password'); |
|
149 | - $this->value['merchant_id'] = $this->kernel->setting->get('intranet', 'onlinepayment.dandomain.merchant_id'); |
|
148 | + $this->value['password'] = $this->kernel->setting->get('intranet', 'onlinepayment.dandomain.password'); |
|
149 | + $this->value['merchant_id'] = $this->kernel->setting->get('intranet', 'onlinepayment.dandomain.merchant_id'); |
|
150 | 150 | return $this->value; |
151 | 151 | } |
152 | 152 |