| @@ -26,6 +26,9 @@ discard block | ||
| 26 | 26 |          $this->db->setOption('portability', MDB2_PORTABILITY_NONE); | 
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | + /** | |
| 30 | + * @param string $SQL | |
| 31 | + */ | |
| 29 | 32 | function query($SQL) | 
| 30 | 33 |      { | 
| 31 | 34 | $this->result = $this->db->query($SQL); | 
| @@ -101,6 +104,9 @@ discard block | ||
| 101 | 104 | return mysql_escape_string($value); | 
| 102 | 105 | } | 
| 103 | 106 | |
| 107 | + /** | |
| 108 | + * @param string $type | |
| 109 | + */ | |
| 104 | 110 | function quote($value, $type) | 
| 105 | 111 |      { | 
| 106 | 112 | return $this->db->quote($value, $type); | 
| @@ -16,11 +16,11 @@ discard block | ||
| 16 | 16 |          if (empty($dbhost) OR empty($dbuser) OR empty($dbpass) OR empty($dbname)) { | 
| 17 | 17 | $this->db = MDB2::singleton(DB_DSN); | 
| 18 | 18 |          } else { | 
| 19 | -            $this->db = MDB2::singleton('mysql://' . $dbuser . ':' . $dbpass . '@' . $dbhost . '/' . $dbname); | |
| 19 | +            $this->db = MDB2::singleton('mysql://'.$dbuser.':'.$dbpass.'@'.$dbhost.'/'.$dbname); | |
| 20 | 20 | } | 
| 21 | 21 | |
| 22 | 22 |          if (PEAR::isError($this->db)) { | 
| 23 | - die($this->db->getMessage() . ' ' . $this->db->getUserInfo()); | |
| 23 | + die($this->db->getMessage().' '.$this->db->getUserInfo()); | |
| 24 | 24 | } | 
| 25 | 25 |          $this->db->query('SET NAMES utf8'); | 
| 26 | 26 |          $this->db->setOption('portability', MDB2_PORTABILITY_NONE); | 
| @@ -30,7 +30,7 @@ discard block | ||
| 30 | 30 |      { | 
| 31 | 31 | $this->result = $this->db->query($SQL); | 
| 32 | 32 |          if (PEAR::isError($this->result)) { | 
| 33 | - die($this->result->getMessage() . ' ' . $this->result->getUserInfo()); | |
| 33 | + die($this->result->getMessage().' '.$this->result->getUserInfo()); | |
| 34 | 34 | } | 
| 35 | 35 | } | 
| 36 | 36 | |
| @@ -38,7 +38,7 @@ discard block | ||
| 38 | 38 |      { | 
| 39 | 39 | $this->result = $this->db->exec($SQL); | 
| 40 | 40 |          if (PEAR::isError($this->result)) { | 
| 41 | - die($this->result->getMessage() . ' ' . $this->result->getUserInfo()); | |
| 41 | + die($this->result->getMessage().' '.$this->result->getUserInfo()); | |
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | 44 | $this->result->free(); | 
| @@ -52,7 +52,7 @@ discard block | ||
| 52 | 52 |          // while($db->next_record()) { | 
| 53 | 53 | $this->row = $this->result->fetchRow(MDB2_FETCHMODE_ASSOC); | 
| 54 | 54 |          if (PEAR::isError($this->row)) { | 
| 55 | - die($this->row->getMessage() . '' . $this->row->getUserInfo()); | |
| 55 | + die($this->row->getMessage().''.$this->row->getUserInfo()); | |
| 56 | 56 | } | 
| 57 | 57 | |
| 58 | 58 | return($this->row); | 
| @@ -14,7 +14,7 @@ | ||
| 14 | 14 | * @param string $belong_to What the address belongs to, corresponding to the ones in Address::getBelongToTypes() | 
| 15 | 15 | * @param integer $belong_to_id From belong_to. NB not id on the address | 
| 16 | 16 | * | 
| 17 | - * @return object Address | |
| 17 | + * @return Intraface_Address Address | |
| 18 | 18 | */ | 
| 19 | 19 | public function findByBelongToAndId($belong_to, $belong_to_id) | 
| 20 | 20 |      { | 
| @@ -8,6 +8,9 @@ | ||
| 8 | 8 | $this->translation = $translation; | 
| 9 | 9 | } | 
| 10 | 10 | |
| 11 | + /** | |
| 12 | + * @param Intraface_User $user | |
| 13 | + */ | |
| 11 | 14 | function findByUserobject($user) | 
| 12 | 15 |      { | 
| 13 | 16 | $kernel = new Intraface_Kernel(session_id()); | 
| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | * | 
| 24 | 24 | * @param object $voucher | 
| 25 | 25 | * | 
| 26 | - * @return void | |
| 26 | + * @return string | |
| 27 | 27 | */ | 
| 28 | 28 | function __construct($voucher) | 
| 29 | 29 |      { | 
| @@ -39,11 +39,11 @@ discard block | ||
| 39 | 39 |      { | 
| 40 | 40 | $post_id = (int)$post_id; | 
| 41 | 41 | $db = new DB_Sql; | 
| 42 | -        $db->query("SELECT voucher_id FROM accounting_post WHERE id = " . $post_id . " AND year_id = " . $year->get('id') . " AND intranet_id=" . $year->kernel->intranet->get('id')); | |
| 42 | +        $db->query("SELECT voucher_id FROM accounting_post WHERE id = ".$post_id." AND year_id = ".$year->get('id')." AND intranet_id=".$year->kernel->intranet->get('id')); | |
| 43 | 43 |          if (!$db->nextRecord()) { | 
| 44 | 44 | return new Post(new Voucher($year)); | 
| 45 | 45 | } | 
| 46 | -        $post =  new Post(new Voucher($year, $db->f('voucher_id')), (int)$post_id); | |
| 46 | +        $post = new Post(new Voucher($year, $db->f('voucher_id')), (int)$post_id); | |
| 47 | 47 | return $post; | 
| 48 | 48 | |
| 49 | 49 | } | 
| @@ -51,13 +51,13 @@ discard block | ||
| 51 | 51 | public function getList($type = 'stated') | 
| 52 | 52 |      { | 
| 53 | 53 | $db = new DB_Sql; | 
| 54 | -        $sql = "SELECT voucher.reference, post.id, post.text, post.voucher_id, post.date, post.account_id, post.debet, post.credit, post.stated, DATE_FORMAT(post.date, '%d-%m-%Y') AS date_dk FROM accounting_post post INNER JOIN accounting_voucher voucher ON post.voucher_id = voucher.id WHERE post.year_id = " . $this->voucher->year->get('id') . " AND post.intranet_id = " . $this->voucher->year->kernel->intranet->get('id'); | |
| 54 | +        $sql = "SELECT voucher.reference, post.id, post.text, post.voucher_id, post.date, post.account_id, post.debet, post.credit, post.stated, DATE_FORMAT(post.date, '%d-%m-%Y') AS date_dk FROM accounting_post post INNER JOIN accounting_voucher voucher ON post.voucher_id = voucher.id WHERE post.year_id = ".$this->voucher->year->get('id')." AND post.intranet_id = ".$this->voucher->year->kernel->intranet->get('id'); | |
| 55 | 55 |          if ($type == 'stated') { | 
| 56 | 56 | $sql .= " AND post.stated = 1"; | 
| 57 | 57 |          } elseif ($type == 'draft') { | 
| 58 | 58 | $sql .= " AND post.stated = 0"; | 
| 59 | 59 | } | 
| 60 | - $db->query($sql . " ORDER BY post.voucher_id DESC, post.id DESC"); | |
| 60 | + $db->query($sql." ORDER BY post.voucher_id DESC, post.id DESC"); | |
| 61 | 61 | |
| 62 | 62 | $i = 0; | 
| 63 | 63 | $this->value['list_saldo'] = 0; | 
| @@ -90,6 +90,9 @@ | ||
| 90 | 90 | return $files; | 
| 91 | 91 | } | 
| 92 | 92 | |
| 93 | + /** | |
| 94 | + * @param string $url | |
| 95 | + */ | |
| 93 | 96 | function url($url) | 
| 94 | 97 |      { | 
| 95 | 98 | return PATH_WWW . 'restricted' . $url; | 
| @@ -22,14 +22,14 @@ discard block | ||
| 22 | 22 | |
| 23 | 23 | function findFromId($id) | 
| 24 | 24 |      { | 
| 25 | - require_once dirname(__FILE__) . '/VoucherFile.php'; | |
| 25 | + require_once dirname(__FILE__).'/VoucherFile.php'; | |
| 26 | 26 | return new VoucherFile($this->voucher, $id); | 
| 27 | 27 | } | 
| 28 | 28 | |
| 29 | 29 | function getList() | 
| 30 | 30 |      { | 
| 31 | 31 | $db = new DB_Sql; | 
| 32 | -        $db->query("SELECT * FROM accounting_voucher_file WHERE active = 1 AND voucher_id = " . $this->voucher->get('id') . " AND intranet_id=" . $this->voucher->year->kernel->intranet->get('id')); | |
| 32 | +        $db->query("SELECT * FROM accounting_voucher_file WHERE active = 1 AND voucher_id = ".$this->voucher->get('id')." AND intranet_id=".$this->voucher->year->kernel->intranet->get('id')); | |
| 33 | 33 | $i = 0; | 
| 34 | 34 | $files = array(); | 
| 35 | 35 |          while ($db->nextRecord()) { | 
| @@ -49,7 +49,7 @@ discard block | ||
| 49 | 49 | $files[$i]['description'] = 'Momsperiode'; | 
| 50 | 50 | } | 
| 51 | 51 | $files[$i]['name'] = 'Momsperiode'; | 
| 52 | -                    $files[$i]['file_uri'] = $this->url('/module/accounting/year/'.$this->voucher->year->getId().'/vat/' . $db->f('belong_to_id')); | |
| 52 | +                    $files[$i]['file_uri'] = $this->url('/module/accounting/year/'.$this->voucher->year->getId().'/vat/'.$db->f('belong_to_id')); | |
| 53 | 53 | break; | 
| 54 | 54 | case 'file': | 
| 55 | 55 |                      $this->voucher->year->kernel->useModule('filemanager'); | 
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | $files[$i]['description'] = 'Kreditnota'; | 
| 64 | 64 | } | 
| 65 | 65 | $files[$i]['name'] = 'Kreditnota'; | 
| 66 | -                    $files[$i]['file_uri'] = $this->url('/module/debtor/credit_note/' . $db->f('belong_to_id') . '.pdf'); | |
| 66 | +                    $files[$i]['file_uri'] = $this->url('/module/debtor/credit_note/'.$db->f('belong_to_id').'.pdf'); | |
| 67 | 67 | break; | 
| 68 | 68 | case 'reminder': | 
| 69 | 69 |                      if (empty($files[$i]['description'])) { | 
| @@ -91,6 +91,6 @@ discard block | ||
| 91 | 91 | |
| 92 | 92 | function url($url) | 
| 93 | 93 |      { | 
| 94 | - return PATH_WWW . 'restricted' . $url; | |
| 94 | + return PATH_WWW.'restricted'.$url; | |
| 95 | 95 | } | 
| 96 | 96 | } | 
| @@ -16,7 +16,7 @@ discard block | ||
| 16 | 16 | * | 
| 17 | 17 | * @param object $year_object | 
| 18 | 18 | * | 
| 19 | - * @return void | |
| 19 | + * @return string | |
| 20 | 20 | */ | 
| 21 | 21 | public function __construct($year_object) | 
| 22 | 22 |      { | 
| @@ -32,10 +32,9 @@ discard block | ||
| 32 | 32 | /** | 
| 33 | 33 | * Creates a voucher | 
| 34 | 34 | * | 
| 35 | - * @param object $year | |
| 36 | 35 | * @param string $voucher_number | 
| 37 | 36 | * | 
| 38 | - * @return void | |
| 37 | + * @return Voucher | |
| 39 | 38 | */ | 
| 40 | 39 | public function findFromVoucherNumber($voucher_number) | 
| 41 | 40 |      { | 
| @@ -25,7 +25,7 @@ discard block | ||
| 25 | 25 | |
| 26 | 26 | public function findFromId($id) | 
| 27 | 27 |      { | 
| 28 | - require_once dirname(__FILE__) . '/Voucher.php'; | |
| 28 | + require_once dirname(__FILE__).'/Voucher.php'; | |
| 29 | 29 | return new Voucher($this->year, $id); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 | public function findFromVoucherNumber($voucher_number) | 
| 41 | 41 |      { | 
| 42 | 42 | $db = new DB_Sql; | 
| 43 | -        $db->query("SELECT id FROM accounting_voucher WHERE number = '".safeToDb($voucher_number)."' AND year_id = '".$this->year->get('id')."' AND intranet_id = " . $this->year->kernel->intranet->get('id')); | |
| 43 | +        $db->query("SELECT id FROM accounting_voucher WHERE number = '".safeToDb($voucher_number)."' AND year_id = '".$this->year->get('id')."' AND intranet_id = ".$this->year->kernel->intranet->get('id')); | |
| 44 | 44 |          if (!$db->nextRecord()) { | 
| 45 | 45 | return new Voucher($this->year); | 
| 46 | 46 | } | 
| @@ -93,7 +93,7 @@ discard block | ||
| 93 | 93 | |
| 94 | 94 |          $db->query("SELECT MAX(number) AS max_voucher_number | 
| 95 | 95 | FROM accounting_voucher | 
| 96 | -            WHERE intranet_id = " . $this->year->kernel->intranet->get('id') . " | |
| 96 | +            WHERE intranet_id = " . $this->year->kernel->intranet->get('id')." | |
| 97 | 97 |                  AND year_id = " . $this->year->get('id')); | 
| 98 | 98 |          if (!$db->nextRecord()) { | 
| 99 | 99 | return 0; | 
| @@ -11,6 +11,9 @@ discard block | ||
| 11 | 11 | $this->kernel = $kernel; | 
| 12 | 12 | } | 
| 13 | 13 | |
| 14 | + /** | |
| 15 | + * @param string $type | |
| 16 | + */ | |
| 14 | 17 | function findBySectionAndType($section, $type) | 
| 15 | 18 |      { | 
| 16 | 19 | $class = $this->class_prefix . ucfirst($type); | 
| @@ -37,6 +40,9 @@ discard block | ||
| 37 | 40 |          return new $class(CMS_Section::factory($this->kernel, 'id', $this->db->f('section_id')), $this->db->f('id')); | 
| 38 | 41 | } | 
| 39 | 42 | |
| 43 | + /** | |
| 44 | + * @param string $id | |
| 45 | + */ | |
| 40 | 46 | function findByKernelAndId($kernel, $id) | 
| 41 | 47 |      { | 
| 42 | 48 |          $cms_module = $kernel->getModule('cms'); | 
| @@ -53,6 +59,9 @@ discard block | ||
| 53 | 59 |          return new $class(CMS_Section::factory($kernel, 'id', $this->db->f('section_id')), $this->db->f('id')); | 
| 54 | 60 | } | 
| 55 | 61 | |
| 62 | + /** | |
| 63 | + * @param string $id | |
| 64 | + */ | |
| 56 | 65 | function findBySectionAndId($section, $id) | 
| 57 | 66 |      { | 
| 58 | 67 | // FIXME - jeg tror den her kan skabe en del | 
| @@ -13,7 +13,7 @@ discard block | ||
| 13 | 13 | |
| 14 | 14 | function findBySectionAndType($section, $type) | 
| 15 | 15 |      { | 
| 16 | - $class = $this->class_prefix . ucfirst($type); | |
| 16 | + $class = $this->class_prefix.ucfirst($type); | |
| 17 | 17 | |
| 18 | 18 |          if (!class_exists($class)) { | 
| 19 | 19 |              throw new Exception('Class does not exist'); | 
| @@ -26,11 +26,11 @@ discard block | ||
| 26 | 26 |          $cms_module = $this->kernel->getModule('cms'); | 
| 27 | 27 |          $element_types = $cms_module->getSetting('element_types'); | 
| 28 | 28 | |
| 29 | -        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = " . $id . " AND intranet_id = " . $this->kernel->intranet->get('id')); | |
| 29 | +        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = ".$id." AND intranet_id = ".$this->kernel->intranet->get('id')); | |
| 30 | 30 |          if (!$this->db->nextRecord()) { | 
| 31 | 31 | return false; | 
| 32 | 32 | } | 
| 33 | -        $class = $this->class_prefix . ucfirst($element_types[$this->db->f('type_key')]); | |
| 33 | +        $class = $this->class_prefix.ucfirst($element_types[$this->db->f('type_key')]); | |
| 34 | 34 |          if (!class_exists($class)) { | 
| 35 | 35 | return false; | 
| 36 | 36 | } | 
| @@ -42,11 +42,11 @@ discard block | ||
| 42 | 42 |          $cms_module = $kernel->getModule('cms'); | 
| 43 | 43 |          $element_types = $cms_module->getSetting('element_types'); | 
| 44 | 44 | |
| 45 | -        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = " . $id . " AND intranet_id = " . $kernel->intranet->get('id')); | |
| 45 | +        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = ".$id." AND intranet_id = ".$kernel->intranet->get('id')); | |
| 46 | 46 |          if (!$this->db->nextRecord()) { | 
| 47 | 47 | return false; | 
| 48 | 48 | } | 
| 49 | -        $class = $this->class_prefix . ucfirst($element_types[$this->db->f('type_key')]); | |
| 49 | +        $class = $this->class_prefix.ucfirst($element_types[$this->db->f('type_key')]); | |
| 50 | 50 |          if (!class_exists($class)) { | 
| 51 | 51 | return false; | 
| 52 | 52 | } | 
| @@ -61,12 +61,12 @@ discard block | ||
| 61 | 61 |          $cms_module = $section->kernel->getModule('cms'); | 
| 62 | 62 |          $element_types = $cms_module->getSetting('element_types'); | 
| 63 | 63 | |
| 64 | -        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = " . $id . " AND intranet_id = " . $section->kernel->intranet->get('id')); | |
| 64 | +        $this->db->query("SELECT id, section_id, type_key FROM cms_element WHERE id = ".$id." AND intranet_id = ".$section->kernel->intranet->get('id')); | |
| 65 | 65 |          if (!$this->db->nextRecord()) { | 
| 66 | 66 | return false; | 
| 67 | 67 | } | 
| 68 | 68 | |
| 69 | -        $class = $this->class_prefix . ucfirst($element_types[$this->db->f('type_key')]); | |
| 69 | +        $class = $this->class_prefix.ucfirst($element_types[$this->db->f('type_key')]); | |
| 70 | 70 |          if (!class_exists($class)) { | 
| 71 | 71 | return false; | 
| 72 | 72 | } | 
| @@ -124,6 +124,9 @@ | ||
| 124 | 124 | } | 
| 125 | 125 | } | 
| 126 | 126 | |
| 127 | + /** | |
| 128 | + * @param integer $id | |
| 129 | + */ | |
| 127 | 130 | public function factory($kernel, $id) | 
| 128 | 131 |      { | 
| 129 | 132 | $gateway = new Intraface_modules_contact_MemosGateway($kernel); | 
| @@ -199,9 +199,9 @@ discard block | ||
| 199 | 199 |              throw new Exception("Was not able to convert date in ContactReminder->update"); | 
| 200 | 200 | } | 
| 201 | 201 | |
| 202 | - $sql = "reminder_date = ".$this->db->quote($date->get(), 'date')."," . | |
| 203 | - "date_changed = NOW()," . | |
| 204 | - "subject = ".$this->db->quote($input['subject'], 'text')."," . | |
| 202 | + $sql = "reminder_date = ".$this->db->quote($date->get(), 'date').",". | |
| 203 | + "date_changed = NOW(),". | |
| 204 | + "subject = ".$this->db->quote($input['subject'], 'text').",". | |
| 205 | 205 | "description = ".$this->db->quote($input['description'], 'text').""; | 
| 206 | 206 | |
| 207 | 207 |          if ($this->error->isError()) { | 
| @@ -212,17 +212,17 @@ discard block | ||
| 212 | 212 |              $result = $this->db->exec("UPDATE contact_reminder_single SET ".$sql." WHERE intranet_id = ".$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer')." AND id = ".$this->db->quote($this->id, 'integer')); | 
| 213 | 213 |          } else { | 
| 214 | 214 |              $result = $this->db->exec("INSERT INTO contact_reminder_single SET ".$sql.", ". | 
| 215 | -                "intranet_id = ".$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer')."," . | |
| 216 | -                "contact_id = ".$this->db->quote($this->contact->get('id'), 'integer')."," . | |
| 217 | -                "created_by_user_id = ".$this->db->quote($this->contact->kernel->user->get('id'), 'integer')."," . | |
| 218 | - "status_key = 1," . | |
| 219 | - "date_created = NOW()," . | |
| 215 | +                "intranet_id = ".$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer').",". | |
| 216 | +                "contact_id = ".$this->db->quote($this->contact->get('id'), 'integer').",". | |
| 217 | +                "created_by_user_id = ".$this->db->quote($this->contact->kernel->user->get('id'), 'integer').",". | |
| 218 | + "status_key = 1,". | |
| 219 | + "date_created = NOW(),". | |
| 220 | 220 | "active = 1"); | 
| 221 | 221 | $this->id = $this->db->lastInsertID(); | 
| 222 | 222 | } | 
| 223 | 223 | |
| 224 | 224 |          if (PEAR::isError($result)) { | 
| 225 | -            throw new Exception('Could not save information in ContactReminder->update' . $result->getUserInfo()); | |
| 225 | +            throw new Exception('Could not save information in ContactReminder->update'.$result->getUserInfo()); | |
| 226 | 226 | return false; | 
| 227 | 227 | } | 
| 228 | 228 | return $this->id; | 
| @@ -240,9 +240,9 @@ discard block | ||
| 240 | 240 | /** | 
| 241 | 241 | * @todo: validation needed - not crucial as we are setting the postpone date | 
| 242 | 242 | */ | 
| 243 | -        $result = $this->db->exec('UPDATE contact_reminder_single SET date_changed = NOW(), reminder_date = ' .$this->db->quote($date, 'date').' WHERE intranet_id = '.$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer').' AND id = '.$this->db->quote($this->id, 'integer')); | |
| 243 | +        $result = $this->db->exec('UPDATE contact_reminder_single SET date_changed = NOW(), reminder_date = '.$this->db->quote($date, 'date').' WHERE intranet_id = '.$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer').' AND id = '.$this->db->quote($this->id, 'integer')); | |
| 244 | 244 |          if (PEAR::isError($result)) { | 
| 245 | -            throw new Exception('Could not postphone reminder' . $result->getUserInfo()); | |
| 245 | +            throw new Exception('Could not postphone reminder'.$result->getUserInfo()); | |
| 246 | 246 | return false; | 
| 247 | 247 | } | 
| 248 | 248 | $this->load(); | 
| @@ -265,11 +265,11 @@ discard block | ||
| 265 | 265 | |
| 266 | 266 | $db = MDB2::singleton(DB_DSN); | 
| 267 | 267 | // | 
| 268 | -        $result = $db->query('SELECT contact_reminder_single.*, DATE_FORMAT(contact_reminder_single.reminder_date, "%d-%m-%Y") AS dk_reminder_date, address.name AS contact_name ' . | |
| 269 | - 'FROM contact_reminder_single ' . | |
| 270 | -                'INNER JOIN contact ON (contact_reminder_single.contact_id = contact.id AND contact.intranet_id = '.$db->quote($kernel->intranet->get('id'), 'integer') . ' AND contact.active = 1) '. | |
| 271 | - 'LEFT JOIN address ON (address.belong_to_id = contact.id AND address.type = 3 AND address.active = 1) ' . | |
| 272 | -                'WHERE contact_reminder_single.reminder_date < DATE_ADD(NOW(), INTERVAL 30 DAY) AND contact_reminder_single.intranet_id = ' .$db->quote($kernel->intranet->get('id'), 'integer').' AND contact_reminder_single.active = 1 AND contact_reminder_single.status_key = 1 ' . | |
| 268 | +        $result = $db->query('SELECT contact_reminder_single.*, DATE_FORMAT(contact_reminder_single.reminder_date, "%d-%m-%Y") AS dk_reminder_date, address.name AS contact_name '. | |
| 269 | + 'FROM contact_reminder_single '. | |
| 270 | +                'INNER JOIN contact ON (contact_reminder_single.contact_id = contact.id AND contact.intranet_id = '.$db->quote($kernel->intranet->get('id'), 'integer').' AND contact.active = 1) '. | |
| 271 | + 'LEFT JOIN address ON (address.belong_to_id = contact.id AND address.type = 3 AND address.active = 1) '. | |
| 272 | +                'WHERE contact_reminder_single.reminder_date < DATE_ADD(NOW(), INTERVAL 30 DAY) AND contact_reminder_single.intranet_id = '.$db->quote($kernel->intranet->get('id'), 'integer').' AND contact_reminder_single.active = 1 AND contact_reminder_single.status_key = 1 '. | |
| 273 | 273 | 'ORDER BY contact_reminder_single.reminder_date ASC'); | 
| 274 | 274 |          if (PEAR::isError($result)) { | 
| 275 | 275 | die($result->getUserInfo()); | 
| @@ -292,9 +292,9 @@ discard block | ||
| 292 | 292 |      { | 
| 293 | 293 | $status_key = array_search($status, $this->status_types); | 
| 294 | 294 | |
| 295 | -        $result = $this->db->exec('UPDATE contact_reminder_single SET date_changed = NOW(), status_key = ' .$this->db->quote($status_key, 'integer').' WHERE intranet_id = '.$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer').' AND id = '.$this->db->quote($this->id, 'integer')); | |
| 295 | +        $result = $this->db->exec('UPDATE contact_reminder_single SET date_changed = NOW(), status_key = '.$this->db->quote($status_key, 'integer').' WHERE intranet_id = '.$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer').' AND id = '.$this->db->quote($this->id, 'integer')); | |
| 296 | 296 |          if (PEAR::isError($result)) { | 
| 297 | -            throw new Exception('Could not postphone reminder' . $result->getUserInfo()); | |
| 297 | +            throw new Exception('Could not postphone reminder'.$result->getUserInfo()); | |
| 298 | 298 | return false; | 
| 299 | 299 | } | 
| 300 | 300 | $this->load(); | 
| @@ -224,7 +224,7 @@ discard block | ||
| 224 | 224 |              throw new Exception('Could not save information in ContactReminder->update' . $result->getUserInfo()); | 
| 225 | 225 | return false; | 
| 226 | 226 | } | 
| 227 | - return $this->id; | |
| 227 | + return $this->id; | |
| 228 | 228 | } | 
| 229 | 229 | |
| 230 | 230 | /** | 
| @@ -244,8 +244,8 @@ discard block | ||
| 244 | 244 |              throw new Exception('Could not postphone reminder' . $result->getUserInfo()); | 
| 245 | 245 | return false; | 
| 246 | 246 | } | 
| 247 | - $this->load(); | |
| 248 | - return true; | |
| 247 | + $this->load(); | |
| 248 | + return true; | |
| 249 | 249 | } | 
| 250 | 250 | |
| 251 | 251 | /** | 
| @@ -277,7 +277,7 @@ discard block | ||
| 277 | 277 |          if ($result->numRows() == 0) { | 
| 278 | 278 | return array(); | 
| 279 | 279 | } | 
| 280 | - return $result->fetchAll(MDB2_FETCHMODE_ASSOC); | |
| 280 | + return $result->fetchAll(MDB2_FETCHMODE_ASSOC); | |
| 281 | 281 | } | 
| 282 | 282 | |
| 283 | 283 | /** | 
| @@ -295,8 +295,8 @@ discard block | ||
| 295 | 295 |              throw new Exception('Could not postphone reminder' . $result->getUserInfo()); | 
| 296 | 296 | return false; | 
| 297 | 297 | } | 
| 298 | - $this->load(); | |
| 299 | - return true; | |
| 298 | + $this->load(); | |
| 299 | + return true; | |
| 300 | 300 | } | 
| 301 | 301 | |
| 302 | 302 | public function getDBQuery() | 
| @@ -87,6 +87,9 @@ | ||
| 87 | 87 | return 'Create'; | 
| 88 | 88 | } | 
| 89 | 89 | |
| 90 | + /** | |
| 91 | + * @return string | |
| 92 | + */ | |
| 90 | 93 | function getType() | 
| 91 | 94 |      { | 
| 92 | 95 | return $this->context->context->getType(); | 
| @@ -25,7 +25,7 @@ discard block | ||
| 25 | 25 |          if ($this->query('contact_id') == '') { | 
| 26 | 26 |              return new k_SeeOther($this->url('contact')); | 
| 27 | 27 | } | 
| 28 | - $smarty = $this->template->create(dirname(__FILE__) . '/templates/edit'); | |
| 28 | + $smarty = $this->template->create(dirname(__FILE__).'/templates/edit'); | |
| 29 | 29 | return $smarty->render($this); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -55,7 +55,7 @@ discard block | ||
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | 57 |          if ($debtor->update($_POST)) { | 
| 58 | -            return new k_SeeOther($this->url('../' . $debtor->get('id'))); | |
| 58 | +            return new k_SeeOther($this->url('../'.$debtor->get('id'))); | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | return $this->render(); | 
| @@ -67,7 +67,7 @@ discard block | ||
| 67 | 67 | return $this->body(); | 
| 68 | 68 | } | 
| 69 | 69 | |
| 70 | -        $due_time = time() + $this->getContact()->get('paymentcondition') * 24 * 60 * 60; | |
| 70 | +        $due_time = time() + $this->getContact()->get('paymentcondition')*24*60*60; | |
| 71 | 71 |          $due_date = date('d-m-Y', $due_time); | 
| 72 | 72 | |
| 73 | 73 | return array( |