[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10138] Added files for bim type requirement
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [10138] Added files for bim type requirement |
Date: |
Mon, 08 Oct 2012 08:02:20 +0000 |
Revision: 10138
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10138
Author: erikhl
Date: 2012-10-08 08:02:19 +0000 (Mon, 08 Oct 2012)
Log Message:
-----------
Added files for bim type requirement
Modified Paths:
--------------
trunk/logistic/inc/class.menu.inc.php
trunk/logistic/inc/class.sobim_type_requirement.inc.php
trunk/logistic/inc/class.uibim_type_requirement.inc.php
trunk/logistic/inc/class.uirequirement.inc.php
trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
trunk/logistic/inc/model/class.requirement_value.inc.php
trunk/logistic/setup/phpgw_no.lang
trunk/logistic/setup/setup.inc.php
trunk/logistic/setup/tables_current.inc.php
trunk/logistic/setup/tables_update.inc.php
trunk/logistic/templates/base/bim_type_requirement_item.xsl
Added Paths:
-----------
trunk/logistic/js/logistic/bim_type_requirement.js
Modified: trunk/logistic/inc/class.menu.inc.php
===================================================================
--- trunk/logistic/inc/class.menu.inc.php 2012-10-08 06:26:02 UTC (rev
10137)
+++ trunk/logistic/inc/class.menu.inc.php 2012-10-08 08:02:19 UTC (rev
10138)
@@ -69,7 +69,7 @@
),
'booking' =>
array
(
-
'text' => lang('booking'),
+
'text' => lang('allocation'),
'url' => $GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'logistic.uibooking.index') ),
'image' => array('property', 'location_tenant'),
),
Modified: trunk/logistic/inc/class.sobim_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.sobim_type_requirement.inc.php 2012-10-08
06:26:02 UTC (rev 10137)
+++ trunk/logistic/inc/class.sobim_type_requirement.inc.php 2012-10-08
08:02:19 UTC (rev 10138)
@@ -45,7 +45,24 @@
protected function add(&$object)
{
+ $user_id = $GLOBALS['phpgw_info']['user']['id'];
+ $now = time();
+ $loc_id = $object->get_location_id();
+ $cust_attribute_id = $object->get_cust_attribute_id();
+ $type_id = $project->get_project_type_id();
+ $sql = "INSERT INTO lg_bim_item_type_requirement
(location_id, cust_attribute_id, project_type_id, create_user, create_date)
VALUES ('$loc_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()
Modified: trunk/logistic/inc/class.uibim_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uibim_type_requirement.inc.php 2012-10-08
06:26:02 UTC (rev 10137)
+++ trunk/logistic/inc/class.uibim_type_requirement.inc.php 2012-10-08
08:02:19 UTC (rev 10138)
@@ -44,7 +44,10 @@
'query' => true,
'index' => true,
'edit' => true,
- 'add' => true
+ 'add' => true,
+ 'view' => true,
+ 'get_bim_level1' => true,
+ 'get_bim_level2' => true
);
public function __construct()
@@ -212,51 +215,79 @@
self::render_template_xsl('datatable_common', $data);
}
- public function edit()
+ public function add()
{
-
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uibim_type_requirement.edit'));
}
- public function add()
+ public function edit()
{
- $custom = createObject('phpgwapi.custom_fields');
- $entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
+ $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();
+ }
- //_debug_array($entity_list);
+ if (isset($_POST['save']))
+ {
+
$req_type->set_location_id(phpgw::get_var('location_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));
- foreach($entity_list as &$entry)
+ $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']))
{
- $cat_list =
execMethod('property.soadmin_entity.read_category',(array('allrows'=>true,'entity_id'=>$entry['id'])));
- //_debug_array($cat_list);
+ $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));
- foreach($cat_list as &$cat)
- {
- $attrib_data =
$custom->find('property',".entity.{$cat['entity_id']}.{$cat[id]}", 0,
'','','',true, true);
- $cat['attrib'] = $attrib_data;
- //_debug_array($attrib_data);
- }
+ array_unshift($entity_list,array
('id'=>'','name'=> lang('select value')));
+ $project_type_array =
$this->so_project->get_project_types();
- $entry['cat_list'] = $cat_list;
+ $data = array
+ (
+ 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
+ 'entities' => $entity_list,
+ 'project_types' =>
$project_type_array,
+ 'editable' => true
+ );
+ $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);
}
+ }
- //var_dump($entity_list);
- array_unshift($entity_list,array ('id'=>'','name'=>
lang('select value')));
- $project_type_array =
$this->so_project->get_project_types();
+ public function get_bim_level1()
+ {
+ $entity_id = phpgw::get_var('entity_id');
+ $entity =
CreateObject('property.soadmin_entity');
- $data = array
- (
- 'img_go_home' =>
'rental/templates/base/images/32x32/actions/go-home.png',
- 'entities' => $entity_list,
- 'project_types' => $project_type_array,
- 'editable' => true
- );
+ $category_list =
$entity->read_category(array('allrows'=>true,'entity_id'=>$entity_id));
- $GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Project type');
+ return $category_list;
+ }
- phpgwapi_jquery::load_widget('core');
+ public function get_bim_level2()
+ {
+ $custom = createObject('phpgwapi.custom_fields');
+ $entity_id = phpgw::get_var('entity_id');
+ $cat_id = phpgw::get_var('cat_id');
- self::add_javascript('logistic', 'logistic', 'ajax.js');
-
self::render_template_xsl(array('bim_type_requirement_item'), $data);
+ $attrib_data =
$custom->find('property',".entity.{$entity_id}.{$cat_id}", 0, '','','',true,
true);
+
+ return $attrib_data;
}
}
Modified: trunk/logistic/inc/class.uirequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement.inc.php 2012-10-08 06:26:02 UTC
(rev 10137)
+++ trunk/logistic/inc/class.uirequirement.inc.php 2012-10-08 08:02:19 UTC
(rev 10138)
@@ -282,7 +282,5 @@
}
}
-
-
}
}
Modified: trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
2012-10-08 06:26:02 UTC (rev 10137)
+++ trunk/logistic/inc/model/class.bim_item_type_requirement.inc.php
2012-10-08 08:02:19 UTC (rev 10138)
@@ -36,8 +36,7 @@
protected static $id;
protected static $location_id;
protected static $project_type_id;
- protected static $attribute_name;
- protected static $attribute_type;
+ protected static $cust_attribute_id;
/**
* Constructor. Takes an optional ID. If a contract is
created from outside
@@ -80,26 +79,16 @@
return $this->project_type_id;
}
- public function set_attribute_name($attribute_name)
+ public function set_cust_attribute_id($cust_attribute_id)
{
- $this->attribute_name = $attribute_name;
+ $this->cust_attribute_id = $cust_attribute_id;
}
- public function get_attribute_name()
+ public function get_cust_attribute_id()
{
- return $this->attribute_name;
+ return $this->cust_attribute_id;
}
- public function set_attribute_type($attribute_type)
- {
- $this->attribute_type = $attribute_type;
- }
-
- public function get_attribute_type()
- {
- return $this->attribute_type;
- }
-
/**
* Get a static reference to the storage object associated with
this model object
*
@@ -108,7 +97,7 @@
public static function get_so()
{
if (self::$so == null) {
- self::$so =
CreateObject('logistic.sobim_item_type_requirement');
+ self::$so =
CreateObject('logistic.sobim_type_requirement');
}
return self::$so;
Modified: trunk/logistic/inc/model/class.requirement_value.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement_value.inc.php 2012-10-08
06:26:02 UTC (rev 10137)
+++ trunk/logistic/inc/model/class.requirement_value.inc.php 2012-10-08
08:02:19 UTC (rev 10138)
@@ -35,7 +35,8 @@
protected static $id;
protected static $requirement_id;
- protected static $bim_item_type_requirement_id;
+ protected $location_id;
+ protected $cust_attribute_id;
protected static $value;
/**
@@ -69,16 +70,26 @@
return $this->requirement_id;
}
- public function
set_bim_item_type_requirement_id($bim_item_type_requirement_id)
+ public function set_location_id($location_id)
{
- $this->bim_item_type_requirement_id =
$bim_item_type_requirement_id;
+ $this->location_id = $location_id;
}
- public function get_bim_item_type_requirement_id()
+ public function get_location_id()
{
- return $this->bim_item_type_requirement_id;
+ return $this->location_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;
+ }
+
public function set_value($value)
{
$this->value = $value;
Added: trunk/logistic/js/logistic/bim_type_requirement.js
===================================================================
--- trunk/logistic/js/logistic/bim_type_requirement.js
(rev 0)
+++ trunk/logistic/js/logistic/bim_type_requirement.js 2012-10-08 08:02:19 UTC
(rev 10138)
@@ -0,0 +1,64 @@
+$(document).ready(function(){
+
+ $("#location_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>";
+ });
+
+ $("#categories").html( htmlString );
+ }
+ else
+ {
+ htmlString += "";
+ $("#categories").html( htmlString );
+ }
+ }
+ });
+ });
+
+ $("#categories").change(function () {
+ var oArgs =
{menuaction:'logistic.uibim_type_requirement.get_bim_level2', entity_id:
$("#location_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: trunk/logistic/setup/phpgw_no.lang
===================================================================
--- trunk/logistic/setup/phpgw_no.lang 2012-10-08 06:26:02 UTC (rev 10137)
+++ trunk/logistic/setup/phpgw_no.lang 2012-10-08 08:02:19 UTC (rev 10138)
@@ -3,6 +3,7 @@
project logistic no Prosjekt
activity logistic no Aktivitet
booking logistic no Booking
+allocation logistic no Beholdning
requirement logistic no Behov
Project name logistic no Navn
Project type logistic no Type
Modified: trunk/logistic/setup/setup.inc.php
===================================================================
--- trunk/logistic/setup/setup.inc.php 2012-10-08 06:26:02 UTC (rev 10137)
+++ trunk/logistic/setup/setup.inc.php 2012-10-08 08:02:19 UTC (rev 10138)
@@ -1,6 +1,6 @@
<?php
$setup_info['logistic']['name'] = 'logistic';
- $setup_info['logistic']['version'] = '0.0.3';
+ $setup_info['logistic']['version'] = '0.0.4';
$setup_info['logistic']['app_order'] = 70;
$setup_info['logistic']['enable'] = 1;
$setup_info['logistic']['app_group'] = 'office';
Modified: trunk/logistic/setup/tables_current.inc.php
===================================================================
--- trunk/logistic/setup/tables_current.inc.php 2012-10-08 06:26:02 UTC (rev
10137)
+++ trunk/logistic/setup/tables_current.inc.php 2012-10-08 08:02:19 UTC (rev
10138)
@@ -102,8 +102,7 @@
'fd' => array(
'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
'location_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
- 'attribute_name' =>
array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
- 'attribute_type' =>
array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
+ 'cust_attribute_id' =>
array('type' => 'varchar', 'precision' => 255, 'nullable' => false),
'project_type_id' =>
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),
@@ -120,6 +119,8 @@
'fd' => array(
'id' => array('type' => 'auto',
'precision' => 4, 'nullable' => false),
'type_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),
'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_date' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
Modified: trunk/logistic/setup/tables_update.inc.php
===================================================================
--- trunk/logistic/setup/tables_update.inc.php 2012-10-08 06:26:02 UTC (rev
10137)
+++ trunk/logistic/setup/tables_update.inc.php 2012-10-08 08:02:19 UTC (rev
10138)
@@ -29,3 +29,37 @@
$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->AddColumn('lg_requirement_value','cust_attribute_id',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => True
+ ));
+
+
$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'];
+ }
\ No newline at end of file
Modified: trunk/logistic/templates/base/bim_type_requirement_item.xsl
===================================================================
--- trunk/logistic/templates/base/bim_type_requirement_item.xsl 2012-10-08
06:26:02 UTC (rev 10137)
+++ trunk/logistic/templates/base/bim_type_requirement_item.xsl 2012-10-08
08:02:19 UTC (rev 10138)
@@ -16,73 +16,59 @@
<dt>
<label for="name"><xsl:value-of
select="php:function('lang','Project title')" /></label>
</dt>
- <dd>
- <xsl:for-each select="entities">
- <xsl:value-of
disable-output-escaping="yes" select="name"/><br/>
- <i><xsl:value-of
disable-output-escaping="yes" select="descr"/></i><br/>
- <ul>
- <xsl:for-each
select="cat_list">
- <li>
-
<xsl:value-of disable-output-escaping="yes" select="name"/><br/>
-
<i><xsl:value-of disable-output-escaping="yes" select="descr"/></i><br/>
-
<xsl:for-each select="attrib">
-
<xsl:value-of disable-output-escaping="yes"
select="name"/><br/>
-
<i><xsl:value-of disable-output-escaping="yes"
select="descr"/></i>
-
</xsl:for-each>
- </li>
- </xsl:for-each>
- </ul>
- <br/>
- </xsl:for-each>
- </dd>
<dt>
<label>Prosjekttype</label>
</dt>
<dd>
- <select name="project_type"
id="project_type">
- <xsl:for-each
select="project_types">
- <option
value="{id}">
-
<xsl:value-of select="name"/>
- </option>
- </xsl:for-each>
- </select>
+ <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:value-of select="name"/>
+
</option>
+
</xsl:for-each>
+ </select>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of
select="project_type_id" />
+ </xsl:otherwise>
+ </xsl:choose>
</dd>
- <dt>
- <label>BIM</label>
- </dt>
- <dd>
- <select name="level0"
id="level0">
- <xsl:for-each
select="entities">
- <option
value="{id}">
-
<xsl:value-of select="name"/>
- </option>
- </xsl:for-each>
- </select>
- </dd>
- <dt>
- <label>BIM2</label>
- </dt>
- <dd>
- <select name="level1"
id="level1">
- <xsl:for-each
select="entities/cat_list">
- <option
value="{id}">
-
<xsl:value-of select="name"/>
- </option>
- </xsl:for-each>
- </select>
- </dd>
- <dt>
- <label>BIM3</label>
- </dt>
- <dd>
- <select name="level2"
id="level2">
- <xsl:for-each
select="entities/cat_list/attrib">
- <option
value="{id}">
-
<xsl:value-of select="name"/>
- </option>
- </xsl:for-each>
- </select>
- </dd>
+ <xsl:choose>
+ <xsl:when test="editable">
+ <dt>
+
<label>BIM</label>
+ </dt>
+ <dd>
+ <select
name="location_id" id="location_id">
+
<xsl:for-each select="entities">
+
<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>
+ <dt>
+
<label>BIM3</label>
+ </dt>
+ <dd>
+ <div
id="attributes">
+ </div>
+ </dd>
+ </xsl:when>
+ <xsl:otherwise>
+ Visningsmodus!
+ <xsl:value-of
select="cust_attribute_id" />
+ </xsl:otherwise>
+ </xsl:choose>
</dl>
<div class="form-buttons">
<xsl:choose>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10138] Added files for bim type requirement,
Erik Holm-Larsen <=