[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10217] Merge 10166:10210 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10217] Merge 10166:10210 from trunk |
Date: |
Mon, 15 Oct 2012 10:39:18 +0000 |
Revision: 10217
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10217
Author: sigurdne
Date: 2012-10-15 10:39:17 +0000 (Mon, 15 Oct 2012)
Log Message:
-----------
Merge 10166:10210 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/logistic/inc/class.menu.inc.php
branches/Version-1_0-branch/logistic/inc/class.sorequirement.inc.php
branches/Version-1_0-branch/logistic/inc/class.uiallocation.inc.php
branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.requirement.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.requirement_value.inc.php
branches/Version-1_0-branch/logistic/js/logistic/activity.js
branches/Version-1_0-branch/logistic/js/logistic/ajax.js
branches/Version-1_0-branch/logistic/setup/default_records.inc.php
branches/Version-1_0-branch/logistic/setup/phpgw_no.lang
branches/Version-1_0-branch/logistic/setup/setup.inc.php
branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
branches/Version-1_0-branch/logistic/setup/tables_update.inc.php
Added Paths:
-----------
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
branches/Version-1_0-branch/logistic/inc/class.soresource_type_requirement.inc.php
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
branches/Version-1_0-branch/logistic/inc/class.uiresource_type_requirement.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.resource_type_requirement.inc.php
branches/Version-1_0-branch/logistic/js/logistic/resource_type_requirement.js
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_item.xsl
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_item.xsl
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_tabs.xsl
branches/Version-1_0-branch/logistic/templates/base/resource_type_requirement_item.xsl
Removed Paths:
-------------
branches/Version-1_0-branch/logistic/inc/class.sobim_type_requirement.inc.php
branches/Version-1_0-branch/logistic/inc/class.uibim_type_requirement.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.bim_item_type_requirement.inc.php
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_type.inc.php
branches/Version-1_0-branch/logistic/js/logistic/bim_type_requirement.js
branches/Version-1_0-branch/logistic/templates/base/bim_type_requirement_item.xsl
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement.xsl
Modified: branches/Version-1_0-branch/logistic/inc/class.menu.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.menu.inc.php 2012-10-15
10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/inc/class.menu.inc.php 2012-10-15
10:39:17 UTC (rev 10217)
@@ -97,9 +97,9 @@
'text' => lang('Project
types'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'logistic.uiproject.project_types') )
),
- 'bim_type_requirement' => array(
- 'text' => lang('Bim type
requirement'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'logistic.uibim_type_requirement.index') )
+ 'resource_type_requirement' => array(
+ 'text' =>
lang('resource_type_requirement'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'logistic.uiresource_type_requirement.index') )
)
/* 'control_cats' => array
(
Deleted:
branches/Version-1_0-branch/logistic/inc/class.sobim_type_requirement.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/class.sobim_type_requirement.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++
branches/Version-1_0-branch/logistic/inc/class.sobim_type_requirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,188 +0,0 @@
-<?php
-
- /**
- * phpGroupWare - logistic: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <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 logistic
- * @version $Id: class.soproject.inc.php 10111 2012-10-04 08:53:35Z
erikhl $
- */
-
- phpgw::import_class('logistic.socommon');
-
- include_class('logistic', 'bim_item_type_requirement', 'inc/model/');
-
- class logistic_sobim_type_requirement extends logistic_socommon
- {
- protected static $so;
- private $local_db;
-
- public function __construct()
- {
- parent::__construct();
- $this->local_db = clone $this->db;
- }
-
- protected function add(&$object)
- {
- $user_id = $GLOBALS['phpgw_info']['user']['id'];
- $now = time();
- $entity_id = $object->get_entity_id();
- $category_id = $object->get_category_id();
- $cust_attribute_id = $object->get_cust_attribute_id();
- $type_id = $object->get_project_type_id();
-
- $sql = "INSERT INTO lg_bim_item_type_requirement
(entity_id, category_id, cust_attribute_id, project_type_id, create_user,
create_date) VALUES ($entity_id,$category_id,'$cust_attribute_id',$type_id,
$user_id, $now)";
- $result = $this->db->query($sql, __LINE__,__FILE__);
-
- if($result)
- {
- // Set the new bim_item_type_requirement ID
- return
$this->db->get_last_insert_id('lg_bim_item_type_requirement', 'id');
- }
- else
- {
- return 0;
- }
- }
-
- protected function get_id_field_name()
- {
- if(!$extended_info)
- {
- $ret = 'id';
- }
- else
- {
- $ret = array
- (
- 'table' =>
'type_requirement', // alias
- 'field' => 'id',
- 'translated' => 'id'
- );
- }
-
- return $ret;
- }
-
- protected function get_query(string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count)
- {
- $clauses = array('1=1');
-
- /*if($search_for)
- {
- $like_pattern = "'%" .
$this->db->db_addslashes($search_for) . "%'";
- $like_clauses = array();
- switch($search_type)
- {
- default:
- $like_clauses[] =
"{$table_alias}.name $this->like $like_pattern";
- break;
- }
- if(count($like_clauses))
- {
- $clauses[] = '(' . join(' OR ',
$like_clauses) . ')';
- }
- }*/
-
- $filter_clauses = array();
- if(isset($filters[$this->get_id_field_name()]))
- {
- $filter_clauses[] = "type_requirement.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
- }
-
- if(count($filter_clauses))
- {
- $clauses[] = join(' AND ', $filter_clauses);
- }
-
- $condition = join(' AND ', $clauses);
-
- //$joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
-
- $tables = "lg_bim_item_type_requirement
type_requirement";
-
- if($return_count) // We should only return a count
- {
- $cols = 'COUNT(DISTINCT(type_requirement.id))
AS count';
- }
- else
- {
- $cols .= "type_requirement.* ";
- }
-
- $dir = $ascending ? 'ASC' : 'DESC';
- $order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
-
- //var_dump("SELECT {$cols} FROM {$tables} {$joins}
WHERE {$condition} {$order}");
-
- return "SELECT {$cols} FROM {$tables} WHERE
{$condition} {$order}";
- }
-
- protected function populate(int $req_id,
&$bim_item_type_requirement)
- {
- if($bim_item_type_requirement == null)
- {
- $bim_item_type_requirement = new
logistic_bim_item_type_requirement((int) $req_id);
-
-
$bim_item_type_requirement->set_entity_id($this->unmarshal($this->db->f('entity_id'),
'int'));
-
$bim_item_type_requirement->set_category_id($this->unmarshal($this->db->f('category_id'),
'int'));
-
$bim_item_type_requirement->set_cust_attribute_id($this->unmarshal($this->db->f('cust_attribute_id'),
'string'));
-
$bim_item_type_requirement->set_project_type_id($this->unmarshal($this->db->f('project_type_id'),
'int'));
- }
-
- return $bim_item_type_requirement;
- }
-
- protected function update($object)
- {
- $id = intval($object->get_id());
-
- $values = array(
- 'entity_id = ' .
$this->marshal($object->get_entity_id(), 'int'),
- 'category_id = ' .
$this->marshal($object->get_category_id(), 'int'),
- 'cust_attribute_id = ' .
$this->marshal($object->get_cust_attribute_id(), 'string'),
- 'project_type_id = ' .
$this->marshal($object->get_project_type_id(), 'int')
- );
-
- $result = $this->db->query('UPDATE
lg_bim_item_type_requirement SET ' . join(',', $values) . " WHERE id=$id",
__LINE__,__FILE__);
-
- if( $result )
- {
- return $id;
- }
- else
- {
- return 0;
- }
- }
-
- public static function get_instance()
- {
- if (self::$so == null)
- {
- self::$so =
CreateObject('logistic.sobim_type_requirement');
- }
- return self::$so;
- }
- }
Modified: branches/Version-1_0-branch/logistic/inc/class.sorequirement.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.sorequirement.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/inc/class.sorequirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -35,11 +35,65 @@
{
protected static $so;
- protected function add(&$object)
+ protected function add(&$requirement)
{
+ $cols = array(
+ 'activity_id',
+ 'start_date',
+ 'end_date',
+ 'no_of_elements',
+ 'location_id',
+ 'create_user',
+ 'create_date'
+ );
+ $values = array(
+ $this->marshal($requirement->get_activity_id(),
'int'),
+ $this->marshal($requirement->get_start_date(),
'int'),
+ $this->marshal($requirement->get_end_date(),
'int'),
+ $this->marshal($requirement->get_no_of_items(),
'int'),
+ $this->marshal($requirement->get_location_id(),
'int'),
+ $this->marshal($requirement->get_create_user(),
'int'),
+ $this->marshal(strtotime('now'), 'int')
+ );
+
+ $sql = 'INSERT INTO lg_requirement (' . join(',',
$cols) . ') VALUES (' . join(',', $values) . ')';
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if($result)
+ {
+ return
$this->db->get_last_insert_id('lg_requirement', 'id');
+ }
+ else
+ {
+ return 0;
+ }
}
+ protected function update($requirement)
+ {
+ $id = intval($requirement->get_id());
+
+ $values = array(
+ 'activity_id=' .
$this->marshal($requirement->get_activity_id(), 'int'),
+ 'start_date=' .
$this->marshal($requirement->get_start_date(), 'int'),
+ 'end_date=' .
$this->marshal($requirement->get_end_date(), 'int'),
+ 'no_of_elements=' .
$this->marshal($requirement->get_no_of_items(), 'int'),
+ 'location_id=' .
$this->marshal($requirement->get_location_id(), 'int')
+ );
+
+ $result = $this->db->query('UPDATE lg_requirement SET '
. join(',', $values) . " WHERE id=$id", __LINE__,__FILE__);
+
+ if($result)
+ {
+ return $id;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
protected function get_id_field_name()
{
if(!$extended_info)
@@ -112,8 +166,6 @@
$dir = $ascending ? 'ASC' : 'DESC';
$order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
- //var_dump("SELECT {$cols} FROM {$tables} {$joins}
WHERE {$condition} {$order}");
-
return "SELECT {$cols} FROM {$tables} {$joins} WHERE
{$condition} {$order}";
}
@@ -124,18 +176,15 @@
$requirement = new logistic_requirement((int)
$requirement_id);
$requirement->set_activity_id($this->unmarshal($this->db->f('activity_id'),
'int'));
-
$requirement->set_date_from($this->unmarshal($this->db->f('date_from'), 'int'));
-
$requirement->set_date_to($this->unmarshal($this->db->f('date_to'), 'int'));
+
$requirement->set_start_date($this->unmarshal($this->db->f('start_date'),
'int'));
+
$requirement->set_end_date($this->unmarshal($this->db->f('end_date'), 'int'));
+
$requirement->set_no_of_items($this->unmarshal($this->db->f('no_of_elements'),
'int'));
+
$requirement->set_location_id($this->unmarshal($this->db->f('location_id'),
'int'));
}
return $requirement;
}
- protected function update($object)
- {
-
- }
-
public static function get_instance()
{
if (self::$so == null)
Copied:
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
(from rev 10210,
trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php)
===================================================================
---
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
(rev 0)
+++
branches/Version-1_0-branch/logistic/inc/class.sorequirement_resource_allocation.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,143 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id: class.soproject.inc.php 10111 2012-10-04 08:53:35Z
erikhl $
+ */
+
+ phpgw::import_class('logistic.socommon');
+
+ include_class('logistic', 'requirement_resource_allocation',
'inc/model/');
+
+ class logistic_sorequirement_resource_allocation extends
logistic_socommon
+ {
+ protected static $so;
+ private $local_db;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->local_db = clone $this->db;
+ }
+
+ protected function add(&$object)
+ {
+
+ }
+
+ protected function get_id_field_name()
+ {
+
+ }
+
+ protected function get_query(string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count)
+ {
+ $clauses = array('1=1');
+
+ /*if($search_for)
+ {
+ $like_pattern = "'%" .
$this->db->db_addslashes($search_for) . "%'";
+ $like_clauses = array();
+ switch($search_type)
+ {
+ default:
+ $like_clauses[] =
"{$table_alias}.name $this->like $like_pattern";
+ break;
+ }
+ if(count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ',
$like_clauses) . ')';
+ }
+ }*/
+
+ $filter_clauses = array();
+ if(isset($filters[$this->get_id_field_name()]))
+ {
+ $filter_clauses[] = "allocation.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ }
+ if(isset($filters['location_id']))
+ {
+ $filter_clauses[] = "allocation.location_id =
{$this->marshal($filters['location_id'],'int')}";
+ }
+ if(isset($filters['requirement_id']))
+ {
+ $filter_clauses[] = "allocation.requirement_id
= {$this->marshal($filters['requirement_id'],'int')}";
+ }
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ //$joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
+
+ $tables = "lg_requirement_resource_allocation
allocation";
+
+ if($return_count) // We should only return a count
+ {
+ $cols = 'COUNT(DISTINCT(allocation.id)) AS
count';
+ }
+ else
+ {
+ $cols .= "allocation.* ";
+ }
+
+ $dir = $ascending ? 'ASC' : 'DESC';
+ $order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
+
+ return "SELECT {$cols} FROM {$tables} WHERE
{$condition} {$order}";
+ }
+
+ protected function populate(int $allocation_id, &$allocation)
+ {
+ if($allocation == null)
+ {
+ $allocation = new
logistic_requirement_resource_allocation((int) $allocation_id);
+
+
$allocation->set_location_id($this->unmarshal($this->db->f('location_id'),
'int'));
+
$allocation->set_requirement_id($this->unmarshal($this->db->f('requirement_id'),
'string'));
+
$allocation->set_resource_id($this->unmarshal($this->db->f('resource_id'),
'int'));
+ }
+
+ return $allocation;
+ }
+
+ protected function update($object)
+ {
+
+ }
+
+ public static function get_instance()
+ {
+ if (self::$so == null)
+ {
+ self::$so =
CreateObject('logistic.sorequirement_resource_allocation');
+ }
+ return self::$so;
+ }
+ }
\ No newline at end of file
Copied:
branches/Version-1_0-branch/logistic/inc/class.soresource_type_requirement.inc.php
(from rev 10210, trunk/logistic/inc/class.soresource_type_requirement.inc.php)
===================================================================
---
branches/Version-1_0-branch/logistic/inc/class.soresource_type_requirement.inc.php
(rev 0)
+++
branches/Version-1_0-branch/logistic/inc/class.soresource_type_requirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,234 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id: class.soproject.inc.php 10111 2012-10-04 08:53:35Z
erikhl $
+ */
+
+ phpgw::import_class('logistic.socommon');
+
+ include_class('logistic', 'resource_type_requirement', 'inc/model/');
+
+ class logistic_soresource_type_requirement extends logistic_socommon
+ {
+ protected static $so;
+ private $local_db;
+
+ public function __construct()
+ {
+ parent::__construct();
+ $this->local_db = clone $this->db;
+ }
+
+ protected function add(&$object)
+ {
+ $user_id = $GLOBALS['phpgw_info']['user']['id'];
+ $now = time();
+ $location_id = $object->get_location_id();
+ $cust_attribute_id = $object->get_cust_attribute_id();
+ $type_id = $object->get_project_type_id();
+
+ $sql = "INSERT INTO lg_resource_type_requirement
(location_id, cust_attribute_id, project_type_id, create_user, create_date)
VALUES ($location_id,$cust_attribute_id,$type_id, $user_id, $now)";
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if($result)
+ {
+ // Set the new bim_item_type_requirement ID
+ return
$this->db->get_last_insert_id('lg_resource_type_requirement', 'id');
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ protected function get_id_field_name()
+ {
+ if(!$extended_info)
+ {
+ $ret = 'id';
+ }
+ else
+ {
+ $ret = array
+ (
+ 'table' =>
'type_requirement', // alias
+ 'field' => 'id',
+ 'translated' => 'id'
+ );
+ }
+
+ return $ret;
+ }
+
+ protected function get_query(string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count)
+ {
+ $clauses = array('1=1');
+
+ /*if($search_for)
+ {
+ $like_pattern = "'%" .
$this->db->db_addslashes($search_for) . "%'";
+ $like_clauses = array();
+ switch($search_type)
+ {
+ default:
+ $like_clauses[] =
"{$table_alias}.name $this->like $like_pattern";
+ break;
+ }
+ if(count($like_clauses))
+ {
+ $clauses[] = '(' . join(' OR ',
$like_clauses) . ')';
+ }
+ }*/
+
+ $filter_clauses = array();
+ if(isset($filters[$this->get_id_field_name()]))
+ {
+ $filter_clauses[] = "type_requirement.id =
{$this->marshal($filters[$this->get_id_field_name()],'int')}";
+ }
+ if(isset($filters['location_id']))
+ {
+ $filter_clauses[] =
"type_requirement.location_id =
{$this->marshal($filters['location_id'],'int')}";
+ }
+ if(isset($filters['project_type_id']))
+ {
+ $filter_clauses[] =
"type_requirement.project_type_id =
{$this->marshal($filters['project_type_id'],'int')}";
+ }
+
+ if(count($filter_clauses))
+ {
+ $clauses[] = join(' AND ', $filter_clauses);
+ }
+
+ $condition = join(' AND ', $clauses);
+
+ //$joins = " {$this->left_join} controller_control_area
ON (controller_procedure.control_area_id = controller_control_area.id)";
+
+ $tables = "lg_resource_type_requirement
type_requirement";
+
+ if($search_type && $search_type ==
'resource_type_requirement_list')
+ {
+ if($return_count) // We should only return a
count
+ {
+ $cols =
'COUNT(DISTINCT(type_requirement.location_id,
type_requirement.project_type_id)) AS count';
+ }
+ else
+ {
+ $cols .=
"DISTINCT(type_requirement.location_id, type_requirement.project_type_id) as
id, (type_requirement.location_id * type_requirement.project_type_id) as id,
type_requirement.location_id, type_requirement.project_type_id ";
+ }
+ }
+ else
+ {
+ if($return_count) // We should only return a
count
+ {
+ $cols =
'COUNT(DISTINCT(type_requirement.id)) AS count';
+ }
+ else
+ {
+ $cols .= "type_requirement.* ";
+ }
+ }
+
+ $dir = $ascending ? 'ASC' : 'DESC';
+ $order = $sort_field ? "ORDER BY
{$this->marshal($sort_field, 'field')} $dir ": '';
+
+ return "SELECT {$cols} FROM {$tables} WHERE
{$condition} {$order}";
+ }
+
+ protected function populate(int $req_id,
&$resource_type_requirement)
+ {
+ if($resource_type_requirement == null)
+ {
+ $resource_type_requirement = new
logistic_resource_type_requirement((int) $req_id);
+
+
$resource_type_requirement->set_location_id($this->unmarshal($this->db->f('location_id'),
'int'));
+
$resource_type_requirement->set_cust_attribute_id($this->unmarshal($this->db->f('cust_attribute_id'),
'string'));
+
$resource_type_requirement->set_project_type_id($this->unmarshal($this->db->f('project_type_id'),
'int'));
+ }
+
+ return $resource_type_requirement;
+ }
+
+ protected function update($object)
+ {
+ $id = intval($object->get_id());
+
+ $values = array(
+ 'location_id = ' .
$this->marshal($object->get_location_id(), 'int'),
+ 'cust_attribute_id = ' .
$this->marshal($object->get_cust_attribute_id(), 'int'),
+ 'project_type_id = ' .
$this->marshal($object->get_project_type_id(), 'int')
+ );
+
+ $result = $this->db->query('UPDATE
lg_resource_type_requirement SET ' . join(',', $values) . " WHERE id=$id",
__LINE__,__FILE__);
+
+ if( $result )
+ {
+ return $id;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ public function delete($object)
+ {
+ $sql = "DELETE FROM lg_resource_type_requirement where
id={$object->get_id()}";
+ $result = $this->db->query($sql, __LINE__,__FILE__);
+
+ if( $result )
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ public static function get_instance()
+ {
+ if (self::$so == null)
+ {
+ self::$so =
CreateObject('logistic.soresource_type_requirement');
+ }
+ return self::$so;
+ }
+
+ public function get_selected_attributes($location_id,
$project_type_id)
+ {
+ $attributes = array();
+ $sql = "SELECT cust_attribute_id FROM
lg_resource_type_requirement where location_id={$location_id} AND
project_type_id={$project_type_id}";
+ $this->local_db->query($sql, __LINE__, __FILE__);
+
+ while ($this->local_db->next_record())
+ {
+ $attributes[] =
$this->local_db->f('cust_attribute_id');
+ }
+
+ return $attributes;
+ }
+ }
Modified: branches/Version-1_0-branch/logistic/inc/class.uiallocation.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uiallocation.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/inc/class.uiallocation.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -28,8 +28,10 @@
* @version $Id: class.uiactivity.inc.php 10101 2012-10-03 09:46:51Z
vator $
*/
phpgw::import_class('phpgwapi.uicommon');
-
+ phpgw::import_class('logistic.soactivity');
+ include_class('logistic', 'activity');
+
class logistic_uiallocation extends phpgwapi_uicommon
{
@@ -44,8 +46,8 @@
private $bo;
private $bocommon;
-
- private $so;
+ private $so_activity;
+
public $public_functions = array(
'query' => true,
'add' => true,
@@ -60,8 +62,9 @@
$this->bo =
CreateObject('property.bolocation',true);
$this->bocommon = &
$this->bo->bocommon;
- $this->so_control =
CreateObject('controller.socontrol');
+ $this->so_activity =
createObject('logistic.soactivity');
+
$this->type_id =
$this->bo->type_id;
$this->start =
$this->bo->start;
@@ -177,19 +180,8 @@
$boentity->results = $results;
//$values =
$boentity->read(array('control_registered' => $control_registered, 'control_id'
=> $control_id));
$values = $boentity->read();
- //}
+ //}
- foreach($values as &$entry)
- {
- $checked = '';
-
if($this->so_control->check_control_component($control_id,$location_id,$entry['id']))
- {
- $checked = 'checked = "checked"
disabled = "disabled"';
- $entry['delete'] = "<input class
=\"mychecks_delete\" type =\"checkbox\" name=\"values[delete][]\"
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
- }
- $entry['select'] = "<input class
=\"mychecks_add\" type =\"checkbox\" $checked
name=\"values[register_component][]\"
value=\"{$control_id}_{$location_id}_{$entry['id']}\">";
- }
-
$results = $results ? $results :
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
$result_data = array('results' => $values);
@@ -214,7 +206,7 @@
if ($activity_id && is_numeric($activity_id))
{
- $activity = $this->so->get_single($activity_id);
+ $activity =
$this->so_activity->get_single($activity_id);
}
if (isset($_POST['save_allocation']))
@@ -225,24 +217,22 @@
$allocation->set_article_id(phpgw::get_var('article_id'));
$allocation->set_type(phpgw::get_var('type'));
- $allocation_id = $this->so->store($allocation);
+ // $allocation_id = $this->so->store($allocation);
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiallocation.view', 'id' => $allocation_id));
}
else if (isset($_POST['cancel_allocation']))
{
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiallocation.view', 'id' => $requirement_id));
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiallocation.view', 'id' => $allocation_id));
}
else
{
$accounts =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
- $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
$data = array
(
'editable' => true,
- 'entity_list' => $entity_list
);
if($activity_id > 0)
@@ -250,11 +240,7 @@
$data['activity'] = $activity;
}
-
$GLOBALS['phpgw']->jqcal->add_listener('start_date');
-
$GLOBALS['phpgw']->jqcal->add_listener('end_date');
-
- self::add_javascript('logistic', 'logistic',
'bim_type_requirement.js');
-
self::render_template_xsl(array('requirement/requirement'), $data);
+
self::render_template_xsl(array('allocation/allocation_item'), $data);
}
}
Deleted:
branches/Version-1_0-branch/logistic/inc/class.uibim_type_requirement.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/class.uibim_type_requirement.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++
branches/Version-1_0-branch/logistic/inc/class.uibim_type_requirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,384 +0,0 @@
-<?php
-
- /**
- * phpGroupWare - logistic: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <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 logistic
- * @version $Id$
- */
-
- phpgw::import_class('phpgwapi.jquery');
- phpgw::import_class('phpgwapi.uicommon');
- phpgw::import_class('logistic.soproject');
-
- include_class('logistic', 'project');
-
- class logistic_uibim_type_requirement extends phpgwapi_uicommon
- {
-
- private $so;
- private $so_project;
- public $public_functions = array(
-
- 'query' => true,
- 'index' => true,
- 'edit' => true,
- 'add' => true,
- 'view' => true,
- 'get_bim_level1' => true,
- 'get_bim_level2' => true
- );
-
- public function __construct()
- {
- parent::__construct();
-
- $this->so =
CreateObject('logistic.sobim_type_requirement');
- $this->so_project = CreateObject('logistic.soproject');
-
- $read = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_READ, 'logistic');//1
- $add = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_ADD, 'logistic');//2
- $edit = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_EDIT, 'logistic');//4
- $delete = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_DELETE, 'logistic');//8
-
- $manage = $GLOBALS['phpgw']->acl->check('.project',
16, 'logistic');//16
-
- $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::logistic::bim_type_requirement";
- }
-
- public function query()
- {
- $params = array(
- 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
- 'results' => phpgw::get_var('results', 'int',
'REQUEST', null),
- 'query' => phpgw::get_var('query'),
- 'sort' => phpgw::get_var('sort'),
- 'dir' => phpgw::get_var('dir'),
- 'filters' => $filters
- );
-
- if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
- {
- $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
- }
- else
- {
- $user_rows_per_page = 10;
- }
- // YUI variables for paging and sorting
- $start_index = phpgw::get_var('startIndex', 'int');
- $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
- $sort_field = phpgw::get_var('sort');
- $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
- // Form variables
- $search_for = phpgw::get_var('query');
- $search_type = phpgw::get_var('search_option');
- // Create an empty result set
- $result_objects = array();
- $result_count = 0;
-
- $exp_param = phpgw::get_var('export');
- $export = false;
- if (isset($exp_param))
- {
- $export = true;
- $num_of_objects = null;
- }
-
- //Retrieve the type of query and perform type specific
logic
- $query_type = phpgw::get_var('type');
- //var_dump($query_type);
- switch ($query_type)
- {
- default: // ... all composites, filters (active
and vacant)
- $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
- $object_count =
$this->so->get_count($search_for, $search_type, $filters);
- break;
- }
- //var_dump($result_objects);
- //Create an empty row set
- $rows = array();
- foreach ($result_objects as $result)
- {
- if (isset($result))
- {
- $rows[] = $result->serialize();
- }
- }
-
- // ... add result data
- $result_data = array('results' => $rows);
-
- $result_data['total_records'] = $object_count;
- $result_data['start'] = $params['start'];
- $result_data['sort'] = $params['sort'];
- $result_data['dir'] = $params['dir'];
-
- $editable = phpgw::get_var('editable') == 'true' ? true
: false;
-
- if (!$export)
- {
- //Add action column to each row in result table
- array_walk(
-
$result_data['results'], array($this, '_add_links'),
"logistic.uibim_type_requirement.view");
- }
- return $this->yui_results($result_data);
- }
-
- public function index()
- {
- if (phpgw::get_var('phpgw_return_as') == 'json')
- {
- return $this->query();
- }
-
- self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
- phpgwapi_yui::load_widget('datatable');
- phpgwapi_yui::load_widget('paginator');
-
- $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
-
- $data = array(
- 'datatable_name' =>
lang('bim_type_requirement'),
- 'form' => array(
- 'toolbar' => array(
- 'item' => array(
- array('type' =>
'filter',
- 'name' =>
'entity_type',
- 'text' =>
lang('Entity types') . ':',
- 'list' =>
$entity_list,
- ),
- array('type' => 'text',
- 'text' =>
lang('search'),
- 'name' =>
'query'
- ),
- array(
- 'type' =>
'submit',
- 'name' =>
'search',
- 'value' =>
lang('Search')
- ),
- array(
- 'type' =>
'link',
- 'value' =>
lang('t_new_type_requirement'),
- 'href' =>
self::link(array('menuaction' => 'logistic.uibim_type_requirement.add')),
- 'class' =>
'new_item'
- ),
- ),
- ),
- ),
- 'datatable' => array(
- 'source' =>
self::link(array('menuaction' => 'logistic.uibim_type_requirement.index',
'phpgw_return_as' => 'json')),
- 'field' => array(
- array(
- 'key' => 'id',
- 'label' => lang('ID'),
- 'sortable' => true,
- 'formatter' =>
'YAHOO.portico.formatLink'
- ),
- array(
- 'key' => 'entity_label',
- 'label' =>
lang('Entity'),
- 'sortable' => true
- ),
- array(
- 'key' =>
'category_label',
- 'label' =>
lang('Category'),
- 'sortable' => true
- ),
- array(
- 'key' =>
'project_type_label',
- 'label' =>
lang('Project_type'),
- 'sortable' => true
- ),
- array(
- 'key' => 'link',
- 'hidden' => true
- )
- )
- ),
- );
-
- self::render_template_xsl('datatable_common', $data);
- }
-
- public function add()
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.edit'));
- }
-
- public function edit()
- {
- $entity_so =
CreateObject('property.soadmin_entity');
- $custom = createObject('phpgwapi.custom_fields');
- $req_type_id = phpgw::get_var('id');
- if($req_type_id && is_numeric($req_type_id))
- {
- $req_type = $this->so->get_single($req_type_id);
- }
- else
- {
- $req_type = new
logistic_bim_item_type_requirement();
- }
-
- if (isset($_POST['save']))
- {
-
$req_type->set_entity_id(phpgw::get_var('entity_id'));
-
$req_type->set_category_id(phpgw::get_var('category_id'));
-
$req_type->set_project_type_id(phpgw::get_var('project_type_id'));
- $cust_attr_ids = phpgw::get_var('attributes');
- $req_type->set_cust_attribute_id(implode(',',
$cust_attr_ids));
-
- $req_type_id = $this->so->store($req_type);
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.view', 'id' =>
$req_type_id));
- }
- else if (isset($_POST['cancel']))
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.view', 'id' =>
$req_type_id));
- }
- else
- {
- $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
-
- array_unshift($entity_list,array
('id'=>'','name'=> lang('select value')));
- if($req_type->get_entity_id())
- {
- foreach ($entity_list as &$e)
- {
- if($e['id'] ==
$req_type->get_entity_id())
- {
- $e['selected'] = 1;
- }
- }
- $category_list =
$entity_so->read_category(array('allrows'=>true,'entity_id'=>$req_type->get_entity_id()));
- foreach ($category_list as &$c)
- {
- if($c['id'] ==
$req_type->get_category_id())
- {
- $c['selected'] = 1;
- }
- }
-
- $attributes =
$custom->find('property',".entity.{$req_type->get_entity_id()}.{$req_type->get_category_id()}",
0, '','','',true, true);
- $selected_attributes = explode(',',
$req_type->get_cust_attribute_id());
- foreach ($attributes as &$a)
- {
- if(in_array($a['id'],
$selected_attributes))
- {
- $a['checked'] =
'checked';
- }
- }
- }
- $project_type_array =
$this->so_project->get_project_types($req_type->get_project_type_id());
-
- $data = array
- (
- 'value_id' => !empty($req_type)
? $req_type->get_id() : 0,
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'entities' => $entity_list,
- 'categories' => $category_list,
- 'attributes' => $attributes,
- 'project_types' =>
$project_type_array,
- 'editable' => true,
- 'req_type' => $req_type
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
-
- phpgwapi_jquery::load_widget('core');
-
- self::add_javascript('logistic', 'logistic',
'bim_type_requirement.js');
-
self::render_template_xsl(array('bim_type_requirement_item'), $data);
- }
- }
-
- public function get_bim_level1()
- {
- $entity_id = phpgw::get_var('entity_id');
- $entity =
CreateObject('property.soadmin_entity');
-
- $category_list =
$entity->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
-
- return $category_list;
- }
-
- public function get_bim_level2()
- {
- $custom = createObject('phpgwapi.custom_fields');
- $entity_id = phpgw::get_var('entity_id');
- $cat_id = phpgw::get_var('cat_id');
-
- $attrib_data =
$custom->find('property',".entity.{$entity_id}.{$cat_id}", 0, '','','',true,
true);
-
- return $attrib_data;
- }
-
- public function view()
- {
- $entity_so =
CreateObject('property.soadmin_entity');
- $custom = createObject('phpgwapi.custom_fields');
- $req_type_id = phpgw::get_var('id');
- if(isset($_POST['edit']))
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.edit', 'id' =>
$req_type_id));
- }
-
- if($req_type_id && is_numeric($req_type_id))
- {
- $req_type = $this->so->get_single($req_type_id);
- $entity =
$entity_so->read_single($req_type->get_entity_id());
- $category =
$entity_so->read_single_category($req_type->get_entity_id(),$req_type->get_category_id());
- $all_attributes =
$custom->find('property',".entity.{$req_type->get_entity_id()}.{$req_type->get_category_id()}",
0, '','','',true, true);
- $attributes = array();
- $selected_attributes = explode(',',
$req_type->get_cust_attribute_id());
- foreach ($all_attributes as $attr)
- {
- if(in_array($attr['id'],
$selected_attributes))
- {
- $attributes[] = $attr;
- }
- }
-
- $objects = $this->so_project->get(null, null,
null, null, null, 'project_type', array('id' =>
$req_type->get_project_type_id()));
- if (count($objects) > 0)
- {
- $keys = array_keys($objects);
- $project_type = $objects[$keys[0]];
- }
-
- $data = array
- (
- 'value_id' => !empty($req_type)
? $req_type->get_id() : 0,
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'req_type' => $req_type,
- 'entity' => $entity,
- 'category' => $category,
- 'attributes' => $attributes,
- 'project_type' => $project_type
- );
-
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
-
self::render_template_xsl(array('bim_type_requirement_item'), $data);
- }
- }
- }
Modified: branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/inc/class.uirequirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -30,21 +30,22 @@
phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('logistic.sorequirement');
+ phpgw::import_class('logistic.soactivity');
include_class('logistic', 'requirement');
+ phpgw::import_class('phpgwapi.datetime');
-
class uirequirement extends phpgwapi_uicommon
{
private $so;
-
+ private $so_activity;
+
public $public_functions = array(
'query' => true,
'index' => true,
'add' => true,
'edit' => true,
- 'view' => true,
- 'test' => true
+ 'view' => true
);
public function __construct()
@@ -52,6 +53,7 @@
parent::__construct();
$this->so = CreateObject('logistic.sorequirement');
+ $this->so_activity =
CreateObject('logistic.soactivity');
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
"logistic::project::requirement";
}
@@ -102,6 +104,7 @@
//Retrieve the type of query and perform type specific
logic
$query_type = phpgw::get_var('type');
//var_dump($query_type);
+
switch ($query_type)
{
default: // ... all composites, filters (active
and vacant)
@@ -178,46 +181,33 @@
'sortable' => true,
),
array(
- 'key' => 'date_from',
- 'label' => lang('From
date'),
+ 'key' => 'start_date',
+ 'label' => lang('Start
date'),
'sortable' => false
),
array(
- 'key' => 'date_to',
- 'label' => lang('To
date'),
+ 'key' => 'end_date',
+ 'label' => lang('End
date'),
'sortable' => false
),
array(
+ 'key' => 'no_of_items',
+ 'label' => lang('No of
items'),
+ 'sortable' => false
+ ),
+ array(
+ 'key' => 'location_id',
+ 'label' =>
lang('Resource type'),
+ 'sortable' => false
+ ),
+ array(
'key' => 'link',
'hidden' => true
)
)
),
- );
+ );
- $parameters = array
- (
- 'parameter' => array
- (
- array
- (
- 'name' =>
'requirement_id',
- 'source' => 'id'
- ),
- )
- );
-
- $data['datatable']['actions'][] = array
- (
- 'my_name' =>
'book_requirement',
- 'text' =>
lang('t_book_requirement'),
- 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
- (
- 'menuaction' =>
'logistic.uiallocation.add'
- )),
- 'parameters' =>
json_encode($parameters)
- );
-
self::render_template_xsl('datatable_common', $data);
}
@@ -236,24 +226,19 @@
$requirement =
$this->so->get_single($requirement_id);
}
- $requirement_array = $requirement->toArray();
-
- if ($this->flash_msgs)
- {
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
- $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
- }
-
+ $location_info =
$GLOBALS['phpgw']->locations->get_name($requirement->get_location_id());
+ echo $requirement->get_location_id();
+ print_r($location_info);
$data = array
(
'value_id' => !empty($requirement) ?
$requirement->get_id() : 0,
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'project' => $requirement_array,
+ 'requirement' => $requirement,
+ 'location' => $location_info,
'view' => 'view_requirement'
);
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project') . '::' . lang('Requirement');
-
self::render_template_xsl(array('requirement_item'), $data);
+
self::render_template_xsl(array('requirement/requirement_item'), $data);
}
}
@@ -264,20 +249,36 @@
public function edit()
{
+ $requirement_id = phpgw::get_var('id');
$activity_id = phpgw::get_var('activity_id');
- $requirement_id = phpgw::get_var('id');
+
+ if ($requirement_id && is_numeric($requirement_id))
+ {
+ $requirement =
$this->so->get_single($requirement_id);
+ }
+ else
+ {
+ $requirement = new logistic_requirement();
+ }
if ($activity_id && is_numeric($activity_id))
{
- $activity = $this->so->get_single($activity_id);
+ $activity =
$this->so_activity->get_single($activity_id);
}
if (isset($_POST['save_requirement']))
{
$requirement->set_id( phpgw::get_var('id') );
- $requirement->set_resource_type_id(
phpgw::get_var('categories') );
- $requirement->set_no_of_elements(
phpgw::get_var('no_of_elements') );
+ $requirement->set_activity_id(
phpgw::get_var('activity_id') );
+ $requirement->set_no_of_items(
phpgw::get_var('no_of_items') );
+
+ $entity_id = phpgw::get_var('entity_id');
+ $category_id = phpgw::get_var('category_id');
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property',".entity.{$entity_id}.{$category_id}");
+
+ $requirement->set_location_id($location_id);
+
if(phpgw::get_var('start_date','string') != '')
{
$start_date_ts =
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('start_date','string') );
@@ -297,9 +298,11 @@
{
$requirement->set_end_date(0);
}
-
+
+ $user_id = $GLOBALS['phpgw_info']['user']['id'];
+ $requirement->set_create_user($user_id);
+
$requirement_id =
$this->so->store($requirement);
-
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement.view', 'id' => $requirement_id));
}
else if (isset($_POST['cancel_requirement']))
@@ -312,8 +315,17 @@
$entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
+ $location_id = $requirement->get_location_id();
+
+ $system_location =
$GLOBALS['phpgw']->locations->get_name($location_id);
+ print_r($system_location);
+ $location_info =
$GLOBALS['phpgw']->locations->read($location_id);
+
+ print_r($location_info);
+
$data = array
(
+ 'requirement' => $requirement,
'editable' => true,
'entity_list' => $entity_list
);
@@ -326,29 +338,8 @@
$GLOBALS['phpgw']->jqcal->add_listener('start_date');
$GLOBALS['phpgw']->jqcal->add_listener('end_date');
- self::add_javascript('logistic', 'logistic',
'bim_type_requirement.js');
-
self::render_template_xsl(array('requirement/requirement'), $data);
+ self::add_javascript('logistic', 'logistic',
'resource_type_requirement.js');
+
self::render_template_xsl(array('requirement/requirement_item'), $data);
}
}
-
- public function test()
- {
- $custom = createObject('phpgwapi.custom_fields');
- $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
-
- _debug_array($entity_list);
-
- foreach($entity_list as $entry)
- {
- $cat_list =
execMethod('property.soadmin_entity.read_category',(array('allrows'=>true,'entity_id'=>$entry['id'])));
- _debug_array($cat_list);
-
- foreach($cat_list as $cat)
- {
- $attrib_data =
$custom->find('property',".entity.{$cat['entity_id']}.{$cat[id]}", 0,
'','','',true, true);
- _debug_array($attrib_data);
- }
-
- }
- }
}
Copied:
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
(from rev 10210,
trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php)
===================================================================
---
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
(rev 0)
+++
branches/Version-1_0-branch/logistic/inc/class.uirequirement_resource_allocation.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,470 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id: class.uiactivity.inc.php 10101 2012-10-03 09:46:51Z
vator $
+ */
+ phpgw::import_class('phpgwapi.uicommon');
+ phpgw::import_class('logistic.soactivity');
+ include_class('logistic', 'activity', '/inc/model/');
+ include_class('logistic', 'requirement', '/inc/model/');
+ include_class('logistic', 'requirement_value', '/inc/model/');
+
+
+ class logistic_uirequirement_resource_allocation extends
phpgwapi_uicommon
+ {
+
+ var $cat_id;
+ var $start;
+ var $query;
+ var $sort;
+ var $order;
+ var $filter;
+ var $type_id;
+ var $location_code;
+
+ private $bo;
+ private $bocommon;
+ private $so_activity;
+ private $so_requirement;
+ private $so;
+
+ public $public_functions = array(
+ 'query' => true,
+ 'add' => true,
+ 'edit' => true,
+ 'view' => true,
+ 'index' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->so =
createObject('logistic.sorequirement_resource_allocation');
+ $this->bo =
CreateObject('property.bolocation',true);
+ $this->bocommon = &
$this->bo->bocommon;
+
+ $this->so_activity =
createObject('logistic.soactivity');
+ $this->so_requirement =
createObject('logistic.sorequirement');
+
+ $this->type_id =
$this->bo->type_id;
+
+ $this->start =
$this->bo->start;
+ $this->query =
$this->bo->query;
+ $this->sort =
$this->bo->sort;
+ $this->order =
$this->bo->order;
+ $this->filter =
$this->bo->filter;
+ $this->cat_id =
$this->bo->cat_id;
+ $this->part_of_town_id =
$this->bo->part_of_town_id;
+ $this->district_id =
$this->bo->district_id;
+ $this->status =
$this->bo->status;
+ $this->allrows =
$this->bo->allrows;
+ $this->lookup =
$this->bo->lookup;
+ $this->location_code =
$this->bo->location_code;
+
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"logistic::project::activity";
+ }
+
+ public function index()
+ {
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
+
+ $user_array = $this->get_user_array();
+
+ $data = array(
+ 'datatable_name' => lang('Activity'). '
:: ' . lang('allocation'),
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array('type' =>
'filter',
+ 'name' =>
'user',
+ 'text' =>
lang('Responsible user') . ':',
+ 'list' =>
$user_array,
+ ),
+ array('type' => 'text',
+ 'text' =>
lang('search'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' =>
'logistic.uirequirement_resource_allocation.index', 'phpgw_return_as' =>
'json')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ ),
+ array(
+ 'key' =>
'location_code',
+ 'label' =>
lang('Location code'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'address',
+ 'label' =>
lang('Address'),
+ 'sortable' => false
+ )
+ )
+ ),
+ );
+
+ self::render_template_xsl(array('datatable_common'),
$data);
+ }
+
+ public function query()
+ {
+/* $params = array(
+ 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
+ 'query' => phpgw::get_var('query'),
+ 'sort' => phpgw::get_var('sort'),
+ 'dir' => phpgw::get_var('dir'),
+ 'filters' => $filters
+ );
+
+ $entity_id = phpgw::get_var('entity_id',
'int');
+ $cat_id =
phpgw::get_var('cat_id', 'int');
+ $district_id = phpgw::get_var('district_id',
'int');
+ $part_of_town_id =
phpgw::get_var('part_of_town_id', 'int');
+ $control_id =
phpgw::get_var('control_id', 'int');
+ $results =
phpgw::get_var('results', 'int');
+
+
+ if(!$entity_id && !$cat_id)
+ {
+ $values = array();
+ }
+ else
+ {
+
+ $entity_id = 3;
+ $cat_id = 1;
+ $location_id =
2295;//$GLOBALS['phpgw']->locations->get_id('property',
".entity.{$entity_id}.{$cat_id}");
+ //$boentity =
CreateObject('property.boentity',false, 'entity');
+ $boentity =
CreateObject('property.boentity',false, 'entity', $entity_id, $cat_id);
+ $boentity->results = $results;
+ //$values =
$boentity->read(array('control_registered' => $control_registered, 'control_id'
=> $control_id));
+ $values = $boentity->read();
+ //}
+
+ $results = $results ? $results :
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+
+ $result_data = array('results' => $values);
+
+ $result_data['total_records'] =
$boentity->total_records;
+ $result_data['start'] = $params['start'];
+ $result_data['sort'] = $params['sort'];
+ $result_data['dir'] = $params['dir'];
+
+ return $this->yui_results($result_data);
+ *
+ */
+ $params = array(
+ 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
+ 'results' => phpgw::get_var('results', 'int',
'REQUEST', null),
+ 'query' => phpgw::get_var('query'),
+ 'sort' => phpgw::get_var('sort'),
+ 'dir' => phpgw::get_var('dir'),
+ 'filters' => $filters
+ );
+
+ if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $user_rows_per_page = 10;
+ }
+ // YUI variables for paging and sorting
+ $start_index = phpgw::get_var('startIndex', 'int');
+ $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
+ $sort_field = phpgw::get_var('sort');
+ $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
+ // Form variables
+ $search_for = phpgw::get_var('query');
+ $search_type = phpgw::get_var('search_option');
+ // Create an empty result set
+ $result_objects = array();
+ $result_count = 0;
+
+ $exp_param = phpgw::get_var('export');
+ $export = false;
+ if (isset($exp_param))
+ {
+ $export = true;
+ $num_of_objects = null;
+ }
+
+ //Retrieve the type of query and perform type specific
logic
+ $query_type = phpgw::get_var('type');
+ //var_dump($query_type);
+ switch ($query_type)
+ {
+ default: // ... all composites, filters (active
and vacant)
+ $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
+ $object_count =
$this->so->get_count($search_for, $search_type, $filters);
+ break;
+ }
+ //var_dump($result_objects);
+ //Create an empty row set
+ $rows = array();
+ foreach ($result_objects as $result)
+ {
+ if (isset($result))
+ {
+ $rows[] = $result->serialize();
+ }
+ }
+
+ // ... add result data
+ $result_data = array('results' => $rows);
+
+ $result_data['total_records'] = $object_count;
+ $result_data['start'] = $params['start'];
+ $result_data['sort'] = $params['sort'];
+ $result_data['dir'] = $params['dir'];
+
+ $editable = phpgw::get_var('editable') == 'true' ? true
: false;
+
+ if (!$export)
+ {
+ //Add action column to each row in result table
+ array_walk(
+
$result_data['results'], array($this, '_add_links'),
"logistic.uirequirement_resource_allocation.view");
+ }
+ return $this->yui_results($result_data);
+ }
+
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement_resource_allocation.edit'));
+ }
+
+ public function edit()
+ {
+ $entity_admin_so =
CreateObject('property.soadmin_entity');
+ $entity_so = CreateObject('property.soentity');
+ $custom = createObject('phpgwapi.custom_fields');
+ $activity_id = phpgw::get_var('activity_id');
+ $requirement_id = phpgw::get_var('requirement_id');
+ $allocation_id = phpgw::get_var('id');
+
+ if ($activity_id && is_numeric($activity_id))
+ {
+ $activity =
$this->so_activity->get_single($activity_id);
+ }
+ if($requirement_id && is_numeric($requirement_id))
+ {
+ $requirement =
$this->so_requirement->get_single($requirement_id);
+ }
+ else
+ {
+ $requirement = new logistic_requirement(1);
+ $requirement->set_activity_id($activity_id);
+ $requirement->set_location_id(2295);
+ $requirement->set_no_of_items(1);
+ $requirement_value = new
logistic_requirement_value();
+
$requirement_value->set_bim_type_requirement_id(3);
+ $requirement_value->set_cust_attribute_id(1);
+ $requirement_value->set_requirement_id(1);
+ $requirement_value->set_value(1);
+ }
+ if ($allocation_id && is_numeric($allocation_id))
+ {
+ $allocation =
$this->so->get_single($allocation_id);
+ }
+ else
+ {
+ $allocation = new
logistic_requirement_resource_allocation();
+ }
+
+
+ if (isset($_POST['save_allocation']))
+ {
+
$allocation->set_requirement_id(phpgw::get_var('requirement_id'));
+
$allocation->set_article_id(phpgw::get_var('article_id'));
+ $allocation->set_type(phpgw::get_var('type'));
+
+ // $allocation_id = $this->so->store($allocation);
+
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement_resource_allocation.view', 'id'
=> $allocation_id));
+ }
+ else if (isset($_POST['cancel_allocation']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement_resource_allocation.view', 'id'
=> $allocation_id));
+ }
+ else
+ {
+ $accounts =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
+
+ if($requirement)
+ {
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($requirement->get_location_id());
+ $entity_arr =
explode('.',$loc_arr['location']);
+
+ $entity =
$entity_admin_so->read_single($entity_arr[2]);
+ $category =
$entity_admin_so->read_single_category($entity_arr[2],$entity_arr[3]);
+ $all_attributes =
$custom->find('property',".entity.{$entity_arr[2]}.{$entity_arr[3]}", 0,
'','','',true, true);
+ $attributes = array();
+
+ foreach ($all_attributes as $attr)
+ {
+ if($attr['id'] ==
$requirement_value->get_cust_attribute_id())
+ {
+ $attributes[] = $attr;
+ }
+ }
+
+ $column_name =
$attributes[0]['column_name'];
+ $col_val =
$attributes[0]['choice'][0]['value'];
+ var_dump($col_val);
+ //_debug_array($attributes);
+ $items =
$entity_so->read(array('allrows' => true, 'entity_id' => $entity_arr[2],
'cat_id' => $entity_arr[3]));
+ //_debug_array($items);
+ $list_items = array();
+ foreach ($items as $it)
+ {
+ if($it[$column_name] ==
$col_val)
+ {
+ $list_items[] =
$it;
+ }
+ }
+ //echo $column_value;
+ _debug_array($list_items);
+
+ }
+
+ $data = array
+ (
+ 'editable' => true,
+ );
+
+ if($activity_id > 0)
+ {
+ $data['activity'] = $activity;
+ }
+ //if($requirement_id > 0)
+ //{
+ $data['requirement'] = $requirement;
+ //}
+ $data['requirement_value'] = $requirement_value;
+ $data['attributes'] = $attributes;
+ $data['elements'] = $list_items;
+
+
self::render_template_xsl(array('allocation/allocation_item'), $data);
+ }
+ }
+
+ function convert_to_array($object_list)
+ {
+ $converted_array = array();
+
+ foreach($object_list as $object)
+ {
+ $converted_array[] = $object->toArray();
+ }
+
+ return $converted_array;
+ }
+
+ public function view()
+ {
+ $activity_id = phpgw::get_var('id');
+ $allocation_id = phpgw::get_var('allocation_id');
+ $requirement_id = phpgw::get_var('requirement_id');
+ if (isset($_POST['edit_allocation']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement_resource_allocation.edit', 'id'
=> $activity_id, 'requirement_id' => $requirement_id, 'allocation_id' =>
$allocation_id));
+ }
+ else if (isset($_POST['new_activity']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement_resource_allocation.edit', 'id'
=> $activity_id, 'requirement_id' => $requirement_id));
+ }
+ else
+ {
+ if ($activity_id && is_numeric($activity_id))
+ {
+ $activity =
$this->so->get_single($activity_id);
+ }
+ if ($allocation_id &&
is_numeric($allocation_id))
+ {
+ $allocation =
$this->so->get_single($allocation_id);
+ }
+ if ($requirement_id &&
is_numeric($requirement_id))
+ {
+ $requirement =
$this->so_requirement->get_single($requirement_id);
+ }
+
+ if ($this->flash_msgs)
+ {
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
+ $msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
+ }
+
+ $data = array
+ (
+ 'activity' => $activity,
+ 'allocation' => $allocation,
+ 'requirement' => $requirement,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'dateformat' =>
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project') . '::' . lang('Activity') . '::' .
lang('Allocation');
+
self::render_template_xsl(array('allocation/allocation_item'), $data);
+ }
+ }
+
+ private function get_user_array()
+ {
+ $user_array = array();
+ $user_array[] = array(
+ 'id' => '',
+ 'name' => lang('all_types')
+ );
+ $user_array[] = array(
+ 'id' =>
$GLOBALS['phpgw_info']['user']['account_id'],
+ 'name' => lang('my_activities'),
+ 'selected' => 1
+ );
+
+ return $user_array;
+ }
+ }
Copied:
branches/Version-1_0-branch/logistic/inc/class.uiresource_type_requirement.inc.php
(from rev 10210, trunk/logistic/inc/class.uiresource_type_requirement.inc.php)
===================================================================
---
branches/Version-1_0-branch/logistic/inc/class.uiresource_type_requirement.inc.php
(rev 0)
+++
branches/Version-1_0-branch/logistic/inc/class.uiresource_type_requirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,471 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id$
+ */
+
+ phpgw::import_class('phpgwapi.jquery');
+ phpgw::import_class('phpgwapi.uicommon');
+ phpgw::import_class('logistic.soproject');
+
+ include_class('logistic', 'project');
+
+ class logistic_uiresource_type_requirement extends phpgwapi_uicommon
+ {
+
+ private $so;
+ private $so_project;
+ public $public_functions = array(
+
+ 'query' => true,
+ 'index' => true,
+ 'edit' => true,
+ 'add' => true,
+ 'view' => true,
+ 'get_bim_level1' => true,
+ 'get_bim_level2' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ $this->so =
CreateObject('logistic.soresource_type_requirement');
+ $this->so_project = CreateObject('logistic.soproject');
+
+ $read = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_READ, 'logistic');//1
+ $add = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_ADD, 'logistic');//2
+ $edit = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_EDIT, 'logistic');//4
+ $delete = $GLOBALS['phpgw']->acl->check('.project',
PHPGW_ACL_DELETE, 'logistic');//8
+
+ $manage = $GLOBALS['phpgw']->acl->check('.project',
16, 'logistic');//16
+
+ $GLOBALS['phpgw_info']['flags']['menu_selection'] =
"admin::logistic::resource_type_requirement";
+ }
+
+ public function query()
+ {
+ $params = array(
+ 'start' => phpgw::get_var('startIndex', 'int',
'REQUEST', 0),
+ 'results' => phpgw::get_var('results', 'int',
'REQUEST', null),
+ 'query' => phpgw::get_var('query'),
+ 'sort' => phpgw::get_var('sort'),
+ 'dir' => phpgw::get_var('dir'),
+ 'filters' => $filters
+ );
+
+ if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else
+ {
+ $user_rows_per_page = 10;
+ }
+ // YUI variables for paging and sorting
+ $start_index = phpgw::get_var('startIndex', 'int');
+ $num_of_objects = phpgw::get_var('results', 'int',
'GET', $user_rows_per_page);
+ $sort_field = phpgw::get_var('sort');
+ $sort_ascending = phpgw::get_var('dir') == 'desc' ?
false : true;
+ // Form variables
+ $search_for = phpgw::get_var('query');
+ $search_type = phpgw::get_var('search_option');
+ // Create an empty result set
+ $result_objects = array();
+ $result_count = 0;
+
+ $exp_param = phpgw::get_var('export');
+ $export = false;
+ if (isset($exp_param))
+ {
+ $export = true;
+ $num_of_objects = null;
+ }
+
+ //Retrieve the type of query and perform type specific
logic
+ $query_type = phpgw::get_var('type');
+ //var_dump($query_type);
+ switch ($query_type)
+ {
+ case 'resource_type_requirement_list':
+ $search_type =
'resource_type_requirement_list';
+ $sort_field =
'type_requirement.location_id';
+ $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
+ $object_count =
$this->so->get_count($search_for, $search_type, $filters);
+ break;
+ default: // ... all composites, filters (active
and vacant)
+ $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters);
+ $object_count =
$this->so->get_count($search_for, $search_type, $filters);
+ break;
+ }
+ //var_dump($result_objects);
+ //Create an empty row set
+ $rows = array();
+ foreach ($result_objects as $result)
+ {
+ if (isset($result))
+ {
+ $rows[] = $result->serialize();
+ }
+ }
+
+ // ... add result data
+ $result_data = array('results' => $rows);
+
+ $result_data['total_records'] = $object_count;
+ $result_data['start'] = $params['start'];
+ $result_data['sort'] = $params['sort'];
+ $result_data['dir'] = $params['dir'];
+
+ $editable = phpgw::get_var('editable') == 'true' ? true
: false;
+
+ if (!$export)
+ {
+ //Add action column to each row in result table
+ array_walk(
+
$result_data['results'], array($this, '_add_links'),
"logistic.uiresource_type_requirement.view");
+ }
+ return $this->yui_results($result_data);
+ }
+
+ public function index()
+ {
+ if (phpgw::get_var('phpgw_return_as') == 'json')
+ {
+ return $this->query();
+ }
+
+ self::add_javascript('phpgwapi', 'yahoo',
'datatable.js');
+ phpgwapi_yui::load_widget('datatable');
+ phpgwapi_yui::load_widget('paginator');
+
+ $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
+ array_unshift($entity_list,array ('id'=>'','name'=>
lang('select value')));
+ $data = array(
+ 'datatable_name' =>
lang('resource_type_requirement'),
+ 'form' => array(
+ 'toolbar' => array(
+ 'item' => array(
+ array('type' =>
'filter',
+ 'name' =>
'entity_type',
+ 'text' =>
lang('Entity types') . ':',
+ 'list' =>
$entity_list,
+ ),
+ array('type' => 'text',
+ 'text' =>
lang('search'),
+ 'name' =>
'query'
+ ),
+ array(
+ 'type' =>
'submit',
+ 'name' =>
'search',
+ 'value' =>
lang('Search')
+ ),
+ array(
+ 'type' =>
'link',
+ 'value' =>
lang('t_new_type_requirement'),
+ 'href' =>
self::link(array('menuaction' => 'logistic.uiresource_type_requirement.add')),
+ 'class' =>
'new_item'
+ ),
+ ),
+ ),
+ ),
+ 'datatable' => array(
+ 'source' =>
self::link(array('menuaction' => 'logistic.uiresource_type_requirement.index',
'phpgw_return_as' => 'json', 'type' => 'resource_type_requirement_list')),
+ 'field' => array(
+ array(
+ 'key' => 'id',
+ 'label' => lang('ID'),
+ 'sortable' => false,
+ 'hidden' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'location_id',
+ 'label' => lang('ID'),
+ 'sortable' => true,
+ 'formatter' =>
'YAHOO.portico.formatLink'
+ ),
+ array(
+ 'key' => 'entity_label',
+ 'label' =>
lang('Entity'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' =>
'category_label',
+ 'label' =>
lang('Category'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' =>
'project_type_label',
+ 'label' =>
lang('Project_type'),
+ 'sortable' => true
+ ),
+ array(
+ 'key' => 'link',
+ 'hidden' => true
+ )
+ )
+ ),
+ );
+
+ self::render_template_xsl('datatable_common', $data);
+ }
+
+ public function add()
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiresource_type_requirement.edit'));
+ }
+
+ public function edit()
+ {
+ $entity_so =
CreateObject('property.soadmin_entity');
+ $custom = createObject('phpgwapi.custom_fields');
+ $location_id = phpgw::get_var('location_id');
+ $project_type_id = phpgw::get_var('project_type_id');
+ if($location_id)
+ {
+ $req_types =
$this->so->get(null,null,null,null,null,null,array('location_id' =>
$location_id, 'project_type_id' => $project_type_id));
+ if (count($req_types) > 0)
+ {
+ $keys = array_keys($req_types);
+ $req_type =
$req_types[$keys[0]];
+ }
+ }
+ else
+ {
+ $req_type = new
logistic_resource_type_requirement();
+ }
+
+ if (isset($_POST['save']))
+ {
+ $entity_id = phpgw::get_var('entity_id');
+ $category_id = phpgw::get_var('category_id');
+ $location_id =
$GLOBALS['phpgw']->locations->get_id('property',".entity.{$entity_id}.{$category_id}");
+ $req_type->set_location_id($location_id);
+
$req_type->set_project_type_id(phpgw::get_var('project_type_id'));
+ $cust_attr_ids = phpgw::get_var('attributes');
+ $selected_attributes[] = array();
+
+ $req_type_array =
$this->so->get(null,null,null,null,null,null,array('location_id' =>
$location_id, 'project_type_id' => $project_type_id));
+ $req_types_for_delete = array();
+ $new_req_types = array();
+ if (count($req_type_array) > 0)
+ {
+ foreach ($req_type_array as $rt)
+ {
+
if(!in_array($rt->get_cust_attribute_id(), $cust_attr_ids))
+ {
+ $req_types_for_delete[]
= $rt;
+ }
+ $selected_attributes[] =
$rt->get_cust_attribute_id();
+ }
+
+ foreach ($cust_attr_ids as $attr)
+ {
+ if(!in_array($attr,
$selected_attributes))
+ {
+ $req_type_new = new
logistic_resource_type_requirement();
+
$req_type_new->set_location_id($location_id);
+
$req_type_new->set_project_type_id(phpgw::get_var('project_type_id'));
+
$req_type_new->set_cust_attribute_id($attr);
+ $req_type_new_id =
$this->so->store($req_type_new);
+ }
+ }
+
+ foreach ($req_types_for_delete as
$del_req_type)
+ {
+
$this->so->delete($del_req_type);
+ }
+ }
+ else
+ {
+ foreach ($cust_attr_ids as $attr)
+ {
+
$req_type->set_cust_attribute_id($attr);
+ $req_type_id =
$this->so->store($req_type);
+ }
+ }
+
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiresource_type_requirement.view',
'location_id' => $location_id, 'project_type_id' =>
$req_type->get_project_type_id()));
+ }
+ else if (isset($_POST['cancel']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiresource_type_requirement.index'));
+ }
+ else
+ {
+ $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
+ array_unshift($entity_list,array
('id'=>'','name'=> lang('select value')));
+
+ if($location_id)
+ {
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
+ $entity_arr =
explode('.',$loc_arr['location']);
+
+ $entity =
$entity_so->read_single($entity_arr[2]);
+ $category =
$entity_so->read_single_category($entity_arr[2],$entity_arr[3]);
+ foreach ($entity_list as &$e)
+ {
+ if($e['id'] == $entity['id'])
+ {
+ $e['selected'] = 1;
+ }
+ }
+ $category_list =
$entity_so->read_category(array('allrows'=>true,'entity_id'=>$entity_arr[2]));
+ foreach ($category_list as &$c)
+ {
+ if($c['id'] == $category['id'])
+ {
+ $c['selected'] = 1;
+ }
+ }
+
+ $attributes =
$custom->find('property',".entity.{$entity_arr[2]}.{$entity_arr[3]}", 0,
'','','',true, true);
+ $selected_attributes =
$this->so->get_selected_attributes($location_id, $project_type_id);
+ foreach ($attributes as &$a)
+ {
+ if(in_array($a['id'],
$selected_attributes))
+ {
+ $a['checked'] =
'checked';
+ }
+ }
+ }
+ $project_type_array =
$this->so_project->get_project_types($req_type->get_project_type_id());
+
+ $data = array
+ (
+ 'value_id' => !empty($req_type)
? $req_type->get_id() : 0,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'entities' => $entity_list,
+ 'categories' => $category_list,
+ 'attributes' => $attributes,
+ 'project_types' =>
$project_type_array,
+ 'editable' => true,
+ 'req_type' => $req_type
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
+
+ phpgwapi_jquery::load_widget('core');
+
+ self::add_javascript('logistic', 'logistic',
'resource_type_requirement.js');
+
self::render_template_xsl(array('resource_type_requirement_item'), $data);
+ }
+ }
+
+ public function get_bim_level1()
+ {
+ $entity_id = phpgw::get_var('entity_id');
+ $entity =
CreateObject('property.soadmin_entity');
+
+ $category_list =
$entity->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
+
+ return $category_list;
+ }
+
+ public function get_bim_level2()
+ {
+ $custom = createObject('phpgwapi.custom_fields');
+ $entity_id = phpgw::get_var('entity_id');
+ $cat_id = phpgw::get_var('cat_id');
+
+ $attrib_data =
$custom->find('property',".entity.{$entity_id}.{$cat_id}", 0, '','','',true,
true);
+
+ return $attrib_data;
+ }
+
+ public function view()
+ {
+ $entity_so =
CreateObject('property.soadmin_entity');
+ $custom = createObject('phpgwapi.custom_fields');
+ $id_fields = phpgw::get_var('id');
+ if($id_fields && $id_fields != '')
+ {
+ $id_array = explode('-', $id_fields);
+ $location_id = $id_array[0];
+ $project_type_id = $id_array[1];
+ }
+ else
+ {
+ $location_id = phpgw::get_var('location_id');
+ $project_type_id =
phpgw::get_var('project_type_id');
+ }
+
+ if(isset($_POST['edit']))
+ {
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiresource_type_requirement.edit',
'location_id' => $location_id, 'project_type_id' => $project_type_id));
+ }
+
+ if($location_id && is_numeric($location_id))
+ {
+ $req_types =
$this->so->get(null,null,null,null,null,null,array('location_id' =>
$location_id, 'project_type_id' => $project_type_id));
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
+ $entity_arr = explode('.',$loc_arr['location']);
+
+ $entity =
$entity_so->read_single($entity_arr[2]);
+ $category =
$entity_so->read_single_category($entity_arr[2],$entity_arr[3]);
+ $all_attributes =
$custom->find('property',".entity.{$entity_arr[2]}.{$entity_arr[3]}", 0,
'','','',true, true);
+ $attributes = array();
+ $selected_attributes = array();
+ foreach ($req_types as $req)
+ {
+ $selected_attributes[] =
$req->get_cust_attribute_id();
+ }
+
+ foreach ($all_attributes as $attr)
+ {
+ if(in_array($attr['id'],
$selected_attributes))
+ {
+ $attributes[] = $attr;
+ }
+ }
+
+ $objects = $this->so_project->get(null, null,
null, null, null, 'project_type', array('id' => $project_type_id));
+ if (count($objects) > 0)
+ {
+ $keys = array_keys($objects);
+ $project_type = $objects[$keys[0]];
+ }
+
+ $data = array
+ (
+ 'value_id' =>
!empty($req_types[0]) ? $req_types[0]->get_id() : 0,
+ 'location_id' => $location_id,
+ 'project_type_id' =>
$project_type_id,
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'req_type' => $req_types[0],
+ 'entity' => $entity,
+ 'category' => $category,
+ 'attributes' => $attributes,
+ 'project_type' => $project_type
+ );
+
+ $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
+
self::render_template_xsl(array('resource_type_requirement_item'), $data);
+ }
+ }
+ }
Deleted:
branches/Version-1_0-branch/logistic/inc/model/class.bim_item_type_requirement.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/model/class.bim_item_type_requirement.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++
branches/Version-1_0-branch/logistic/inc/model/class.bim_item_type_requirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,138 +0,0 @@
-<?php
-
- /**
- * phpGroupWare - logistic: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <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 logistic
- * @version $Id $
- */
- include_class('logistic', 'model', '/inc/model/');
-
- class logistic_bim_item_type_requirement extends logistic_model
- {
- public static $so;
-
- protected $id;
- protected $entity_id;
- protected $category_id;
- protected $project_type_id;
- protected $cust_attribute_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 project
- */
- 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_entity_id($entity_id)
- {
- $this->entity_id = $entity_id;
- }
-
- public function get_entity_id()
- {
- return $this->entity_id;
- }
-
- public function set_category_id($category_id)
- {
- $this->category_id = $category_id;
- }
-
- public function get_category_id()
- {
- return $this->category_id;
- }
-
- public function set_project_type_id($project_type_id)
- {
- $this->project_type_id = $project_type_id;
- }
-
- public function get_project_type_id()
- {
- return $this->project_type_id;
- }
-
- public function set_cust_attribute_id($cust_attribute_id)
- {
- $this->cust_attribute_id = $cust_attribute_id;
- }
-
- public function get_cust_attribute_id()
- {
- return $this->cust_attribute_id;
- }
-
- /**
- * 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('logistic.sobim_type_requirement');
- }
-
- return self::$so;
- }
-
- public function serialize()
- {
- $entity_so =
CreateObject('property.soadmin_entity');
- $project_so = CreateObject('logistic.soproject');
- $entity =
$entity_so->read_single($this->get_entity_id());
- $category =
$entity_so->read_single_category($this->get_entity_id(),$this->get_category_id());
- $entity_label = $entity['name'];
- $category_label = $category['name'];
- $project_type_label =
$project_so->get_project_type_label($this->get_project_type_id());
-
- return array(
- 'id' => $this->get_id(),
- 'entity_id' => $this->get_entity_id(),
- 'entity_label' => $entity_label,
- 'category_id' => $this->get_category_id(),
- 'category_label' => $category_label,
- 'atributes' => $this->get_cust_attribute_id(),
- 'project_type_id' =>
$this->get_project_type_id(),
- 'project_type_label' => $project_type_label
- );
- }
- }
\ No newline at end of file
Modified:
branches/Version-1_0-branch/logistic/inc/model/class.requirement.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/inc/model/class.requirement.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/inc/model/class.requirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -27,17 +27,21 @@
* @subpackage logistic
* @version $Id $
*/
+
include_class('logistic', 'model', '/inc/model/');
class logistic_requirement extends logistic_model
{
-
public static $so;
- protected static $requirement_id;
- protected static $activity_id;
- protected static $date_from;
- protected static $date_to;
-
+
+ protected $id;
+ protected $activity_id;
+ protected $start_date;
+ protected $end_date;
+ protected $no_of_items;
+ protected $location_id;
+ protected $create_user;
+
/**
* 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.
@@ -46,19 +50,39 @@
*/
public function __construct(int $id = null)
{
- $this->requirement_id = (int) $id;
+ $this->id = (int) $id;
}
+
+ public function set_id($id)
+ {
+ $this->id = $id;
+ }
- public function set_requirement_id($id)
+ public function get_id()
{
- $this->requirement_id = $id;
+ return $this->id;
}
- public function get_requirement_id()
+ public function set_no_of_items($no_of_items)
{
- return $this->requirement_id;
+ $this->no_of_items = $no_of_items;
}
+ public function get_no_of_items()
+ {
+ return $this->no_of_items;
+ }
+
+ public function set_location_id($location_id)
+ {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_id()
+ {
+ return $this->location_id;
+ }
+
public function set_activity_id($activity_id)
{
$this->activity_id = $activity_id;
@@ -69,26 +93,27 @@
return $this->activity_id;
}
- public function set_date_from($date_from)
+ public function set_end_date($end_date)
{
- $this->date_from = $date_from;
+ $this->end_date = $end_date;
}
-
- public function get_date_from()
+
+ public function get_end_date() { return $this->end_date; }
+
+ public function set_start_date($start_date)
{
- return $this->date_from;
+ $this->start_date = $start_date;
}
-
- public function set_date_to($date_to)
+
+ public function get_start_date() { return $this->start_date; }
+
+ public function set_create_user($create_user)
{
- $this->date_to = $date_to;
+ $this->create_user = $create_user;
}
+
+ public function get_create_user() { return $this->create_user; }
- public function get_date_to()
- {
- return $this->date_to;
- }
-
/**
* Get a static reference to the storage object associated with
this model object
*
@@ -102,14 +127,16 @@
return self::$so;
}
-
+
public function serialize()
{
return array(
- 'requirement_id' => $this->get_requirement_id(),
+ 'id' => $this->get_id(),
'activity_id' => $this->get_activity_id(),
- 'date_from' => $this->get_date_from(),
- 'date_to' => $this->get_date_to()
+ 'start_date' => $this->get_start_date(),
+ 'end_date' => $this->get_end_date(),
+ 'no_of_items' => $this->get_no_of_items(),
+ 'location_id' => $this->get_location_id(),
);
}
}
\ No newline at end of file
Modified:
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_allocation.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -35,9 +35,9 @@
protected static $id;
protected static $requirement_id;
- protected static $article_id;
- protected static $type;
-
+ protected static $resource_id;
+ protected static $location_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.
@@ -69,24 +69,24 @@
return $this->requirement_id;
}
- public function set_article_id($article_id)
+ public function set_resource_id($resource_id)
{
- $this->article_id = $article_id;
+ $this->resource_id = $resource_id;
}
- public function get_article_id()
+ public function get_resource_id()
{
- return $this->article_id;
+ return $this->resource_id;
}
- public function set_type($type)
+ public function set_location_id($location_id)
{
- $this->type = $type;
+ $this->location_id = $location_id;
}
- public function get_type()
+ public function get_location_id()
{
- return $this->type;
+ return $this->location_id;
}
/**
Deleted:
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_type.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_type.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++
branches/Version-1_0-branch/logistic/inc/model/class.requirement_resource_type.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,105 +0,0 @@
-<?php
-
- /**
- * phpGroupWare - logistic: a part of a Facilities Management System.
- *
- * @author Erik Holm-Larsen <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 logistic
- * @version $Id $
- */
- include_class('logistic', 'model', '/inc/model/');
-
- class logistic_requirement_resource_type extends logistic_model
- {
- public static $so;
-
- protected static $id;
- protected static $requirement_id;
- protected static $resource_type_id;
- protected static $no_of_elements;
-
- /**
- * 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 project
- */
- 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_requirement_id($requirement_id)
- {
- $this->requirement_id = $requirement_id;
- }
-
- public function get_requirement_id()
- {
- return $this->requirement_id;
- }
-
- public function set_resource_type_id($resource_type_id)
- {
- $this->resource_type_id = $resource_type_id;
- }
-
- public function get_resource_type_id()
- {
- return $this->resource_type_id;
- }
-
- public function set_no_of_elements($no_of_elements)
- {
- $this->no_of_elements = $no_of_elements;
- }
-
- public function get_no_of_elements()
- {
- return $this->no_of_elements;
- }
-
- /**
- * 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('logistic.sorequirement_resource_type');
- }
-
- return self::$so;
- }
- }
Modified:
branches/Version-1_0-branch/logistic/inc/model/class.requirement_value.inc.php
===================================================================
---
branches/Version-1_0-branch/logistic/inc/model/class.requirement_value.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++
branches/Version-1_0-branch/logistic/inc/model/class.requirement_value.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -33,12 +33,13 @@
{
public static $so;
- protected static $id;
- protected static $requirement_id;
+ protected $id;
+ protected $requirement_id;
protected $bim_type_requirement_id;
protected $location_id;
protected $cust_attribute_id;
- protected static $value;
+ protected $value;
+ protected $operator;
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
@@ -110,7 +111,17 @@
{
return $this->value;
}
+
+ public function set_operator($operator)
+ {
+ $this->operator = $operator;
+ }
+ public function get_operator()
+ {
+ return $this->operator;
+ }
+
/**
* Get a static reference to the storage object associated with
this model object
*
Copied:
branches/Version-1_0-branch/logistic/inc/model/class.resource_type_requirement.inc.php
(from rev 10210,
trunk/logistic/inc/model/class.resource_type_requirement.inc.php)
===================================================================
---
branches/Version-1_0-branch/logistic/inc/model/class.resource_type_requirement.inc.php
(rev 0)
+++
branches/Version-1_0-branch/logistic/inc/model/class.resource_type_requirement.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,127 @@
+<?php
+
+ /**
+ * phpGroupWare - logistic: a part of a Facilities Management System.
+ *
+ * @author Erik Holm-Larsen <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 logistic
+ * @version $Id $
+ */
+ include_class('logistic', 'model', '/inc/model/');
+
+ class logistic_resource_type_requirement extends logistic_model
+ {
+ public static $so;
+
+ protected $id;
+ protected $location_id;
+ protected $project_type_id;
+ protected $cust_attribute_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 project
+ */
+ 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_location_id($location_id)
+ {
+ $this->location_id = $location_id;
+ }
+
+ public function get_location_id()
+ {
+ return $this->location_id;
+ }
+
+ public function set_project_type_id($project_type_id)
+ {
+ $this->project_type_id = $project_type_id;
+ }
+
+ public function get_project_type_id()
+ {
+ return $this->project_type_id;
+ }
+
+ public function set_cust_attribute_id($cust_attribute_id)
+ {
+ $this->cust_attribute_id = $cust_attribute_id;
+ }
+
+ public function get_cust_attribute_id()
+ {
+ return $this->cust_attribute_id;
+ }
+
+ /**
+ * 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('logistic.soresource_type_requirement');
+ }
+
+ return self::$so;
+ }
+
+ public function serialize()
+ {
+ $entity_so =
CreateObject('property.soadmin_entity');
+ $project_so = CreateObject('logistic.soproject');
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($this->get_location_id());
+ $entity_arr = explode('.',$loc_arr['location']);
+
+ $entity = $entity_so->read_single($entity_arr[2]);
+ $category =
$entity_so->read_single_category($entity_arr[2],$entity_arr[3]);
+ $entity_label = $entity['name'];
+ $category_label = $category['name'];
+ $project_type_label =
$project_so->get_project_type_label($this->get_project_type_id());
+
+ return array(
+ 'id' =>
$this->get_location_id().'-'.$this->get_project_type_id(),
+ 'location_id' => $this->get_location_id(),
+ 'entity_label' => $entity_label,
+ 'category_label' => $category_label,
+ 'project_type_label' => $project_type_label
+ );
+ }
+ }
\ No newline at end of file
Modified: branches/Version-1_0-branch/logistic/js/logistic/activity.js
===================================================================
--- branches/Version-1_0-branch/logistic/js/logistic/activity.js
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/js/logistic/activity.js
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,4 +1,15 @@
$(document).ready(function(){
-
+ $("#select_activity").change(function () {
+ var parent_id = $(this).val();
+ var thisForm = $(this).closest("form");
+ var project_id =
$(thisForm).find("input[name=project_id]").val();
+ var activity_id =
$(thisForm).find("input[name=activity_id]").val();
+
+ var oArgs = {menuaction:'logistic.uiactivity.edit'};
+ var baseUrl = phpGWLink('index.php', oArgs, false);
+ var requestUrl = baseUrl + "&parent_id=" + parent_id +
"&activity_id=" + activity_id;
+
+ window.location.href = requestUrl;
+ });
});
\ No newline at end of file
Modified: branches/Version-1_0-branch/logistic/js/logistic/ajax.js
===================================================================
--- branches/Version-1_0-branch/logistic/js/logistic/ajax.js 2012-10-15
10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/js/logistic/ajax.js 2012-10-15
10:39:17 UTC (rev 10217)
@@ -1,15 +1,4 @@
$(document).ready(function(){
- $("#select_activity").change(function () {
- var parent_id = $(this).val();
- var thisForm = $(this).closest("form");
- var project_id =
$(thisForm).find("input[name=project_id]").val();
- var activity_id =
$(thisForm).find("input[name=activity_id]").val();
-
- var oArgs = {menuaction:'logistic.uiactivity.edit'};
- var baseUrl = phpGWLink('index.php', oArgs, false);
- var requestUrl = baseUrl + "&parent_id=" + parent_id +
"&activity_id=" + activity_id;
-
- window.location.href = requestUrl;
- });
+
});
\ No newline at end of file
Deleted:
branches/Version-1_0-branch/logistic/js/logistic/bim_type_requirement.js
===================================================================
--- branches/Version-1_0-branch/logistic/js/logistic/bim_type_requirement.js
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/js/logistic/bim_type_requirement.js
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,64 +0,0 @@
-$(document).ready(function(){
-
- $("#entity_id").change(function () {
- var oArgs =
{menuaction:'logistic.uibim_type_requirement.get_bim_level1', entity_id:
$(this).val()};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- var htmlString = "";
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl,
- success: function(data)
- {
- if( data != null)
- {
- htmlString = "<option>Velg</option>"
-
- $.each(data, function(i) {
- var selected = '';
- htmlString += "<option
value='" + data[i].id + "'" + selected + ">" + data[i].name + "</option>";
- });
-
- $("#category_id").html( htmlString );
- }
- else
- {
- htmlString += "";
- $("#category_id").html( htmlString );
- }
- }
- });
- });
-
- $("#category_id").change(function () {
- var oArgs =
{menuaction:'logistic.uibim_type_requirement.get_bim_level2', entity_id:
$("#entity_id").val(), cat_id: $(this).val()};
- var requestUrl = phpGWLink('index.php', oArgs, true);
-
- var htmlString = "";
-
- $.ajax({
- type: 'POST',
- dataType: 'json',
- url: requestUrl,
- success: function(data)
- {
- if( data != null)
- {
- $.each(data, function(i) {
- htmlString += "<input
type='checkbox' name='attributes[]' id='attributes[]' value='" + data[i].id +
"'/>" + data[i].input_text + " (" + data[i].trans_datatype + ")<br/>";
- });
-
- $("#attributes").html( htmlString );
- }
- else
- {
- htmlString += "";
- $("#attributes").html( htmlString );
- }
- }
- });
- });
-
-});
\ No newline at end of file
Copied:
branches/Version-1_0-branch/logistic/js/logistic/resource_type_requirement.js
(from rev 10210, trunk/logistic/js/logistic/resource_type_requirement.js)
===================================================================
---
branches/Version-1_0-branch/logistic/js/logistic/resource_type_requirement.js
(rev 0)
+++
branches/Version-1_0-branch/logistic/js/logistic/resource_type_requirement.js
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,64 @@
+$(document).ready(function(){
+
+ $("#entity_id").change(function () {
+ var oArgs =
{menuaction:'logistic.uiresource_type_requirement.get_bim_level1', entity_id:
$(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data)
+ {
+ if( data != null)
+ {
+ htmlString = "<option>Velg</option>"
+
+ $.each(data, function(i) {
+ var selected = '';
+ htmlString += "<option
value='" + data[i].id + "'" + selected + ">" + data[i].name + "</option>";
+ });
+
+ $("#category_id").html( htmlString );
+ }
+ else
+ {
+ htmlString += "";
+ $("#category_id").html( htmlString );
+ }
+ }
+ });
+ });
+
+ $("#category_id").change(function () {
+ var oArgs =
{menuaction:'logistic.uiresource_type_requirement.get_bim_level2', entity_id:
$("#entity_id").val(), cat_id: $(this).val()};
+ var requestUrl = phpGWLink('index.php', oArgs, true);
+
+ var htmlString = "";
+
+ $.ajax({
+ type: 'POST',
+ dataType: 'json',
+ url: requestUrl,
+ success: function(data)
+ {
+ if( data != null)
+ {
+ $.each(data, function(i) {
+ htmlString += "<input
type='checkbox' name='attributes[]' id='attributes[]' value='" + data[i].id +
"'/>" + data[i].input_text + " (" + data[i].trans_datatype + ")<br/>";
+ });
+
+ $("#attributes").html( htmlString );
+ }
+ else
+ {
+ htmlString += "";
+ $("#attributes").html( htmlString );
+ }
+ }
+ });
+ });
+
+});
\ No newline at end of file
Modified: branches/Version-1_0-branch/logistic/setup/default_records.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/default_records.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/setup/default_records.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,7 +1,7 @@
<?php
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-?>
+ //Create groups, users, add users to groups and set preferences
+ $GLOBALS['phpgw']->locations->add('.', 'Topp', 'logistic');
+ $GLOBALS['phpgw']->locations->add('.project', 'Prosjekt', 'logistic');
+ $GLOBALS['phpgw']->locations->add('.activity', 'Aktivitet', 'logistic');
+
\ No newline at end of file
Modified: branches/Version-1_0-branch/logistic/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/logistic/setup/phpgw_no.lang 2012-10-15
10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/setup/phpgw_no.lang 2012-10-15
10:39:17 UTC (rev 10217)
@@ -36,7 +36,7 @@
Attributes logistic no Attributter
Chosen attributes logistic no Valgte attributter
Administrate requirements logistic no Administrer type-krav
-bim_type_requirement logistic no Type-krav
+resource_type_requirement logistic no Ressurstype-krav
Varchar logistic no Text
Contact logistic no Kontakt
Entity types logistic no Entitetstyper
@@ -49,5 +49,5 @@
Muliple checkbox logistic no Flervalgs avkrysningsboks
event logistic no Hendelse
Link logistic no Lenke
-Add requirement to activity logistic no Legg krav til
aktiviteten
+Add requirement to activity logistic no Registrer behov for
aktiviteten
Add requirement logistic no Legg til krav
\ No newline at end of file
Modified: branches/Version-1_0-branch/logistic/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/setup.inc.php 2012-10-15
10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/setup/setup.inc.php 2012-10-15
10:39:17 UTC (rev 10217)
@@ -1,6 +1,6 @@
<?php
$setup_info['logistic']['name'] = 'logistic';
- $setup_info['logistic']['version'] = '0.0.7';
+ $setup_info['logistic']['version'] = '0.0.3';
$setup_info['logistic']['app_order'] = 70;
$setup_info['logistic']['enable'] = 1;
$setup_info['logistic']['app_group'] = 'office';
@@ -11,9 +11,8 @@
'lg_project_type',
'lg_activity',
'lg_requirement',
- 'lg_requirement_resource_type',
'lg_requirement_resource_allocation',
- 'lg_bim_item_type_requirement',
+ 'lg_resource_type_requirement',
'lg_requirement_value',
'lg_calendar'
);
Modified: branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/setup/tables_current.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -54,29 +54,17 @@
'fd' => array(
'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
'activity_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
- 'date_from' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
- 'date_to' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
+ 'start_date' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
+ 'end_date' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
+ 'no_of_elements' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+ 'location_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_date' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
),
'pk' => array('id'),
- 'fk' => array('lg_activity' =>
array('activity_id' => 'id')),
- 'ix' => array(),
- 'uc' => array()
- ),
- 'lg_requirement_resource_type' => array(
- 'fd' => array(
- 'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
- 'requirement_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
- 'resource_type_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
- 'no_of_elements' =>
array('type' => 'int', 'precision' => 4, 'nullable' => true),
- 'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
- 'create_date' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
- ),
- 'pk' => array('id'),
'fk' => array(
- 'lg_requirement' =>
array('requirement_id' => 'id'),
- 'fm_bim_type' =>
array('resource_type_id' => 'id')
+ 'lg_activity' =>
array('activity_id' => 'id'),
+ 'phpgw_locations' =>
array('location_id' => 'location_id')
),
'ix' => array(),
'uc' => array()
@@ -85,33 +73,32 @@
'fd' => array(
'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
'requirement_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
- 'article_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
- 'type' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
+ 'resource_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
+ 'location_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_date' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
),
'pk' => array('id'),
'fk' => array(
'lg_requirement' =>
array('requirement_id' => 'id'),
- 'fm_bim_item' =>
array('article_id' => 'id', 'type' => 'type')
+ 'phpgw_locations' =>
array('location_id' => 'location_id')
),
'ix' => array(),
'uc' => array()
),
- 'lg_bim_item_type_requirement' => array(
+ 'lg_resource_type_requirement' => array(
'fd' => array(
'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
- 'entity_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
- 'category_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
- 'cust_attribute_id' =>
array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
- 'project_type_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => true),
+ 'location_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
+ 'project_type_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
+ 'cust_attribute_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_date' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
),
'pk' => array('id'),
'fk' => array(
'lg_project_type' =>
array('project_type_id' => 'id'),
- 'phpgw_locations' =>
array('location_id' => 'location_id')
+ 'phpgw_cust_attribute' =>
array('location_id' => 'location_id','cust_attribute_id' => 'id')
),
'ix' => array(),
'uc' => array()
@@ -119,16 +106,18 @@
'lg_requirement_value' => array(
'fd' => array(
'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
- 'type_requirement_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
'requirement_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
- 'cust_attribute_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
- 'location_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
- 'value' => array('type' =>
'varchar', 'precision' => '255', 'nullable' => true),
+ 'operator' => array('type' =>
'varchar', 'precision' => '255', 'nullable' => false),
+ 'value' => array('type' =>
'varchar', 'precision' => '255', 'nullable' => false),
'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_date' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
+ 'cust_attribute_id' =>
array('type' => 'int', 'precision' => 4, 'nullable' => false),
),
'pk' => array('id'),
- 'fk' => array('lg_bim_item_type_requirement' =>
array('type_requirement_id' => 'id')),
+ 'fk' => array(
+ 'lg_resource_type_requirement'
=> array('type_requirement_id' => 'id'),
+ 'lg_requirement' =>
array('requirement_id' => 'id')
+ ),
'ix' => array(),
'uc' => array()
),
@@ -137,13 +126,13 @@
'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
'location_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'item_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
- 'type' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
- 'tracking' => array('type' =>
'varchar', 'precision' => '255', 'nullable' => true),
'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_date' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
),
'pk' => array('id'),
- 'fk' => array('fm_bim_item' => array('item_id'
=> 'id', 'type' => 'type')),
+ 'fk' => array(
+ 'phpgw_locations' =>
array('location_id' => 'location_id')
+ ),
'ix' => array(),
'uc' => array()
)
Modified: branches/Version-1_0-branch/logistic/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/logistic/setup/tables_update.inc.php
2012-10-15 10:38:59 UTC (rev 10216)
+++ branches/Version-1_0-branch/logistic/setup/tables_update.inc.php
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,108 +1,37 @@
<?php
- /* Update Logistic from v 0.0.1 to 0.0.2
- * Add column 'description' to table activity
- */
-
+
$test[] = '0.0.1';
function logistic_upgrade0_0_1()
{
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_activity','description',array(
- 'type' => 'text',
- 'nullable' => True
- ));
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->RenameColumn('lg_requirement','date_from','start_date');
+
$GLOBALS['phpgw_setup']->oProc->RenameColumn('lg_requirement','date_to','end_date');
- $GLOBALS['setup_info']['logistic']['currentver'] = '0.0.2';
- return $GLOBALS['setup_info']['logistic']['currentver'];
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['logistic']['currentver'] =
'0.0.2';
+ return $GLOBALS['setup_info']['logistic']['currentver'];
+ }
}
-
- /* Update Logistic from v 0.0.2 to 0.0.3
- * Add locations
- */
-
+
$test[] = '0.0.2';
function logistic_upgrade0_0_2()
{
- $GLOBALS['phpgw']->locations->add('.', 'Topp', 'logistic');
- $GLOBALS['phpgw']->locations->add('.project', 'Prosjekt',
'logistic');
- $GLOBALS['phpgw']->locations->add('.activity', 'Aktivitet',
'logistic');
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
- $GLOBALS['setup_info']['logistic']['currentver'] = '0.0.3';
- return $GLOBALS['setup_info']['logistic']['currentver'];
- }
-
- /*
- * Update Logistic from v 0.0.3 to 0.0.4
- * Add columns for custom attribute id and location id to
lg_requirement_value
- * Alter lg_bim_item_type_requirement: add cust_attribute_id column,
remove attribute-colums
- */
-
- $test[] = '0.0.3';
- function logistic_upgrade0_0_3()
- {
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_requirement_value','location_id',array(
- 'type' => 'int',
- 'precision' => 4,
- 'nullable' => True
- ));
-
+
$GLOBALS['phpgw_setup']->oProc->DropColumn('lg_requirement_value', array(),
'type_requirement_id');
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_requirement_value','cust_attribute_id',array(
'type' => 'int',
'precision' => 4,
- 'nullable' => True
+ 'nullable' => False
));
-
-
$GLOBALS['phpgw_setup']->oProc->DropColumn('lg_bim_item_type_requirement',
array(), 'attribute_name');
-
$GLOBALS['phpgw_setup']->oProc->DropColumn('lg_bim_item_type_requirement',
array(), 'attribute_type');
-
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_bim_item_type_requirement','cust_attribute_id_id',array(
- 'type' => 'varchar',
- 'precision' => '255',
- 'nullable' => True
- ));
-
- $GLOBALS['setup_info']['logistic']['currentver'] = '0.0.4';
- return $GLOBALS['setup_info']['logistic']['currentver'];
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['logistic']['currentver'] =
'0.0.3';
+ return $GLOBALS['setup_info']['logistic']['currentver'];
+ }
}
-
- $test[] = '0.0.4';
- function logistic_upgrade0_0_4()
- {
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_requirement_value','requirement_id',array(
- 'type' => 'int',
- 'precision' => 4,
- 'nullable' => True
- ));
-
- $GLOBALS['setup_info']['logistic']['currentver'] = '0.0.5';
- return $GLOBALS['setup_info']['logistic']['currentver'];
- }
-
- $test[] = '0.0.5';
- function logistic_upgrade0_0_5()
- {
-
$GLOBALS['phpgw_setup']->oProc->DropColumn('lg_bim_item_type_requirement',
array(), 'cust_attribute_id_id');
-
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_bim_item_type_requirement','cust_attribute_id',array(
- 'type' => 'varchar',
- 'precision' => '255',
- 'nullable' => True
- ));
-
- $GLOBALS['setup_info']['logistic']['currentver'] = '0.0.6';
- return $GLOBALS['setup_info']['logistic']['currentver'];
- }
-
- $test[] = '0.0.6';
- function logistic_upgrade0_0_6()
- {
-
$GLOBALS['phpgw_setup']->oProc->RenameColumn('lg_bim_item_type_requirement','location_id','entity_id');
-
-
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_bim_item_type_requirement','category_id',array(
- 'type' => 'varchar',
- 'precision' => '255',
- 'nullable' => True
- ));
-
- $GLOBALS['setup_info']['logistic']['currentver'] = '0.0.7';
- return $GLOBALS['setup_info']['logistic']['currentver'];
- }
\ No newline at end of file
+
\ No newline at end of file
Copied:
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_item.xsl
(from rev 10210, trunk/logistic/templates/base/allocation/allocation_item.xsl)
===================================================================
---
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_item.xsl
(rev 0)
+++
branches/Version-1_0-branch/logistic/templates/base/allocation/allocation_item.xsl
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,141 @@
+<!-- $Id: activity_item.xsl 10096 2012-10-03 07:10:49Z vator $ -->
+<!-- item -->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+<xsl:variable name="date_format"><xsl:value-of
select="php:function('get_phpgw_info',
'user|preferences|common|dateformat')"/></xsl:variable>
+
+<xsl:call-template name="yui_phpgw_i18n"/>
+<div class="yui-navset yui-navset-top">
+ <div style="clear: both;margin-bottom: 0;overflow: hidden;padding:
1em;" class="identifier-header">
+ <xsl:choose>
+ <xsl:when test="activity/id != '' or activity/id != 0">
+ <h1 style="float:left;">
+ <span>
+ <xsl:value-of
select="php:function('lang', 'Add requirement to activity')" />
+ </span>
+ <span>
+ {activity/name}
+ </span>
+ </h1>
+ </xsl:when>
+ <xsl:otherwise>
+ <h1 style="float:left;">
+ <xsl:value-of
select="php:function('lang', 'Add requirement')" />
+ </h1>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+
+ <div class="yui-content" style="padding: 20px;">
+ <div id="details">
+ <form action="#" method="post">
+ <input type="hidden" name="id" value =
"{activity/id}" />
+
+ <dl class="proplist-col">
+ <dt>
+ <label
for="start_date">Startdato</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <input
class="date" id="start_date" name="start_date" type="text">
+ <xsl:if
test="requirement/start_date != ''">
+ <xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(requirement/start_date))"/></xsl:attribute>
+ </xsl:if>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <span><xsl:value-of
select="php:function('date', $date_format,
number(requirement/start_date))"/></span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="end_date">Sluttdato</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <input
class="date" id="end_date" name="end_date" type="text">
+ <xsl:if
test="requirement/end_date != ''">
+ <xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(requirement/end_date))"/></xsl:attribute>
+ </xsl:if>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <span><xsl:value-of
select="php:function('date', $date_format,
number(requirement/end_date))"/></span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <dt>
+
<label>BIM</label>
+ </dt>
+ <dd>
+ <select
name="location_id" id="location_id">
+
<xsl:for-each select="entity_list">
+
<option value="{id}">
+
<xsl:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+ </select>
+ </dd>
+ <dt>
+
<label>BIM2</label>
+ </dt>
+ <dd>
+ <select
name="categories" id="categories">
+ </select>
+ </dd>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="entity/name" />
+ <xsl:value-of
select="category/name" />
+ <xsl:for-each
select="attributes">
+ <xsl:value-of
select="name" /><br/>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ <dt>
+ <label
for="no_of_items">Antall</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <input
style="width: 20px;" id="no_of_items" name="no_of_items" type="text" />
+ </xsl:when>
+ <xsl:otherwise>
+
<span>{requirement/no_of_items}</span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ </dl>
+
+ <div class="form-buttons">
+ <xsl:choose>
+ <xsl:when test="editable">
+ <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
+ <input type="submit"
name="save_activity" value="{$lang_save}" title = "{$lang_save}" />
+ <input type="submit"
name="cancel_activity" value="{$lang_cancel}" title = "{$lang_cancel}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
+ <input type="submit"
name="edit_activity" value="{$lang_edit}" title = "{$lang_edit}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+</xsl:template>
+
+<xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected">
+ <xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
Deleted:
branches/Version-1_0-branch/logistic/templates/base/bim_type_requirement_item.xsl
===================================================================
---
branches/Version-1_0-branch/logistic/templates/base/bim_type_requirement_item.xsl
2012-10-15 10:38:59 UTC (rev 10216)
+++
branches/Version-1_0-branch/logistic/templates/base/bim_type_requirement_item.xsl
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,136 +0,0 @@
-<xsl:template match="data" xmlns:php="http://php.net/xsl">
-
-<xsl:call-template name="yui_phpgw_i18n"/>
-<div class="yui-navset yui-navset-top">
- <div class="identifier-header">
- <h1><img src="{img_go_home}" />
- <xsl:value-of select="php:function('lang',
'Administrate requirements')" />
- </h1>
- </div>
- <div class="yui-content">
- <div id="details">
- <form action="#" method="post">
- <input type="hidden" name="id" value =
"{value_id}">
- </input>
- <dl class="proplist-col">
- <dt>
- <label><xsl:value-of
select="php:function('lang', 'Project_type')" /></label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when
test="editable">
- <select
name="project_type_id" id="project_type_id">
-
<xsl:for-each select="project_types">
-
<option value="{id}">
-
<xsl:if test="selected">
-
<xsl:attribute name="selected" value="selected" />
-
</xsl:if>
-
<xsl:value-of select="name"/>
-
</option>
-
</xsl:for-each>
- </select>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="project_type/name" />
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- <xsl:choose>
- <xsl:when test="editable">
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
- </dt>
- <dd>
- <select
name="entity_id" id="entity_id">
-
<xsl:for-each select="entities">
-
<option value="{id}">
-
<xsl:if test="selected">
-
<xsl:attribute name="selected" value="selected" />
-
</xsl:if>
-
<xsl:value-of select="name"/>
-
</option>
-
</xsl:for-each>
- </select>
- </dd>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
- </dt>
- <dd>
- <select
name="category_id" id="category_id">
- <xsl:if
test="req_type/category_id">
-
<xsl:for-each select="categories">
-
<option value="{id}">
-
<xsl:if test="selected">
-
<xsl:attribute name="selected" value="selected" />
-
</xsl:if>
-
<xsl:value-of select="name"/>
-
</option>
-
</xsl:for-each>
-
</xsl:if>
- </select>
- </dd>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Attributes')" /></label>
- </dt>
- <dd>
- <div
id="attributes">
- <xsl:if
test="req_type/cust_attribute_id">
-
<xsl:for-each select="attributes">
-
<xsl:if test="input_text">
-
<xsl:choose>
-
<xsl:when test="checked">
-
<input type='checkbox' name='attributes[]'
id='attributes[]' value='{id}' checked='checked'/><xsl:value-of
select="input_text" /> <xsl:value-of select="trans_datatype" /><br/>
-
</xsl:when>
-
<xsl:otherwise>
-
<input type='checkbox' name='attributes[]'
id='attributes[]' value='{id}'/><xsl:value-of select="input_text" />
<xsl:value-of select="trans_datatype" /><br/>
-
</xsl:otherwise>
-
</xsl:choose>
-
</xsl:if>
-
</xsl:for-each>
-
</xsl:if>
- </div>
- </dd>
- </xsl:when>
- <xsl:otherwise>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
- </dt>
- <dd>
- <xsl:value-of
select="entity/name" />
- </dd>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
- </dt>
- <dd>
- <xsl:value-of
select="category/name" />
- </dd>
- <dt>
-
<label><xsl:value-of select="php:function('lang', 'Chosen attributes')"
/></label>
- </dt>
- <dd>
- <xsl:for-each
select="attributes">
-
<xsl:value-of select="input_text" /> (<xsl:value-of select="trans_datatype"
/>)<br/>
- </xsl:for-each>
- </dd>
- </xsl:otherwise>
- </xsl:choose>
- </dl>
- <div class="form-buttons">
- <xsl:choose>
- <xsl:when test="editable">
- <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
- <input type="submit"
name="save" value="{$lang_save}" title = "{$lang_save}" />
- <input type="submit"
name="cancel" value="{$lang_cancel}" title = "{$lang_cancel}" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
- <input type="submit"
name="edit" value="{$lang_edit}" title = "{$lang_edit}" />
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </form>
- </div>
- </div>
-</div>
-</xsl:template>
Deleted:
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement.xsl
===================================================================
---
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement.xsl
2012-10-15 10:38:59 UTC (rev 10216)
+++
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement.xsl
2012-10-15 10:39:17 UTC (rev 10217)
@@ -1,141 +0,0 @@
-<!-- $Id: activity_item.xsl 10096 2012-10-03 07:10:49Z vator $ -->
-<!-- item -->
-
-<xsl:template match="data" xmlns:php="http://php.net/xsl">
-<xsl:variable name="date_format"><xsl:value-of
select="php:function('get_phpgw_info',
'user|preferences|common|dateformat')"/></xsl:variable>
-
-<xsl:call-template name="yui_phpgw_i18n"/>
-<div class="yui-navset yui-navset-top">
- <div style="clear: both;margin-bottom: 0;overflow: hidden;padding:
1em;" class="identifier-header">
- <xsl:choose>
- <xsl:when test="activity/id != '' or activity/id != 0">
- <h1 style="float:left;">
- <span>
- <xsl:value-of
select="php:function('lang', 'Add requirement to activity')" />
- </span>
- <span>
- {activity/name}
- </span>
- </h1>
- </xsl:when>
- <xsl:otherwise>
- <h1 style="float:left;">
- <xsl:value-of
select="php:function('lang', 'Add requirement')" />
- </h1>
- </xsl:otherwise>
- </xsl:choose>
- </div>
-
- <div class="yui-content" style="padding: 20px;">
- <div id="details">
- <form action="#" method="post">
- <input type="hidden" name="id" value =
"{activity/id}" />
-
- <dl class="proplist-col">
- <dt>
- <label
for="start_date">Startdato</label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when
test="editable">
- <input
class="date" id="start_date" name="start_date" type="text">
- <xsl:if
test="requirement/start_date != ''">
- <xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(requirement/start_date))"/></xsl:attribute>
- </xsl:if>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <span><xsl:value-of
select="php:function('date', $date_format,
number(requirement/start_date))"/></span>
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- <dt>
- <label
for="end_date">Sluttdato</label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when
test="editable">
- <input
class="date" id="end_date" name="end_date" type="text">
- <xsl:if
test="requirement/end_date != ''">
- <xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(requirement/end_date))"/></xsl:attribute>
- </xsl:if>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <span><xsl:value-of
select="php:function('date', $date_format,
number(requirement/end_date))"/></span>
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- <xsl:choose>
- <xsl:when test="editable">
- <dt>
-
<label>BIM</label>
- </dt>
- <dd>
- <select
name="location_id" id="location_id">
-
<xsl:for-each select="entity_list">
-
<option value="{id}">
-
<xsl:value-of select="name"/>
-
</option>
-
</xsl:for-each>
- </select>
- </dd>
- <dt>
-
<label>BIM2</label>
- </dt>
- <dd>
- <select
name="categories" id="categories">
- </select>
- </dd>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of
select="entity/name" />
- <xsl:value-of
select="category/name" />
- <xsl:for-each
select="attributes">
- <xsl:value-of
select="name" /><br/>
- </xsl:for-each>
- </xsl:otherwise>
- </xsl:choose>
- <dt>
- <label
for="no_of_items">Antall</label>
- </dt>
- <dd>
- <xsl:choose>
- <xsl:when
test="editable">
- <input
style="width: 20px;" id="no_of_items" name="no_of_items" type="text" />
- </xsl:when>
- <xsl:otherwise>
-
<span>{requirement/no_of_items}</span>
- </xsl:otherwise>
- </xsl:choose>
- </dd>
- </dl>
-
- <div class="form-buttons">
- <xsl:choose>
- <xsl:when test="editable">
- <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
- <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
- <input type="submit"
name="save_activity" value="{$lang_save}" title = "{$lang_save}" />
- <input type="submit"
name="cancel_activity" value="{$lang_cancel}" title = "{$lang_cancel}" />
- </xsl:when>
- <xsl:otherwise>
- <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
- <input type="submit"
name="edit_activity" value="{$lang_edit}" title = "{$lang_edit}" />
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </form>
- </div>
- </div>
-</div>
-</xsl:template>
-
-<xsl:template match="options">
- <option value="{id}">
- <xsl:if test="selected">
- <xsl:attribute name="selected" value="selected" />
- </xsl:if>
- <xsl:value-of disable-output-escaping="yes" select="name"/>
- </option>
-</xsl:template>
Copied:
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_item.xsl
(from rev 10210,
trunk/logistic/templates/base/requirement/requirement_item.xsl)
===================================================================
---
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_item.xsl
(rev 0)
+++
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_item.xsl
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,138 @@
+<!-- $Id: activity_item.xsl 10096 2012-10-03 07:10:49Z vator $ -->
+<!-- item -->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+<xsl:variable name="date_format"><xsl:value-of
select="php:function('get_phpgw_info',
'user|preferences|common|dateformat')"/></xsl:variable>
+
+<xsl:call-template name="yui_phpgw_i18n"/>
+<div class="yui-navset yui-navset-top">
+ <div style="clear: both;margin-bottom: 0;overflow: hidden;padding:
1em;" class="identifier-header">
+ <xsl:choose>
+ <xsl:when test="activity/id != '' or activity/id != 0">
+ <h1 style="float:left;">
+ <span>
+ <xsl:value-of
select="php:function('lang', 'Add requirement to activity')" />
+ </span>
+ <span style="margin-left:5px;">
+ <xsl:value-of
select="activity/name" />
+ </span>
+ </h1>
+ </xsl:when>
+ <xsl:otherwise>
+ <h1 style="float:left;">
+ <xsl:value-of
select="php:function('lang', 'Add requirement')" />
+ </h1>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+
+ <div class="yui-content" style="padding: 20px;">
+ <div id="details">
+ <form action="#" method="post">
+ <input type="hidden" name="id" value =
"{requirement/id}" />
+ <input type="hidden" name="activity_id" value =
"{activity/id}" />
+
+ <dl class="proplist-col">
+ <dt>
+ <label
for="start_date">Startdato</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <input
class="date" id="start_date" name="start_date" type="text">
+ <xsl:if
test="requirement/start_date != ''">
+ <xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(requirement/start_date))"/></xsl:attribute>
+ </xsl:if>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <span><xsl:value-of
select="php:function('date', $date_format,
number(requirement/start_date))"/></span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <dt>
+ <label
for="end_date">Sluttdato</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <input
class="date" id="end_date" name="end_date" type="text">
+ <xsl:if
test="requirement/end_date != ''">
+ <xsl:attribute
name="value"><xsl:value-of select="php:function('date', $date_format,
number(requirement/end_date))"/></xsl:attribute>
+ </xsl:if>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <span><xsl:value-of
select="php:function('date', $date_format,
number(requirement/end_date))"/></span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <dt>
+
<label>BIM</label>
+ </dt>
+ <dd>
+ <select
name="entity_id" id="entity_id">
+
<xsl:for-each select="entity_list">
+
<option value="{id}">
+
<xsl:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+ </select>
+ </dd>
+ <dt>
+
<label>BIM2</label>
+ </dt>
+ <dd>
+ <select
name="category_id" id="category_id">
+ </select>
+ </dd>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="location/descr" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <dt>
+ <label
for="no_of_items">Antall</label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <input
style="width: 20px;" id="no_of_items" name="no_of_items" type="text" />
+ </xsl:when>
+ <xsl:otherwise>
+ <span><xsl:value-of
select="requirement/no_of_items"/></span>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ </dl>
+
+ <div class="form-buttons">
+ <xsl:choose>
+ <xsl:when test="editable">
+ <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
+ <input type="submit"
name="save_requirement" value="{$lang_save}" title = "{$lang_save}" />
+ <input type="submit"
name="cancel_requirement" value="{$lang_cancel}" title = "{$lang_cancel}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
+ <input type="submit"
name="edit_requirement" value="{$lang_edit}" title = "{$lang_edit}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+</xsl:template>
+
+<xsl:template match="options">
+ <option value="{id}">
+ <xsl:if test="selected">
+ <xsl:attribute name="selected" value="selected" />
+ </xsl:if>
+ <xsl:value-of disable-output-escaping="yes" select="name"/>
+ </option>
+</xsl:template>
Copied:
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_tabs.xsl
(from rev 10210,
trunk/logistic/templates/base/requirement/requirement_tabs.xsl)
===================================================================
---
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_tabs.xsl
(rev 0)
+++
branches/Version-1_0-branch/logistic/templates/base/requirement/requirement_tabs.xsl
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,25 @@
+<!-- $Id: control_tabs.xsl 9951 2012-08-31 10:14:12Z vator $ -->
+<!-- separate tabs and inline tables-->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+<div class="yui-navset yui-navset-top" id="requirement_tabview">
+ <xsl:choose>
+ <xsl:when test="view = 'requirement_details'">
+ <xsl:call-template name="yui_phpgw_i18n"/>
+ <div class="identifier-header">
+ <h1><xsl:value-of select="php:function('lang',
'Control')"/></h1>
+ </div>
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
+ <xsl:call-template name="requirement_details" />
+ </xsl:when>
+ <xsl:when test="view = 'requirement_values'">
+ <div class="identifier-header">
+ <h1><xsl:value-of select="php:function('lang',
'Requirement_values')"/></h1>
+ </div>
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
+ <xsl:call-template name="requirement_values" />
+ </xsl:when>
+ </xsl:choose>
+</div>
+
+</xsl:template>
Copied:
branches/Version-1_0-branch/logistic/templates/base/resource_type_requirement_item.xsl
(from rev 10210,
trunk/logistic/templates/base/resource_type_requirement_item.xsl)
===================================================================
---
branches/Version-1_0-branch/logistic/templates/base/resource_type_requirement_item.xsl
(rev 0)
+++
branches/Version-1_0-branch/logistic/templates/base/resource_type_requirement_item.xsl
2012-10-15 10:39:17 UTC (rev 10217)
@@ -0,0 +1,135 @@
+<xsl:template match="data" xmlns:php="http://php.net/xsl">
+
+<xsl:call-template name="yui_phpgw_i18n"/>
+<div class="yui-navset yui-navset-top">
+ <div class="identifier-header">
+ <h1><img src="{img_go_home}" />
+ <xsl:value-of select="php:function('lang',
'Administrate requirements')" />
+ </h1>
+ </div>
+ <div class="yui-content">
+ <div id="details">
+ <form action="#" method="post">
+ <input type="hidden" name="id" value =
"{value_id}" />
+ <input type="hidden" name="location_id" value =
"{location_id}" />
+ <input type="hidden" name="project_type_id"
value = "{project_type_id}" />
+ <dl class="proplist-col">
+ <dt>
+ <label><xsl:value-of
select="php:function('lang', 'Project_type')" /></label>
+ </dt>
+ <dd>
+ <xsl:choose>
+ <xsl:when
test="editable">
+ <select
name="project_type_id" id="project_type_id">
+
<xsl:for-each select="project_types">
+
<option value="{id}">
+
<xsl:if test="selected">
+
<xsl:attribute name="selected" value="selected" />
+
</xsl:if>
+
<xsl:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+ </select>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="project_type/name" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
+ </dt>
+ <dd>
+ <select
name="entity_id" id="entity_id">
+
<xsl:for-each select="entities">
+
<option value="{id}">
+
<xsl:if test="selected">
+
<xsl:attribute name="selected" value="selected" />
+
</xsl:if>
+
<xsl:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+ </select>
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
+ </dt>
+ <dd>
+ <select
name="category_id" id="category_id">
+
<xsl:for-each select="categories">
+
<option value="{id}">
+
<xsl:if test="selected">
+
<xsl:attribute name="selected" value="selected" />
+
</xsl:if>
+
<xsl:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+ </select>
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Attributes')" /></label>
+ </dt>
+ <dd>
+ <div
id="attributes">
+ <xsl:if
test="req_type/cust_attribute_id">
+
<xsl:for-each select="attributes">
+
<xsl:if test="input_text">
+
<xsl:choose>
+
<xsl:when test="checked">
+
<input type='checkbox' name='attributes[]'
id='attributes[]' value='{id}' checked='checked'/><xsl:value-of
select="input_text" /> <xsl:value-of select="trans_datatype" /><br/>
+
</xsl:when>
+
<xsl:otherwise>
+
<input type='checkbox' name='attributes[]'
id='attributes[]' value='{id}'/><xsl:value-of select="input_text" />
<xsl:value-of select="trans_datatype" /><br/>
+
</xsl:otherwise>
+
</xsl:choose>
+
</xsl:if>
+
</xsl:for-each>
+
</xsl:if>
+ </div>
+ </dd>
+ </xsl:when>
+ <xsl:otherwise>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Entity')" /></label>
+ </dt>
+ <dd>
+ <xsl:value-of
select="entity/name" />
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Category')" /></label>
+ </dt>
+ <dd>
+ <xsl:value-of
select="category/name" />
+ </dd>
+ <dt>
+
<label><xsl:value-of select="php:function('lang', 'Chosen attributes')"
/></label>
+ </dt>
+ <dd>
+ <xsl:for-each
select="attributes">
+
<xsl:value-of select="input_text" /> (<xsl:value-of select="trans_datatype"
/>)<br/>
+ </xsl:for-each>
+ </dd>
+ </xsl:otherwise>
+ </xsl:choose>
+ </dl>
+ <div class="form-buttons">
+ <xsl:choose>
+ <xsl:when test="editable">
+ <xsl:variable
name="lang_save"><xsl:value-of select="php:function('lang', 'save')"
/></xsl:variable>
+ <xsl:variable
name="lang_cancel"><xsl:value-of select="php:function('lang', 'cancel')"
/></xsl:variable>
+ <input type="submit"
name="save" value="{$lang_save}" title = "{$lang_save}" />
+ <input type="submit"
name="cancel" value="{$lang_cancel}" title = "{$lang_cancel}" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable
name="lang_edit"><xsl:value-of select="php:function('lang', 'edit')"
/></xsl:variable>
+ <input type="submit"
name="edit" value="{$lang_edit}" title = "{$lang_edit}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </form>
+ </div>
+ </div>
+</div>
+</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10217] Merge 10166:10210 from trunk,
Sigurd Nes <=