fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9991] Overwriting


From: Torstein
Subject: [Fmsystem-commits] [9991] Overwriting
Date: Tue, 11 Sep 2012 07:48:54 +0000

Revision: 9991
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9991
Author:   vator
Date:     2012-09-11 07:48:54 +0000 (Tue, 11 Sep 2012)
Log Message:
-----------
Overwriting 

Modified Paths:
--------------
    trunk/controller/inc/model/class.check_item.inc.php
    trunk/controller/inc/model/class.check_item_case.inc.php
    trunk/controller/inc/model/class.check_list.inc.php
    trunk/controller/inc/model/class.component.inc.php
    trunk/controller/inc/model/class.control.inc.php
    trunk/controller/inc/model/class.control_area.inc.php
    trunk/controller/inc/model/class.control_group.inc.php
    trunk/controller/inc/model/class.control_group_list.inc.php
    trunk/controller/inc/model/class.control_item.inc.php
    trunk/controller/inc/model/class.control_item_list.inc.php
    trunk/controller/inc/model/class.control_item_option.inc.php
    trunk/controller/inc/model/class.control_location.inc.php
    trunk/controller/inc/model/class.model.inc.php
    trunk/controller/inc/model/class.procedure.inc.php

Modified: trunk/controller/inc/model/class.check_item.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item.inc.php 2012-09-11 07:36:58 UTC 
(rev 9990)
+++ trunk/controller/inc/model/class.check_item.inc.php 2012-09-11 07:48:54 UTC 
(rev 9991)
@@ -1,108 +1,108 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_check_item extends controller_model
+       {
+               public static $so;
 
-class controller_check_item extends controller_model {
+               protected $id;
+               protected $control_item_id;
+               protected $check_list_id;
+                               
+               // Objects
+               protected $control_item;
+               protected $cases_array = array();
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
 
-  public static $so;
-  protected $id;
-  protected $control_item_id;
-  protected $check_list_id;
-  // Objects
-  protected $control_item;
-  protected $cases_array = array();
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_control_item_id($control_item_id) {
-    $this->control_item_id = $control_item_id;
-  }
-
-  public function get_control_item_id() {
-    return $this->control_item_id;
-  }
-
-  public function set_check_list_id($check_list_id) {
-    $this->check_list_id = $check_list_id;
-  }
-
-  public function get_check_list_id() {
-    return $this->check_list_id;
-  }
-
-  // =================  Getters and setters for objects =================
-
-  public function set_control_item($control_item) {
-    $this->control_item = $control_item;
-  }
-
-  public function get_control_item() {
-    return $this->control_item;
-  }
-
-  public function set_cases_array($cases_array) {
-    $this->cases_array = $cases_array;
-  }
-
-  public function get_cases_array() {
-    return $this->cases_array;
-  }
-
-  /**
-   * Get a static reference to the storage object associated with this model 
object
-   * 
-   * @return the storage object
-   */
-  public static function get_so() {
-    /*                         if (self::$so == null) {
-      self::$so = CreateObject('controller.socontrol_item');
-      }
-
-      return self::$so; */
-  }
-
-}
+               public function set_control_item_id($control_item_id)
+               {
+                       $this->control_item_id = $control_item_id;
+               }
+               
+               public function get_control_item_id() { return 
$this->control_item_id; }
+                               
+               public function set_check_list_id($check_list_id)
+               {
+                       $this->check_list_id = $check_list_id;
+               }
+               
+               public function get_check_list_id() { return 
$this->check_list_id; }
+               
+               
+               // =================  Getters and setters for objects 
=================
+               
+               public function set_control_item($control_item)
+               {
+                       $this->control_item = $control_item;
+               }
+               
+               public function get_control_item() { return 
$this->control_item; }
+               
+               public function set_cases_array($cases_array)
+               {
+                       $this->cases_array = $cases_array;
+               }
+               
+               public function get_cases_array() { return $this->cases_array; }
+                       
+                       
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+/*                     if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.socontrol_item');
+                       }
+                       
+                       return self::$so;*/
+               }
+       }

Modified: trunk/controller/inc/model/class.check_item_case.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_item_case.inc.php    2012-09-11 
07:36:58 UTC (rev 9990)
+++ trunk/controller/inc/model/class.check_item_case.inc.php    2012-09-11 
07:48:54 UTC (rev 9991)
@@ -1,151 +1,140 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.check_item.inc.php 8478 2012-01-03 12:36:37Z 
vator $
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id: class.check_item.inc.php 8478 2012-01-03 12:36:37Z vator $
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_check_item_case extends controller_model
+       {
+               public static $so;
 
-class controller_check_item_case extends controller_model {
+               const STATUS_OPEN = 0;
+               const STATUS_CLOSED = 1;
+               const STATUS_PENDING = 2;
+                               
+               protected $id;
+               protected $check_item_id;
+               protected $status;
+               protected $location_id;                 // FOREKOMST I 
MELDINGSREGISTERET
+               protected $location_item_id;    // MELDINGS ID
+               protected $descr;
+               protected $user_id;
+               protected $entry_date;
+               protected $modified_date;
+               protected $modified_by;
+               protected $measurement;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
 
-  public static $so;
+               public function set_check_item_id($check_item_id)
+               {
+                       $this->check_item_id = $check_item_id;
+               }
+               
+               public function get_check_item_id() { return 
$this->check_item_id; }
+                               
+               public function set_status($status)
+               {
+                       $this->status = (int)$status;
+               }
+               
+               public function get_status() { return (int)$this->status; }
+               
+               public function get_location_id() { return 
(int)$this->location_id; }
+               
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+               
+               public function get_location_item_id() { return 
(int)$this->location_item_id; }
+               
+               public function set_location_item_id($location_item_id)
+               {
+                       $this->location_item_id = $location_item_id;
+               }
 
-  const STATUS_OPEN = 0;
-  const STATUS_CLOSED = 1;
-  const STATUS_PENDING = 2;
-
-  protected $id;
-  protected $check_item_id;
-  protected $status;
-  protected $location_id;   // FOREKOMST I MELDINGSREGISTERET
-  protected $location_item_id;  // MELDINGS ID
-  protected $descr;
-  protected $user_id;
-  protected $entry_date;
-  protected $modified_date;
-  protected $modified_by;
-  protected $measurement;
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_check_item_id($check_item_id) {
-    $this->check_item_id = $check_item_id;
-  }
-
-  public function get_check_item_id() {
-    return $this->check_item_id;
-  }
-
-  public function set_status($status) {
-    $this->status = (int) $status;
-  }
-
-  public function get_status() {
-    return (int) $this->status;
-  }
-
-  public function get_location_id() {
-    return (int) $this->location_id;
-  }
-
-  public function set_location_id($location_id) {
-    $this->location_id = $location_id;
-  }
-
-  public function get_location_item_id() {
-    return (int) $this->location_item_id;
-  }
-
-  public function set_location_item_id($location_item_id) {
-    $this->location_item_id = $location_item_id;
-  }
-
-  public function get_descr() {
-    return $this->descr;
-  }
-
-  public function set_descr($descr) {
-    $this->descr = $descr;
-  }
-
-  public function get_user_id() {
-    return (int) $this->user_id;
-  }
-
-  public function set_user_id($user_id) {
-    $this->user_id = $user_id;
-  }
-
-  public function get_entry_date() {
-    return (int) $this->entry_date;
-  }
-
-  public function set_entry_date($entry_date) {
-    $this->entry_date = $entry_date;
-  }
-
-  public function get_modified_date() {
-    return (int) $this->modified_date;
-  }
-
-  public function set_modified_date($modified_date) {
-    $this->modified_date = $modified_date;
-  }
-
-  public function get_modified_by() {
-    return (int) $this->modified_by;
-  }
-
-  public function set_modified_by($modified_by) {
-    $this->modified_by = $modified_by;
-  }
-
-  public function get_measurement() {
-    return $this->measurement;
-  }
-
-  public function set_measurement($measurement) {
-    $this->measurement = $measurement;
-  }
-
-}
+               public function get_descr() { return $this->descr; }
+               
+               public function set_descr($descr)
+               {
+                       $this->descr = $descr;
+               }
+               
+               public function get_user_id() { return (int)$this->user_id; }
+               
+               public function set_user_id($user_id)
+               {
+                       $this->user_id = $user_id;
+               }
+               
+               public function get_entry_date() { return 
(int)$this->entry_date; }
+               
+               public function set_entry_date($entry_date)
+               {
+                       $this->entry_date = $entry_date;
+               }
+               
+               public function get_modified_date() { return 
(int)$this->modified_date; }
+               
+               public function set_modified_date($modified_date)
+               {
+                       $this->modified_date = $modified_date;
+               }
+               
+               public function get_modified_by() { return 
(int)$this->modified_by; }
+               
+               public function set_modified_by($modified_by)
+               {
+                       $this->modified_by = $modified_by;
+               }
+               
+               public function get_measurement() { return $this->measurement; }
+               
+               public function set_measurement($measurement)
+               {
+                       $this->measurement = $measurement;
+               }
+       }

