fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9872] Merge 9868:9871 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [9872] Merge 9868:9871 from trunk
Date: Fri, 17 Aug 2012 08:15:50 +0000

Revision: 9872
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9872
Author:   sigurdne
Date:     2012-08-17 08:15:49 +0000 (Fri, 17 Aug 2012)
Log Message:
-----------
Merge 9868:9871 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
    
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
    branches/Version-1_0-branch/controller/inc/class.socase.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
    
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
    branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php
    
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php
    branches/Version-1_0-branch/controller/inc/class.sodocument.inc.php
    branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739,6741,6743,6745-6746,6748-6756,6758-6762,6764,6766-6788,6790,6792-6798,6800-6814,6816-6819,6821-6822,6824-6826,6828-6837,6839,6841,6843-6849,6851,6853-6869,6871-6874,6876-6877,6879,6881,6883,6885-6886,6888-6893,6895-6897,6899-6901,6903,6905-6907,6909,6911-6929,6931-6936,6938-6947,6949,6951,6953,6955-6956,6958-6959,6961-6968,6970-6971,6973-6974,6976-6978,6980,6982-7017,7019-7025,7027-7035,7037-7039,7041-7045,7047-7055,7057,7059-7065,7067-7069,7071,7073,7075-7076,7078,7080-7081,7083,7085,7087,7089-7097,7099-7102,7104-7105,7107-7111,7113-7120,7122-7124,7126-7129,7131,7133-7141,7143,7145-7146,7148-7150,7152-7153,7155-7158,7160-7164,7166-7167,7169-7170,7172,7174,7176,7178,7180-7181,7183,7185,7187-7188,7190,7192-7196,7198-7199,7201-7203,7205,7207,7209-7210,7212,7214,7216-7217,7219-7222,7224-7226,7228-7229,7231,7233-7234,7236-7238,7240-7241,7243-7244,7246,7248,7250,7252-7256,7258-7259,7261-7264,7266-7273,7275-7279,7281-7332,7334-7338,7340-7348,7350,7352-7353,7355-7361,7363-7366,7368-7370,7372,7374,7376,7378,7380-7386,7388-7400,7402,7404-7433,7435-7439,7441-7446,7448-7458,7460-7469,7471-7483,7485-7487,7489-7490,7492,7494,7496-7497,7499,7501-7502,7504,7506-7507,7509-7511,7513-7517,7519-7521,7523,7525,7527-7529,7531,7533,7535-7538,7540-7542,7544-7549,7551-7552,7554-7561,7563,7565,7567-7573,7575-7578,7580-7584,7586-7591,7593-7624,7627-7636,7638-7656,7658-7718,7720-7732,7734,7736,7738-7750,7754-7759,7761-7767,7769-7780,7782,7784-7809,7811-7812,7814-7835,7837-7847,7849-7887,7889-7895,7897,7899,7901,7903-7905,7907-7921,7923-7925,7927-7933,7935,7937-7952,7954-7968,7970-7974,7976,7978-7979,7981-7982,7984-7988,7990-7992,7994-8041,8043-8066,8068-8087,8089,8091-8108,8110-8124,8126-8129,8131,8133-8150,8152-8154,8156-8162,8164-8167,8169-8170,8172-8179,8181,8183-8196,8198-8207,8209-8211,8213-8214,8216-8217,8219-8220,8222,8224-8225,8227-8247,8249,8251,8253-8282,8284-8352,8354-8368,8370-8396,8398-8430,8432,8434-8440,8442-8445,8447-8453,8455-8456,8458,8460,8462-8464,8466-8473,8475-8479,8481,8483-8501,8503-8523,8525,8527-8531,8533,8535-8536,8538-8550,8552-8554,8556-8557,8559-8579,8581-8587,8589,8591-8592,8594-8595,8597-8601,8603-8610,8612-8613,8615,8617,8619-8645,8647-8650,8652-8661,8663-8666,8668-8669,8671-8683,8685-8691,8693-8730,8732-8737,8739,8741-8767,8769,8771-8772,8774,8776-8797,8799-8812,8814-8819,8821,8823-8833,8835-8837,8839,8841,8843-8849,8852-8858,8860-8867,8869-8870,8872,8874-8877,8879,8881,8883-8888,8890,8892-8901,8903-8911,8913-8917,8920-8923,8925-8933,8935-8938,8940-8943,8945,8947-8948,8950,8952-8953,8955-8962,8964,8966,8968-8970,8972-8975,8977-8983,8985-8993,8995-9001,9003,9005,9007,9009,9011-9019,9021-9023,9025,9027-9028,9030-9044,9046-9047,9049-9050,9052-9056,9058-9059,9061,9063-9064,9066-9068,9071-9092,9094-9112,9114-9117,9119,9121-9160,9162-9166,9169-9207,9209-9211,9213-9215,9217,9219,9221-9253,9255,9257,9259-9260,9262,9264-9269,9271-9273,9275,9277-9278,9280,9282-9283,9285-9289,9291-9299,9301-9310,9312-9313,9315-9320,9322-9324,9326-9338,9340-9342,9344,9346-9348,9350-9358,9360-9362,9364-9366,9368-9374,9376-9382,9384,9386,9388-9390,9392-9396,9398-9402,9404-9410,9412,9414,9416-9417,9419-9425,9427,9429-9430,9432,9434-9463,9465-9502,9504-9506,9508-9521,9523-9526,9528,9530-9537,9539,9541-9551,9553,9555-9556,9558-9578,9580-9581,9583,9585,9587,9589,9591-9624,9626-9655,9657-9700,9702-9726,9728-9729,9731-9749,9751,9753-9754,9756-9832,9834-9836,9838-9839,9841-9846,9848-9850,9852-9858,9860-9863,9865,9867,9869-9871

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang    
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/activitycalendarfrontend/setup/phpgw_no.lang    
2012-08-17 08:15:49 UTC (rev 9872)
@@ -96,6 +96,7 @@
 address        activitycalendarfrontend        no      Adresse
 activity_edit_helptext_step1   activitycalendarfrontend        no      Skal du 
endre opplysninger knyttet til en aktivitet må du være registrert som 
kontaktperson for aktiviteten.<br/>Du velger først organisasjon og deretter 
aktivitet i bildet under, og får en e-post i retur med en lenke til 
endringsskjema.
 mail_body_update_frontend      activitycalendarfrontend        no      Dette 
er en melding fra Bergen kommune/AktivBy.<br/><br/>I aktivitetsoversikten som 
ligger i kommuneportalen på internett, står du registrert som kontaktperson for 
%1.<br/>Det har kommet inn et endringsønske på denne aktiviteten. Bruk lenken 
under for å endre opplysningene om aktiviteten.<br/>%2<br/><br/><br/> Mvh %3 
kulturkontor
+mail_body_update       activitycalendarfrontend        no      Dette er en 
melding fra Bergen kommune/AktivBy.<br/><br/>I aktivitetsoversikten som ligger 
i kommuneportalen på internett, står du registrert som kontaktperson for 
%1.<br/>Det har kommet inn et endringsønske på denne aktiviteten. Bruk lenken 
under for å endre opplysningene om aktiviteten.<br/>%2<br/><br/><br/> Mvh %3 
kulturkontor
 mail_subject_update    activitycalendarfrontend        no      Melding fra 
AktivBy - Aktivitetsoversikt
 save_organization_next activitycalendarfrontend        no      Lagre 
organisasjon og gå videre til Ny aktivitet
 new_organization       activitycalendarfrontend        no      Ny organisasjon

Modified: 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
===================================================================
--- 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
        2012-08-17 07:19:03 UTC (rev 9871)
+++ 
branches/Version-1_0-branch/activitycalendarfrontend/templates/base/activity_new.php
        2012-08-17 08:15:49 UTC (rev 9872)
