fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10714] logistic: show pre-allocated / update require


From: Sigurd Nes
Subject: [Fmsystem-commits] [10714] logistic: show pre-allocated / update requirements table on delete allocated
Date: Fri, 25 Jan 2013 14:27:13 +0000

Revision: 10714
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10714
Author:   sigurdne
Date:     2013-01-25 14:27:08 +0000 (Fri, 25 Jan 2013)
Log Message:
-----------
logistic: show pre-allocated / update requirements table on delete allocated

Modified Paths:
--------------
    trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
    trunk/logistic/js/logistic/resource_allocation.js
    trunk/logistic/templates/base/allocation/book_resources.xsl

Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2013-01-24 20:54:40 UTC (rev 10713)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php  
2013-01-25 14:27:08 UTC (rev 10714)
@@ -301,9 +301,18 @@
 
                        if($requirement)
                        {
-                               $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($requirement->get_location_id());
-                               $entity_arr = explode('.',$loc_arr['location']);
-
+// find allocated
+                               $allocated_objects = $this->so->get(null, null, 
null, null, null, null, array('requirement_id' => $requirement->get_id()));
+                               
+                               $allocated = array();
+                               if($allocated_objects)
+                               {
+                                       foreach ($allocated_objects as 
$allocated_object)
+                                       {
+                                               $allocated[] = 
$allocated_object->get_resource_id();
+                                       }
+                               }
+//
                                $requirement_values = 
$this->so_requirement_value->get(null, null, null, null, null, null, 
array('requirement_id' => $requirement->get_id()));
 
                                $criterias_array = array();
@@ -311,11 +320,7 @@
                                $location_id = $requirement->get_location_id();
 
                                $loc_arr = 
$GLOBALS['phpgw']->locations->get_name($location_id);
-                               $entity_arr = explode('.',$loc_arr['location']);
 
-                               $entity_id = $entity_arr[2];
-                               $cat_id = $entity_arr[3];
-
                                $criterias_array['location_id'] = $location_id;
                                $criterias_array['allrows'] = true;
 
@@ -341,26 +346,30 @@
                                                $operator_str = ">";
                                        }
 
-                                       $attrib_data = $custom->get('property', 
".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
+                                       $attrib_data = 
$custom->get($loc_arr['appname'], $loc_arr['location'], $cust_attribute_id);
 
                                        $view_criterias_array[] =  array(
-                                                       'operator'              
                                =>      $operator_str,
-                                                       'value'                 
                                        =>      $attrib_value,
-                                                       "cust_attribute_data" 
=> $attrib_data
+                                                       'operator'              
                                => $operator_str,
+                                                       'value'                 
                                => $attrib_value,
+                                                       'cust_attribute_data'   
                => $attrib_data
                                                );
 
                                        $condition = array(
                                                'operator'              => 
$operator_str,
-                                               'value'                         
=> $attrib_value,
-                                               'attribute_id' => 
$cust_attribute_id
+                                               'value'                 => 
$attrib_value,
+                                               'attribute_id'  => 
$cust_attribute_id
                                        );
 
                                        $criterias_array['conditions'][] = 
$condition;
                                }
                        }
                    
-                       $so_entity      = 
CreateObject('property.soentity',$entity_id,$cat_id);
-                       $allocation_suggestions = 
$so_entity->get_eav_list($criterias_array);
+                       $allocation_suggestions = 
execMethod('property.soentity.get_eav_list', $criterias_array);
+                       
+                       foreach ($allocation_suggestions as 
&$allocation_suggestion)
+                       {
+                               $allocation_suggestion['allocated'] = 
in_array($allocation_suggestion['id'],$allocated);
+                       }
 
                        $activity = $this->so_activity->get_single( 
$requirement->get_activity_id() );
 

Modified: trunk/logistic/js/logistic/resource_allocation.js
===================================================================
--- trunk/logistic/js/logistic/resource_allocation.js   2013-01-24 20:54:40 UTC 
(rev 10713)
+++ trunk/logistic/js/logistic/resource_allocation.js   2013-01-25 14:27:08 UTC 
(rev 10714)
@@ -20,7 +20,8 @@
                                  var obj = jQuery.parseJSON(data);
                          
                          if(obj.status == "deleted"){
-                                 $(thisRow).remove();
+                                       $(thisRow).remove();
+                                               
YAHOO.portico.updateinlineTableHelper('requirement-container');
                                  }
                          },
                          error: function(XMLHttpRequest, textStatus, 
errorThrown) {

Modified: trunk/logistic/templates/base/allocation/book_resources.xsl
===================================================================
--- trunk/logistic/templates/base/allocation/book_resources.xsl 2013-01-24 
20:54:40 UTC (rev 10713)
+++ trunk/logistic/templates/base/allocation/book_resources.xsl 2013-01-25 
14:27:08 UTC (rev 10714)
@@ -76,7 +76,7 @@
                                        <div class="resource heading">
                                                        <span class="desc">Kort 
beskrivelse</span>
                                                        <span 
class="loc_id">Lokasjons id</span>
-                                                       <span 
class="type">Type</span>
+                                               <!--    <span 
class="type">Type</span> -->
                                                        <span 
class="loc_code">Lokasjons kode</span>
                                        </div>
                                        <xsl:for-each 
select="allocation_suggestions">
@@ -90,11 +90,15 @@
                                                        <xsl:attribute 
name="class">resource even</xsl:attribute>
                                                    </xsl:otherwise>
                                                  </xsl:choose>
-                                               
-                                                       <input type="checkbox" 
value="{id}" name="chosen_resources[]" />
+                                                       <input type="checkbox" 
value="{id}" name="chosen_resources[]" >
+                                                               <xsl:if 
test="allocated = 1">
+                                                               <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>
                                                        <span 
class="loc_id"><xsl:value-of select="location_id" /></span>
-                                                       <span 
class="type"><xsl:value-of select="type_lokale" /></span>
+                                               <!--    <span 
class="type"><xsl:value-of select="type_lokale" /></span> -->
                                                        <span 
class="loc_code"><xsl:value-of select="location_code" /></span>
                                                </div>
                                        </xsl:for-each>
@@ -104,4 +108,4 @@
                        </form>
        </div>
 </div>
-</xsl:template>
\ No newline at end of file
+</xsl:template>




reply via email to

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