Modified: trunk/controller/inc/model/class.check_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.check_list.inc.php 2012-09-11 07:36:58 UTC 
(rev 9990)
+++ trunk/controller/inc/model/class.check_list.inc.php 2012-09-11 07:48:54 UTC 
(rev 9991)
@@ -1,249 +1,245 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_check_list extends controller_model
+       {
+               public static $so;
+                               
+               const STATUS_NOT_DONE = 0;
+               const STATUS_DONE = 1;
+               const STATUS_CANCELED = 3;
+               
+               protected $id;
+               protected $control_id;
+               protected $status;
+               protected $comment;
+               protected $deadline;
+               protected $planned_date;
+               protected $completed_date;
+               protected $location_code;
+               protected $component_id;
+               protected $location_id;
+               
+               // Aggregate fields. Fields not in a table
+               protected $num_open_cases;
+               protected $num_pending_cases;
+               
+               // Objects
+               protected $check_item_array = array();
+               // Array that contains error messages. Is populted in function 
validate
+               protected $error_msg_array = array();
+               
+               protected $control;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
 
-class controller_check_list extends controller_model {
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = $control_id;
+               }
+               
+               public function get_control_id() { return $this->control_id; }
+               
+               public function set_status($status)
+               {
+                       $this->status = $status;
+               }
+               
+               public function get_status() { return $this->status; }
+               
+               public function set_comment($comment)
+               {
+                       $this->comment = $comment;
+               }
+               
+               public function get_comment() { return $this->comment; }
+               
+               public function set_deadline($deadline)
+               {
+                       $this->deadline = $deadline;
+               }
+               
+               public function get_deadline() { return $this->deadline; }
+               
+               public function set_check_item_array($check_item_array)
+               {
+                       $this->check_item_array = $check_item_array;
+               }
+               
+               public function get_check_item_array() { return 
$this->check_item_array; }
+               
+               public function set_planned_date($planned_date)
+               {
+                       $this->planned_date = $planned_date;
+               }
+               
+               public function get_planned_date() { return 
$this->planned_date; }
+               
+               public function set_completed_date($completed_date)
+               {
+                       $this->completed_date = $completed_date;
+               }
+               
+               public function get_completed_date() { return 
$this->completed_date; }
+               
+               public function set_location_code($location_code)
+               {
+                       $this->location_code = $location_code;
+               }
+               
+               public function get_location_code() { return 
$this->location_code; }
+               
+               public function set_component_id($component_id)
+               {
+                       $this->component_id = $component_id;
+               }
+               
+               public function get_component_id() { return 
$this->component_id; }
+               
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+               
+               public function get_location_id() { return $this->location_id; }
 
-  public static $so;
+               public function get_num_open_cases() { return 
$this->num_open_cases; }
+               
+               public function set_num_open_cases($num_open_cases)
+               {
+                       $this->num_open_cases = $num_open_cases;
+               }
 
-  const STATUS_NOT_DONE = 0;
-  const STATUS_DONE = 1;
-  const STATUS_CANCELED = 3;
+               public function get_num_pending_cases() { return 
$this->num_pending_cases; }
+               
+               public function set_num_pending_cases($num_pending_cases)
+               {
+                       $this->num_pending_cases = $num_pending_cases;
+               }
+               
+               public function set_control($control)
+               {
+                       $this->control = $control;
+               }
+               
+               public function get_control() { return $this->control; }
+               
+               public function get_error_msg_array() { return 
$this->error_msg_array; }
+               
+               public function set_error_msg_array( $error_msg_array )
+               {
+                       $this->error_msg_array = $error_msg_array;
+               }
+               
+               public function serialize()
+               {
+                       return array(
+                               'id'                                            
        => $this->get_id(),
+                               'control_id'                    => 
$this->get_control_id(),
+                               'status'                                        
=> $this->get_status(),
+                               'comment'                               => 
$this->get_comment(),
+                               'deadline'                              => 
$this->get_deadline(),
+                               'planned_date'          => 
$this->get_planned_date(),
+                               'completed_date'        => 
$this->get_completed_date(),
+                               'location_code'         => 
$this->get_location_code(),
+                               'component_id'          => 
$this->get_component_id(),
+                               'location_id'           => 
$this->get_location_id(),
+                               'num_open_cases'        => 
$this->get_num_open_cases()
+                       );
+               }
+               
+               public function validate()
+               {
+                       $status = true;
+       
+                       // Validate CONTROL ID
+                       if( empty( $this->control_id ) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['control_id'] = "error_msg_4";
+                 }
+                
+                 // Validate STATUS                              
+                       if( $this->status != 0 and $this->status != 1 )
+                 { 
+                       $status = false;
+                       $this->error_msg_array['status'] = "error_msg_2";
+                 }
+                 
+                       // Validate STATUS ON PLANNED DATE                      
          
+                       if( $this->status == 0 and ( $this->planned_date == '' 
or $this->planned_date == 0) )
+                 { 
+                       $status = false;
+                       $this->error_msg_array['status'] = "error_msg_7";
+                 }
 
-  protected $id;
-  protected $control_id;
-  protected $status;
-  protected $comment;
-  protected $deadline;
-  protected $planned_date;
-  protected $completed_date;
-  protected $location_code;
-  protected $component_id;
-  protected $location_id;
-  // Aggregate fields. Fields not in a table
-  protected $num_open_cases;
-  protected $num_pending_cases;
-  // Objects
-  protected $check_item_array = array();
-  // Array that contains error messages. Is populted in function validate
-  protected $error_msg_array = array();
-  protected $control;
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_control_id($control_id) {
-    $this->control_id = $control_id;
-  }
-
-  public function get_control_id() {
-    return $this->control_id;
-  }
-
-  public function set_status($status) {
-    $this->status = $status;
-  }
-
-  public function get_status() {
-    return $this->status;
-  }
-
-  public function set_comment($comment) {
-    $this->comment = $comment;
-  }
-
-  public function get_comment() {
-    return $this->comment;
-  }
-
-  public function set_deadline($deadline) {
-    $this->deadline = $deadline;
-  }
-
-  public function get_deadline() {
-    return $this->deadline;
-  }
-
-  public function set_check_item_array($check_item_array) {
-    $this->check_item_array = $check_item_array;
-  }
-
-  public function get_check_item_array() {
-    return $this->check_item_array;
-  }
-
-  public function set_planned_date($planned_date) {
-    $this->planned_date = $planned_date;
-  }
-
-  public function get_planned_date() {
-    return $this->planned_date;
-  }
-
-  public function set_completed_date($completed_date) {
-    $this->completed_date = $completed_date;
-  }
-
-  public function get_completed_date() {
-    return $this->completed_date;
-  }
-
-  public function set_location_code($location_code) {
-    $this->location_code = $location_code;
-  }
-
-  public function get_location_code() {
-    return $this->location_code;
-  }
-
-  public function set_component_id($component_id) {
-    $this->component_id = $component_id;
-  }
-
-  public function get_component_id() {
-    return $this->component_id;
-  }
-
-  public function set_location_id($location_id) {
-    $this->location_id = $location_id;
-  }
-
-  public function get_location_id() {
-    return $this->location_id;
-  }
-
-  public function get_num_open_cases() {
-    return $this->num_open_cases;
-  }
-
-  public function set_num_open_cases($num_open_cases) {
-    $this->num_open_cases = $num_open_cases;
-  }
-
-  public function get_num_pending_cases() {
-    return $this->num_pending_cases;
-  }
-
-  public function set_num_pending_cases($num_pending_cases) {
-    $this->num_pending_cases = $num_pending_cases;
-  }
-
-  public function set_control($control) {
-    $this->control = $control;
-  }
-
-  public function get_control() {
-    return $this->control;
-  }
-
-  public function get_error_msg_array() {
-    return $this->error_msg_array;
-  }
-
-  public function set_error_msg_array($error_msg_array) {
-    $this->error_msg_array = $error_msg_array;
-  }
-
-  public function serialize() {
-    return array(
-        'id' => $this->get_id(),
-        'control_id' => $this->get_control_id(),
-        'status' => $this->get_status(),
-        'comment' => $this->get_comment(),
-        'deadline' => $this->get_deadline(),
-        'planned_date' => $this->get_planned_date(),
-        'completed_date' => $this->get_completed_date(),
-        'location_code' => $this->get_location_code(),
-        'component_id' => $this->get_component_id(),
-        'location_id' => $this->get_location_id(),
-        'num_open_cases' => $this->get_num_open_cases()
-    );
-  }
-
-  public function validate() {
-    $status = true;
-
-    // Validate CONTROL ID
-    if (empty($this->control_id)) {
-      $status = false;
-      $this->error_msg_array['control_id'] = "error_msg_4";
-    }
-
-    // Validate STATUS                           
-    if ($this->status != 0 and $this->status != 1) {
-      $status = false;
-      $this->error_msg_array['status'] = "error_msg_2";
-    }
-
-    // Validate STATUS ON PLANNED DATE                           
-    if ($this->status == 0 and ( $this->planned_date == '' or 
$this->planned_date == 0)) {
-      $status = false;
-      $this->error_msg_array['status'] = "error_msg_7";
-    }
-
-    // Validate COMPLETED DATE when STATUS:DONE                                
  
-    if (($this->status == controller_check_list::STATUS_DONE) && 
empty($this->completed_date)) {
-      $status = false;
-      $this->error_msg_array['completed_date'] = "error_msg_5";
-    }
-
-    // Validate DEADLINE                         
-    if (empty($this->deadline)) {
-      $status = false;
-      $this->error_msg_array['deadline'] = "error_msg_1";
-    }
-
-    // Validate connection to COMPONENT/LOCATION
-    if (empty($this->location_code) && empty($this->component_id)) {
-      echo "FAILED: " . $this->location_code;
-      $status = false;
-      $this->error_msg_array['location_code'] = "error_msg_6";
-    }
-
-    return $status;
-  }
-
-}
+                 // Validate COMPLETED DATE when STATUS:DONE                   
          
+                       if( ($this->status == 
controller_check_list::STATUS_DONE) && empty($this->completed_date) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['completed_date'] = 
"error_msg_5";
+                 }
+       
+                 // Validate DEADLINE                    
+                       if( empty( $this->deadline ) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['deadline'] = "error_msg_1";
+                 }
+       
+                       // Validate connection to COMPONENT/LOCATION
+                       if( empty( $this->location_code ) && empty( 
$this->component_id ) )
+                 {
+                       echo "FAILED: " . $this->location_code; 
+                       $status = false;
+                       $this->error_msg_array['location_code'] = "error_msg_6";
+                 }
+       
+                 return $status;
+               }
+       }

Modified: trunk/controller/inc/model/class.component.inc.php
===================================================================
--- trunk/controller/inc/model/class.component.inc.php  2012-09-11 07:36:58 UTC 
(rev 9990)
+++ trunk/controller/inc/model/class.component.inc.php  2012-09-11 07:48:54 UTC 
(rev 9991)
@@ -1,157 +1,148 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.control.inc.php 9548 2012-06-11 12:40:52Z vator $
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id: class.control.inc.php 9548 2012-06-11 12:40:52Z vator $
- */
-include_class('controller', 'model', 'inc/model/');
-include_class('controller', 'date_helper', 'inc/helper/');
+       include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'date_helper', 'inc/helper/');
 
