[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11287] more on logistic
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11287] more on logistic |
Date: |
Wed, 11 Sep 2013 11:37:15 +0000 |
Revision: 11287
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11287
Author: sigurdne
Date: 2013-09-11 11:37:14 +0000 (Wed, 11 Sep 2013)
Log Message:
-----------
more on logistic
Modified Paths:
--------------
trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
trunk/logistic/inc/class.uirequirement.inc.php
trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
trunk/logistic/js/logistic/assign_job.js
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/allocation/assign_job.xsl
trunk/property/inc/class.interlink.inc.php
Modified: trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
2013-09-11 11:12:20 UTC (rev 11286)
+++ trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
2013-09-11 11:37:14 UTC (rev 11287)
@@ -116,7 +116,8 @@
$values = array(
'requirement_id=' .
$this->marshal($resource_alloc->get_requirement_id(), 'int'),
'resource_id=' .
$this->marshal($resource_alloc->get_resource_id(), 'int'),
- 'location_id=' .
$this->marshal($resource_alloc->get_location_id(), 'int')
+ 'location_id=' .
$this->marshal($resource_alloc->get_location_id(), 'int'),
+ 'ticket_id=' .
$this->marshal($resource_alloc->get_ticket_id(), 'int')
);
$result = $this->db->query('UPDATE
lg_requirement_resource_allocation SET ' . join(',', $values) . " WHERE
id={$id}", __LINE__,__FILE__);
@@ -246,6 +247,7 @@
$allocation->set_fm_bim_item_address($this->unmarshal($this->db->f('fm_bim_item_address'),
'string'));
$allocation->set_allocated_amount($this->unmarshal($this->db->f('count'),
'int'));
$allocation->set_inventory_id($this->unmarshal($this->db->f('inventory_id'),
'int'));
+
$allocation->set_ticket_id($this->unmarshal($this->db->f('ticket_id'), 'int'));
$fm_bim_name = $this->unmarshal(
$this->db->f('fm_bim_item_name'), 'string');
Modified: trunk/logistic/inc/class.uirequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement.inc.php 2013-09-11 11:12:20 UTC
(rev 11286)
+++ trunk/logistic/inc/class.uirequirement.inc.php 2013-09-11 11:37:14 UTC
(rev 11287)
@@ -933,99 +933,110 @@
$requirement = $this->so->get_single($requirement_id);
- $custom =
createObject('phpgwapi.custom_fields');
+ $custom = createObject('phpgwapi.custom_fields');
//--
- $_filters = array('requirement_id' =>
$requirement_id);
- $requirement_values_array =
$this->so_requirement_value->get(0, false, $sort_field, $sort_ascending,
$search_for, $search_type, $_filters);
+ $_filters = array('requirement_id' => $requirement_id);
+ $requirement_values_array =
$this->so_requirement_value->get(0, false, $sort_field, $sort_ascending,
$search_for, $search_type, $_filters);
- $location_id = $requirement->get_location_id();
- $criterias = array();
- if( count( $requirement_values_array ) > 0 )
+ $location_id = $requirement->get_location_id();
+ $criterias = array();
+ if( count( $requirement_values_array ) > 0 )
+ {
+ foreach($requirement_values_array as
$requirement_value)
{
- foreach($requirement_values_array as
$requirement_value)
- {
- $loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
+ $loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
- $cust_attribute_id =
$requirement_value->get_cust_attribute_id();
+ $cust_attribute_id =
$requirement_value->get_cust_attribute_id();
- $attrib_data =
$custom->get('property', $loc_arr['location'], $cust_attribute_id);
+ $attrib_data = $custom->get('property',
$loc_arr['location'], $cust_attribute_id);
- $_criterie =
$attrib_data['input_text'];
+ $_criterie = $attrib_data['input_text'];
-
if(isset($attrib_data['choice']))
+ if(isset($attrib_data['choice']))
+ {
+ foreach ($attrib_data['choice']
as $_choice)
{
- foreach
($attrib_data['choice'] as $_choice)
+ if($_choice['id'] ==
$requirement_value->get_value())
{
-
if($_choice['id'] == $requirement_value->get_value())
- {
-
$_criterie .= "::{$_choice['value']}";
- break;
- }
+ $_criterie .=
"::{$_choice['value']}";
+ break;
}
}
- else
if($requirement_value->get_value())
- {
- $_criterie .=
"::{$requirement_value->get_value()}";
- }
+ }
+ else if($requirement_value->get_value())
+ {
+ $_criterie .=
"::{$requirement_value->get_value()}";
+ }
- $criterias[] = $_criterie;
+ $criterias[] = $_criterie;
-// $operator =
$requirement_value->get_operator();
- }
+// $operator =
$requirement_value->get_operator();
}
- $requirement_descr = $loc_arr['descr'] . '::' .
implode(',',$criterias);
- $message = 'Hva: ' . $requirement_descr .
"\n\n";
+ }
+
+
+ $path =
$this->so_activity->get_path($requirement->get_activity_id());
+
+ $breadcrumb_array = array();
+ foreach($path as $menu_item)
+ {
+ $breadcrumb_array[] = $menu_item['name'];
+ }
+
+ $title = implode(' -> ',$breadcrumb_array);
+
+
+ $message .= 'Hvor: ' . $title . "\n\n";
+ $requirement_descr = $loc_arr['descr'] . '::' .
implode(',',$criterias);
+ $message .= 'Hva: ' . $requirement_descr . "\n\n";
- #FIXME timezone..
-
//$GLOBALS['phpgw']->common->show_date($requirement->get_start_date())
- //$message .= 'Frist:' .
$GLOBALS['phpgw']->common->show_date($requirement->get_start_date()) . "\n\n";
+ #FIXME timezone..
+
//$GLOBALS['phpgw']->common->show_date($requirement->get_start_date())
+ //$message .= 'Frist:' .
$GLOBALS['phpgw']->common->show_date($requirement->get_start_date()) . "\n\n";
- $datetime_format =
"{$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']} H:i";
+ $datetime_format =
"{$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']} H:i";
- $when = date($datetime_format,
$requirement->get_start_date());
- $message .= 'Frist: ' . $when . "\n\n";
+ $when = date($datetime_format,
$requirement->get_start_date());
+ $message .= 'Frist: ' . $when . "\n\n";
- foreach ($allocations as $allocation)
- {
- $message .= 'Antall: ';
- $message .=
$allocation->get_allocated_amount();
- $message .= ' Fra: ';
+ foreach ($allocations as $allocation)
+ {
+ $message .= 'Antall: ';
+ $message .= $allocation->get_allocated_amount();
+ $message .= ' Fra: ';
- if($allocation->get_inventory_id())
+ if($allocation->get_inventory_id())
+ {
+ $inventory =
execMethod('property.soentity.get_inventory',array('inventory_id' =>
$allocation->get_inventory_id()));
+ $system_location =
$GLOBALS['phpgw']->locations->get_name($inventory[0]['p_location_id']);
+ $name = 'N∕A';
+ if( preg_match('/.location./i',
$system_location['location']) )
{
- $inventory =
execMethod('property.soentity.get_inventory',array('inventory_id' =>
$allocation->get_inventory_id()));
-
- $system_location =
$GLOBALS['phpgw']->locations->get_name($inventory[0]['p_location_id']);
-
- $name = 'N∕A';
- if( preg_match('/.location./i',
$system_location['location']) )
+ $location_code =
execMethod('property.solocation.get_location_code', $inventory[0]['p_id']);
+ $location =
execMethod('property.solocation.read_single', $location_code);
+ $location_arr = explode('-',
$location_code);
+ $i=1;
+ $name_arr = array();
+ foreach($location_arr as
$_dummy)
{
- $location_code =
execMethod('property.solocation.get_location_code', $inventory[0]['p_id']);
- $location =
execMethod('property.solocation.read_single', $location_code);
- $location_arr =
explode('-', $location_code);
- $i=1;
- $name_arr = array();
- foreach($location_arr
as $_dummy)
- {
- $name_arr[] =
$location["loc{$i}_name"];
- $i++;
- }
-
- $name = implode('::',
$name_arr);
+ $name_arr[] =
$location["loc{$i}_name"];
+ $i++;
}
- else if(
preg_match('/.entity./i', $system_location['location']) )
- {
- $name =
execMethod('property.soentity.get_short_description',
-
array('location_id' => $inventory[0]['p_location_id'], 'id' =>
$inventory[0]['p_id']));
- }
+ $name = implode('::',
$name_arr);
}
+ else if( preg_match('/.entity./i',
$system_location['location']) )
+ {
+ $name =
execMethod('property.soentity.get_short_description',
+
array('location_id' => $inventory[0]['p_location_id'], 'id' =>
$inventory[0]['p_id']));
+ }
- $message .= "$name ($location_code)\n";
+ }
- }
+ $message .= "$name ($location_code)\n";
+ }
// --------
@@ -1036,18 +1047,9 @@
$categories =
$catsObj->formatted_xslt_list(array('select_name' =>
'values[cat_id]','selected' => $this->cat_id, 'use_acl' =>
$this->_category_acl));
- $path =
$this->so_activity->get_path($requirement->get_activity_id());
-
- $breadcrumb_array = array();
- foreach($path as $menu_item)
- {
- $breadcrumb_array[] = $menu_item['name'];
- }
-
- $title = implode(' -> ',$breadcrumb_array);
-
$data = array
(
+ 'requirement_id' =>
$requirement_id,
'title'
=> $title,
'title_size' =>
strlen($title) > 20 ? strlen($title) : 20,
'categories' =>
$categories,
@@ -1126,39 +1128,48 @@
$botts = CreateObject('property.botts',true);
$message_ticket_id = $botts->add_ticket($ticket);
- $location_id_ticket =
$GLOBALS['phpgw']->locations->get_id('property', '.ticket');
+ if($location_id_ticket =
$GLOBALS['phpgw']->locations->get_id('property', '.ticket'))
+ {
+//---Sigurd: start register allocation to ticket
+ $GLOBALS['phpgw']->db->transaction_begin();
-//---Sigurd: start register component to ticket
+ $user_id = $GLOBALS['phpgw_info']['user']['id'];
- $user_id = $GLOBALS['phpgw_info']['user']['id'];
+ $interlink_verify = array();
+ foreach ($assign_requirement as $assign_entry)
+ {
+ $assign_arr = explode('_',
$assign_entry);
+ $requirement_id = $assign_arr[0];
+ $allocation_id = $assign_arr[1];
+ $location_id = $assign_arr[2];
+ $item_id = $assign_arr[3];
+ $inventory_id = (int)$assign_arr[4];
- foreach ($assign_requirement as $assign_entry)
- {
- $assign_arr = explode('_', $assign_entry);
- $requirement_id = $assign_arr[0];
- $allocation_id = $assign_arr[1];
- $location_id = $assign_arr[2];
- $item_id = $assign_arr[3];
- $inventory_id = (int)$assign_arr[4];
+ $interlink_data = array
+ (
+ 'location1_id' =>
$location_id,
+ 'location1_item_id' => $item_id,
+ 'location2_id' =>
$location_id_ticket,
+ 'location2_item_id' =>
$message_ticket_id,
+ 'account_id' => $user_id
+ );
- $interlink_data = array
- (
- 'location1_id' => $location_id,
- 'location1_item_id' => $item_id,
- 'location2_id' =>
$location_id_ticket,
- 'location2_item_id' =>
$message_ticket_id,
- 'account_id' => $user_id
- );
+
if(!isset($interlink_verify[$location_id][$item_id][$location_id_ticket][$message_ticket_id]))
+ {
+
execMethod('property.interlink.add', $interlink_data);
+
$interlink_verify[$location_id][$item_id][$location_id_ticket][$message_ticket_id]
= true;
+ }
- execMethod('property.interlink.add',
$interlink_data);
+ $allocation =
$this->so_resource_allocation->get_single($allocation_id);
+
$allocation->set_ticket_id($message_ticket_id);
+
$this->so_resource_allocation->store($allocation);
+ }
- $allocation =
$this->so_resource_allocation->get_single($allocation_id);
- $allocation->set_ticket_id($message_ticket_id);
-
$this->so_resource_allocation->store($allocation);
+ $GLOBALS['phpgw']->db->transaction_commit();
}
-//---End register component to ticket
+//---End register allocation to ticket
}
Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
2013-09-11 11:12:20 UTC (rev 11286)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
2013-09-11 11:37:14 UTC (rev 11287)
@@ -239,21 +239,22 @@
$rows = array();
$lang_delete = lang('delete');
$lang_assign = lang('assign');
+ $lang_ticket = lang('ticket');
foreach ($result_objects as $result)
{
if (isset($result))
{
- $requirement = $result->serialize();
+ $allocation = $result->serialize();
if($short_desc =
execMethod('property.soentity.get_short_description',
- array('location_id' =>
$requirement['location_id'], 'id' => $requirement['resource_id'])))
+ array('location_id' =>
$allocation['location_id'], 'id' => $allocation['resource_id'])))
{
-
$requirement['fm_bim_item_name'] = $short_desc;
+ $allocation['fm_bim_item_name']
= $short_desc;
}
- if($requirement['inventory_id'])
+ if($allocation['inventory_id'])
{
- $inventory =
execMethod('property.soentity.get_inventory',array('inventory_id' =>
$requirement['inventory_id']));
+ $inventory =
execMethod('property.soentity.get_inventory',array('inventory_id' =>
$allocation['inventory_id']));
$system_location =
$GLOBALS['phpgw']->locations->get_name($inventory[0]['p_location_id']);
@@ -279,25 +280,40 @@
array('location_id' => $inventory[0]['p_location_id'], 'id' =>
$inventory[0]['p_id']));
}
- $requirement['location_code'] =
$location_code;
-
$requirement['fm_bim_item_address'] = $name;
+ $allocation['location_code'] =
$location_code;
+
$allocation['fm_bim_item_address'] = $name;
}
$delete_href =
self::link(array('menuaction' =>
'logistic.uirequirement_resource_allocation.delete',
-
'id' =>
$requirement['id'],
+
'id' =>
$allocation['id'],
'phpgw_return_as' =>
'json')
);
- $delete_href =
"javascript:load_delete_allocation({$requirement['id']});";
+ $delete_href =
"javascript:load_delete_allocation({$allocation['id']});";
- $requirement['delete_link'] = "<a
class=\"btn-sm \" href=\"{$delete_href}\">{$lang_delete}</a>";
+ $allocation['delete_link'] = "<a
class=\"btn-sm \" href=\"{$delete_href}\">{$lang_delete}</a>";
- $assign_href =
"javascript:load_assign_task(document.assign_task, {$requirement['id']});";
+ $assign_href =
"javascript:load_assign_task(document.assign_task, {$allocation['id']});";
+
+ $disabled = $allocation['ticket_id'] ?
'disabled = "disabled"' : '';
- $requirement['assign_job'] = "<input
name='assign_requirement' type='checkbox'
value='{$requirement_id}_{$requirement['id']}_{$requirement['location_id']}_{$requirement['resource_id']}_{$requirement['inventory_id']}'
/>"
+ if($allocation['ticket_id'])
+ {
+
+ $related_href =
self::link(array('menuaction' => 'property.uitts.view','id' =>
$allocation['ticket_id']));
+ $allocation['related'] = "<a
href=\"{$related_href}\">{$lang_ticket} #{$allocation['ticket_id']}</a>";
+
+ $relation_info =
execMethod('property.interlink.get_relation_info',
+
array('location' => '.ticket', 'id' => $allocation['ticket_id']));
+
+ $allocation['status'] =
$relation_info['statustext'];
+ }
+
+ $allocation['assign_job'] = "<input
name='assign_requirement' type='checkbox' {$disabled}
value='{$requirement_id}_{$allocation['id']}_{$allocation['location_id']}_{$allocation['resource_id']}_{$allocation['inventory_id']}'
/>"
. "<a class=\"btn-sm assign\"
href=\"{$assign_href}\">{$lang_assign}</a>";
+
- $rows[] = $requirement;
+ $rows[] = $allocation;
}
}
Modified: trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
2013-09-11 11:12:20 UTC (rev 11286)
+++ trunk/logistic/inc/model/class.requirement_resource_allocation.inc.php
2013-09-11 11:37:14 UTC (rev 11287)
@@ -49,6 +49,8 @@
protected $end_date;
protected $allocated_amount;
protected $allocated_amount_orig;
+ protected $ticket_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.
@@ -213,6 +215,18 @@
}
+
+ public function set_ticket_id($ticket_id)
+ {
+ $this->ticket_id = $ticket_id;
+ }
+
+ public function get_ticket_id()
+ {
+ return $this->ticket_id;
+ }
+
+
/**
* Get a static reference to the storage object associated with
this model object
*
@@ -236,6 +250,7 @@
'requirement_id' =>
$this->get_requirement_id(),
'resource_id' =>
$this->get_resource_id(),
'inventory_id' =>
$this->get_inventory_id(),
+ 'ticket_id' =>
$this->get_ticket_id(),
//FIXME
'inventory_amount' =>
$this->get_inventory_amount(),
'allocated_amount' =>
$this->get_allocated_amount(),
Modified: trunk/logistic/js/logistic/assign_job.js
===================================================================
--- trunk/logistic/js/logistic/assign_job.js 2013-09-11 11:12:20 UTC (rev
11286)
+++ trunk/logistic/js/logistic/assign_job.js 2013-09-11 11:37:14 UTC (rev
11287)
@@ -5,6 +5,8 @@
// REGISTER MESSAGE
$("#frmRegCaseMessage").submit(function(e){
+ e.preventDefault();
+
var thisForm = $(this);
var $required_input_fields = $(this).find(".required");
@@ -48,10 +50,21 @@
}
});
- if( !status )
+ if( status )
{
- e.preventDefault();
- }
+
+ var requestUrl = $(thisForm).attr("action");
+ $.ajax({
+ type: 'POST',
+ url: requestUrl + "&" +
$(thisForm).serialize(),
+ success: function(data) {
+
parent.closeJS_local_allocation(requirement_id);
+ parent.TINY.box.hide();
+ }
+ });
+ }
+
+
});
Modified: trunk/logistic/setup/phpgw_no.lang
===================================================================
--- trunk/logistic/setup/phpgw_no.lang 2013-09-11 11:12:20 UTC (rev 11286)
+++ trunk/logistic/setup/phpgw_no.lang 2013-09-11 11:37:14 UTC (rev 11287)
@@ -115,3 +115,5 @@
Responsible person for activity logistic no Angi hvilken
person som skal være ansvarlig for aktiviteten
allocated date logistic no Allokert når
allocated where logistic no Allokert hvor
+assign ticket logistic no Bestill oppdrag
+assign logistic no Bestill
Modified: trunk/logistic/setup/setup.inc.php
===================================================================
--- trunk/logistic/setup/setup.inc.php 2013-09-11 11:12:20 UTC (rev 11286)
+++ trunk/logistic/setup/setup.inc.php 2013-09-11 11:37:14 UTC (rev 11287)
@@ -1,6 +1,6 @@
<?php
$setup_info['logistic']['name'] = 'logistic';
- $setup_info['logistic']['version'] = '0.0.6';
+ $setup_info['logistic']['version'] = '0.0.7';
$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 2013-09-11 11:12:20 UTC (rev
11286)
+++ trunk/logistic/setup/tables_current.inc.php 2013-09-11 11:37:14 UTC (rev
11287)
@@ -99,6 +99,8 @@
'calendar_id' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_user' => array('type'
=> 'int', 'precision' => 4, 'nullable' => false),
'create_date' => array('type'
=> 'int', 'precision' => 8, 'nullable' => false),
+ 'ticket_id' => array('type' =>
'int', 'precision' => 4, 'nullable' => false),
+
),
'pk' => array('id'),
'fk' => array(
Modified: trunk/logistic/setup/tables_update.inc.php
===================================================================
--- trunk/logistic/setup/tables_update.inc.php 2013-09-11 11:12:20 UTC (rev
11286)
+++ trunk/logistic/setup/tables_update.inc.php 2013-09-11 11:37:14 UTC (rev
11287)
@@ -195,3 +195,21 @@
}
}
+
+ $test[] = '0.0.6';
+ function logistic_upgrade0_0_6()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('lg_requirement_resource_allocation','ticket_id',array(
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => true
+ ));
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['logistic']['currentver'] =
'0.0.7';
+ return $GLOBALS['setup_info']['logistic']['currentver'];
+ }
+ }
Modified: trunk/logistic/templates/base/allocation/assign_job.xsl
===================================================================
--- trunk/logistic/templates/base/allocation/assign_job.xsl 2013-09-11
11:12:20 UTC (rev 11286)
+++ trunk/logistic/templates/base/allocation/assign_job.xsl 2013-09-11
11:37:14 UTC (rev 11287)
@@ -25,6 +25,10 @@
<xsl:value-of
select="php:function('get_phpgw_link', '/index.php',
'menuaction:logistic.uirequirement.send_job_ticket')" />
</xsl:variable>
+ <script type="text/javascript">
+ var requirement_id = <xsl:value-of
select="requirement_id"/>;
+ </script>
+
<form ENCTYPE="multipart/form-data"
id="frmRegCaseMessage" action="{$action_url}" method="post">
<input name="assign_requirement"
type="text" value="{assign_requirement_json}" />
Modified: trunk/property/inc/class.interlink.inc.php
===================================================================
--- trunk/property/inc/class.interlink.inc.php 2013-09-11 11:12:20 UTC (rev
11286)
+++ trunk/property/inc/class.interlink.inc.php 2013-09-11 11:37:14 UTC (rev
11287)
@@ -351,10 +351,10 @@
* @return string info of the linked item
*/
- public function get_relation_info($linkend_location, $id)
+ public function get_relation_info($linkend_location, $id=0)
{
$relation_info = array();
- $id = (int)$id;
+ $id = isset($linkend_location['id']) ?
(int)$linkend_location['id'] : (int)$id;
$type = $linkend_location['location'];
if($type == '.ticket')
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11287] more on logistic,
Sigurd Nes <=