[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10282] files for allocating requirement
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [10282] files for allocating requirement |
Date: |
Mon, 22 Oct 2012 06:21:30 +0000 |
Revision: 10282
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10282
Author: erikhl
Date: 2012-10-22 06:21:29 +0000 (Mon, 22 Oct 2012)
Log Message:
-----------
files for allocating requirement
Modified Paths:
--------------
trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
trunk/logistic/inc/class.uiresource_type_requirement.inc.php
trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
trunk/logistic/templates/base/allocation/allocation_item.xsl
Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
2012-10-21 10:44:49 UTC (rev 10281)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
2012-10-22 06:21:29 UTC (rev 10282)
@@ -50,6 +50,7 @@
private $bocommon;
private $so_activity;
private $so_requirement;
+ private $so_requirement_value;
private $so;
public $public_functions = array(
@@ -70,6 +71,7 @@
$this->so_activity =
createObject('logistic.soactivity');
$this->so_requirement =
createObject('logistic.sorequirement');
+ $this->so_requirement_value =
CreateObject('logistic.sorequirement_value');
$this->type_id =
$this->bo->type_id;
@@ -294,18 +296,7 @@
{
$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);
@@ -338,39 +329,102 @@
{
$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]);
+ //_debug_array($entity_arr);
+ //$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)
+ $requirement_values =
$this->so_requirement_value->get(null, null, null, null, null, null,
array('requirement_id' => $requirement->get_id()));
+ //_debug_array($requirement_values);
+ foreach($requirement_values as
$requirement_value)
{
- if($attr['id'] ==
$requirement_value->get_cust_attribute_id())
+ foreach ($all_attributes as
&$attr)
{
- $attributes[] = $attr;
+ if($attr['id'] ==
$requirement_value->get_cust_attribute_id())
+ {
+
$attr['req_value'] = $requirement_value->get_value();
+ $attr['op'] =
$requirement_value->get_operator();
+ $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)
+ for($index=0;
$index<count($attributes); $index++)
{
- if($it[$column_name] ==
$col_val)
+ $curr_attr =
$attributes[$index];
+ $column_name =
$curr_attr['column_name'];
+ if($curr_attr['choice'] &&
count($curr_attr['choice'])>0)
+ {
+ $curr_choice =
$curr_attr['choice'];
+ $curr_attr_req_value =
$curr_attr['req_value'];
+ foreach ($curr_choice
as $ch)
{
- $list_items[] =
$it;
+ $col_val =
$ch['value'];
+ if($col_val ==
$curr_attr_req_value)
+ {
+ foreach
($items as $it)
+ {
+
if($it[$column_name] == $col_val)
+
{
+
$list_items[] = $it;
+
}
+ }
+ }
}
+ }
+ else
+ {
+ foreach ($items as $it)
+ {
+
//var_dump($it[$column_name]);
+
//var_dump($curr_attr['op']);
+
//var_dump($it[$column_name]);
+ $operator =
$curr_attr['op'];
+ if($operator)
+ {
+
var_dump($operator);
+
var_dump($it[$column_name]);
+
var_dump($col_val);
+
if($operator == "eq")
+ {
+
if($it[$column_name] == $col_val)
+
{
+
$list_items[] = $it;
+
}
+ }
+ else
if($operator == 'gt')
+ {
+
if(is_numeric($it[$column_name]) && $it[$column_name] > $col_val)
+
{
+
$list_items[] = $it;
+
}
+ }
+ else
if($operator == 'lt')
+ {
+
if(is_numeric($it[$column_name]) && $it[$column_name] < $col_val)
+
{
+
$list_items[] = $it;
+
}
+ }
+ }
+/*
if($it[$column_name] == $col_val)
+ {
+
$list_items[] = $it;
+ } */
+ }
+
+
//var_dump($curr_attr[$column_name]);
+ }
}
- //echo $column_value;
- _debug_array($list_items);
-
}
+ //_debug_array($list_items);
+
$data = array
(
'editable' => true,
Modified: trunk/logistic/inc/class.uiresource_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uiresource_type_requirement.inc.php
2012-10-21 10:44:49 UTC (rev 10281)
+++ trunk/logistic/inc/class.uiresource_type_requirement.inc.php
2012-10-22 06:21:29 UTC (rev 10282)
@@ -272,7 +272,6 @@
$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)
Modified: trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
2012-10-21 10:44:49 UTC (rev 10281)
+++ trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
2012-10-22 06:21:29 UTC (rev 10282)
@@ -37,7 +37,7 @@
protected static $requirement_id;
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.
@@ -102,4 +102,26 @@
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_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: trunk/logistic/templates/base/allocation/allocation_item.xsl
===================================================================
--- trunk/logistic/templates/base/allocation/allocation_item.xsl
2012-10-21 10:44:49 UTC (rev 10281)
+++ trunk/logistic/templates/base/allocation/allocation_item.xsl
2012-10-22 06:21:29 UTC (rev 10282)
@@ -9,17 +9,14 @@
<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;">
+ <h1 style="float:left;">
<span>
- <xsl:value-of
select="php:function('lang', 'Add requirement to activity')" />
+ <xsl:value-of
select="php:function('lang', 'Add resources to activity')"/>: <xsl:value-of
select="activity/name"/>
</span>
- <span>
- {activity/name}
- </span>
</h1>
</xsl:when>
<xsl:otherwise>
- <h1 style="float:left;">
+ <h1 style="float:left;">
<xsl:value-of
select="php:function('lang', 'Add requirement')" />
</h1>
</xsl:otherwise>
@@ -30,87 +27,36 @@
<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>
+ <span><xsl:value-of
select="php:function('date', $date_format,
number(requirement/start_date))"/></span>
</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>
+ <span><xsl:value-of
select="php:function('date', $date_format,
number(requirement/end_date))"/></span>
</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>
+ <span><xsl:value-of
select="requirement/no_of_items" /></span>
</dd>
+ <dt>
+ <label
for="bim_item">ELEMENTER</label>
+ </dt>
+ <dd>
+ <xsl:for-each select="elements">
+ <input type="checkbox"
value="{id}" /> <xsl:value-of select="location_code" /> - <xsl:value-of
select="type" /><br/>
+ </xsl:for-each>
+ </dd>
</dl>
-
+
<div class="form-buttons">
<xsl:choose>
<xsl:when test="editable">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10282] files for allocating requirement,
Erik Holm-Larsen <=