-class controller_component extends controller_model {
-
-  protected $type;
-  protected $id;
-  protected $location_id;
-  protected $guid;
-  protected $xml;
-  // Not a table column
-  protected $xml_short_desc;
-  protected $type_str;
-  protected $location_code;
-  protected $p_location_code;
-  protected $loc_1;
-  protected $address;
-  // Objects
-  protected $controls_array = array();
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function set_type($type) {
-    $this->type = $type;
-  }
-
-  public function get_type() {
-    return $this->type;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_location_id($location_id) {
-    $this->location_id = $location_id;
-  }
-
-  public function get_location_id() {
-    return $this->location_id;
-  }
-
-  public function set_guid($guid) {
-    $this->guid = $guid;
-  }
-
-  public function get_guid() {
-    return $this->guid;
-  }
-
-  public function set_xml($xml) {
-    $this->xml = $xml;
-  }
-
-  public function get_xml() {
-    return $this->xml;
-  }
-
-  public function set_xml_short_desc($xml_short_desc) {
-    $this->xml_short_desc = $xml_short_desc;
-  }
-
-  public function get_xml_short_desc() {
-    return $this->xml_short_desc;
-  }
-
-  public function set_location_code($location_code) {
-    $this->location_code = $location_code;
-  }
-
-  public function get_location_code() {
-    return $this->location_code;
-  }
-
-  public function set_loc_1($loc_1) {
-    $this->loc_1 = $loc_1;
-  }
-
-  public function get_loc_1() {
-    return $this->loc_1;
-  }
-
-  public function set_address($address) {
-    $this->address = $address;
-  }
-
-  public function get_address() {
-    return $this->address;
-  }
-
-  public function set_type_str($type_str) {
-    $this->type_str = $type_str;
-  }
-
-  public function get_type_str() {
-    return $this->type_str;
-  }
-
-  public function set_controls_array($controls_array) {
-    $this->controls_array = $controls_array;
-  }
-
-  public function get_controls_array() {
-    return $this->controls_array;
-  }
-
-  public function serialize() {
-    return array(
-        'type' => $this->get_type(),
-        'id' => $this->get_id(),
-        'guid' => $this->get_guid(),
-        'xml' => $this->get_xml(),
-        'location_code' => $this->get_location_code(),
-        'loc_1' => $this->get_loc_1(),
-        'address' => $this->get_address()
-    );
-  }
-
-}
+       class controller_component extends controller_model
+       {
+               protected $type;
+               protected $id;
+               protected $location_id;
+               protected $guid;
+               protected $xml;
+               // Not a table column
+               protected $xml_short_desc;
+               protected $type_str;
+               protected $location_code;
+               protected $p_location_code;
+               protected $loc_1;
+               protected $address;
+               
+               // Objects
+               protected $controls_array = array();
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               
+               public function set_type($type)
+               {
+                       $this->type = $type;
+               }
+               
+               public function get_type() { return $this->type; }
+                       
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+               
+               public function set_location_id($location_id)
+               {
+                       $this->location_id = $location_id;
+               }
+               
+               public function get_location_id() { return $this->location_id; }
+               
+               public function set_guid($guid)
+               {
+                       $this->guid = $guid;
+               }
+               
+               public function get_guid() { return $this->guid; }
+               
+               public function set_xml($xml)
+               {
+                       $this->xml = $xml;
+               }
+               
+               public function get_xml() { return $this->xml; }
+               
+               public function set_xml_short_desc($xml_short_desc)
+               {
+                       $this->xml_short_desc = $xml_short_desc;
+               }
+               
+               public function get_xml_short_desc() { return 
$this->xml_short_desc; }
+               
+               public function set_location_code($location_code)
+               {
+                       $this->location_code = $location_code;
+               }
+               
+               public function get_location_code() { return 
$this->location_code; }
+               
+               public function set_loc_1($loc_1)
+               {
+                       $this->loc_1 = $loc_1;
+               }
+               
+               public function get_loc_1() { return $this->loc_1; }
+               
+               public function set_address($address)
+               {
+                       $this->address = $address;
+               }
+               
+               public function get_address() { return $this->address; }
+               
+               public function set_type_str($type_str)
+               {
+                       $this->type_str = $type_str;
+               }
+               
+               public function get_type_str() { return $this->type_str; }
+               
+               public function set_controls_array($controls_array)
+               {
+                       $this->controls_array = $controls_array;
+               }
+               
+               public function get_controls_array() { return 
$this->controls_array; }
+               
+               public function serialize()
+               {
+                       return array(
+                               'type' => $this->get_type(),
+                               'id' => $this->get_id(),
+                               'guid' => $this->get_guid(),
+                               'xml' => $this->get_xml(),
+                               'location_code' => $this->get_location_code(),
+                               'loc_1' => $this->get_loc_1(),
+                               'address' => $this->get_address()
+                       );
+               }
+       }

Modified: trunk/controller/inc/model/class.control.inc.php
===================================================================
--- trunk/controller/inc/model/class.control.inc.php    2012-09-11 07:36:58 UTC 
(rev 9990)
+++ trunk/controller/inc/model/class.control.inc.php    2012-09-11 07:48:54 UTC 
(rev 9991)
@@ -1,362 +1,360 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
-include_class('controller', 'date_helper', 'inc/helper/');
+       include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'date_helper', 'inc/helper/');
 