@@ -174,12 +174,42 @@
        {
                alert("Kategori må fylles ut!");
                return false;
-       } 
+       }
+        var malgrupper = document.getElementsByName('target[]');
+        var malgruppe_ok = false;
+        for(i=0;i<malgrupper.length;i++)
+        {
+            if(!malgruppe_ok)
+                {
+                    if(malgrupper[i].checked)
+                        {malgruppe_ok = true;}
+                }
+        }
+        if(!malgruppe_ok)
+        {
+            alert("Målgruppe må fylles ut!");
+            return false;
+        }
        if((document.getElementById('internal_arena_id').value == null || 
document.getElementById('internal_arena_id').value == 0) && 
(document.getElementById('new_arena_hidden').value==null || 
document.getElementById('new_arena_hidden').value==''))
        {
                alert("Lokale må fylles ut!");
                return false;
        }
+        var distrikter = document.getElementsByName('district');
+        var distrikt_ok = false;
+        for(i=0;i<distrikter.length;i++)
+        {
+            if(!distrikt_ok)
+                {
+                    if(distrikter[i].checked)
+                        {distrikt_ok = true;}
+                }
+        }
+        if(!distrikt_ok)
+        {
+            alert("Bydel må fylles ut!");
+            return false;
+        }
        if(document.getElementById('time').value == null || 
document.getElementById('time').value == '')
        {
                alert("Dag og tid må fylles ut!");

Modified: branches/Version-1_0-branch/controller/inc/class.socase.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socase.inc.php     
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.socase.inc.php     
2012-08-17 08:15:49 UTC (rev 9872)
@@ -43,7 +43,8 @@
                 */
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = CreateObject('controller.socase');
                        }
                        return self::$so;
@@ -69,7 +70,8 @@
 
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
 
-                       if($this->db->next_record()) {
+                       if($this->db->next_record())
+                       {
                                $case = new 
controller_check_item_case($this->unmarshal($this->db->f('id'), 'int'));
                                
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id'), 
'int'));
                                
$case->set_status($this->unmarshal($this->db->f('status'), 'int'));
@@ -108,7 +110,8 @@
 
                        $this->db->query($sql);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $case = new 
controller_check_item_case($this->unmarshal($this->db->f('id'), 'int'));
                                
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id'), 
'int'));
                                
$case->set_status($this->unmarshal($this->db->f('status'), 'int'));
@@ -122,9 +125,13 @@
                                
$case->set_measurement($this->unmarshal($this->db->f('measurement'), 'string'));
                                
                                if($return_type == "return_object")
+                               {
                                        $cases_array[] = $case;
+                               }
                                else
+                               {
                                        $cases_array[] = $case->toArray();
+                               }
                        }
 
                        return $cases_array;
