Completed
Branch master (6ed6e7)
by Lars
07:57
created
src/Intraface/modules/cms/section/Longtext.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -52,6 +52,9 @@
 block discarded – undo
52 52
         return true;
53 53
     }
54 54
 
55
+    /**
56
+     * @param string[] $array
57
+     */
55 58
     public static function convertArrayToTags($array)
56 59
     {
57 60
         $tags = '';
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Stylesheet.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -7,6 +7,9 @@
 block discarded – undo
7 7
     private $cmssite;
8 8
     public $error;
9 9
 
10
+    /**
11
+     * @param CMS_Site $cmssite
12
+     */
10 13
     function __construct($cmssite)
11 14
     {
12 15
         if (!is_object($cmssite) OR strtolower(get_class($cmssite)) != 'cms_site') {
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     function __construct($cmssite)
11 11
     {
12 12
         if (!is_object($cmssite) OR strtolower(get_class($cmssite)) != 'cms_site') {
13
-            throw new Exception('CMS_Stylesheet::__construct needs CMS_Site - got ' . get_class($cmssite));
13
+            throw new Exception('CMS_Stylesheet::__construct needs CMS_Site - got '.get_class($cmssite));
14 14
         }
15 15
         $this->cmssite = $cmssite;
16 16
         $this->error = new Intraface_Error;
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Template.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -65,6 +65,9 @@
 block discarded – undo
65 65
         return 'cms_template';
66 66
     }
67 67
 
68
+    /**
69
+     * @param DB_Sql $db
70
+     */
68 71
     function getPosition($db)
69 72
     {
70 73
         return new Ilib_Position($db, 'cms_template', $this->id, 'site_id = ' . $this->cmssite->get('id'), 'id', 'position');
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
     function getPosition($db)
69 69
     {
70
-        return new Ilib_Position($db, 'cms_template', $this->id, 'site_id = ' . $this->cmssite->get('id'), 'id', 'position');
70
+        return new Ilib_Position($db, 'cms_template', $this->id, 'site_id = '.$this->cmssite->get('id'), 'id', 'position');
71 71
     }
72 72
 
73 73
     /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         switch ($type) {
79 79
             case 'id':
80 80
                 $db = new DB_Sql;
81
-                $db->query("SELECT site_id, id FROM cms_template WHERE id = " . $id . " AND intranet_id = " . $kernel->intranet->get('id'));
81
+                $db->query("SELECT site_id, id FROM cms_template WHERE id = ".$id." AND intranet_id = ".$kernel->intranet->get('id'));
82 82
                 if (!$db->nextRecord()) {
83 83
                     return false;
84 84
                 }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     function load()
98 98
     {
99 99
         $db = new DB_Sql;
100
-        $db->query("SELECT id, name, site_id, identifier, for_page_type FROM cms_template WHERE intranet_id = " . $this->cmssite->kernel->intranet->get('id') . " AND id = " . $this->id);
100
+        $db->query("SELECT id, name, site_id, identifier, for_page_type FROM cms_template WHERE intranet_id = ".$this->cmssite->kernel->intranet->get('id')." AND id = ".$this->id);
101 101
 
102 102
         if (!$db->nextRecord()) {
103 103
             return 0;
@@ -146,12 +146,12 @@  discard block
 block discarded – undo
146 146
         $db = new DB_Sql;
147 147
         if ($this->id > 0) {
148 148
             $sql_type = "UPDATE ";
149
-            $sql_end = " WHERE id = " . $this->id;
149
+            $sql_end = " WHERE id = ".$this->id;
150 150
         } else {
151 151
             $sql_type = "INSERT INTO ";
152 152
             $sql_end = ", date_created = NOW()";
153 153
         }
154
-        $db->query($sql_type . " cms_template SET
154
+        $db->query($sql_type." cms_template SET
155 155
             name = '".safeToDb($var['name'])."',
156 156
             date_updated = NOW(),
157 157
             intranet_id = ".safeToDb($this->cmssite->kernel->intranet->get('id')).",
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             $sql_extra = '';
181 181
         }
182 182
 
183
-        $db->query("SELECT id, name, identifier, for_page_type FROM cms_template WHERE ".$sql_extra." intranet_id = " . $this->cmssite->kernel->intranet->get('id') . " AND site_id = " . $this->cmssite->get('id') . " AND active = 1 ORDER BY name");
183
+        $db->query("SELECT id, name, identifier, for_page_type FROM cms_template WHERE ".$sql_extra." intranet_id = ".$this->cmssite->kernel->intranet->get('id')." AND site_id = ".$this->cmssite->get('id')." AND active = 1 ORDER BY name");
184 184
         $i = 0;
185 185
         $templates = array();
186 186
         while ($db->nextRecord()) {
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
     function delete()
214 214
     {
215 215
         $db = new DB_Sql;
216
-        $db->query("UPDATE cms_template SET active = 0 WHERE id = " . $this->id);
216
+        $db->query("UPDATE cms_template SET active = 0 WHERE id = ".$this->id);
217 217
         return true;
218 218
     }
219 219
 
220 220
     function isIdentifierUnique($identifier)
221 221
     {
222 222
         $db = new DB_Sql;
223
-        $db->query("SELECT id FROM cms_template WHERE site_id = " . $this->cmssite->get('id') . " AND identifier = '".$identifier."' AND active = 1 AND id != " . $this->id);
223
+        $db->query("SELECT id FROM cms_template WHERE site_id = ".$this->cmssite->get('id')." AND identifier = '".$identifier."' AND active = 1 AND id != ".$this->id);
224 224
         if ($db->numRows() == 0) {
225 225
             return true;
226 226
         } else {
Please login to merge, or discard this patch.
src/Intraface/modules/cms/TemplateSection.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -62,11 +62,17 @@
 block discarded – undo
62 62
         return new CMS_Parameter($this);
63 63
     }
64 64
 
65
+    /**
66
+     * @param string $key
67
+     */
65 68
     function addParameter($key, $value)
66 69
     {
67 70
         return $this->parameter->save($key, $value);
68 71
     }
69 72
 
73
+    /**
74
+     * @param string $type
75
+     */
70 76
     function factory($object, $type, $value)
71 77
     {
72 78
         $class_prefix = 'Intraface_modules_cms_templatesection_';
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
             throw new Exception('TemplateSection::__construct skal bruge CMS_Template');
32 32
         }
33 33
         $this->error    = new Intraface_Error;
34
-        $this->id       = (int) $id;
34
+        $this->id       = (int)$id;
35 35
         $this->template = $template;
36 36
         $this->kernel   = $template->kernel;
37 37
 
38
-        $this->value['identify_as'] = 'cms_template_section';  // bruges af parameter
38
+        $this->value['identify_as'] = 'cms_template_section'; // bruges af parameter
39 39
 
40 40
         $this->parameter = $this->createParameterObject();
41 41
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
                 // validering p� value
76 76
                 // kun v�re gyldige elementtyper
77 77
                 // object skal vre cmspage
78
-                $class = $class_prefix . ucfirst($value);
78
+                $class = $class_prefix.ucfirst($value);
79 79
                 return new $class($object);
80 80
                 break;
81 81
             case 'id':
@@ -84,12 +84,12 @@  discard block
 block discarded – undo
84 84
                 $section_types = $cms_module->getSetting('section_types');
85 85
 
86 86
                 $db = new DB_Sql;
87
-                $db->query("SELECT id, type_key, template_id FROM cms_template_section WHERE id = " . $value . " AND intranet_id = " . $object->intranet->get('id'));
87
+                $db->query("SELECT id, type_key, template_id FROM cms_template_section WHERE id = ".$value." AND intranet_id = ".$object->intranet->get('id'));
88 88
                 if (!$db->nextRecord()) {
89 89
                     return false;
90 90
                 }
91 91
 
92
-                $class = $class_prefix . ucfirst($section_types[$db->f('type_key')]);
92
+                $class = $class_prefix.ucfirst($section_types[$db->f('type_key')]);
93 93
                 return new $class(CMS_Template::factory($object, 'id', $db->f('template_id')), $db->f('id'));
94 94
 
95 95
                 break;
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
                 $section_types = $cms_module->getSetting('section_types');
100 100
 
101 101
                 $db = new DB_Sql;
102
-                $db->query("SELECT id, type_key FROM cms_template_section WHERE id = " . $value . " AND intranet_id = " . $object->kernel->intranet->get('id'));
102
+                $db->query("SELECT id, type_key FROM cms_template_section WHERE id = ".$value." AND intranet_id = ".$object->kernel->intranet->get('id'));
103 103
                 if (!$db->nextRecord()) {
104 104
                     return false;
105 105
                 }
106 106
 
107
-                $class = $class_prefix . ucfirst($section_types[$db->f('type_key')]);
107
+                $class = $class_prefix.ucfirst($section_types[$db->f('type_key')]);
108 108
                 return new $class($object, $db->f('id'));
109 109
 
110 110
                 break;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
     function load()
118 118
     {
119 119
         $db = new DB_Sql;
120
-        $db->query("SELECT id, name, identifier, type_key, locked FROM cms_template_section WHERE cms_template_section.intranet_id = ".$this->template->cmssite->kernel->intranet->get('id')." AND cms_template_section.id = " . $this->id);
120
+        $db->query("SELECT id, name, identifier, type_key, locked FROM cms_template_section WHERE cms_template_section.intranet_id = ".$this->template->cmssite->kernel->intranet->get('id')." AND cms_template_section.id = ".$this->id);
121 121
         if (!$db->nextRecord()) {
122 122
             return 0;
123 123
         }
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
             $this->error->set('error in identifier - cannot be empty');
146 146
         }
147 147
 
148
-        if (!Validate::string($var['identifier'], array('format' => VALIDATE_ALPHA . VALIDATE_NUM . '-_'))) {
148
+        if (!Validate::string($var['identifier'], array('format' => VALIDATE_ALPHA.VALIDATE_NUM.'-_'))) {
149 149
             $this->error->set('error in identfier - allowed characters are a-z and 1-9');
150 150
         }
151 151
         if ($this->isIdentifierUnique($var['identifier'])) {
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
             $sql_end = ", date_created = NOW()";
177 177
         } else {
178 178
             $sql_type = "UPDATE ";
179
-            $sql_end = " WHERE id = " . $this->id;
179
+            $sql_end = " WHERE id = ".$this->id;
180 180
         }
181
-        $sql = $sql_type . " cms_template_section SET
181
+        $sql = $sql_type." cms_template_section SET
182 182
                 name = '".safeToDb($var['name'])."',
183 183
                 identifier = '".safeToDb($var['identifier'])."',
184
-                site_id = " . $this->template->cmssite->get('id') . ",
184
+                site_id = " . $this->template->cmssite->get('id').",
185 185
                 intranet_id = ".$this->template->kernel->intranet->get('id').",
186 186
                 template_id = ".$this->template->get('id').",
187 187
                 type_key = ".$this->value['type_key'].",
@@ -211,14 +211,14 @@  discard block
 block discarded – undo
211 211
     function delete()
212 212
     {
213 213
         $db = new DB_Sql;
214
-        $db->query("UPDATE cms_template_section SET active = 0 WHERE id = " . $this->id);
214
+        $db->query("UPDATE cms_template_section SET active = 0 WHERE id = ".$this->id);
215 215
         return true;
216 216
     }
217 217
 
218 218
     function getList()
219 219
     {
220 220
         $db = new DB_Sql;
221
-        $db->query("SELECT id, name, identifier, type_key FROM cms_template_section WHERE template_id = " . $this->template->get('id') . " AND intranet_id = " . $this->kernel->intranet->get('id') . " AND active = 1 ORDER BY position ASC");
221
+        $db->query("SELECT id, name, identifier, type_key FROM cms_template_section WHERE template_id = ".$this->template->get('id')." AND intranet_id = ".$this->kernel->intranet->get('id')." AND active = 1 ORDER BY position ASC");
222 222
 
223 223
         $i = 0;
224 224
         $sections = array();
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     function isIdentifierUnique($identifier)
238 238
     {
239 239
         $db = new DB_Sql;
240
-        $db->query("SELECT count(*) AS antal FROM cms_template_section WHERE identifier = '".$identifier."' AND intranet_id = " . $this->kernel->intranet->get('id') . " AND template_id = " . $this->template->get('id') . " AND active = 1 AND id != " . $this->id);
240
+        $db->query("SELECT count(*) AS antal FROM cms_template_section WHERE identifier = '".$identifier."' AND intranet_id = ".$this->kernel->intranet->get('id')." AND template_id = ".$this->template->get('id')." AND active = 1 AND id != ".$this->id);
241 241
         if (!$db->nextRecord()) {
242 242
             return 0;
243 243
         }
Please login to merge, or discard this patch.
src/Intraface/modules/cms/templatesection/Mixed.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -6,6 +6,9 @@
 block discarded – undo
6 6
  */
7 7
 class Intraface_modules_cms_templatesection_Mixed extends CMS_TemplateSection
8 8
 {
9
+    /**
10
+     * @param CMS_Template $cmspage
11
+     */
9 12
     function __construct($cmspage, $id = 0)
10 13
     {
11 14
         $this->value['type'] = 'mixed';
Please login to merge, or discard this patch.
src/Intraface/modules/contact/Contact.php 3 patches
Doc Comments   +6 added lines, -23 removed lines patch added patch discarded remove patch
@@ -257,8 +257,6 @@  discard block
 block discarded – undo
257 257
      *
258 258
      * @param object $kernel
259 259
      * @param string $type   What should the contact object be created from
260
-     * @param string $id     The value which corresponds to the type
261
-     *
262 260
      * @return  object
263 261
      */
264 262
     public function factory($kernel, $type, $value)
@@ -318,7 +316,7 @@  discard block
 block discarded – undo
318 316
     /**
319 317
      * Loads values for the contact into an array
320 318
      *
321
-     * @return true on success
319
+     * @return boolean on success
322 320
      */
323 321
     private function load()
324 322
     {
@@ -394,7 +392,7 @@  discard block
 block discarded – undo
394 392
      *
395 393
      * @param array $var Values to validate
396 394
      *
397
-     * @return true on success
395
+     * @return boolean on success
398 396
      */
399 397
     public function validate($var)
400 398
     {
@@ -502,21 +500,6 @@  discard block
 block discarded – undo
502 500
     /**
503 501
      * Saves the contact
504 502
      *
505
-     * @param	int $var['id']	Kundeid
506
-     * @param	string $var['company']
507
-     * @param	string $var['address']
508
-     * @param	string $var['postalcode']
509
-     * @param	string $var['town']
510
-     * @param	string $var['country']
511
-     * @param	string $var['email']
512
-     * @param	string $var['website']
513
-     * @param	string $var['phone']
514
-     * @param	string $var['deliveryaddress']
515
-     * @param	string $var['deliverypostalcode']
516
-     * @param	string $var['deliverytown']
517
-     * @param	string $var['deliverycountry']
518
-     * @param	string $var['paymentcondition']
519
-     *
520 503
      * @return void
521 504
      */
522 505
     public function save($var)
@@ -616,7 +599,7 @@  discard block
 block discarded – undo
616 599
      *
617 600
      * Never delete a contact entirely. Should only be deactivated.
618 601
      *
619
-     * @return integer	0 = false eller 1 = true
602
+     * @return boolean	0 = false eller 1 = true
620 603
      */
621 604
     public function delete()
622 605
     {
@@ -659,7 +642,7 @@  discard block
 block discarded – undo
659 642
      *
660 643
      * @param string $number
661 644
      *
662
-     * @return true hvis det er frit
645
+     * @return boolean hvis det er frit
663 646
      */
664 647
     public function isNumberFree($number)
665 648
     {
@@ -822,7 +805,7 @@  discard block
 block discarded – undo
822 805
      *
823 806
      * TODO M�ske burde denne metode hedde loadKeywords()?
824 807
      *
825
-     * @return object
808
+     * @return Keyword
826 809
      */
827 810
     function getKeywords()
828 811
     {
@@ -858,7 +841,7 @@  discard block
 block discarded – undo
858 841
      *
859 842
      * @param integer $id Optional id of the contact person
860 843
      *
861
-     * @return object
844
+     * @return ContactPerson
862 845
      */
863 846
     function loadContactPerson($id = 0)
864 847
     {
Please login to merge, or discard this patch.
Indentation   -3 removed lines patch added patch discarded remove patch
@@ -105,9 +105,6 @@
 block discarded – undo
105 105
 
106 106
  function getContacts()
107 107
  }
108
-
109
-
110
-
111 108
  *
112 109
  * @package Intraface_Contact
113 110
  * @author	Lars Olesen <[email protected]>
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
  * @license
120 120
  *
121 121
  */
122
-require_once dirname(__FILE__) . '/ContactPerson.php';
122
+require_once dirname(__FILE__).'/ContactPerson.php';
123 123
 require_once 'Intraface/functions.php';
124 124
 
125 125
 class Contact extends Intraface_Standard
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         // Husk noget validering af de forskellige values og typer
267 267
         $gateway = new Intraface_modules_contact_ContactGateway($kernel, new DB_Sql);
268 268
         try {
269
-            switch($type) {
269
+            switch ($type) {
270 270
                 case 'email':
271 271
                     $emails = $gateway->findByEmail($value);
272 272
                     return $emails[0];
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     {
387 387
         // HACK NECCESSARY FOR THE NEWSLETTERSUBSCRIBER
388 388
         $this->kernel->useModule('contact');
389
-        return ($this->value['login_url'] = 'http://' . $this->kernel->getSetting()->get('intranet', 'contact.login_url') . '/' .$this->kernel->intranet->get('identifier') . '/login?code='. $this->get('code'));
389
+        return ($this->value['login_url'] = 'http://'.$this->kernel->getSetting()->get('intranet', 'contact.login_url').'/'.$this->kernel->intranet->get('identifier').'/login?code='.$this->get('code'));
390 390
     }
391 391
 
392 392
     /**
@@ -556,16 +556,16 @@  discard block
 block discarded – undo
556 556
 
557 557
         // prepare sql to update or insert
558 558
         if ($this->id > 0) {
559
-            $sql="UPDATE contact ";
560
-            $sql_after=" WHERE id='".$this->id."'";
559
+            $sql = "UPDATE contact ";
560
+            $sql_after = " WHERE id='".$this->id."'";
561 561
             $sql_create = "";
562 562
         } else {
563
-            $sql="INSERT INTO contact ";
564
-            $sql_after = ", code='".safeToDb(md5(date('Y-m-d H:i:s') . $sql_items))."'";
563
+            $sql = "INSERT INTO contact ";
564
+            $sql_after = ", code='".safeToDb(md5(date('Y-m-d H:i:s').$sql_items))."'";
565 565
             $sql_create = "date_created = NOW(),";
566 566
         }
567 567
 
568
-        $sql .= " SET	".$sql_create. "
568
+        $sql .= " SET	".$sql_create."
569 569
             intranet_id = '". $this->kernel->intranet->get('id')."',"
570 570
             .$sql_items.
571 571
             "date_changed = NOW()
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
             // Delivery Address
596 596
             foreach ($address_fields AS $key=>$value) {
597 597
                 if (array_key_exists('delivery_'.$value, $var)) {
598
-                    $delivery_address_to_save[$value] = $var['delivery_' . $value];
598
+                    $delivery_address_to_save[$value] = $var['delivery_'.$value];
599 599
                 }
600 600
             }
601 601
 
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
             return false;
630 630
         }
631 631
         $db = new DB_Sql;
632
-        $db->query("UPDATE contact SET active = 0, date_changed = NOW() WHERE intranet_id = " . $this->kernel->intranet->get("id") . " AND id = " . $this->id);
632
+        $db->query("UPDATE contact SET active = 0, date_changed = NOW() WHERE intranet_id = ".$this->kernel->intranet->get("id")." AND id = ".$this->id);
633 633
         return true;
634 634
     }
635 635
 
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
             return false;
650 650
         }
651 651
         $db = new DB_Sql;
652
-        $db->query("UPDATE contact SET active = 1, date_changed = NOW() WHERE intranet_id = " . $this->kernel->intranet->get("id") . " AND id = " . $this->id);
652
+        $db->query("UPDATE contact SET active = 1, date_changed = NOW() WHERE intranet_id = ".$this->kernel->intranet->get("id")." AND id = ".$this->id);
653 653
 
654 654
         return true;
655 655
     }
@@ -667,9 +667,9 @@  discard block
 block discarded – undo
667 667
         $db = new DB_Sql();
668 668
         $sql = "SELECT id
669 669
             FROM contact
670
-            WHERE intranet_id = " . $this->kernel->intranet->get("id") . "
671
-                AND number = " . (int)$number . "
672
-                AND id <> " . $this->id . "
670
+            WHERE intranet_id = " . $this->kernel->intranet->get("id")."
671
+                AND number = " . (int)$number."
672
+                AND id <> " . $this->id."
673 673
                 AND active = 1
674 674
             LIMIT 1";
675 675
         $db->query($sql);
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
     public function getMaxNumber()
690 690
     {
691 691
         $db = new DB_Sql();
692
-        $db->query("SELECT number FROM contact WHERE intranet_id = " . $this->kernel->intranet->get("id") . " ORDER BY number DESC");
692
+        $db->query("SELECT number FROM contact WHERE intranet_id = ".$this->kernel->intranet->get("id")." ORDER BY number DESC");
693 693
         if (!$db->nextRecord()) {
694 694
             return 0;
695 695
         }
@@ -781,11 +781,11 @@  discard block
 block discarded – undo
781 781
                 WHERE address.type=3
782 782
                     AND contact.active = 1
783 783
                     AND address.active = 1
784
-                    AND contact.intranet_id = " . $db->quote($this->kernel->intranet->get('id'), 'integer') . "
785
-                    AND contact.id != " . $db->quote($this->id, 'integer') . "
784
+                    AND contact.intranet_id = " . $db->quote($this->kernel->intranet->get('id'), 'integer')."
785
+                    AND contact.id != " . $db->quote($this->id, 'integer')."
786 786
                     AND (
787
-                        (address.email = " . $db->quote($this->address->get('email'), 'text') . " AND address.email != '')
788
-                        OR (address.phone = " . $db->quote($this->address->get('phone'), 'text') . " AND address.phone != ''))
787
+                        (address.email = " . $db->quote($this->address->get('email'), 'text')." AND address.email != '')
788
+                        OR (address.phone = " . $db->quote($this->address->get('phone'), 'text')." AND address.phone != ''))
789 789
 
790 790
                     ";
791 791
 
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
     function isFilledIn()
875 875
     {
876 876
         $db = new DB_Sql;
877
-        $db->query("SELECT count(*) AS antal FROM contact WHERE intranet_id = " . $this->kernel->intranet->get('id'));
877
+        $db->query("SELECT count(*) AS antal FROM contact WHERE intranet_id = ".$this->kernel->intranet->get('id'));
878 878
         if ($db->nextRecord()) {
879 879
             return $db->f('antal');
880 880
         }
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
             return false;
893 893
         }
894 894
         $db = new DB_Sql;
895
-        $db->query("UPDATE contact SET code = '".md5($this->id . date('Y-m-d H:i:s') . $this->kernel->intranet->get('id'))."' WHERE id = " . $this->id);
895
+        $db->query("UPDATE contact SET code = '".md5($this->id.date('Y-m-d H:i:s').$this->kernel->intranet->get('id'))."' WHERE id = ".$this->id);
896 896
         $this->load();
897 897
         return true;
898 898
     }
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
             return false;
910 910
         }
911 911
         $db = new DB_Sql;
912
-        $db->query("UPDATE contact SET password = '".md5($this->id . date('Y-m-d H:i:s') . $this->kernel->intranet->get('id'))."' WHERE id = " . $this->id);
912
+        $db->query("UPDATE contact SET password = '".md5($this->id.date('Y-m-d H:i:s').$this->kernel->intranet->get('id'))."' WHERE id = ".$this->id);
913 913
         $this->load();
914 914
         return true;
915 915
     }
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
     function getNewsletterSubscriptions()
923 923
     {
924 924
         $db = new DB_Sql;
925
-        $db->query("SELECT * FROM newsletter_subscriber WHERE optin = 1 AND active = 1 AND contact_id = " . $this->id . " AND intranet_id =" . $this->kernel->intranet->get('id'));
925
+        $db->query("SELECT * FROM newsletter_subscriber WHERE optin = 1 AND active = 1 AND contact_id = ".$this->id." AND intranet_id =".$this->kernel->intranet->get('id'));
926 926
         $lists = array();
927 927
         while ($db->nextRecord()) {
928 928
             $lists[] = $db->f('list_id');
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
     function needNewsletterOptin()
939 939
     {
940 940
         $db = new DB_Sql;
941
-        $db->query("SELECT list_id, code FROM newsletter_subscriber WHERE optin = 0 AND contact_id = " . $this->id . " AND intranet_id =" . $this->kernel->intranet->get('id'));
941
+        $db->query("SELECT list_id, code FROM newsletter_subscriber WHERE optin = 0 AND contact_id = ".$this->id." AND intranet_id =".$this->kernel->intranet->get('id'));
942 942
         $lists = array();
943 943
         $i = 0;
944 944
         while ($db->nextRecord()) {
@@ -959,7 +959,7 @@  discard block
 block discarded – undo
959 959
     function canBeDeleted()
960 960
     {
961 961
         $db = new DB_Sql;
962
-        $db->query("SELECT * FROM debtor WHERE contact_id = " . $this->id . " AND intranet_id = " . $this->kernel->intranet->get('id'));
962
+        $db->query("SELECT * FROM debtor WHERE contact_id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id'));
963 963
         if (!$db->nextRecord()) {
964 964
             return true;
965 965
         }
Please login to merge, or discard this patch.
src/Intraface/modules/contact/ContactReminder.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -124,6 +124,9 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
             $this->id = $this->db->lastInsertID();
224 224
         }
225 225
 
226
-         if (PEAR::isError($result)) {
227
-             throw new Exception('Could not save information in ContactReminder->update' . $result->getUserInfo());
228
-             return false;
229
-         }
230
-         return $this->id;
226
+            if (PEAR::isError($result)) {
227
+                throw new Exception('Could not save information in ContactReminder->update' . $result->getUserInfo());
228
+                return false;
229
+            }
230
+            return $this->id;
231 231
     }
232 232
 
233 233
     /**
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
          * @todo: validation needed - not crucial as we are setting the postpone date
244 244
          */
245 245
         $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'));
246
-         if (PEAR::isError($result)) {
247
-             throw new Exception('Could not postphone reminder' . $result->getUserInfo());
248
-             return false;
249
-         }
250
-         $this->load();
251
-         return true;
246
+            if (PEAR::isError($result)) {
247
+                throw new Exception('Could not postphone reminder' . $result->getUserInfo());
248
+                return false;
249
+            }
250
+            $this->load();
251
+            return true;
252 252
     }
253 253
 
254 254
     /**
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
                 '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 ' .
275 275
                 'ORDER BY contact_reminder_single.reminder_date ASC'
276 276
             );
277
-         if (PEAR::isError($result)) {
278
-             die($result->getUserInfo());
279
-             return false;
280
-         }
281
-         if ($result->numRows() == 0) {
282
-             return array();
283
-         }
284
-         return $result->fetchAll(MDB2_FETCHMODE_ASSOC);
277
+            if (PEAR::isError($result)) {
278
+                die($result->getUserInfo());
279
+                return false;
280
+            }
281
+            if ($result->numRows() == 0) {
282
+                return array();
283
+            }
284
+            return $result->fetchAll(MDB2_FETCHMODE_ASSOC);
285 285
 
286 286
     }
287 287
 
@@ -296,12 +296,12 @@  discard block
 block discarded – undo
296 296
         $status_key = array_search($status, $this->status_types);
297 297
 
298 298
         $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'));
299
-         if (PEAR::isError($result)) {
300
-             throw new Exception('Could not postphone reminder' . $result->getUserInfo());
301
-             return false;
302
-         }
303
-         $this->load();
304
-         return true;
299
+            if (PEAR::isError($result)) {
300
+                throw new Exception('Could not postphone reminder' . $result->getUserInfo());
301
+                return false;
302
+            }
303
+            $this->load();
304
+            return true;
305 305
 
306 306
     }
307 307
 
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
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()) {
@@ -214,17 +214,17 @@  discard block
 block discarded – undo
214 214
         } else {
215 215
 
216 216
             $result = $this->db->exec("INSERT INTO contact_reminder_single SET ".$sql.", ".
217
-                "intranet_id = ".$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer')."," .
218
-                "contact_id = ".$this->db->quote($this->contact->get('id'), 'integer')."," .
219
-                "created_by_user_id = ".$this->db->quote($this->contact->kernel->user->get('id'), 'integer')."," .
220
-                "status_key = 1," .
221
-                "date_created = NOW()," .
217
+                "intranet_id = ".$this->db->quote($this->contact->kernel->intranet->get('id'), 'integer').",".
218
+                "contact_id = ".$this->db->quote($this->contact->get('id'), 'integer').",".
219
+                "created_by_user_id = ".$this->db->quote($this->contact->kernel->user->get('id'), 'integer').",".
220
+                "status_key = 1,".
221
+                "date_created = NOW(),".
222 222
                 "active = 1");
223 223
             $this->id = $this->db->lastInsertID();
224 224
         }
225 225
 
226 226
          if (PEAR::isError($result)) {
227
-             throw new Exception('Could not save information in ContactReminder->update' . $result->getUserInfo());
227
+             throw new Exception('Could not save information in ContactReminder->update'.$result->getUserInfo());
228 228
              return false;
229 229
          }
230 230
          return $this->id;
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
         /**
243 243
          * @todo: validation needed - not crucial as we are setting the postpone date
244 244
          */
245
-        $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'));
245
+        $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'));
246 246
          if (PEAR::isError($result)) {
247
-             throw new Exception('Could not postphone reminder' . $result->getUserInfo());
247
+             throw new Exception('Could not postphone reminder'.$result->getUserInfo());
248 248
              return false;
249 249
          }
250 250
          $this->load();
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 
268 268
         $db = MDB2::singleton(DB_DSN);
269 269
         //
270
-        $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 ' .
271
-                'FROM contact_reminder_single ' .
272
-                '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) '.
273
-                'LEFT JOIN address ON (address.belong_to_id = contact.id AND address.type = 3 AND address.active = 1) ' .
274
-                '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 ' .
270
+        $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 '.
271
+                'FROM contact_reminder_single '.
272
+                '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) '.
273
+                'LEFT JOIN address ON (address.belong_to_id = contact.id AND address.type = 3 AND address.active = 1) '.
274
+                '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 '.
275 275
                 'ORDER BY contact_reminder_single.reminder_date ASC'
276 276
             );
277 277
          if (PEAR::isError($result)) {
@@ -295,9 +295,9 @@  discard block
 block discarded – undo
295 295
     {
296 296
         $status_key = array_search($status, $this->status_types);
297 297
 
298
-        $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'));
298
+        $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'));
299 299
          if (PEAR::isError($result)) {
300
-             throw new Exception('Could not postphone reminder' . $result->getUserInfo());
300
+             throw new Exception('Could not postphone reminder'.$result->getUserInfo());
301 301
              return false;
302 302
          }
303 303
          $this->load();
Please login to merge, or discard this patch.
src/Intraface/modules/debtor/Controller/Collection.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -548,6 +548,9 @@
 block discarded – undo
548 548
         return 'Create';
549 549
     }
550 550
 
551
+    /**
552
+     * @return string
553
+     */
551 554
     function getType()
552 555
     {
553 556
         return $this->context->getType();
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
         $this->getGateway()->getDBQuery()->setUri($this->url(null, array('use_stored' => 'true')));
80 80
 
81 81
         $data = array(
82
-        	'posts' => $this->getGateway()->findAll(),
83
-        	'debtor' => $this->getGateway());
82
+            'posts' => $this->getGateway()->findAll(),
83
+            'debtor' => $this->getGateway());
84 84
 
85 85
 
86 86
         // @todo kan følgende ikke lige så godt hente fra $this->query()
@@ -101,17 +101,17 @@  discard block
 block discarded – undo
101 101
 
102 102
     function postForm()
103 103
     {
104
-    	$debtor = $this->getDebtor();
105
-    	$contact = new Contact($this->getKernel(), $_POST["contact_id"]);
106
-
107
-    	if (isset($_POST["contact_person_id"]) && $_POST["contact_person_id"] == "-1") {
108
-    		$contact_person = new ContactPerson($contact);
109
-    		$person["name"] = $_POST['contact_person_name'];
110
-    		$person["email"] = $_POST['contact_person_email'];
111
-    		$contact_person->save($person);
112
-    		$contact_person->load();
113
-    		$_POST["contact_person_id"] = $contact_person->get("id");
114
-    	}
104
+        $debtor = $this->getDebtor();
105
+        $contact = new Contact($this->getKernel(), $_POST["contact_id"]);
106
+
107
+        if (isset($_POST["contact_person_id"]) && $_POST["contact_person_id"] == "-1") {
108
+            $contact_person = new ContactPerson($contact);
109
+            $person["name"] = $_POST['contact_person_name'];
110
+            $person["email"] = $_POST['contact_person_email'];
111
+            $contact_person->save($person);
112
+            $contact_person->load();
113
+            $_POST["contact_person_id"] = $contact_person->get("id");
114
+        }
115 115
 
116 116
         if ($this->getKernel()->intranet->hasModuleAccess('currency') && !empty($_POST['currency_id'])) {
117 117
             $currency_module = $this->getKernel()->useModule('currency', false); // false = ignore user access
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
             $_POST['currency'] = $currency;
125 125
         }
126 126
 
127
-    	if ($debtor->update($_POST)) {
128
-    	    return new k_SeeOther($this->url('../list/' . $debtor->get('id')));
129
-    	}
127
+        if ($debtor->update($_POST)) {
128
+            return new k_SeeOther($this->url('../list/' . $debtor->get('id')));
129
+        }
130 130
 
131
-    	return $this->render();
131
+        return $this->render();
132 132
     }
133 133
 
134 134
     function renderXls()
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
             $data['contact'] = new Contact($this->getKernel(), $this->getGateway()->getDBQuery()->getFilter('contact_id'));
96 96
         }
97 97
 
98
-        $smarty = $this->template->create(dirname(__FILE__) . '/templates/collection');
98
+        $smarty = $this->template->create(dirname(__FILE__).'/templates/collection');
99 99
         return $smarty->render($this, $data);
100 100
     }
101 101
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
         }
126 126
 
127 127
     	if ($debtor->update($_POST)) {
128
-    	    return new k_SeeOther($this->url('../list/' . $debtor->get('id')));
128
+    	    return new k_SeeOther($this->url('../list/'.$debtor->get('id')));
129 129
     	}
130 130
 
131 131
     	return $this->render();
@@ -323,15 +323,15 @@  discard block
 block discarded – undo
323 323
             $i++;
324 324
 
325 325
             $worksheet->write($i, 0, 'Forfaldne', $format_italic);
326
-            $worksheet->write($i, 1, number_format($due_total, 2, ",","."), $format_italic);
326
+            $worksheet->write($i, 1, number_format($due_total, 2, ",", "."), $format_italic);
327 327
             $i++;
328 328
 
329 329
             $worksheet->write($i, 0, 'Udestående (sendt):', $format_italic);
330
-            $worksheet->write($i, 1, number_format($sent_total, 2, ",","."), $format_italic);
330
+            $worksheet->write($i, 1, number_format($sent_total, 2, ",", "."), $format_italic);
331 331
             $i++;
332 332
 
333 333
             $worksheet->write($i, 0, 'Total:', $format_italic);
334
-            $worksheet->write($i, 1, number_format($total, 2, ",","."), $format_italic);
334
+            $worksheet->write($i, 1, number_format($total, 2, ",", "."), $format_italic);
335 335
             $i++;
336 336
 
337 337
             // $worksheet->write($i, 0, number_format(memory_get_usage()));
@@ -510,15 +510,15 @@  discard block
 block discarded – undo
510 510
         $i++;
511 511
 
512 512
         $worksheet->write($i, 0, 'Forfaldne', $format_italic);
513
-        $worksheet->write($i, 1, number_format($due_total, 2, ",","."), $format_italic);
513
+        $worksheet->write($i, 1, number_format($due_total, 2, ",", "."), $format_italic);
514 514
         $i++;
515 515
 
516 516
         $worksheet->write($i, 0, 'Udestående (sendt):', $format_italic);
517
-        $worksheet->write($i, 1, number_format($sent_total, 2, ",","."), $format_italic);
517
+        $worksheet->write($i, 1, number_format($sent_total, 2, ",", "."), $format_italic);
518 518
         $i++;
519 519
 
520 520
         $worksheet->write($i, 0, 'Total:', $format_italic);
521
-        $worksheet->write($i, 1, number_format($total, 2, ",","."), $format_italic);
521
+        $worksheet->write($i, 1, number_format($total, 2, ",", "."), $format_italic);
522 522
         $i++;
523 523
 
524 524
         $worksheet->hideGridLines();
Please login to merge, or discard this patch.
src/Intraface/modules/debtor/Controller/Create.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -87,6 +87,9 @@
 block discarded – undo
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();
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
 
32 32
     function postForm()
33 33
     {
34
-    	$debtor = $this->getDebtor();
35
-    	$contact = new Contact($this->getKernel(), $this->body("contact_id"));
36
-
37
-    	if ($this->body("contact_person_id") == "-1") {
38
-    		$contact_person = new ContactPerson($contact);
39
-    		$person["name"] = $_POST['contact_person_name'];
40
-    		$person["email"] = $_POST['contact_person_email'];
41
-    		$contact_person->save($person);
42
-    		$contact_person->load();
43
-    		$_POST["contact_person_id"] = $contact_person->get("id");
44
-    	}
34
+        $debtor = $this->getDebtor();
35
+        $contact = new Contact($this->getKernel(), $this->body("contact_id"));
36
+
37
+        if ($this->body("contact_person_id") == "-1") {
38
+            $contact_person = new ContactPerson($contact);
39
+            $person["name"] = $_POST['contact_person_name'];
40
+            $person["email"] = $_POST['contact_person_email'];
41
+            $contact_person->save($person);
42
+            $contact_person->load();
43
+            $_POST["contact_person_id"] = $contact_person->get("id");
44
+        }
45 45
 
46 46
         if ($this->getKernel()->intranet->hasModuleAccess('currency') && $this->body('currency_id')) {
47 47
             $currency_module = $this->getKernel()->useModule('currency', false); // false = ignore user access
@@ -54,11 +54,11 @@  discard block
 block discarded – undo
54 54
             $_POST['currency'] = $currency;
55 55
         }
56 56
 
57
-    	if ($debtor->update($_POST)) {
58
-    	    return new k_SeeOther($this->url('../' . $debtor->get('id')));
59
-    	}
57
+        if ($debtor->update($_POST)) {
58
+            return new k_SeeOther($this->url('../' . $debtor->get('id')));
59
+        }
60 60
 
61
-    	return $this->render();
61
+        return $this->render();
62 62
     }
63 63
 
64 64
     function getValues()
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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(
Please login to merge, or discard this patch.