-class controller_control extends controller_model {
+       class controller_control extends controller_model
+       {
+               public static $so;
+               
+               const REPEAT_TYPE_DAY = 0;
+               const REPEAT_TYPE_WEEK = 1;
+               const REPEAT_TYPE_MONTH = 2;
+               const REPEAT_TYPE_YEAR = 3;
+               
+               protected $id;
+               protected $title;
+               protected $description;
+               protected $start_date;
+               protected $end_date;
+               protected $repeat_type;
+               protected $repeat_type_label;
+               protected $repeat_interval;
+               protected $procedure_id;
+               protected $procedure_name;
+               protected $enabled;
+               protected $requirement_id;
+               protected $costresponsibility_id;
+               protected $responsibility_id;
+               protected $responsibility_name;
+               protected $control_area_id;
+               protected $control_area_name;
 
-  public static $so;
+               // Objects
+               protected $check_lists_array = array();
+               // Array that contains open cases for a month   
+               protected $agg_open_cases_pr_month_array = array();
+               // Array that contains error messages. Is populted in function 
validate
+               protected $error_msg_array;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+               
+               public function set_title($title)
+               {
+                       $this->title = $title;
+               }
+               
+               public function get_title() { return $this->title; }
+               
+               public function set_description($description)
+               {
+                       $this->description = $description;
+               }
+               
+               public function get_description() { return $this->description; }
+               
+               public function set_end_date($end_date)
+               {
+                       $this->end_date = $end_date;
+               }
+               
+               public function get_end_date() { return $this->end_date; }
+               
+               public function set_start_date($start_date)
+               {
+                       $this->start_date = $start_date;
+               }
+               
+               public function get_start_date() { return $this->start_date; }
+               
+               public function set_repeat_type($repeat_type)
+               {
+                       $this->repeat_type = $repeat_type;
+               }
+                                       
+               public function get_repeat_type() { return $this->repeat_type; }
+               
+               public function set_repeat_type_label(int $repeat_type = null)
+               {
+                       switch($repeat_type)
+                       {
+                               case controller_control::REPEAT_TYPE_DAY:
+                                       $this->repeat_type_label = 
lang('repeat_type_day');
+                                       break;
+                               case controller_control::REPEAT_TYPE_WEEK:
+                                       $this->repeat_type_label = 
lang('repeat_type_week');
+                                       break;
+                               case controller_control::REPEAT_TYPE_MONTH:
+                                       $this->repeat_type_label = 
lang('repeat_type_month');
+                                       break;
+                               case controller_control::REPEAT_TYPE_YEAR;
+                                       $this->repeat_type_label = 
lang('repeat_type_year');
+                                       break;
+                               default:
+                                       $this->repeat_type_label = 
lang('repeat_type_none');
+                                       break;
+                       }
+               }
+                                       
+               public function get_repeat_type_label() { return 
$this->repeat_type_label; }
+               
+               public function set_repeat_interval($repeat_interval)
+               {
+                       $this->repeat_interval = $repeat_interval;
+               }
+               
+               public function get_repeat_interval() { return 
$this->repeat_interval; }
+               
+               public function set_procedure_id($procedure_id)
+               {
+                       $this->procedure_id = $procedure_id;
+               }
+               
+               public function get_procedure_id() { return 
$this->procedure_id; }
+               
+               public function set_procedure_name($procedure_name)
+               {
+                       $this->procedure_name = $procedure_name;
+               }
+               
+               public function get_procedure_name() { return 
$this->procedure_name; }
+               
+               public function set_enabled($enabled)
+               {
+                       $this->enabled = $enabled;
+               }
+               
+               public function get_enabled() { return $this->enabled; }
+               
+               public function set_requirement_id($requirement_id)
+               {
+                       $this->requirement_id = $requirement_id;
+               }
+               
+               public function get_requirement_id() { return 
$this->requirement_id; }
+               
+               public function 
set_costresponsibility_id($costresponsibility_id)
+               {
+                       $this->costresponsibility_id = $costresponsibility_id;
+               }
+               
+               public function get_costresponsibility_id() { return 
$this->costresponsibility_id; }
+               
+               public function set_responsibility_id($responsibility_id)
+               {
+                       $this->responsibility_id = $responsibility_id;
+               }
+               
+               public function get_responsibility_id() { return 
$this->responsibility_id; }
+               
+               public function set_responsibility_name($responsibility_name)
+               {
+                       $this->responsibility_name = $responsibility_name;
+               }
+               
+               public function get_responsibility_name() { return 
$this->responsibility_name; }
+               
+               public function set_control_area_id($control_area_id)
+               {
+                       $this->control_area_id = $control_area_id;
+               }
+               
+               public function get_control_area_id() { return 
$this->control_area_id; }
+               
+               public function set_control_area_name($control_area_name)
+               {
+                       $this->control_area_name = $control_area_name;
+               }
+               
+               public function get_control_area_name() { return 
$this->control_area_name; }
+               
+               public function set_check_lists_array($check_lists_array)
+               {
+                       $this->check_lists_array = $check_lists_array;
+               }
+               
+               public function get_check_lists_array() { return 
$this->check_lists_array; }
+               
+               public function 
set_agg_open_cases_pr_month_array($agg_open_cases_pr_month_array)
+               {
+                       $this->agg_open_cases_pr_month_array = 
$agg_open_cases_pr_month_array;
+               }
+               
+               public function get_agg_open_cases_pr_month_array() { return 
$this->agg_open_cases_pr_month_array; }
+               
+               public function get_error_msg_array() { return 
$this->error_msg_array; }
+               
+               public function set_error_msg_array( $error_msg_array )
+               {
+                       $this->error_msg_array = $error_msg_array;
+               }
+               
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('controller.socontrol');
+                       }
+                       
+                       return self::$so;
+               }
+               
+               public function populate()
+               {
+                               
$this->set_title(phpgw::get_var('title','string'));
+                               
$this->set_description(phpgw::get_var('description','html'));
+                               
+                               if(phpgw::get_var('start_date','string') != '')
+                               {
+                                       $start_date_ts = 
date_helper::get_timestamp_from_date( phpgw::get_var('start_date','string'), 
"d/m-Y" );
+                                       $this->set_start_date($start_date_ts);
+                               }else
+                                       $this->set_start_date(0);
+                                                               
+                               if( phpgw::get_var('end_date','string') != '')
+                               {
+                                       $end_date_ts = 
date_helper::get_timestamp_from_date( phpgw::get_var('end_date','string'), 
"d/m-Y" );
+                                       $this->set_end_date( $end_date_ts );
+                               }else
+                               {
+                                       $this->set_end_date( 0 );
+                               }
+                               
+                               
$this->set_repeat_type(phpgw::get_var('repeat_type','string'));
+                               
$this->set_repeat_interval(phpgw::get_var('repeat_interval','string'));
+                               
$this->set_procedure_id(phpgw::get_var('procedure_id','int'));
+                               
$this->set_control_area_id(phpgw::get_var('control_area_id','int'));
+                               
$this->set_responsibility_id(phpgw::get_var('responsibility_id','int'));
+               }
+               
+               public function serialize()
+               {
+                       return array(
+                               'id' => $this->get_id(),
+                               'title' => $this->get_title(),
+                               'description' => $this->get_description(),
+                               'start_date' => $this->get_start_date(),
+                               'end_date' => $this->get_end_date(),
+                               'procedure_id' => $this->get_procedure_id(),
+                               'procedure_name' => $this->get_procedure_name(),
+                               'control_area_id' => 
$this->get_control_area_id(),
+                               'control_area_name' => 
$this->get_control_area_name(),
+                         'repeat_type' => $this->get_repeat_type(),
+                               'repeat_interval' => 
$this->get_repeat_interval(),
+                               'responsibility_name' => 
$this->get_responsibility_name()
+                       );
+               }
+                               
+               public function validate()
+               {
+                       $status = true;
+       
+                       // Validate CONTROL AREA
+                       if( empty( $this->control_area_id ) && 
(intval($this->control_area_id) == 0) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['control_area_id'] = 
"error_msg_2";
+                 }
+                 
+                 // Validate PROCEDURE                           
+                       if( empty( $this->procedure_id ) && 
(intval($this->procedure_id) == 0) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['procedure_id'] = "error_msg_2";
+                 }
+                       
+                 // Validate TITLE
+                 if( empty($this->title) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['title'] = "error_msg_1";
+                 }
+                                 
+                 // Validate START DATE
+                       if( empty($this->start_date) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['start_date'] = "error_msg_1";
+                 }
 
-  const REPEAT_TYPE_DAY = 0;
-  const REPEAT_TYPE_WEEK = 1;
-  const REPEAT_TYPE_MONTH = 2;
-  const REPEAT_TYPE_YEAR = 3;
+                 // Validate END DATE
+                       if( !empty($this->end_date) && ($this->end_date < 
$this->start_date) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['end_date'] = "error_msg_3";
+                 }  
+                 
+                 // Validate REPEAT TYPE
+                 if( $this->repeat_type == "" )
+                 {
+                       $status = false;
+                       $this->error_msg_array['repeat_type'] = "error_msg_2";
+                 }
 
-  protected $id;
-  protected $title;
-  protected $description;
-  protected $start_date;
-  protected $end_date;
-  protected $repeat_type;
-  protected $repeat_type_label;
-  protected $repeat_interval;
-  protected $procedure_id;
-  protected $procedure_name;
-  protected $enabled;
-  protected $requirement_id;
-  protected $costresponsibility_id;
-  protected $responsibility_id;
-  protected $responsibility_name;
-  protected $control_area_id;
-  protected $control_area_name;
-  // Objects
-  protected $check_lists_array = array();
-  // Array that contains open cases for a month   
-  protected $agg_open_cases_pr_month_array = array();
-  // Array that contains error messages. Is populted in function validate
-  protected $error_msg_array;
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_title($title) {
-    $this->title = $title;
-  }
-
-  public function get_title() {
-    return $this->title;
-  }
-
-  public function set_description($description) {
-    $this->description = $description;
-  }
-
-  public function get_description() {
-    return $this->description;
-  }
-
-  public function set_end_date($end_date) {
-    $this->end_date = $end_date;
-  }
-
-  public function get_end_date() {
-    return $this->end_date;
-  }
-
-  public function set_start_date($start_date) {
-    $this->start_date = $start_date;
-  }
-
-  public function get_start_date() {
-    return $this->start_date;
-  }
-
-  public function set_repeat_type($repeat_type) {
-    $this->repeat_type = $repeat_type;
-  }
-
-  public function get_repeat_type() {
-    return $this->repeat_type;
-  }
-
-  public function set_repeat_type_label(int $repeat_type = null) {
-    switch ($repeat_type) {
-      case controller_control::REPEAT_TYPE_DAY:
-        $this->repeat_type_label = lang('repeat_type_day');
-        break;
-      case controller_control::REPEAT_TYPE_WEEK:
-        $this->repeat_type_label = lang('repeat_type_week');
-        break;
-      case controller_control::REPEAT_TYPE_MONTH:
-        $this->repeat_type_label = lang('repeat_type_month');
-        break;
-      case controller_control::REPEAT_TYPE_YEAR;
-        $this->repeat_type_label = lang('repeat_type_year');
-        break;
-      default:
-        $this->repeat_type_label = lang('repeat_type_none');
-        break;
-    }
-  }
-
-  public function get_repeat_type_label() {
-    return $this->repeat_type_label;
-  }
-
-  public function set_repeat_interval($repeat_interval) {
-    $this->repeat_interval = $repeat_interval;
-  }
-
-  public function get_repeat_interval() {
-    return $this->repeat_interval;
-  }
-
-  public function set_procedure_id($procedure_id) {
-    $this->procedure_id = $procedure_id;
-  }
-
-  public function get_procedure_id() {
-    return $this->procedure_id;
-  }
-
-  public function set_procedure_name($procedure_name) {
-    $this->procedure_name = $procedure_name;
-  }
-
-  public function get_procedure_name() {
-    return $this->procedure_name;
-  }
-
-  public function set_enabled($enabled) {
-    $this->enabled = $enabled;
-  }
-
-  public function get_enabled() {
-    return $this->enabled;
-  }
-
-  public function set_requirement_id($requirement_id) {
-    $this->requirement_id = $requirement_id;
-  }
-
-  public function get_requirement_id() {
-    return $this->requirement_id;
-  }
-
-  public function set_costresponsibility_id($costresponsibility_id) {
-    $this->costresponsibility_id = $costresponsibility_id;
-  }
-
-  public function get_costresponsibility_id() {
-    return $this->costresponsibility_id;
-  }
-
-  public function set_responsibility_id($responsibility_id) {
-    $this->responsibility_id = $responsibility_id;
-  }
-
-  public function get_responsibility_id() {
-    return $this->responsibility_id;
-  }
-
-  public function set_responsibility_name($responsibility_name) {
-    $this->responsibility_name = $responsibility_name;
-  }
-
-  public function get_responsibility_name() {
-    return $this->responsibility_name;
-  }
-
-  public function set_control_area_id($control_area_id) {
-    $this->control_area_id = $control_area_id;
-  }
-
-  public function get_control_area_id() {
-    return $this->control_area_id;
-  }
-
-  public function set_control_area_name($control_area_name) {
-    $this->control_area_name = $control_area_name;
-  }
-
-  public function get_control_area_name() {
-    return $this->control_area_name;
-  }
-
-  public function set_check_lists_array($check_lists_array) {
-    $this->check_lists_array = $check_lists_array;
-  }
-
-  public function get_check_lists_array() {
-    return $this->check_lists_array;
-  }
-
-  public function 
set_agg_open_cases_pr_month_array($agg_open_cases_pr_month_array) {
-    $this->agg_open_cases_pr_month_array = $agg_open_cases_pr_month_array;
-  }
-
-  public function get_agg_open_cases_pr_month_array() {
-    return $this->agg_open_cases_pr_month_array;
-  }
-
-  public function get_error_msg_array() {
-    return $this->error_msg_array;
-  }
-
-  public function set_error_msg_array($error_msg_array) {
-    $this->error_msg_array = $error_msg_array;
-  }
-
-  /**
-   * Get a static reference to the storage object associated with this model 
object
-   * 
-   * @return the storage object
-   */
-  public static function get_so() {
-    if (self::$so == null) {
-      self::$so = CreateObject('controller.socontrol');
-    }
-
-    return self::$so;
-  }
-
-  public function populate() {
-    $this->set_title(phpgw::get_var('title', 'string'));
-    $this->set_description(phpgw::get_var('description', 'html'));
-
-    if (phpgw::get_var('start_date', 'string') != '') {
-      $start_date_ts = 
date_helper::get_timestamp_from_date(phpgw::get_var('start_date', 'string'), 
"d/m-Y");
-      $this->set_start_date($start_date_ts);
-    }else
-      $this->set_start_date(0);
-
-    if (phpgw::get_var('end_date', 'string') != '') {
-      $end_date_ts = 
date_helper::get_timestamp_from_date(phpgw::get_var('end_date', 'string'), 
"d/m-Y");
-      $this->set_end_date($end_date_ts);
-    } else {
-      $this->set_end_date(0);
-    }
-
-    $this->set_repeat_type(phpgw::get_var('repeat_type', 'string'));
-    $this->set_repeat_interval(phpgw::get_var('repeat_interval', 'string'));
-    $this->set_procedure_id(phpgw::get_var('procedure_id', 'int'));
-    $this->set_control_area_id(phpgw::get_var('control_area_id', 'int'));
-    $this->set_responsibility_id(phpgw::get_var('responsibility_id', 'int'));
-  }
-
-  public function serialize() {
-    return array(
-        'id' => $this->get_id(),
-        'title' => $this->get_title(),
-        'description' => $this->get_description(),
-        'start_date' => $this->get_start_date(),
-        'end_date' => $this->get_end_date(),
-        'procedure_id' => $this->get_procedure_id(),
-        'procedure_name' => $this->get_procedure_name(),
-        'control_area_id' => $this->get_control_area_id(),
-        'control_area_name' => $this->get_control_area_name(),
-        'repeat_type' => $this->get_repeat_type(),
-        'repeat_interval' => $this->get_repeat_interval(),
-        'responsibility_name' => $this->get_responsibility_name()
-    );
-  }
-
-  public function validate() {
-    $status = true;
-
-    // Validate CONTROL AREA
-    if (empty($this->control_area_id) && (intval($this->control_area_id) == 
0)) {
-      $status = false;
-      $this->error_msg_array['control_area_id'] = "error_msg_2";
-    }
-
-    // Validate PROCEDURE                                
-    if (empty($this->procedure_id) && (intval($this->procedure_id) == 0)) {
-      $status = false;
-      $this->error_msg_array['procedure_id'] = "error_msg_2";
-    }
-
-    // Validate TITLE
-    if (empty($this->title)) {
-      $status = false;
-      $this->error_msg_array['title'] = "error_msg_1";
-    }
-
-    // Validate START DATE
-    if (empty($this->start_date)) {
-      $status = false;
-      $this->error_msg_array['start_date'] = "error_msg_1";
-    }
-
-    // Validate END DATE
-    if (!empty($this->end_date) && ($this->end_date < $this->start_date)) {
-      $status = false;
-      $this->error_msg_array['end_date'] = "error_msg_3";
-    }
-
-    // Validate REPEAT TYPE
-    if ($this->repeat_type == "") {
-      $status = false;
-      $this->error_msg_array['repeat_type'] = "error_msg_2";
-    }
-
-    // Validate REPEAT INTERVAL
-    if (($this->repeat_interval == "") || (intval($this->repeat_interval) < 
1)) {
-      $status = false;
-      $this->error_msg_array['repeat_interval'] = "error_msg_1";
-    }
-
-    // Validate RESPONSIBILITY
-    if ($this->responsibility_id == "" || 
(!is_numeric($this->responsibility_id))) {
-      $status = false;
-      $this->error_msg_array['responsibility_id'] = "error_msg_2";
-    }
-
-
-    return $status;
-  }
-
-}
+                 // Validate REPEAT INTERVAL
+                 if( ($this->repeat_interval == "") || 
(intval($this->repeat_interval) < 1) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['repeat_interval'] = 
"error_msg_1";
+                 }
+                 
+                       // Validate RESPONSIBILITY
+                 if( $this->responsibility_id == "" || 
(!is_numeric($this->responsibility_id)) )
+                 {
+                       $status = false;
+                       $this->error_msg_array['responsibility_id'] = 
"error_msg_2";
+                 }
+                 
+                 
+                 return $status;
+               }
+       }