@@ -166,7 +173,7 @@
 
                        $result = $this->db->query('INSERT INTO 
controller_check_item_case (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
 
-                       return isset($result) ? 
$this->db->get_last_insert_id('controller_check_item_case', 'id') : 0;
+                       return $result ? 
$this->db->get_last_insert_id('controller_check_item_case', 'id') : 0;
                }
 
                /**
@@ -177,7 +184,7 @@
                */
                function update($case)
                {
-                       $id = $case->get_id();
+                       $id = (int) $case->get_id();
                        
                        $values = array(
                                'check_item_id = ' . 
$this->marshal($case->get_check_item_id(), 'int'),
@@ -194,7 +201,7 @@
 
                        $result = $this->db->query('UPDATE 
controller_check_item_case SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
 
-                       if( isset($result) )
+                       if( $result )
                        {
                                return $id;
                        }
@@ -215,7 +222,7 @@
                        $case_id = (int) $case_id;
                        $status = $this->db->query("DELETE FROM 
controller_check_item_case WHERE id = $case_id");
                                        
-                       if( isset($status) )
+                       if( $status )
                        {
                                return true;
                        }

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_item.inc.php       
2012-08-17 08:15:49 UTC (rev 9872)
@@ -44,7 +44,8 @@
                 */
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = 
CreateObject('controller.socheck_item');
                        }
                        return self::$so;
@@ -70,7 +71,7 @@
 
                        $result = $this->db->query('INSERT INTO 
controller_check_item (' . join(',', $cols) . ') VALUES (' . join(',', $values) 
. ')', __LINE__,__FILE__);
 
-                       return isset($result) ? 
$this->db->get_last_insert_id('controller_check_item', 'id') : 0;
+                       return $result ? 
$this->db->get_last_insert_id('controller_check_item', 'id') : 0;
                }
 
                /**
@@ -90,7 +91,7 @@
 
                        $result = $this->db->query('UPDATE 
controller_check_item SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
 
-                       if( isset($result) )
+                       if( $result )
                        {
                                return $id;
                        }
@@ -117,7 +118,8 @@
 
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
 
-                       if($this->db->next_record()) {
+                       if($this->db->next_record())
+                       {
                                $check_item = new 
controller_check_item($this->unmarshal($this->db->f('c_id'), 'int'));
                                
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id'), 
'int'));
                                
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id'),
 'int'));
@@ -161,10 +163,10 @@
                        
                        $counter = 0;
                        $check_item = null;
-                       while ($this->db->next_record()) {
-                               
-                               if( $counter == 0 ){
-                                                                       
+                       while ($this->db->next_record())
+                       {
+                               if( $counter == 0 )
+                               {
                                        $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id'), 'int'));
                                        
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id'),
 'int'));
                                        
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id'), 
'int'));
@@ -178,14 +180,19 @@
                                        
$control_item->set_type($this->db->f('type', true), 'string');
                                
                                        if($return_type == "return_array")
+                                       {
                                                
$check_item->set_control_item($control_item->toArray());
+                                       }
                                        else
+                                       {
                                                
$check_item->set_control_item($control_item);
+                                       }
                                                
                                        $cases_array = array();
                                }
                                
-                               if($this->db->f('cic_id') != ''){
+                               if($this->db->f('cic_id'))
+                               {
                                        $case = new 
controller_check_item_case($this->unmarshal($this->db->f('cic_id'), 'int'));
                                        
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id'), 
'int'));
                                        
$case->set_status($this->unmarshal($this->db->f('cic_status'), 'int'));
@@ -199,23 +206,34 @@
                                
                                
                                        if($return_type == "return_array")
+                                       {
                                                $cases_array[] = 
$case->toArray();
+                                       }
                                        else
+                                       {
                                                $cases_array[] = $case;
+                                       }
                                }
                                
                                $check_item_id =  $check_item->get_id();
                                $counter++;
                        }
                        
-                       if($check_item != null){
+                       if($check_item != null)
+                       {
                                $check_item->set_cases_array($cases_array);
                                
                                if($return_type == "return_array")
+                               {
                                        return $check_item->toArray();
+                               }
                                else
+                               {
                                        return $check_item;
-                       }else{
+                               }
+                       }
+                       else
+                       {
                                return null;
                        }
                }
@@ -240,7 +258,8 @@
                        
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
 
-                       if($this->db->next_record()) {
+                       if($this->db->next_record())
+                       {
                                $check_item = new 
controller_check_item($this->unmarshal($this->db->f('c_id'), 'int'));
                                
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id'), 
'int'));
                                
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id'),
 'int'));
@@ -329,22 +348,35 @@
                        $sql .= "WHERE ci.check_list_id = {$check_list_id} ";
                        
                        if($status == 'open')
+                       {
                                $sql .= "AND cic.status = 0 ";
+                       }
                        else if($status == 'closed')
+                       {
                                $sql .= "AND cic.status = 1 ";
+                       }
                        else if($status == 'waiting')
+                       {
                                $sql .= "AND cic.status = 2 ";
+                       }
                        else if($status == 'open_or_waiting')
+                       {
                                $sql .= "AND (cic.status = 0 OR cic.status = 2) 
";
+                       }
                        
-                       if($type != null){
+                       if($type != null)
+                       {
                                $sql .= "AND coi.type = '$type' ";
                        }
                                                                                
                        if($messageStatus != null & $messageStatus == 
'no_message_registered')
+                       {
                                $sql .= "AND cic.location_item_id IS NULL ";
+                       }
                        else if($messageStatus != null &  $messageStatus == 
'message_registered')
+                       {
                                $sql .= "AND cic.location_item_id > 0 ";
+                       }
                        
                        $sql .= "ORDER BY ci.id";
                                                                                
        
@@ -352,17 +384,22 @@
                        
                        $check_item_id = 0;
                        $check_item = null;
-                       while ($this->db->next_record()) {
-                               
-                               if( $this->db->f('ci_id', true) != 
$check_item_id ){
-                                       
-                                       if($check_item_id != 0){
+                       while ($this->db->next_record())
+                       {
+                               if( $this->db->f('ci_id') != $check_item_id )
+                               {       
+                                       if($check_item_id)
+                                       {
                                                
$check_item->set_cases_array($cases_array);
                                                
                                                if($return_type == 
"return_array")
+                                               {
                                                        $check_items_array[] = 
$check_item->toArray();
+                                               }
                                                else
+                                               {
                                                        $check_items_array[] = 
$check_item;
+                                               }
                                        }
                                
                                        $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id'), 'int'));
@@ -378,14 +415,19 @@
                                        
$control_item->set_type($this->db->f('type', true), 'string');
                                
                                        if($return_type == "return_array")
+                                       {
                                                
$check_item->set_control_item($control_item->toArray());
+                                       }
                                        else
+                                       {
                                                
$check_item->set_control_item($control_item);
+                                       }
                                                        
                                        $cases_array = array();
                                }
                                
-                               if($this->db->f('cic_id', true) != ''){
+                               if( $this->db->f('cic_id') )
+                               {
                                        $case = new 
controller_check_item_case($this->unmarshal($this->db->f('cic_id'), 'int'));
                                        
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id'), 
'int'));
                                        
$case->set_status($this->unmarshal($this->db->f('cic_status'), 'int'));
@@ -399,24 +441,34 @@
                                        
$case->set_measurement($this->unmarshal($this->db->f('measurement', true), 
'string'));
                                                                
                                        if($return_type == "return_array")
+                                       {
                                                $cases_array[] = 
$case->toArray();
+                                       }
                                        else
+                                       {
                                                $cases_array[] = $case;
+                                       }
                                }
                                
                                $check_item_id = $check_item->get_id();
                        }
                        
-                       if($check_item != null){
+                       if($check_item != null)
+                       {
                                $check_item->set_cases_array($cases_array);
                                
                                if($return_type == "return_array")
+                               {
                                        $check_items_array[] = 
$check_item->toArray();
+                               }
                                else
+                               {
                                        $check_items_array[] = $check_item;
-                               
+                               }
                                return $check_items_array;
-                       }else {
+                       }
+                       else
+                       {
                                return null;
                        }
                }
@@ -444,17 +496,22 @@
                        
                        $check_item_id = 0;
                        $check_item = null;
-                       while ($this->db->next_record()) {
-                               
-                               if( $this->db->f('ci_id', true) != 
$check_item_id ){
-                                       
-                                       if($check_item_id != 0){
+                       while ($this->db->next_record())
+                       {
+                               if( $this->db->f('ci_id') != $check_item_id )
+                               {
+                                       if($check_item_id)
+                                       {
                                                
$check_item->set_cases_array($cases_array);
                                                
                                                if($return_type == 
"return_array")
+                                               {
                                                        $check_items_array[] = 
$check_item->toArray();
+                                               }
                                                else
+                                               {
                                                        $check_items_array[] = 
$check_item;
+                                               }
                                        }
                                
                                        $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id'), 'int'));
@@ -470,14 +527,19 @@
                                        
$control_item->set_type($this->db->f('type', true), 'string');
                                
                                        if($return_type == "return_array")
+                                       {
                                                
$check_item->set_control_item($control_item->toArray());
+                                       }
                                        else
+                                       {
                                                
$check_item->set_control_item($control_item);
+                                       }
                                                                        
                                        $cases_array = array();
                                }
                                
-                               if($this->db->f('cic_id') != ''){
+                               if($this->db->f('cic_id'))
+                               {
                                        $case = new 
controller_check_item_case($this->unmarshal($this->db->f('cic_id'), 'int'));
                                        
$case->set_status($this->unmarshal($this->db->f('cic_status'), 'int'));
                                        
$case->set_check_item_id($this->unmarshal($this->db->f('check_item_id'), 
'int'));
@@ -491,24 +553,35 @@
                                
                                
                                        if($return_type == "return_array")
+                                       {
                                                $cases_array[] = 
$case->toArray();
+                                       }
                                        else
+                                       {
                                                $cases_array[] = $case;
+                                       }
                                }
                                
                                $check_item_id =  $check_item->get_id();
                        }
                        
-                       if($check_item != null){
+                       if($check_item != null)
+                       {
                                $check_item->set_cases_array($cases_array);
                                
                                if($return_type == "return_array")
+                               {
                                        $check_items_array[] = 
$check_item->toArray();
+                               }
                                else
+                               {
                                        $check_items_array[] = $check_item;
+                               }
                                
                                return $check_items_array;
-                       }else {
+                       }
+                       else
+                       {
                                return null;
                        }
                }

Modified: branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.socheck_list.inc.php       
2012-08-17 08:15:49 UTC (rev 9872)
@@ -45,7 +45,8 @@
         */
        public static function get_instance()
        {
-               if (self::$so == null) {
+               if (self::$so == null)
+               {
                        self::$so = CreateObject('controller.socheck_list');
                }
                return self::$so;
@@ -82,9 +83,12 @@
                
$check_list->set_num_open_cases($this->unmarshal($this->db->f('num_open_cases'),
 'int'));       
                
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int')); 
                        
-               if($check_list != null){
+               if($check_list != null)
+               {
                        return $check_list;
-               }else {
+               }
+               else
+               {
                        return null;
                }
        }
@@ -110,19 +114,27 @@
                $sql .= "WHERE cl.id = {$check_list_id} ";
                
                if($status == 'open')
+               {
                        $sql .= "AND ci.status = 0 ";
+               }
                else if($status == 'handled')
+               {
                        $sql .= "AND ci.status = 1 ";
+               }
                        
                if($type != null)
+               {
                        $sql .= "AND coi.type = '$type'";
-                                                       
+               }                                       
+
                $this->db->query($sql);
                
                $counter = 0;
                $check_list = null;
-               while ($this->db->next_record()) {
-                       if($counter == 0){
+               while ($this->db->next_record())
+               {
+                       if($counter == 0)
+                       {
                                $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id'), 'int'));
                                
$check_list->set_status($this->unmarshal($this->db->f('cl_status'), 'bool'));
                                
$check_list->set_control_id($this->unmarshal($this->db->f('control_id'), 
'int'));
@@ -135,7 +147,8 @@
                                
$check_list->set_num_pending_cases($this->unmarshal($this->db->f('num_pending_cases'),
 'int'));
                        }
                                                
-                       if($this->db->f('ci_id') != ''){
+                       if($this->db->f('ci_id'))
+                       {
                                $check_item = new 
controller_check_item($this->unmarshal($this->db->f('ci_id'), 'int'));
                                
$check_item->set_control_item_id($this->unmarshal($this->db->f('control_item_id'),
 'int'));
                                
$check_item->set_check_list_id($this->unmarshal($this->db->f('check_list_id'), 
'int'));
@@ -155,10 +168,13 @@
                        $counter++;
                }
                
-               if($check_list != null){
+               if($check_list != null)
+               {
                        $check_list->set_check_item_array($check_items_array);
                        return $check_list->toArray();
-               }else {
+               }
+               else
+               {
                        return null;
                }
        }
@@ -185,9 +201,12 @@
                
                $check_list_id = 0;
                $check_list = null;
-               while ($this->db->next_record()) {              
-                       if( $this->db->f('cl_id') != $check_list_id ){
-                               if($check_list_id != 0){
+               while ($this->db->next_record())
+               {
+                       if( $this->db->f('cl_id') != $check_list_id )
+                       {
+                               if( $check_list_id )
+                               {
                                        
$check_list->set_check_item_array($check_items_array);
                                        $check_list_array[] = 
$check_list->toArray();
                                }
@@ -214,12 +233,15 @@
                        $check_list_id =  $check_list->get_id();
                }
                
-               if($check_list != null){
+               if($check_list != null)
+               {
                        $check_list->set_check_item_array($check_items_array);
                        $check_list_array[] = $check_list->toArray();
                
                        return $check_list_array;
-               }else {
+               }
+               else
+               {
                        return null;
                }
        }
@@ -259,11 +281,14 @@
                
                $check_list_id = 0;
                $check_list = null;
-               while ($this->db->next_record()) {
+               while ($this->db->next_record())
+               {
                
-                       if( $this->db->f('cl_id') != $check_list_id ){
+                       if( $this->db->f('cl_id') != $check_list_id )
+                       {
                                
-                               if($check_list_id != 0){
+                               if($check_list_id)
+                               {
                                        $check_list_array[] = $check_list;
                                }
                                
@@ -281,10 +306,13 @@
                        $check_list_id =  $check_list->get_id();
                }
                
-               if($check_list != null){
+               if($check_list != null)
+               {
                        $check_list_array[] = $check_list;
                        return $check_list_array;
-               }else {
+               }
+               else
+               {
                        return null;
                }
        }
@@ -314,9 +342,12 @@
                
                $check_list_id = 0;
                $check_list = null;
-               while ($this->db->next_record()) {
-                       if( $this->db->f('cl_id') != $check_list_id ){
-                               if($check_list_id != 0){
+               while ($this->db->next_record())
+               {
+                       if( $this->db->f('cl_id') != $check_list_id )
+                       {
+                               if($check_list_id)
+                               {
                                        $check_list_array[] = $check_list;
                                }
                                
@@ -334,10 +365,13 @@
                        $check_list_id =  $check_list->get_id();
                }
                
-               if($check_list != null){
+               if($check_list != null)
+               {
                        $check_list_array[] = $check_list;
                        return $check_list_array;
-               }else {
+               }
+               else
+               {
                        return null;
                }
        }
@@ -367,10 +401,13 @@
                
                $check_list_id = 0;
                $check_list = null;
-               while ($this->db->next_record()) {
+               while ($this->db->next_record())
+               {
                
-                       if( $this->db->f('cl_id') != $check_list_id ){
-                               if($check_list_id != 0){
+                       if( $this->db->f('cl_id') != $check_list_id )
+                       {
+                               if($check_list_id)
+                               {
                                        $check_list_array[] = $check_list;
                                }
                                
@@ -388,10 +425,13 @@
                        $check_list_id =  $check_list->get_id();
                }
                
-               if($check_list != null){
+               if($check_list != null)
+               {
                        $check_list_array[] = $check_list;
                        return $check_list_array;
-               }else {
+               }
+               else
+               {
                        return null;
                }
        }
@@ -404,15 +444,19 @@
         * @param $to_date end time period
         * @return array with check list objects
         */
-       function get_num_open_cases_for_control( $cl_criteria, $from_date_ts, 
$to_date_ts ){
+       function get_num_open_cases_for_control( $cl_criteria, $from_date_ts, 
$to_date_ts )
+       {
                
                $sql =  "SELECT c.id as c_id, sum(cl.num_open_cases) as count ";
                $sql .= "FROM controller_check_list cl, controller_control c ";
                
-               if($cl_criteria->get_component_id() > 0 && 
$cl_criteria->get_location_id() > 0){
+               if($cl_criteria->get_component_id() > 0 && 
$cl_criteria->get_location_id() > 0)
+               {
                    $sql .= "WHERE cl.component_id = 
{$cl_criteria->get_component_id()} ";
                    $sql .= "AND cl.location_id = 
{$cl_criteria->get_location_id()} ";
-               }else{
+               }
+               else
+               {
                    $sql .= "WHERE cl.location_code = 
'{$cl_criteria->get_location_code()}' ";
                }
                
@@ -423,11 +467,13 @@
                
                $this->db->query($sql);
                
-               if ($this->db->next_record() & $this->db->f('count') > 0) {
-      $control_array = array(
-                                               "id"    => 
$this->unmarshal($this->db->f('c_id'), 'int'),
-                                                                               
    "count" => $this->db->f('count')
-                                                                            );
+               if ($this->db->next_record() & $this->db->f('count') > 0)
+               {
+                       $control_array = array
+                       (
+                               "id"    => 
$this->unmarshal($this->db->f('c_id'), 'int'),
+                               "count" => $this->db->f('count')
+                       );
                }
                
                return $control_array;
@@ -442,7 +488,8 @@
         * @param $repeat_type_expr repeat type expression
         * @return array with check list objects
         */
-       function get_check_lists_for_location( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr = null ){
+       function get_check_lists_for_location( $location_code, $from_date_ts, 
$to_date_ts, $repeat_type_expr = null )
+       {
                $sql =  "SELECT c.id as c_id, ";
                $sql .= "cl.id as cl_id, cl.status as cl_status, cl.comment as 
cl_comment, deadline, planned_date, completed_date, ";
                $sql .= "cl.component_id as cl_component_id, cl.location_code 
as cl_location_code, num_open_cases, num_pending_cases "; 
@@ -451,7 +498,9 @@
                $sql .= "WHERE cl.location_code = '{$location_code}' ";
                
                if( $repeat_type != null )
+               {
                        $sql .= "AND c.repeat_type $repeat_type_expr ";
+               }
                
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                $sql .= "ORDER BY c.id;";
@@ -461,11 +510,12 @@
                $control_id = 0;
                $control = null;
                $controls_array = array();
-               while ($this->db->next_record()) {
-                       
-                       if( $this->db->f('c_id') != $control_id ){
-                               
-                               if($control_id != 0){
+               while ($this->db->next_record())
+               {
+                       if( $this->db->f('c_id') != $control_id )
+                       {       
+                               if($control_id)
+                               {
                                        
$control->set_check_lists_array($check_lists_array);
                                        $controls_array[] = $control;
                                }
@@ -491,7 +541,8 @@
                        $control_id =  $control->get_id();
                }
                
-               if($control != null){
+               if($control != null)
+               {
                        $control->set_check_lists_array($check_lists_array);
                        $controls_array[] = $control;
                }       
@@ -522,7 +573,9 @@
                $sql .= "AND cl.component_id = {$component_id} ";
                
                if( $repeat_type != null )
+               {
                        $sql .= "AND c.repeat_type $repeat_type_expr ";
+               }
                
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                $sql .= "ORDER BY c.id;";
@@ -532,15 +585,16 @@
                $control_id = 0;
                $control = null;
                $controls_array = array();
-               while ($this->db->next_record()) {
-                       
-                       if( $this->db->f('c_id') != $control_id ){
-                               
-                               if($control_id != 0){
+               while ($this->db->next_record())
+               {
+                       if( $this->db->f('c_id') != $control_id )
+                       {
+                               if($control_id != 0)
+                               {
                                        
$control->set_check_lists_array($check_lists_array);
                                        $controls_array[] = $control;
                                }
-                       
+
                                $control = new 
controller_control($this->unmarshal($this->db->f('c_id'), 'int'));
                                                                                
                
                                $check_lists_array = array();
@@ -563,7 +617,8 @@
                        $control_id =  $control->get_id();
                }
                
-               if($control != null){
+               if($control != null)
+               {
                        $control->set_check_lists_array($check_lists_array);
                        $controls_array[] = $control;
                }       
@@ -593,13 +648,16 @@
                $sql .= "AND cl.location_code = '{$location_code}' ";
                
                if( $repeat_type != null )
+               {
                        $sql .= "AND c.repeat_type = $repeat_type ";
+               }
                
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                
                $this->db->query($sql);
                
-               while ($this->db->next_record()) {
+               while ($this->db->next_record())
+               {
                        $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id'), 'int'));
                        
$check_list->set_status($this->unmarshal($this->db->f('cl_status'), 'int'));
                        
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
@@ -642,13 +700,16 @@
                $sql .= "AND cl.location_id = {$location_id} ";
                
                if( $repeat_type != null )
+               {
                        $sql .= "AND c.repeat_type = $repeat_type ";
+               }
                
                $sql .= "AND deadline BETWEEN $from_date_ts AND $to_date_ts ";
                
                $this->db->query($sql);
                
-               while ($this->db->next_record()) {
+               while ($this->db->next_record())
+               {
                        $check_list = new 
controller_check_list($this->unmarshal($this->db->f('cl_id'), 'int'));
                        
$check_list->set_status($this->unmarshal($this->db->f('cl_status'), 'int'));
                        
$check_list->set_comment($this->unmarshal($this->db->f('cl_comment', true), 
'string'));
@@ -717,7 +778,8 @@
                        $search_for = $this->marshal($search_for,'field');
                        $like_pattern = "'%".$search_for."%'";
                        $like_clauses = array();
-                       switch($search_type){
+                       switch($search_type)
+                       {
                                default:
                                        $like_clauses[] = "p.title $this->like 
$like_pattern";
                                        break;
@@ -764,7 +826,8 @@
 
        function populate(int $control_id, &$control)
        {
-               if($control == null) {
+               if($control == null)
+               {
                        $start_date = date("d.m.Y",  
$this->db->f('start_date'));
                        $end_date = date("d.m.Y",  $this->db->f('end_date'));
                        $control = new controller_control((int) $control_id);
@@ -846,7 +909,7 @@
 
                $result = $this->db->query('UPDATE controller_check_list SET ' 
. join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
 
-               if(isset($result))
+               if($result)
                {
                        return $id;                     
                }

Modified: branches/Version-1_0-branch/controller/inc/class.socommon.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socommon.inc.php   
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.socommon.inc.php   
2012-08-17 08:15:49 UTC (rev 9872)
@@ -160,7 +160,8 @@
                /**
                 * Method for retrieving the db-object (security "forgotten")
                 */
-               public function get_db(){
+               public function get_db()
+               {
                        return $this->db;
                }
 
@@ -347,8 +348,10 @@
 
                public function store(&$object)
                {
-                       if ($object->validates()) {
-                               if ($object->get_id() > 0) {
+                       if ($object->validates())
+                       {
+                               if ($object->get_id() > 0)
+                               {
                                        // We can assume this composite came 
from the database since it has an ID. Update the existing row
                                        return $this->update($object);
                                }
@@ -362,5 +365,4 @@
                        // The object did not validate
                        return false;
                }
-
        }

Modified: branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol.inc.php  
2012-08-17 08:15:49 UTC (rev 9872)
@@ -36,7 +36,7 @@
 
   class controller_socontrol extends controller_socommon
   {
-    protected static $so;
+               protected static $so;
 
                /**
                 * Get a static reference to the storage object associated with 
this model object
@@ -45,7 +45,8 @@
                 */
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = 
CreateObject('controller.socontrol');
                        }
                        return self::$so;
@@ -63,7 +64,8 @@
                        $sql = "INSERT INTO controller_control (title) VALUES 
('$title')";
                        $result = $this->db->query($sql, __LINE__,__FILE__);
 
-                       if(isset($result)) {
+                       if($result)
+                       {
 
                                // Set the new control ID
                                
$control->set_id($this->db->get_last_insert_id('controller_control', 'id'));
@@ -85,7 +87,6 @@
                 */
                function update($control)
                {
-
                        $id = intval($control->get_id());
 
                        $values = array(
@@ -102,9 +103,12 @@
 
                        $result = $this->db->query('UPDATE controller_control 
SET ' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
 
-                       if( isset($result) ){
+                       if( $result )
+                       {
                                return $id;
-                       }else{
+                       }
+                       else
+                       {
                                return 0;
                        }
                }
@@ -133,16 +137,22 @@
                        $sql .= "WHERE cll.location_code = '$location_code' ";
                        
                        if( is_numeric($repeat_type) )
+                       {
                                $sql .= "AND c.repeat_type = $repeat_type ";
+                       }
+
                        if( is_numeric($role_id))
+                       {
                            $sql .= "AND c.responsibility_id = $role_id ";
+                       }
                        
                        $sql .= "AND (c.start_date <= $from_date AND c.end_date 
IS NULL ";
                        $sql .= "OR c.start_date > $from_date AND c.start_date 
< $to_date)";
 
                        $this->db->query($sql);
 
-                       while($this->db->next_record()) {
+                       while($this->db->next_record())
+                       {
                                $control = new 
controller_control($this->unmarshal($this->db->f('id'), 'int'));
                                
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
                                
$control->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
@@ -159,15 +169,21 @@
                                
$control->set_repeat_interval($this->unmarshal($this->db->f('repeat_interval'), 
'int'));
                                
                                if($return_type == "return_object")
+                               {
                                        $controls_array[] = $control;
+                               }
                                else
+                               {
                                        $controls_array[] = $control->toArray();
+                               }
                        }
 
-                       if( count( $controls_array ) > 0 ){
+                       if( count( $controls_array ) > 0 )
+                       {
                                return $controls_array; 
                        }
-                       else {
+                       else
+                       {
                                return null;
                        }
                }
@@ -197,16 +213,21 @@
                        $sql .= "WHERE fm_bim_item.loc1 = '$location_code' ";
                        
                        if( is_numeric($repeat_type) )
+                       {
                                $sql .= "AND c.repeat_type = $repeat_type ";
+                       }
                        if( is_numeric($role_id))
+                       {
                            $sql .= "AND c.responsibility_id = $role_id ";
+                       }
                        
                        $sql .= "AND (c.start_date <= $from_date AND c.end_date 
IS NULL ";
                        $sql .= "OR c.end_date > $from_date AND c.start_date < 
$to_date)";
 
                        $this->db->query($sql);
                        
-                       while($this->db->next_record()) {
+                       while($this->db->next_record())
+                       {
                                $control = new 
controller_control($this->unmarshal($this->db->f('id'), 'int'));
                                
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
                                
$control->set_description($this->unmarshal($this->db->f('description', true), 
'string'));
@@ -226,14 +247,21 @@
                                
$control->set_component_id($this->unmarshal($this->db->f('component_id'), 
'int'));
 //
                                if($return_type == "return_object")
+                               {
                                        $controls_array[] = $control;
+                               }
                                else
+                               {
                                        $controls_array[] = $control->toArray();
+                               }
                        }
 
-                       if( count( $controls_array ) > 0 ){
+                       if( count( $controls_array ) > 0 )
+                       {
                                return $controls_array; 
-                       }else {
+                       }
+                       else
+                       {
                                return null;
                        }
                }
@@ -431,24 +459,29 @@
 
                        $this->db->query($sql);
 
-                       while($this->db->next_record()) {
+                       while($this->db->next_record())
+                       {
                                $control_id = 
$this->unmarshal($this->db->f('id'), 'int');
                                $title = $this->unmarshal($this->db->f('title', 
true), 'string');
                                $location_code = 
$this->unmarshal($this->db->f('location_code', true), 'string');
 
                                $location_array = 
execMethod('property.bolocation.read_single', array('location_code' => 
$location_code));
 
-                               $controls_array[] = array(
-                                                                               
                                                                "id" => 
$control_id, 
-                                                                               
                                                                "title" => 
$title, 
-                                                                               
                                                                "location_code" 
=> $location_code, 
-                                                                               
                                                                "loc1_name" => 
$location_array["loc1_name"]
-                                                                               
                                                        );
+                               $controls_array[] = array
+                               (
+                                       "id"                    => $control_id, 
+                                       "title"                 => $title, 
+                                       "location_code" => $location_code, 
+                                       "loc1_name"             => 
$location_array["loc1_name"]
+                               );
                        }
 
-                       if( count( $controls_array ) > 0 ){
+                       if( count( $controls_array ) > 0 )
+                       {
                                return $controls_array; 
-                       }else {
+                       }
+                       else
+                       {
                                return null;
                        }
                }
@@ -474,7 +507,8 @@
 
                        $this->db->query($sql);
 
-                       while($this->db->next_record()) {
+                       while($this->db->next_record())
+                       {
                                $component = new controller_component();
                                
$component->set_type($this->unmarshal($this->db->f('type'), 'int'));
                                
$component->set_id($this->unmarshal($this->db->f('component_id'), 'int'));
@@ -489,7 +523,8 @@
                                $components_array[] = $component;
                        }
 
-                       if( count( $components_array ) > 0 ){
+                       if( count( $components_array ) > 0 )
+                       {
                                return $components_array; 
                        }
                        else
@@ -515,7 +550,8 @@
                        
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
                        
-                       if($this->db->next_record()){
+                       if($this->db->next_record())
+                       {
                                $control_location = new 
controller_control_location($this->unmarshal($this->db->f('id'), 'int'));
        
                                
$control_location->set_location_code($this->unmarshal($this->db->f('location_code',
 true), 'string'));
@@ -715,7 +751,8 @@
                                $search_for = 
$this->marshal($search_for,'field');
                                $like_pattern = "'%".$search_for."%'";
                                $like_clauses = array();
-                               switch($search_type){
+                               switch($search_type)
+                               {
                                        default:
                                                $like_clauses[] = 
"controller_control.title $this->like $like_pattern";
                                                $like_clauses[] = 
"controller_control.description $this->like $like_pattern";
@@ -779,7 +816,8 @@
 
                function populate(int $control_id, &$control)
                {
-                       if($control == null) {
+                       if($control == null)
+                       {
                                $control = new controller_control((int) 
$control_id);
 
                                
$control->set_title($this->unmarshal($this->db->f('title', true), 'string'));
@@ -867,9 +905,13 @@
                        if($ifc != null)
                        {
                                if($ifc == 1)
+                               {
                                        $where_clause = "WHERE is_ifc";
+                               }
                                else
+                               {
                                        $where_clause = "WHERE NOT is_ifc";
+                               }
                        }
                        $sql = "select * from fm_bim_type {$where_clause} ORDER 
BY name";
                        $this->db->query($sql, __LINE__, __FILE__);

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_group.inc.php    
2012-08-17 08:15:49 UTC (rev 9872)
@@ -43,7 +43,8 @@
                 */
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = 
CreateObject('controller.socontrol_group');
                        }
                        return self::$so;
@@ -73,7 +74,7 @@
 
                        $result = $this->db->query('INSERT INTO 
controller_control_group (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
 
-                       if(isset($result))
+                       if($result)
                        {
                                // Get the new control group ID and return it
                                return 
$this->db->get_last_insert_id('controller_control_group', 'id');
@@ -104,7 +105,7 @@
 
                        $result = $this->db->query('UPDATE 
controller_control_group SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
 
-                       return isset($result);
+                       return $result ? $id : 0;
                }
 
                /**
@@ -218,7 +219,8 @@
                        $sql = "SELECT * FROM controller_control_group WHERE 
control_area_id=$control_area_id";
                        $this->db->query($sql);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $control_group = new 
controller_control_group($this->unmarshal($this->db->f('id'), 'int'));
                                
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
                                
$control_group->set_procedure_id($this->unmarshal($this->db->f('procedure_id'), 
'int'));
@@ -257,7 +259,8 @@
                        {
                                $like_pattern = "'%" . 
$this->db->db_addslashes($search_for) . "%'";
                                $like_clauses = array();
-                               switch($search_type){
+                               switch($search_type)
+                               {
                                        default:
                                                $like_clauses[] = 
"controller_control_group.group_name $this->like $like_pattern";
                                                break;
@@ -338,7 +341,8 @@
                        $sql = "SELECT * FROM controller_control_group WHERE 
control_area_id=$control_area_id";
                        $this->db->query($sql);
 
-                       while($this->db->next_record()) {
+                       while($this->db->next_record())
+                       {
                                $control_group = new 
controller_control_group((int) $this->db->f('id'));
 
                                
$control_group->set_group_name($this->unmarshal($this->db->f('group_name', 
true), 'string'));
@@ -353,7 +357,8 @@
                                $control_groups_array[] = 
$control_group->toArray();
                        }
 
-                       if( count( $control_groups_array ) > 0 ){
+                       if( count( $control_groups_array ) > 0 )
+                       {
                                return $control_groups_array; 
                        }
                        else
@@ -374,14 +379,16 @@
                        $sql = "SELECT control_area_id FROM 
controller_control_group WHERE control_group_id={$control_group_id}";
                        $this->db->query($sql);
 
-                       while($this->db->next_record()) {
+                       while($this->db->next_record())
+                       {
                                $control_area = 
$this->unmarshal($this->db->f('control_area_id'), 'int');
                                $category = 
execMethod('phpgwapi.categories.return_single', 
$this->unmarshal($this->db->f('control_area_id', 'int')));
                                
                                $control_area_array[] = array($control_area => 
$category[0]['name']);
                        }
 
-                       if( count( $control_area_array ) > 0 ){
+                       if( count( $control_area_array ) > 0 )
+                       {
                                return $control_area_array; 
                        }
                        else

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php   
    2012-08-17 07:19:03 UTC (rev 9871)
+++ 
branches/Version-1_0-branch/controller/inc/class.socontrol_group_list.inc.php   
    2012-08-17 08:15:49 UTC (rev 9872)
@@ -44,7 +44,8 @@
                 */
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = 
CreateObject('controller.socontrol_group_list');
                        }
                        return self::$so;
@@ -72,7 +73,8 @@
 
                        $result = $this->db->query('INSERT INTO 
controller_control_group_list (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
 
-                       if(isset($result)) {
+                       if($result)
+                       {
                                // Get the new control group ID and return it
                                return 
$this->db->get_last_insert_id('controller_control_group_list', 'id');
                        }
@@ -80,7 +82,6 @@
                        {
                                return 0;
                        }
-
                }
 
                /**
@@ -103,7 +104,7 @@
                        //var_dump('UPDATE activity_activity SET ' . join(',', 
$values) . " WHERE id=$id");
                        $result = $this->db->query('UPDATE 
controller_control_group_list SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
 
-                       return isset($result);
+                       return $result;
                }
 
                /**
@@ -119,7 +120,8 @@
                        $sql = "SELECT p.* FROM controller_control_group_list p 
WHERE p.id = " . $id;
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
 
-                       if($this->db->next_record()){
+                       if($this->db->next_record())
+                       {
                                $control_group_list = new 
controller_control_group_list($this->unmarshal($this->db->f('id'), 'int'));
                                
$control_group_list->set_control_id($this->unmarshal($this->db->f('control_id'),
 'int'));
                                
$control_group_list->set_control_group_id($this->unmarshal($this->db->f('control_group_id'),
 'int'));
@@ -148,7 +150,8 @@
                        $sql = "SELECT p.* FROM controller_control_group_list p 
WHERE p.control_id={$control_id} AND p.control_group_id={$control_group_id}";
                        $this->db->limit_query($sql, 0, __LINE__, __FILE__, 1);
 
-                       if($this->db->next_record()){
+                       if($this->db->next_record())
+                       {
                                $control_group_list = new 
controller_control_group_list($this->unmarshal($this->db->f('id'), 'int'));
                                
$control_group_list->set_control_id($this->unmarshal($this->db->f('control_id'),
 'int'));
                                
$control_group_list->set_control_group_id($this->unmarshal($this->db->f('control_group_id'),
 'int'));
@@ -176,7 +179,7 @@
 
                        $result = $this->db->query("DELETE FROM 
controller_control_group_list WHERE control_id = $control_id AND 
control_group_id = $control_group_id");
 
-                       return isset($result);
+                       return $result;
                }
 
                /**
@@ -190,7 +193,7 @@
                        $control_id = (int) $control_id;
                        $result = $this->db->query("DELETE FROM 
controller_control_group_list WHERE control_id = $control_id");
 
-                       return isset($result);
+                       return $result;
                }
 
                /**
@@ -222,9 +225,13 @@
                                
$control_group->set_building_part_id($this->unmarshal($this->db->f('building_part_id'),
 'int'));
 
                                if($returnType == "array")
+                               {
                                        $control_group_list[] = 
$control_group->toArray();
-                               else    
+                               }
+                               else
+                               {
                                        $control_group_list[] = $control_group;
+                               }
                        }
 
                        return $control_group_list;

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php     
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.socontrol_item.inc.php     
2012-08-17 08:15:49 UTC (rev 9872)
@@ -43,7 +43,8 @@
                 */
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = 
CreateObject('controller.socontrol_item');
                        }
                        return self::$so;
@@ -79,7 +80,8 @@
 
                        $result = $this->db->query('INSERT INTO 
controller_control_item (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
 
-                       if(isset($result)) {
+                       if($result)
+                       {
                                // return the new control item ID
                                return 
$this->db->get_last_insert_id('controller_control_item', 'id');
                        }
@@ -113,7 +115,8 @@
                        //var_dump('UPDATE controller_control_item SET ' . 
join(',', $values) . " WHERE id=$id");
                        $result = $this->db->query('UPDATE 
controller_control_item SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
 
-                       if(isset($result)) {
+                       if($result)
+                       {
                                // return the new control item ID
                                return $id;
                        }
@@ -174,7 +177,7 @@
                        $control_item = null;
                        while ($this->db->next_record()) 
                        {
-                               if( $counter == 0 )
+                               if( !$counter )
                                {
                                        $control_item = new 
controller_control_item($this->unmarshal($this->db->f('ci_id'), 'int'));
                                        
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
@@ -189,7 +192,7 @@
                                        
$control_item->set_control_area_name($category[0]['name']);
                                }
                                
-                               if($this->db->f('cio_id') != '')
+                               if($this->db->f('cio_id'))
                                {
                                        $control_item_option = new 
controller_control_item_option();
                                        
$control_item_option->set_id($this->unmarshal($this->db->f('cio_id'), 'int'));
@@ -246,7 +249,8 @@
                        //var_dump($sql);
                        $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $limit);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $control_item = new 
controller_control_item($this->unmarshal($this->db->f('id'), 'int'));
                                
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
                                
$control_item->set_required($this->unmarshal($this->db->f('required', true), 
'boolean'));
@@ -294,7 +298,8 @@
                                $search_for = 
$this->marshal($search_for,'field');
                                $like_pattern = "'%".$search_for."%'";
                                $like_clauses = array();
-                               switch($search_type){
+                               switch($search_type)
+                               {
                                        default:
                                                $like_clauses[] = 
"controller_control_item.title $this->like $like_pattern";
                                                $like_clauses[] = 
"controller_control_item.what_to_do $this->like $like_pattern";
@@ -363,7 +368,8 @@
 
                function populate(int $control_item_id, &$control_item)
                {
-                       if($control_item == null) {
+                       if($control_item == null)
+                       {
                                $control_item = new 
controller_control_item((int) $control_item_id);
 
                                
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
@@ -389,12 +395,12 @@
                        //var_dump($sql1);
                        $this->db->query($sql1, __LINE__, __FILE__);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $results[] = array('control_group' => 
$this->db->f('id'));
                        }
 
                        return $results;
-                       
                }
                
                function location_has_component($comp, $location_code)
@@ -436,5 +442,4 @@
                        }
                        return $results;
                }
-
        }

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php    
    2012-08-17 07:19:03 UTC (rev 9871)
+++ 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_list.inc.php    
    2012-08-17 08:15:49 UTC (rev 9872)
@@ -44,7 +44,8 @@
                 */
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = 
CreateObject('controller.socontrol_item_list');
                        }
                        return self::$so;
@@ -70,7 +71,8 @@
 
                        $result = $this->db->query( 'INSERT INTO 
controller_control_item_list (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
 
-                       if(isset($result)) {
+                       if($result)
+                       {
                                // return the new control item ID
                                return 
$this->db->get_last_insert_id('controller_control_item_list', 'id');
                        }
@@ -98,7 +100,7 @@
 
                        $result = $this->db->query('UPDATE 
controller_control_item_list SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
 
-                       return isset($result);
+                       return $result;
                }
 
                /**
@@ -166,7 +168,8 @@
                        
                        $this->db->query($sql);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $control_item = new 
controller_control_item($this->unmarshal($this->db->f('id'), 'int'));
                                
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
                                
$control_item->set_required($this->unmarshal($this->db->f('required'), 
'boolean'));
@@ -175,9 +178,13 @@
                                
$control_item->set_control_group_id($this->unmarshal($this->db->f('control_group_id'),
 'int'));
 
                                if($return_type == "return_object")
+                               {
                                        $results[] = $control_item;
+                               }
                                else
+                               {
                                        $results[] = $control_item->toArray();
+                               }
                        }
 
                        return $results;
@@ -203,7 +210,8 @@
                                                                        
                        $this->db->query($sql);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $control_item = new 
controller_control_item($this->unmarshal($this->db->f('id'), 'int'));
                                
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
                                
$control_item->set_required($this->unmarshal($this->db->f('required'), 
'boolean'));
@@ -213,9 +221,13 @@
                                
$control_item->set_type($this->unmarshal($this->db->f('type', true), 'string'));
 
                                if($returnType == "return_array")
+                               {
                                        $results[] = $control_item->toArray();
+                               }
                                else
+                               {
                                        $results[] = $control_item;
+                               }
                        }
                        
                        return $results;
@@ -246,7 +258,8 @@
                        
                        $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $limit);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $control_item = new 
controller_control_item($this->unmarshal($this->db->f('id'), 'int'));
                                
$control_item->set_title($this->unmarshal($this->db->f('title', true), 
'string'));
                                
$control_item->set_required($this->unmarshal($this->db->f('required'), 
'boolean'));
@@ -256,9 +269,13 @@
                                
$control_item->set_type($this->unmarshal($this->db->f('type', true), 'string'));
 
                                if($returnType == "return_array")
+                               {
                                        $results[] = $control_item->toArray();
+                               }
                                else
+                               {
                                        $results[] = $control_item;
+                               }
                        }
 
                        return $results;
@@ -293,15 +310,22 @@
                        $control_item_id = 0;
                        $control_item = null;
                        $control_item_array = array();
-                       while ($this->db->next_record()) {
-                               if( $this->db->f('ci_id') != $control_item_id ){
-                                       if($control_item_id != 0){
+                       while ($this->db->next_record())
+                       {
+                               if( $this->db->f('ci_id') != $control_item_id )
+                               {
+                                       if($control_item_id)
+                                       {
                                                
$control_item->set_options_array($options_array);
                                                
                                                if($return_type == 
"return_array")
+                                               {
                                                        $control_item_array[] = 
$control_item->toArray();
+                                               }
                                                else
+                                               {
                                                        $control_item_array[] = 
$control_item;
+                                               }
                                        }
                                                
                                        $control_item = new 
controller_control_item($this->unmarshal($this->db->f('ci_id'), 'int'));
@@ -319,25 +343,34 @@
                                
$control_item_option->set_id($this->db->f('cio_id'));
                                
                                if($return_type == "return_array")
+                               {
                                        $options_array[] = 
$control_item_option->toArray();
+                               }
                                else
+                               {
                                        $options_array[] = $control_item_option;
-                                
-                               
+                               }
+
                                $control_item_id = $control_item->get_id();
                        }
                        
-                       if($control_item != null){
+                       if($control_item != null)
+                       {
                                
$control_item->set_options_array($options_array);
 
-                               if($return_type == "return_array"){
+                               if($return_type == "return_array")
+                               {
                                        $control_item_array[] = 
$control_item->toArray();
-                               }else{
+                               }
+                               else
+                               {
                                        $control_item_array[] = $control_item;
                                }
                                
                                return $control_item_array;
-                       }else {
+                       }
+                       else
+                       {
                                return null;
                        }
                }
@@ -356,7 +389,7 @@
 
                        $result = $this->db->query("DELETE FROM 
controller_control_item_list WHERE control_id = $control_id AND control_item_id 
= $control_item_id", __LINE__,__FILE__);
 
-                       return isset($result);
+                       return $result;
                }
                
                /**
@@ -370,7 +403,7 @@
                        $control_id = (int) $control_id;
                        $result = $this->db->query("DELETE FROM 
controller_control_item_list WHERE control_id = $control_id");
 
-                       return isset($result);
+                       return $result;
                }
 
                /**
@@ -393,7 +426,7 @@
                        
                        $result = $this->db->query($sql);
                        
-                       return isset($result);
+                       return $result;
                }
 
                function get_id_field_name($extended_info = false){}

Modified: 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php
===================================================================
--- 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php  
    2012-08-17 07:19:03 UTC (rev 9871)
+++ 
branches/Version-1_0-branch/controller/inc/class.socontrol_item_option.inc.php  
    2012-08-17 08:15:49 UTC (rev 9872)
@@ -38,7 +38,8 @@
 
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = 
CreateObject('controller.socontrol_item_option');
                        }
                        return self::$so;
@@ -64,7 +65,8 @@
 
                        $result = $this->db->query('INSERT INTO 
controller_control_item_option (' . join(',', $cols) . ') VALUES (' . join(',', 
$values) . ')', __LINE__,__FILE__);
 
-                       if(isset($result)) {
+                       if($result)
+                       {
                                // return the new control item ID
                                return 
$this->db->get_last_insert_id('controller_control_item_option', 'id');
                        }
@@ -91,7 +93,7 @@
 
                        $result = $this->db->query('UPDATE 
controller_control_item_option SET ' . join(',', $values) . " WHERE id=$id", 
__LINE__,__FILE__);
 
-                       return isset($result);
+                       return $result;
                }
                
                /**

Modified: branches/Version-1_0-branch/controller/inc/class.sodocument.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.sodocument.inc.php 
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.sodocument.inc.php 
2012-08-17 08:15:49 UTC (rev 9872)
@@ -45,7 +45,8 @@
         */
        public static function get_instance()
        {
-               if (self::$so == null) {
+               if (self::$so == null)
+               {
                        self::$so = CreateObject('controller.sodocument');
                }
                return self::$so;
@@ -82,7 +83,8 @@
                        $search_for = $this->marshal($search_for,'field');
                        $like_pattern = "'%".$search_for."%'";
                        $like_clauses = array();
-                       switch($search_type){
+                       switch($search_type)
+                       {
                                case "title":
                                        $like_clauses[] = 
"controller_document.title $this->like $like_pattern";
                                        break;
@@ -221,7 +223,8 @@
                        $sql = "SELECT id, title FROM 
controller_document_types";
                        $this->db->query($sql, __LINE__, __FILE__);
                        $results = array();
-                       while($this->db->next_record()){
+                       while($this->db->next_record())
+                       {
                                $location_id = $this->db->f('id');
                                $results[$location_id] = $this->db->f('title', 
true);
                        }
@@ -236,7 +239,8 @@
                $sql = "SELECT id, title FROM controller_document_types";
                $this->db->query($sql, __LINE__, __FILE__);
                $results = array();
-               while($this->db->next_record()){
+               while($this->db->next_record())
+               {
                        $result[] = $this->db->f('id');
                        $result[] = $this->db->f('title', true);
                        $results[] = $result;

Modified: branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php
===================================================================
--- branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php        
2012-08-17 07:19:03 UTC (rev 9871)
+++ branches/Version-1_0-branch/controller/inc/class.soprocedure.inc.php        
2012-08-17 08:15:49 UTC (rev 9872)
@@ -45,7 +45,8 @@
                 */
                public static function get_instance()
                {
-                       if (self::$so == null) {
+                       if (self::$so == null)
+                       {
                                self::$so = 
CreateObject('controller.soprocedure');
                        }
                        return self::$so;
@@ -91,7 +92,8 @@
 
                        $result = $this->db->query('INSERT INTO 
controller_procedure (' . join(',', $cols) . ') VALUES (' . join(',', $values) 
. ')', __LINE__,__FILE__);
 
-                       if(isset($result)) {
+                       if($result)
+                       {
                                // Get the new procedure ID and return it
                                return 
$this->db->get_last_insert_id('controller_procedure', 'id');
                        }
@@ -130,7 +132,7 @@
 
                        $result = $this->db->query('UPDATE controller_procedure 
SET ' . join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
 
-                       return isset($result);
+                       return $result;
                }
 
                /**
@@ -145,13 +147,13 @@
                        
                        $counter = 0;
                        $documents = null;
-                       
 
                        $joins .= " {$this->left_join} controller_document ON 
(p.id = controller_document.procedure_id)";
                        $sql = "SELECT p.*, controller_document.id AS 
document_id, controller_document.title AS document_title, 
controller_document.description as document_description FROM 
controller_procedure p {$joins} WHERE p.id = " . $id;
                        //var_dump($sql);
                        $this->db->query($sql, __LINE__, __FILE__);
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                if($counter == 0){
                                        $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id'), 'int'));
                                        
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
@@ -173,7 +175,8 @@
                                        
//$procedure->set_control_area_name($this->unmarshal($this->db->f('control_area_name',
 'string')));
                                }
                                
-                               if($this->db->f('document_id') != ''){
+                               if($this->db->f('document_id') != '')
+                               {
                                        $document = new 
controller_document($this->unmarshal($this->db->f('document_id'), 'int'));
                                        
$document->set_procedure_id($procedure->get_id());
                                        
$document->set_title($this->unmarshal($this->db->f('document_title', true), 
'string'));
@@ -199,8 +202,10 @@
                        $sql = "SELECT p.*, controller_document.id AS 
document_id, controller_document.title AS document_title, 
controller_document.description as document_description FROM 
controller_procedure p {$joins} WHERE p.id = " . $id;
                        //var_dump($sql);
                        $this->db->query($sql, __LINE__, __FILE__);
-                       while ($this->db->next_record()) {
-                               if($counter == 0){
+                       while ($this->db->next_record())
+                       {
+                               if(!$counter)
+                               {
                                        $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id'), 'int'));
                                        
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
                                        
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
@@ -218,7 +223,8 @@
                                        
$procedure->set_control_area_name($category[0]['name']);
                                }
                                
-                               if($this->db->f('document_id') != ''){
+                               if($this->db->f('document_id'))
+                               {
                                        $document = new 
controller_document($this->unmarshal($this->db->f('document_id'), 'int'));
                                        
$document->set_procedure_id($procedure->get_id());
                                        
$document->set_title($this->unmarshal($this->db->f('document_title', true), 
'string'));
@@ -232,20 +238,29 @@
                                                $documents_array[] = 
$doc_as_array;
                                        }
                                        else
+                                       {
                                                $documents_array[] = $document;
+                                       }
                                }
                                
                                $counter++;
                        }
                        
-                       if($procedure != null){
+                       if($procedure != null)
+                       {
                                $procedure->set_documents($documents_array);
 
                                if($return_type == "return_array")
+                               {
                                        return $procedure->toArray();
+                               }
                                else
+                               {
                                        return $procedure;
-                       }else {
+                               }
+                       }
+                       else
+                       {
                                return null;
                        }
                }
@@ -258,7 +273,8 @@
                        $sql = "SELECT * FROM controller_procedure WHERE 
control_area_id={$control_area_id} AND end_date IS NULL ORDER BY title ASC";
                        $this->db->query($sql);
 
-                       while($this->db->next_record()) {
+                       while($this->db->next_record())
+                       {
                                $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id'), 'int'));
                                
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
                                
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
@@ -275,7 +291,8 @@
                                $procedures_array[] = $procedure->toArray();
                        }
 
-                       if( count( $procedures_array ) > 0 ){
+                       if( count( $procedures_array ) > 0 )
+                       {
                                return $procedures_array; 
                        }
                        else
@@ -297,7 +314,8 @@
                        $sql = "SELECT * FROM controller_procedure $condition 
$order";
                        $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $limit);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id'), 'int'));
                                
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
                                
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
@@ -330,7 +348,8 @@
                        $sql = "SELECT * FROM controller_procedure $condition 
$order";
                        $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $limit);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id'), 'int'));
                                
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
                                
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
@@ -358,7 +377,8 @@
                        $sql = "SELECT p.* FROM controller_procedure p WHERE 
procedure_id = {$id} ORDER BY end_date DESC";
                        $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $limit);
 
-                       while ($this->db->next_record()) {
+                       while ($this->db->next_record())
+                       {
                                $procedure = new 
controller_procedure($this->unmarshal($this->db->f('id'), 'int'));
                                
$procedure->set_title($this->unmarshal($this->db->f('title', true), 'string'));
                                
$procedure->set_purpose($this->unmarshal($this->db->f('purpose', true), 
'string'));
@@ -408,7 +428,8 @@
                        {
                                $like_pattern = "'%" . 
$this->db->db_addslashes($search_for) . "%'";
                                $like_clauses = array();
-                               switch($search_type){
+                               switch($search_type)
+                               {
                                        default:
                                                $like_clauses[] = 
"procedure.title $this->like $like_pattern";
                                                break;
@@ -472,7 +493,8 @@
                function populate(int $procedure_id, &$procedure)
                {
 
-                       if($procedure == null) {
+                       if($procedure == null)
+                       {
                                $procedure = new controller_procedure((int) 
$procedure_id);
 
                                
$procedure->set_title($this->unmarshal($this->db->f('title'), 'string'));
@@ -494,5 +516,4 @@
 
                        return $procedure;
                }
-
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]