[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11075] more on logistic
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11075] more on logistic |
Date: |
Wed, 24 Apr 2013 13:40:58 +0000 |
Revision: 11075
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11075
Author: sigurdne
Date: 2013-04-24 13:40:57 +0000 (Wed, 24 Apr 2013)
Log Message:
-----------
more on logistic
Modified Paths:
--------------
trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
trunk/logistic/templates/base/allocation/book_resources.xsl
Modified: trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
2013-04-24 09:26:14 UTC (rev 11074)
+++ trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
2013-04-24 13:40:57 UTC (rev 11075)
@@ -51,6 +51,7 @@
(
'location_id' =>
$resource_alloc->get_location_id(),
'item_id' =>
$this->marshal($resource_alloc->get_resource_id(), 'int'),
+ 'item_inventory_id' =>
$this->marshal($resource_alloc->get_inventory_id(), 'int'),
'allocation_id' => 0,//not known yet
'create_user' =>
$resource_alloc->get_create_user(),
'create_date' => time(),
Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
2013-04-24 09:26:14 UTC (rev 11074)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
2013-04-24 13:40:57 UTC (rev 11075)
@@ -361,7 +361,7 @@
{
foreach ($allocation_suggestions as
&$entry)
{
- $entry['inventory'] =
execMethod('property.soentity.get_inventory', array('location_id' =>
$location_id, 'id' => $entry['id']));
+ $entry['inventory'] =
execMethod('property.boentity.get_inventory', array('location_id' =>
$location_id, 'id' => $entry['id']));
}
}
@@ -444,6 +444,8 @@
$user_id = $GLOBALS['phpgw_info']['user']['id'];
$chosen_resources = phpgw::get_var('chosen_resources');
+
+ $inventory_ids = phpgw::get_var('inventory_ids');
$filters = array('requirement_id' =>
$requirement->get_id());
$num_allocated = $this->so->get_count($search_for,
$search_type, $filters);
@@ -452,8 +454,34 @@
$num_allowed_bookings = $num_required - $num_allocated;
- if( count($chosen_resources) <= $num_allowed_bookings)
+ if($inventory_ids)
{
+ foreach ($inventory_ids as $resource =>
$inventory)
+ {
+ if($inventory)
+ {
+ $resource_arr = explode('_',
$resource);
+ $resource_id = $resource_arr[0];
+ $inventory_id =
$resource_arr[1];
+
+ $resource_alloc = new
logistic_requirement_resource_allocation();
+
$resource_alloc->set_requirement_id( $requirement->get_id() );
+
$resource_alloc->set_resource_id( $resource_id );
+ //FIXME:
+_debug_array($inventory_id);
+
$resource_alloc->set_inventory_id( $inventory_id );
+
$resource_alloc->set_location_id( $requirement->get_location_id() );
+
$resource_alloc->set_create_user( $user_id );
+
$resource_alloc->set_start_date( $requirement->get_start_date() );
+ $resource_alloc->set_end_date(
$requirement->get_start_date() );
+ $resource_alloc_id =
$this->so->store( $resource_alloc );
+
+ }
+ }
+
+ }
+ else if( count($chosen_resources) <=
$num_allowed_bookings)
+ {
foreach($chosen_resources as $resource_id)
{
$resource_alloc = new
logistic_requirement_resource_allocation();
@@ -467,12 +495,10 @@
$resource_alloc_id = $this->so->store(
$resource_alloc );
}
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.view_resource_allocation',
'activity_id' => $requirement->get_activity_id()));
}
- else
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.view_resource_allocation',
'activity_id' => $requirement->get_activity_id()));
- }
+
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.view_resource_allocation',
'activity_id' => $requirement->get_activity_id()));
+
}
public function delete()
Modified: trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
2013-04-24 09:26:14 UTC (rev 11074)
+++ trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
2013-04-24 13:40:57 UTC (rev 11075)
@@ -36,6 +36,7 @@
protected $id;
protected $requirement_id;
protected $resource_id;
+ protected $inventory;
protected $location_id;
protected $create_user;
@@ -87,6 +88,17 @@
return $this->resource_id;
}
+
+ public function set_inventory_id($inventory_id)
+ {
+ $this->inventory_id = $inventory_id;
+ }
+
+ public function get_inventory_id()
+ {
+ return $this->inventory_id;
+ }
+
public function set_location_id($location_id)
{
$this->location_id = $location_id;
@@ -189,6 +201,7 @@
'resource_type_descr' =>
$this->get_resource_type_descr(),
'requirement_id' =>
$this->get_requirement_id(),
'resource_id' =>
$this->get_resource_id(),
+ 'inventory_id' =>
$this->get_inventory_id(),
'location_id' =>
$this->get_location_id(),
'location_code' =>
$this->get_location_code(),
'fm_bim_item_address' =>
$this->get_fm_bim_item_address(),
Modified: trunk/logistic/templates/base/allocation/book_resources.xsl
===================================================================
--- trunk/logistic/templates/base/allocation/book_resources.xsl 2013-04-24
09:26:14 UTC (rev 11074)
+++ trunk/logistic/templates/base/allocation/book_resources.xsl 2013-04-24
13:40:57 UTC (rev 11075)
@@ -89,25 +89,48 @@
<div>
<xsl:choose>
- <xsl:when
test="(position() mod 2) != 1">
- <xsl:attribute
name="class">resource odd</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute
name="class">resource even</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
+ <xsl:when
test="(position() mod 2) != 1">
+ <xsl:attribute
name="class">resource odd</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute
name="class">resource even</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
<input type="checkbox"
value="{id}" name="chosen_resources[]" >
- <xsl:if
test="allocated = 1">
+ <xsl:if
test="allocated = 1 or inventory != ''">
<xsl:attribute
name="checked">checked</xsl:attribute>
<xsl:attribute
name="disabled">disabled</xsl:attribute>
</xsl:if>
</input>
<span
class="desc"><xsl:value-of select="short_description" /></span>
+
+ <xsl:choose>
+ <xsl:when
test="inventory != ''">
+
<xsl:for-each select="inventory">
+
<div>
+
<span class="loc_code"></span>
+
<span class="loc_code">
+
<input type="text" value="{allocated}"
name="inventory_ids[{//allocation_suggestions/id}_{inventory_id}]" size='4'>
+
</input>
+
</span>
+
<span class="loc_code"><xsl:value-of disable-output-escaping="yes"
select="where" /></span>
+
<span class="loc_code"><xsl:value-of select="unit" /></span>
+
<span class="loc_code"><xsl:value-of select="inventory" /></span>
+
+
</div>
+
</xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
<span
class="loc_id"><xsl:value-of select="location_id" /></span>
<!-- <span
class="type"><xsl:value-of select="type_lokale" /></span> -->
<span
class="loc_code"><xsl:value-of select="location_code" /></span>
<span
class="loc_code"><xsl:value-of select="allocated_date" /></span>
<span
class="loc_code"><xsl:value-of select="allocated_where" /></span>
+
+ </xsl:otherwise>
+ </xsl:choose>
+
+
</div>
</xsl:for-each>
</div>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11075] more on logistic,
Sigurd Nes <=