Modified: trunk/controller/inc/model/class.control_area.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_area.inc.php       2012-09-11 
07:36:58 UTC (rev 9990)
+++ trunk/controller/inc/model/class.control_area.inc.php       2012-09-11 
07:48:54 UTC (rev 9991)
@@ -1,35 +1,35 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
-/*
+       include_class('controller', 'model', 'inc/model/');
+       /*
        class controller_control_area extends controller_model
        {
                public static $so;

Modified: trunk/controller/inc/model/class.control_group.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_group.inc.php      2012-09-11 
07:36:58 UTC (rev 9990)
+++ trunk/controller/inc/model/class.control_group.inc.php      2012-09-11 
07:48:54 UTC (rev 9991)
@@ -1,177 +1,175 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_control_group extends controller_model
+       {
+               public static $so;
 
-class controller_control_group extends controller_model {
+               protected $id;
+               protected $group_name;
+               protected $procedure_id;
+               protected $procedure_name;
+               protected $control_area_id;
+               protected $control_area_name;
+               protected $building_part_id;
+               protected $building_part_descr;
+               protected $order_nr;
+                               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
 
-  public static $so;
-  protected $id;
-  protected $group_name;
-  protected $procedure_id;
-  protected $procedure_name;
-  protected $control_area_id;
-  protected $control_area_name;
-  protected $building_part_id;
-  protected $building_part_descr;
-  protected $order_nr;
+               public function set_group_name($group_name)
+               {
+                       $this->group_name = $group_name;
+               }
+               
+               public function get_group_name(){ return $this->group_name; }
+               
+               public function set_procedure_id($procedure_id)
+               {
+                       $this->procedure_id = $procedure_id;
+               }
+               
+               public function get_procedure_id(){ return $this->procedure_id; 
}
+               
+               public function set_procedure_name($procedure_name)
+               {
+                       $this->procedure_name = $procedure_name;
+               }
+               
+               public function get_procedure_name(){ return 
$this->procedure_name; }
+               
+               public function set_control_area_id($control_area_id)
+               {
+                       $this->control_area_id = $control_area_id;
+               }
+               
+               public function get_control_area_id(){ return 
$this->control_area_id; }
+               
+               public function set_control_area_name($control_area_name)
+               {
+                       $this->control_area_name = $control_area_name;
+               }
+               
+               public function get_control_area_name(){ return 
$this->control_area_name; }
+               
+               public function set_building_part_id($building_part_id)
+               {
+                       $this->building_part_id = $building_part_id;
+               }
+               
+               public function get_building_part_id(){ return 
$this->building_part_id; }
+               
+               public function set_building_part_descr($building_part_descr)
+               {
+                       $this->building_part_descr = $building_part_descr;
+               }
+               
+               public function get_building_part_descr(){ return 
$this->building_part_descr; }
+               
+               public function set_order_nr($order_nr)
+               {
+                       $this->order_nr = $order_nr;
+               }
+               
+               public function get_order_nr(){ return $this->order_nr; }
 
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
+               public function serialize()
+               {
+                       $result = array();
+                       $result['id'] = $this->get_id();
+                       $result['group_name'] = $this->get_group_name();
+                       $result['procedure'] = $this->get_procedure_name();
+                       $result['control_area'] = 
$this->get_control_area_name();
+                       $result['building_part'] = 
$this->get_building_part_descr();
+                       $result['order_nr'] = $this->get_order_nr();
+                       
+                       return $result;
+               }
+               
+               public function toArray()
+               {
 
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_group_name($group_name) {
-    $this->group_name = $group_name;
-  }
-
-  public function get_group_name() {
-    return $this->group_name;
-  }
-
-  public function set_procedure_id($procedure_id) {
-    $this->procedure_id = $procedure_id;
-  }
-
-  public function get_procedure_id() {
-    return $this->procedure_id;
-  }
-
-  public function set_procedure_name($procedure_name) {
-    $this->procedure_name = $procedure_name;
-  }
-
-  public function get_procedure_name() {
-    return $this->procedure_name;
-  }
-
-  public function set_control_area_id($control_area_id) {
-    $this->control_area_id = $control_area_id;
-  }
-
-  public function get_control_area_id() {
-    return $this->control_area_id;
-  }
-
-  public function set_control_area_name($control_area_name) {
-    $this->control_area_name = $control_area_name;
-  }
-
-  public function get_control_area_name() {
-    return $this->control_area_name;
-  }
-
-  public function set_building_part_id($building_part_id) {
-    $this->building_part_id = $building_part_id;
-  }
-
-  public function get_building_part_id() {
-    return $this->building_part_id;
-  }
-
-  public function set_building_part_descr($building_part_descr) {
-    $this->building_part_descr = $building_part_descr;
-  }
-
-  public function get_building_part_descr() {
-    return $this->building_part_descr;
-  }
-
-  public function set_order_nr($order_nr) {
-    $this->order_nr = $order_nr;
-  }
-
-  public function get_order_nr() {
-    return $this->order_nr;
-  }
-
-  public function serialize() {
-    $result = array();
-    $result['id'] = $this->get_id();
-    $result['group_name'] = $this->get_group_name();
-    $result['procedure'] = $this->get_procedure_name();
-    $result['control_area'] = $this->get_control_area_name();
-    $result['building_part'] = $this->get_building_part_descr();
-    $result['order_nr'] = $this->get_order_nr();
-
-    return $result;
-  }
-
-  public function toArray() {
-
 // Alternative 1
 //                     return get_object_vars($this);
+
 // Alternative 2
-    $exclude = array
-        (
-        'get_field', // feiler (foreldreklassen)
-        'get_so', //unødvendig 
-    );
+                       $exclude = array
+                       (
+                               'get_field', // feiler (foreldreklassen)
+                               'get_so',//unødvendig 
+                       );
+                       
+                       $class_methods = get_class_methods($this);
+                       $control_group_arr = array();
+                       foreach ($class_methods as $class_method)
+                       {
+                               if( stripos($class_method , 'get_' ) === 0  && 
!in_array($class_method, $exclude))
+                               {
+                                       $_class_method_part = explode('get_', 
$class_method);
+                                       
$control_group_arr[$_class_method_part[1]] = $this->$class_method();
+                               }
+                       }
 
-    $class_methods = get_class_methods($this);
-    $control_group_arr = array();
-    foreach ($class_methods as $class_method) {
-      if (stripos($class_method, 'get_') === 0 && !in_array($class_method, 
$exclude)) {
-        $_class_method_part = explode('get_', $class_method);
-        $control_group_arr[$_class_method_part[1]] = $this->$class_method();
-      }
-    }
-
 //                     _debug_array($control_group_arr);
-    return $control_group_arr;
-  }
-
-  /**
-   * Get a static reference to the storage object associated with this model 
object
-   * 
-   * @return the storage object
-   */
-  public static function get_so() {
-    if (self::$so == null) {
-      self::$so = CreateObject('controller.socontrol_group');
-    }
-
-    return self::$so;
-  }
-
-}
+                       return $control_group_arr;
+               }
+               
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null) {
+                               self::$so = 
CreateObject('controller.socontrol_group');
+                       }
+                       
+                       return self::$so;
+               }
+       }

Modified: trunk/controller/inc/model/class.control_group_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_group_list.inc.php 2012-09-11 
07:36:58 UTC (rev 9990)
+++ trunk/controller/inc/model/class.control_group_list.inc.php 2012-09-11 
07:48:54 UTC (rev 9991)
@@ -1,106 +1,106 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_control_group_list extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $control_id;
+               protected $control_group_id;
+               protected $order_nr;
+                               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
 
-class controller_control_group_list extends controller_model {
-
-  public static $so;
-  protected $id;
-  protected $control_id;
-  protected $control_group_id;
-  protected $order_nr;
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_control_id($control_id) {
-    $this->control_id = $control_id;
-  }
-
-  public function get_control_id() {
-    return $this->control_id;
-  }
-
-  public function set_control_group_id($control_group_id) {
-    $this->control_group_id = $control_group_id;
-  }
-
-  public function get_control_group_id() {
-    return $this->control_group_id;
-  }
-
-  public function set_order_nr($order_nr) {
-    $this->order_nr = $order_nr;
-  }
-
-  public function get_order_nr() {
-    return $this->order_nr;
-  }
-
-  /**
-   * Get a static reference to the storage object associated with this model 
object
-   * 
-   * @return the storage object
-   */
-  public static function get_so() {
-    if (self::$so == null) {
-      self::$so = CreateObject('controller.socontrol_group_list');
-    }
-
-    return self::$so;
-  }
-
-  public function serialize() {
-    $result = array();
-    $result['id'] = $this->get_id();
-    $result['control_id'] = $this->get_control_id();
-    $result['control_group_id'] = $this->get_control_group_id();
-    $result['order_nr'] = $this->get_order_nr();
-
-    return $result;
-  }
-
-}
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = $control_id;
+               }
+               
+               public function get_control_id() { return $this->control_id; }
+               
+               public function set_control_group_id($control_group_id)
+               {
+                       $this->control_group_id = $control_group_id;
+               }
+               
+               public function get_control_group_id() { return 
$this->control_group_id; }
+               
+               public function set_order_nr($order_nr)
+               {
+                       $this->order_nr = $order_nr;
+               }
+               
+               public function get_order_nr() { return $this->order_nr; }
+                       
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('controller.socontrol_group_list');
+                       }
+                       
+                       return self::$so;
+               }
+               
+                public function serialize()
+                {
+                       $result = array();
+                       $result['id'] = $this->get_id();
+                       $result['control_id'] = $this->get_control_id();
+                       $result['control_group_id'] = 
$this->get_control_group_id();
+                       $result['order_nr'] = $this->get_order_nr();
+                                               
+                       return $result;
+               }
+       }

Modified: trunk/controller/inc/model/class.control_item.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_item.inc.php       2012-09-11 
07:36:58 UTC (rev 9990)
+++ trunk/controller/inc/model/class.control_item.inc.php       2012-09-11 
07:48:54 UTC (rev 9991)
@@ -1,212 +1,212 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_control_item extends controller_model
+       {
+               public static $so;
+               
+               public $type_array = array("control_item_type_1", 
"control_item_type_2", "control_item_type_3", "control_item_type_4");
+               
+               protected $id;
+               protected $title;
+               protected $required;
+               protected $what_to_do;
+               protected $how_to_do;
+               protected $control_group_id;
+               protected $control_group_name;
+               protected $control_area_id;
+               protected $control_area_name;
+               protected $type;
+               
+               protected $options_array;
+               protected $error_msg_array;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
 
-class controller_control_item extends controller_model {
+               public function set_title($title)
+               {
+                       $this->title = $title;
+               }
+               
+               public function get_title() { return $this->title; }
+               
+               public function set_required($required)
+               {
+                       $this->required = $required;
+               }
+               
+               public function get_required() { return $this->required; }
+               
+               public function set_what_to_do($what_to_do)
+               {
+                       $this->what_to_do = $what_to_do;
+               }
+               
+               public function get_what_to_do() { return $this->what_to_do; }
+               
+               public function set_how_to_do($how_to_do)
+               {
+                       $this->how_to_do = $how_to_do;
+               }
+               
+               public function get_how_to_do() { return $this->how_to_do; }
+               
+               public function set_control_group_id($control_group_id)
+               {
+                       $this->control_group_id = $control_group_id;
+               }
+               
+               public function get_control_group_id() { return 
$this->control_group_id; }
+               
+               public function set_control_group_name($control_group_name)
+               {
+                       $this->control_group_name = $control_group_name;
+               }
+               
+               public function get_control_group_name() { return 
$this->control_group_name; }
+               
+               public function set_control_area_id($control_area_id)
+               {
+                       $this->control_area_id = $control_area_id;
+               }
+               
+               public function get_control_area_id() { return 
$this->control_area_id; }
+               
+               public function set_control_area_name($control_area_name)
+               {
+                       $this->control_area_name = $control_area_name;
+               }
+               
+               public function get_control_area_name() { return 
$this->control_area_name; }
+               
+               public function set_type($type)
+               {
+                       $this->type = $type;
+               }
+               
+               public function get_type() { return $this->type; }
+               
+               public function set_options_array($options_array)
+               {
+                       $this->options_array = $options_array;
+               }
+               
+               public function get_options_array() { return 
$this->options_array; }
+               
+               public function get_control_item_types()
+               {
+                       return array_values( $this->type_array );
+               }
+                       
+               public function get_error_msg_array() { return 
$this->error_msg_array; }
+               
+               public function set_error_msg_array( $error_msg_array )
+               {
+                       $this->error_msg_array = $error_msg_array;
+               }
+                       
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('controller.socontrol_item');
+                       }
+                       
+                       return self::$so;
+               }
+               
+               public function serialize()
+                {
+                       $result = array();
+                       $result['id'] = $this->get_id();
+                       $result['title'] = $this->get_title();
+                       $result['required'] = $this->get_required();
+                       $result['what_to_do'] = $this->get_what_to_do();
+                       $result['how_to_do'] = $this->get_how_to_do();
+                       $result['control_group'] = 
$this->get_control_group_name();
+                       $result['control_area'] = 
$this->get_control_area_name();
+                       $result['control_area'] = 
$this->get_control_area_name();
+                                               
+                       return $result;
+               }
+               
+               public function validate()
+               {
+                       $status = true;
+       
+                 if( $this->title == '')
+                 {
+                       $status = false;
+                       $this->error_msg_array['title'] = "error_msg_1";
+                 }
 
-  public static $so;
-  public $type_array = array("control_item_type_1", "control_item_type_2", 
"control_item_type_3", "control_item_type_4");
-  protected $id;
-  protected $title;
-  protected $required;
-  protected $what_to_do;
-  protected $how_to_do;
-  protected $control_group_id;
-  protected $control_group_name;
-  protected $control_area_id;
-  protected $control_area_name;
-  protected $type;
-  protected $options_array;
-  protected $error_msg_array;
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_title($title) {
-    $this->title = $title;
-  }
-
-  public function get_title() {
-    return $this->title;
-  }
-
-  public function set_required($required) {
-    $this->required = $required;
-  }
-
-  public function get_required() {
-    return $this->required;
-  }
-
-  public function set_what_to_do($what_to_do) {
-    $this->what_to_do = $what_to_do;
-  }
-
-  public function get_what_to_do() {
-    return $this->what_to_do;
-  }
-
-  public function set_how_to_do($how_to_do) {
-    $this->how_to_do = $how_to_do;
-  }
-
-  public function get_how_to_do() {
-    return $this->how_to_do;
-  }
-
-  public function set_control_group_id($control_group_id) {
-    $this->control_group_id = $control_group_id;
-  }
-
-  public function get_control_group_id() {
-    return $this->control_group_id;
-  }
-
-  public function set_control_group_name($control_group_name) {
-    $this->control_group_name = $control_group_name;
-  }
-
-  public function get_control_group_name() {
-    return $this->control_group_name;
-  }
-
-  public function set_control_area_id($control_area_id) {
-    $this->control_area_id = $control_area_id;
-  }
-
-  public function get_control_area_id() {
-    return $this->control_area_id;
-  }
-
-  public function set_control_area_name($control_area_name) {
-    $this->control_area_name = $control_area_name;
-  }
-
-  public function get_control_area_name() {
-    return $this->control_area_name;
-  }
-
-  public function set_type($type) {
-    $this->type = $type;
-  }
-
-  public function get_type() {
-    return $this->type;
-  }
-
-  public function set_options_array($options_array) {
-    $this->options_array = $options_array;
-  }
-
-  public function get_options_array() {
-    return $this->options_array;
-  }
-
-  public function get_control_item_types() {
-    return array_values($this->type_array);
-  }
-
-  public function get_error_msg_array() {
-    return $this->error_msg_array;
-  }
-
-  public function set_error_msg_array($error_msg_array) {
-    $this->error_msg_array = $error_msg_array;
-  }
-
-  /**
-   * Get a static reference to the storage object associated with this model 
object
-   * 
-   * @return the storage object
-   */
-  public static function get_so() {
-    if (self::$so == null) {
-      self::$so = CreateObject('controller.socontrol_item');
-    }
-
-    return self::$so;
-  }
-
-  public function serialize() {
-    $result = array();
-    $result['id'] = $this->get_id();
-    $result['title'] = $this->get_title();
-    $result['required'] = $this->get_required();
-    $result['what_to_do'] = $this->get_what_to_do();
-    $result['how_to_do'] = $this->get_how_to_do();
-    $result['control_group'] = $this->get_control_group_name();
-    $result['control_area'] = $this->get_control_area_name();
-    $result['control_area'] = $this->get_control_area_name();
-
-    return $result;
-  }
-
-  public function validate() {
-    $status = true;
-
-    if ($this->title == '') {
-      $status = false;
-      $this->error_msg_array['title'] = "error_msg_1";
-    }
-
-    if ($this->what_to_do == '' | strlen($this->what_to_do) == 0) {
-      $status = false;
-      $this->error_msg_array['what_to_do'] = "error_msg_1";
-    }
-
-    if ($this->how_to_do == '') {
-      $status = false;
-      $this->error_msg_array['how_to_do'] = "error_msg_1";
-    }
-
-    if ($this->control_area_id == '' && intval($this->control_area_id) > 0) {
-      $status = false;
-      $this->error_msg_array['control_area_id'] = "error_msg_2";
-    }
-    return $status;
-  }
-
-}
\ No newline at end of file
+                 if( $this->what_to_do == '' | strlen( $this->what_to_do ) == 
0 )
+                 {
+                       $status = false;
+                       $this->error_msg_array['what_to_do'] = "error_msg_1";
+                 }
+                 
+                       if( $this->how_to_do == '')
+                 {
+                       $status = false;
+                       $this->error_msg_array['how_to_do'] = "error_msg_1";
+                 }
+                 
+                       if( $this->control_area_id == '' && 
intval($this->control_area_id) > 0)
+                 {
+                       $status = false;
+                       $this->error_msg_array['control_area_id'] = 
"error_msg_2";
+                 }
+                 return $status;
+               }
+       }
\ No newline at end of file

Modified: trunk/controller/inc/model/class.control_item_list.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_item_list.inc.php  2012-09-11 
07:36:58 UTC (rev 9990)
+++ trunk/controller/inc/model/class.control_item_list.inc.php  2012-09-11 
07:48:54 UTC (rev 9991)
@@ -1,96 +1,96 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_control_item_list extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $control_id;
+               protected $control_item_id;
+               protected $order_nr;
+                               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+                       
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
 
-class controller_control_item_list extends controller_model {
-
-  public static $so;
-  protected $id;
-  protected $control_id;
-  protected $control_item_id;
-  protected $order_nr;
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_control_id($control_id) {
-    $this->control_id = $control_id;
-  }
-
-  public function get_control_id() {
-    return $this->control_id;
-  }
-
-  public function set_control_item_id($control_item_id) {
-    $this->control_item_id = $control_item_id;
-  }
-
-  public function get_control_item_id() {
-    return $this->control_item_id;
-  }
-
-  public function set_order_nr($order_nr) {
-    $this->order_nr = $order_nr;
-  }
-
-  public function get_order_nr() {
-    return $this->order_nr;
-  }
-
-  /**
-   * Get a static reference to the storage object associated with this model 
object
-   * 
-   * @return the storage object
-   */
-  public static function get_so() {
-    if (self::$so == null) {
-      self::$so = CreateObject('controller.socontrol_item_list');
-    }
-
-    return self::$so;
-  }
-
-}
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = $control_id;
+               }
+               
+               public function get_control_id() { return $this->control_id; }
+               
+               public function set_control_item_id($control_item_id)
+               {
+                       $this->control_item_id = $control_item_id;
+               }
+               
+               public function get_control_item_id() { return 
$this->control_item_id; }
+               
+               public function set_order_nr($order_nr)
+               {
+                       $this->order_nr = $order_nr;
+               }
+               
+               public function get_order_nr() { return $this->order_nr; }
+                               
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('controller.socontrol_item_list');
+                       }
+                       
+                       return self::$so;
+               }
+       }

Modified: trunk/controller/inc/model/class.control_item_option.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_item_option.inc.php        
2012-09-11 07:36:58 UTC (rev 9990)
+++ trunk/controller/inc/model/class.control_item_option.inc.php        
2012-09-11 07:48:54 UTC (rev 9991)
@@ -1,69 +1,67 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.control_item.inc.php 9404 2012-05-15 11:47:15Z 
vator $
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id: class.control_item.inc.php 9404 2012-05-15 11:47:15Z vator $
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       
+       class controller_control_item_option extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $option_value;
+               protected $control_item_id;
+               
+               public function __construct($option_value, $control_item_id)
+               {
+                       $this->option_value = $option_value;
+                       $this->control_item_id = $control_item_id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
 
-class controller_control_item_option extends controller_model {
-
-  public static $so;
-  protected $id;
-  protected $option_value;
-  protected $control_item_id;
-
-  public function __construct($option_value, $control_item_id) {
-    $this->option_value = $option_value;
-    $this->control_item_id = $control_item_id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_option_value($option_value) {
-    $this->option_value = $option_value;
-  }
-
-  public function get_option_value() {
-    return $this->option_value;
-  }
-
-  public function set_control_item_id($control_item_id) {
-    $this->control_item_id = $control_item_id;
-  }
-
-  public function get_control_item_id() {
-    return $this->control_item_id;
-  }
-
+               public function set_option_value($option_value)
+               {
+                       $this->option_value = $option_value;
+               }
+               
+               public function get_option_value() { return 
$this->option_value; }
+               
+               public function set_control_item_id($control_item_id)
+               {
+                       $this->control_item_id = $control_item_id;
+               }
+               
+               public function get_control_item_id() { return 
$this->control_item_id; }
 }

Modified: trunk/controller/inc/model/class.control_location.inc.php
===================================================================
--- trunk/controller/inc/model/class.control_location.inc.php   2012-09-11 
07:36:58 UTC (rev 9990)
+++ trunk/controller/inc/model/class.control_location.inc.php   2012-09-11 
07:48:54 UTC (rev 9991)
@@ -1,73 +1,70 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id: class.control.inc.php 8647 2012-01-23 07:28:36Z vator $
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id: class.control.inc.php 8647 2012-01-23 07:28:36Z vator $
- */
-include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
 
-class controller_control_location extends controller_model {
-
-  protected $id;
-  protected $location_code;
-  protected $control_id;
-
-  /**
-   * Constructor.  Takes an optional ID.  If a contract is created from outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this composite
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return (int) $this->id;
-  }
-
-  public function get_location_code() {
-    return $this->location_code;
-  }
-
-  public function set_location_code($location_code) {
-    $this->location_code = $location_code;
-  }
-
-  public function get_control_id() {
-    return (int) $this->control_id;
-  }
-
-  public function set_control_id($control_id) {
-    $this->control_id = (int) $control_id;
-  }
-
-}
+       class controller_control_location extends controller_model
+       {               
+               protected $id;
+               protected $location_code;
+               protected $control_id;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a contract is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this composite
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return (int)$this->id; }
+               
+               public function get_location_code() { return 
$this->location_code; }
+               
+               public function set_location_code($location_code)
+               {
+                       $this->location_code = $location_code;
+               }
+               
+               public function get_control_id() { return 
(int)$this->control_id; }
+               
+               public function set_control_id($control_id)
+               {
+                       $this->control_id = (int)$control_id;
+               }
+       }

Modified: trunk/controller/inc/model/class.model.inc.php
===================================================================
--- trunk/controller/inc/model/class.model.inc.php      2012-09-11 07:36:58 UTC 
(rev 9990)
+++ trunk/controller/inc/model/class.model.inc.php      2012-09-11 07:48:54 UTC 
(rev 9991)
@@ -1,110 +1,122 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erink Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erink Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-abstract class controller_model {
+       abstract class controller_model
+       {
+               protected $validation_errors = array();
+               protected $validation_warnings = array();
 
-  protected $validation_errors = array();
-  protected $validation_warnings = array();
-  protected $consistency_warnings = array();
-  protected $field_of_responsibility_id;
-  protected $field_of_responsibility_name;
-  protected $permission_array;
+               protected $consistency_warnings = array();
 
-  public function __construct(int $id) {
-    $this->id = (int) $id;
-  }
+               protected $field_of_responsibility_id;
+               protected $field_of_responsibility_name;
+               protected $permission_array;
 
-  public function get_id() {
-    return $this->id;
-  }
+               public function __construct(int $id)
+               {
+                       $this->id = (int)$id;
+               }
 
-  public function set_id($id) {
-    $this->id = $id;
-  }
+               public function get_id()
+               {
+                       return $this->id;
+               }
 
-  /**
-   * Gets the value of the class attribute with the given name.  As such this 
function translates from
-   * string to variable.
-   *
-   * @param $field the name of the class attribute to get
-   * @return mixed the value of the attribute
-   */
-  public function get_field($field) {
-    return $this->{"$field"};
-  }
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
 
-  /**
-   * Sets the value of the class attribute with the given name.  As such this 
function translates from
-   * string to variable name.
-   *
-   * @param $field the name of the class attribute to set
-   * @param $value the value to set
-   */
-  public function set_field($field, $value) {
-    $this->{"$field"} = $value;
-  }
+               /**
+                * Gets the value of the class attribute with the given name.  
As such this function translates from
+                * string to variable.
+                *
+                * @param $field the name of the class attribute to get
+                * @return mixed the value of the attribute
+                */
+               public function get_field($field)
+               {
+                       return $this->{"$field"};
+               }
 
-  /**
-   * Validate the object according to the database setup and custom rules.  
This function
-   * can be overridden in subclasses.  It is then up to the subclasses to call 
this parent method
-   * in order to validate against the standard database rules.  The subclasses 
can in addition
-   * add their own specific validation logic.
-   *
-   * @return boolean true if the object is valid, false otherwise
-   */
-  public function validates() {
-    return true;
-  }
+               /**
+                * Sets the value of the class attribute with the given name.  
As such this function translates from
+                * string to variable name.
+                *
+                * @param $field the name of the class attribute to set
+                * @param $value the value to set
+                */
+               public function set_field($field, $value)
+               {
+                       $this->{"$field"} = $value;
+               }
 
-  public function toArray() {
+               /**
+                * Validate the object according to the database setup and 
custom rules.  This function
+                * can be overridden in subclasses.  It is then up to the 
subclasses to call this parent method
+                * in order to validate against the standard database rules.  
The subclasses can in addition
+                * add their own specific validation logic.
+                *
+                * @return boolean true if the object is valid, false otherwise
+                */
+               public function validates()
+               {
+                       return true;
+               }
 
-    // Alternative 1
-    //                 return get_object_vars($this);
-    // Alternative 2
-    $exclude = array
-        (
-        'get_field', // feiler (foreldreklassen)
-        'get_so', //unødvendig 
-    );
+               public function toArray()
+               {
 
-    $class_methods = get_class_methods($this);
-    $control_item_arr = array();
-    foreach ($class_methods as $class_method) {
-      if (stripos($class_method, 'get_') === 0 && !in_array($class_method, 
$exclude)) {
-        $_class_method_part = explode('get_', $class_method);
-        $control_item_arr[$_class_method_part[1]] = $this->$class_method();
-      }
-    }
+       // Alternative 1
+       //                      return get_object_vars($this);
 
-    //                 _debug_array($control_item_arr);
-    return $control_item_arr;
-  }
+       // Alternative 2
+                               $exclude = array
+                               (
+                                       'get_field', // feiler (foreldreklassen)
+                                       'get_so',//unødvendig 
+                               );
 
-}
+                               $class_methods = get_class_methods($this);
+                               $control_item_arr = array();
+                               foreach ($class_methods as $class_method)
+                               {
+                                       if( stripos($class_method , 'get_' ) 
=== 0  && !in_array($class_method, $exclude))
+                                       {
+                                               $_class_method_part = 
explode('get_', $class_method);
+                                               
$control_item_arr[$_class_method_part[1]] = $this->$class_method();
+                                       }
+                               }
+
+       //                      _debug_array($control_item_arr);
+                               return $control_item_arr;
+                       }
+
+       }

Modified: trunk/controller/inc/model/class.procedure.inc.php
===================================================================
--- trunk/controller/inc/model/class.procedure.inc.php  2012-09-11 07:36:58 UTC 
(rev 9990)
+++ trunk/controller/inc/model/class.procedure.inc.php  2012-09-11 07:48:54 UTC 
(rev 9991)
@@ -1,233 +1,227 @@
 <?php
+       /**
+       * phpGroupWare - controller: a part of a Facilities Management System.
+       *
+       * @author Erik Holm-Larsen <address@hidden>
+       * @author Torstein Vadla <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package property
+       * @subpackage controller
+       * @version $Id$
+       */
 
-/**
- * phpGroupWare - controller: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <address@hidden>
- * @author Torstein Vadla <address@hidden>
- * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public License
- * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
- * @package property
- * @subpackage controller
- * @version $Id$
- */
-include_class('controller', 'model', 'inc/model/');
-include_class('controller', 'document', 'inc/model/');
+       include_class('controller', 'model', 'inc/model/');
+       include_class('controller', 'document', 'inc/model/');
+       
+       class controller_procedure extends controller_model
+       {
+               public static $so;
+               
+               protected $id;
+               protected $title;
+               protected $purpose;
+               protected $responsibility;
+               protected $description;
+               protected $reference;
+               protected $attachment;
+               protected $start_date;
+               protected $end_date;
+               protected $procedure_id;
+               protected $revision_no;
+               protected $revision_date;
+               protected $control_area_id;
+               protected $control_area_name;
+               protected $documents;
+               
+               /**
+                * Constructor.  Takes an optional ID.  If a procedure is 
created from outside
+                * the database the ID should be empty so the database can add 
one according to its logic.
+                * 
+                * @param int $id the id of this procedure
+                */
+               public function __construct(int $id = null)
+               {
+                       $this->id = (int)$id;
+                       $this->documents = array();
+               }
+               
+               public function set_id($id)
+               {
+                       $this->id = $id;
+               }
+               
+               public function get_id() { return $this->id; }
+               
+               public function set_title($title)
+               {
+                       $this->title = $title;
+               }
+               
+               public function get_title() { return $this->title; }
+               
+               public function set_purpose($purpose)
+               {
+                       $this->purpose = $purpose;
+               }
+               
+               public function get_purpose() { return $this->purpose; }
+               
+               public function set_responsibility($responsibility)
+               {
+                       $this->responsibility = $responsibility;
+               }
+               
+               public function get_responsibility() { return 
$this->responsibility; }
+               
+               public function set_description($description)
+               {
+                       $this->description = $description;
+               }
+               
+               public function get_description() { return $this->description; }
+               
+               public function set_reference($reference)
+               {
+                       $this->reference = $reference;
+               }
+               
+               public function get_reference() { return $this->reference; }
+               
+               public function set_attachment($attachment)
+               {
+                       $this->attachment = $attachment;
+               }
+               
+               public function get_attachment() { return $this->attachment; }
+               
+               public function set_start_date($start_date)
+               {
+                       $this->start_date = $start_date;
+               }
+               
+               public function get_start_date() { return $this->start_date; }
+               
+               public function set_end_date($end_date)
+               {
+                       $this->end_date = $end_date;
+               }
+               
+               public function get_end_date() { return $this->end_date; }
+               
+               public function set_procedure_id($procedure_id)
+               {
+                       $this->procedure_id = $procedure_id;
+               }
+               
+               public function get_procedure_id() { return 
$this->procedure_id; }
+               
+               public function set_revision_no($revision_no)
+               {
+                       $this->revision_no = $revision_no;
+               }
+               
+               public function get_revision_no() { return $this->revision_no; }
+               
+               public function set_revision_date($revision_date)
+               {
+                       $this->revision_date = $revision_date;
+               }
+               
+               public function get_revision_date() { return 
$this->revision_date; }
+               
+               public function set_control_area_id($control_area_id)
+               {
+                       $this->control_area_id = $control_area_id;
+               }
+               
+               public function get_control_area_id() { return 
$this->control_area_id; }
+               
+               public function set_control_area_name($control_area_name)
+               {
+                       $this->control_area_name = $control_area_name;
+               }
+               
+               public function get_control_area_name() { return 
$this->control_area_name; }
+               
+               /**
+                * Get a static reference to the storage object associated with 
this model object
+                * 
+                * @return the storage object
+                */
+               public static function get_so()
+               {
+                       if (self::$so == null)
+                       {
+                               self::$so = 
CreateObject('controller.soprocedure');
+                       }
+                       
+                       return self::$so;
+               }
+                               
+               public function serialize()
+               {
+                       return array(
+                                       'id' => $this->get_id(),
+                                       'title' => $this->get_title(),
+                                       'description' => 
$this->get_description(),
+                                       'purpose' => $this->get_purpose(),
+                                       'responsibility' => 
$this->get_responsibility(),
+                                       'reference' => $this->get_reference(),
+                                       'attachment' => $this->get_attachment(),
+                                       'start_date' => $this->get_start_date(),
+                                       'end_date' => $this->get_end_date(),
+                                       'procedure_id' => 
$this->get_procedure_id(),
+                                       'revision_no' => 
$this->get_revision_no(),
+                                       'revision_date' => 
($this->get_revision_date())?date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],
 $this->get_revision_date()):'',
+                                       'control_area'  => 
$this->get_control_area_name()
+                       );
+               }
+               
+               /**
+                * Get a list of the documents associated with this procedure.
+                * 
+                * @return array with controller_document objects, empty array 
if none, never null.
+                */
+               public function get_documents()
+               {
+                       return $this->documents;
+               }
 
-class controller_procedure extends controller_model {
-
-  public static $so;
-  protected $id;
-  protected $title;
-  protected $purpose;
-  protected $responsibility;
-  protected $description;
-  protected $reference;
-  protected $attachment;
-  protected $start_date;
-  protected $end_date;
-  protected $procedure_id;
-  protected $revision_no;
-  protected $revision_date;
-  protected $control_area_id;
-  protected $control_area_name;
-  protected $documents;
-
-  /**
-   * Constructor.  Takes an optional ID.  If a procedure is created from 
outside
-   * the database the ID should be empty so the database can add one according 
to its logic.
-   * 
-   * @param int $id the id of this procedure
-   */
-  public function __construct(int $id = null) {
-    $this->id = (int) $id;
-    $this->documents = array();
-  }
-
-  public function set_id($id) {
-    $this->id = $id;
-  }
-
-  public function get_id() {
-    return $this->id;
-  }
-
-  public function set_title($title) {
-    $this->title = $title;
-  }
-
-  public function get_title() {
-    return $this->title;
-  }
-
-  public function set_purpose($purpose) {
-    $this->purpose = $purpose;
-  }
-
-  public function get_purpose() {
-    return $this->purpose;
-  }
-
-  public function set_responsibility($responsibility) {
-    $this->responsibility = $responsibility;
-  }
-
-  public function get_responsibility() {
-    return $this->responsibility;
-  }
-
-  public function set_description($description) {
-    $this->description = $description;
-  }
-
-  public function get_description() {
-    return $this->description;
-  }
-
-  public function set_reference($reference) {
-    $this->reference = $reference;
-  }
-
-  public function get_reference() {
-    return $this->reference;
-  }
-
-  public function set_attachment($attachment) {
-    $this->attachment = $attachment;
-  }
-
-  public function get_attachment() {
-    return $this->attachment;
-  }
-
-  public function set_start_date($start_date) {
-    $this->start_date = $start_date;
-  }
-
-  public function get_start_date() {
-    return $this->start_date;
-  }
-
-  public function set_end_date($end_date) {
-    $this->end_date = $end_date;
-  }
-
-  public function get_end_date() {
-    return $this->end_date;
-  }
-
-  public function set_procedure_id($procedure_id) {
-    $this->procedure_id = $procedure_id;
-  }
-
-  public function get_procedure_id() {
-    return $this->procedure_id;
-  }
-
-  public function set_revision_no($revision_no) {
-    $this->revision_no = $revision_no;
-  }
-
-  public function get_revision_no() {
-    return $this->revision_no;
-  }
-
-  public function set_revision_date($revision_date) {
-    $this->revision_date = $revision_date;
-  }
-
-  public function get_revision_date() {
-    return $this->revision_date;
-  }
-
-  public function set_control_area_id($control_area_id) {
-    $this->control_area_id = $control_area_id;
-  }
-
-  public function get_control_area_id() {
-    return $this->control_area_id;
-  }
-
-  public function set_control_area_name($control_area_name) {
-    $this->control_area_name = $control_area_name;
-  }
-
-  public function get_control_area_name() {
-    return $this->control_area_name;
-  }
-
-  /**
-   * Get a static reference to the storage object associated with this model 
object
-   * 
-   * @return the storage object
-   */
-  public static function get_so() {
-    if (self::$so == null) {
-      self::$so = CreateObject('controller.soprocedure');
-    }
-
-    return self::$so;
-  }
-
-  public function serialize() {
-    return array(
-        'id' => $this->get_id(),
-        'title' => $this->get_title(),
-        'description' => $this->get_description(),
-        'purpose' => $this->get_purpose(),
-        'responsibility' => $this->get_responsibility(),
-        'reference' => $this->get_reference(),
-        'attachment' => $this->get_attachment(),
-        'start_date' => $this->get_start_date(),
-        'end_date' => $this->get_end_date(),
-        'procedure_id' => $this->get_procedure_id(),
-        'revision_no' => $this->get_revision_no(),
-        'revision_date' => ($this->get_revision_date()) ? 
date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], 
$this->get_revision_date()) : '',
-        'control_area' => $this->get_control_area_name()
-    );
-  }
-
-  /**
-   * Get a list of the documents associated with this procedure.
-   * 
-   * @return array with controller_document objects, empty array if none, 
never null.
-   */
-  public function get_documents() {
-    return $this->documents;
-  }
-
-  public function set_documents($documents) {
-    $this->documents = $documents;
-  }
-
-  /**
-   * Add a document to this procedure. This method does not check if
-   * object is already added and does not do any db handling.
-   * 
-   * @param $new_document
-   */
-  public function add_document(controller_document $new_document) {
-    $new_document_id = $new_document->get_id();
-    if (!in_array($new_document_id, $this->documents)) {
-      $this->documents[$new_document_id] = $new_document;
-    }
-  }
-
-}
+               public function set_documents($documents)
+               {
+                       $this->documents = $documents;
+               }
+               
+               /**
+                * Add a document to this procedure. This method does not check 
if
+                * object is already added and does not do any db handling.
+                * 
+                * @param $new_document
+                */
+               public function add_document(controller_document $new_document)
+               {
+                       $new_document_id = $new_document->get_id();
+                       if(!in_array($new_document_id,$this->documents))
+                       {
+                               $this->documents[$new_document_id] = 
$new_document;
+                       }
+               }
+       }




reply via email to

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