[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10283] added time to requirement date
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [10283] added time to requirement date |
Date: |
Mon, 22 Oct 2012 06:25:59 +0000 |
Revision: 10283
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10283
Author: erikhl
Date: 2012-10-22 06:25:58 +0000 (Mon, 22 Oct 2012)
Log Message:
-----------
added time to requirement date
Fixed link to booking of requirement
Modified Paths:
--------------
trunk/logistic/inc/class.uirequirement.inc.php
trunk/logistic/setup/phpgw_no.lang
Modified: trunk/logistic/inc/class.uirequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement.inc.php 2012-10-22 06:21:29 UTC
(rev 10282)
+++ trunk/logistic/inc/class.uirequirement.inc.php 2012-10-22 06:25:58 UTC
(rev 10283)
@@ -47,7 +47,7 @@
private $so_activity;
private $so_project;
private $so_resource_type_requirement;
-
+
public $public_functions = array(
'query' => true,
'index' => true,
@@ -62,15 +62,15 @@
public function __construct()
{
parent::__construct();
-
+
$this->so = CreateObject('logistic.sorequirement');
$this->so_requirement_value =
CreateObject('logistic.sorequirement_value');
$this->so_entity =
CreateObject('property.soadmin_entity');
$this->so_activity =
CreateObject('logistic.soactivity');
$this->so_project = CreateObject('logistic.soproject');
$this->so_resource_type_requirement =
CreateObject('logistic.soresource_type_requirement');
-
+
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
"logistic::project::requirement";
}
@@ -85,7 +85,7 @@
'dir' => phpgw::get_var('dir'),
'filters' => $filters
);
-
+
$activity_id = phpgw::get_var('activity_id');
if
($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
@@ -110,7 +110,7 @@
//Retrieve a contract identifier and load corresponding
contract
$project_id = phpgw::get_var('project_id');
-
+
$exp_param = phpgw::get_var('export');
$export = false;
if (isset($exp_param))
@@ -172,7 +172,7 @@
phpgwapi_yui::load_widget('datatable');
phpgwapi_yui::load_widget('paginator');
$activity_id = phpgw::get_var('activity_id');
-
+
$data = array(
'datatable_name' => lang('requirement'),
'form' => array(
@@ -197,7 +197,7 @@
'key' => 'id',
'label' => lang('ID'),
'sortable' => true,
- ),
+ ),
array(
'key' => 'start_date',
'label' => lang('Start
date'),
@@ -221,11 +221,54 @@
array(
'key' => 'link',
'hidden' => true
+ ),
+ array(
+ 'key' => 'activity_id',
+ 'hidden' => true
)
)
),
- );
+ );
+ $parameters = array
+ (
+ 'parameter' => array
+ (
+ array
+ (
+ 'name' =>
'requirement_id',
+ 'source' => 'id'
+ ),
+ array
+ (
+ 'name' =>
'activity_id',
+ 'source' =>
'activity_id'
+ ),
+ )
+ );
+
+ $data['datatable']['actions'][] = array
+ (
+ 'my_name' =>
'allocate_booking',
+ 'text' =>
lang('t_new_booking_allocation'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'logistic.uirequirement_resource_allocation.edit'
+ )),
+ 'parameters' =>
json_encode($parameters)
+ );
+
+ $data['datatable']['actions'][] = array
+ (
+ 'my_name' =>
'view_booking_allocations',
+ 'text' =>
lang('t_view_booking_allocations'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'logistic.uirequirement_resource_allocation.index'
+ )),
+ 'parameters' =>
json_encode($parameters)
+ );
+
self::render_template_xsl('datatable_common', $data);
}
@@ -245,7 +288,7 @@
}
$location_info =
$GLOBALS['phpgw']->locations->get_name($requirement->get_location_id());
-
+
$data = array
(
'value_id' => !empty($requirement) ?
$requirement->get_id() : 0,
@@ -272,33 +315,33 @@
if ($requirement_id && is_numeric($requirement_id))
{
$requirement =
$this->so->get_single($requirement_id);
-
+
$activity = $this->so_activity->get_single(
$requirement->get_activity_id() );
$project = $this->so_project->get_single(
$activity->get_project_id() );
}
else
{
$requirement = new logistic_requirement();
-
+
if ($activity_id && is_numeric($activity_id))
{
$activity =
$this->so_activity->get_single( $activity_id );
$project =
$this->so_project->get_single( $activity->get_project_id() );
}
}
-
+
if (isset($_POST['save_requirement']))
{
$requirement->set_id( phpgw::get_var('id') );
-
+
$requirement->set_no_of_items(
phpgw::get_var('no_of_items') );
$requirement->set_location_id(
phpgw::get_var('location_id') );
-
+
if($requirement->get_activity_id() == "" |
$requirement->get_activity_id() == 0)
{
- $requirement->set_activity_id(
phpgw::get_var('activity_id') );
+ $requirement->set_activity_id(
phpgw::get_var('activity_id') );
}
-
+
if(phpgw::get_var('start_date','string') != '')
{
$start_date_ts =
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('start_date','string') );
@@ -318,12 +361,12 @@
{
$requirement->set_end_date(0);
}
-
+
$user_id = $GLOBALS['phpgw_info']['user']['id'];
$requirement->set_create_user($user_id);
-
+
$requirement_id =
$this->so->store($requirement);
-
+
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement.add_requirement_values',
'requirement_id' => $requirement_id));
}
else if (isset($_POST['cancel_requirement']))
@@ -335,44 +378,44 @@
$accounts =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
$entity_list =
execMethod('property.soadmin_entity.read', array('allrows' => true));
-
+
$filters = array('project_type_id' =>
$project->get_project_type_id());
$search_type = 'distinct_location_id';
$distict_location_ids =
$this->so_resource_type_requirement->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
-
+
$distict_location_ids_array = array();
-
+
foreach($distict_location_ids as
$logistic_resource_type_requirement )
{
$location_id =
$logistic_resource_type_requirement->get_id();
$loc_arr =
$GLOBALS['phpgw']->locations->get_name($location_id);
-
- $loc_arr['location_id'] = $location_id;
-
- $distict_locations_array[] = $loc_arr;
- }
-
+
+ $loc_arr['location_id'] = $location_id;
+
+ $distict_locations_array[] = $loc_arr;
+ }
+
$custom =
createObject('phpgwapi.custom_fields');
$attribute_requirement_array = array();
-
+
foreach($attribute_requirement_types as
$attribute_requirement){
$location_id =
$attribute_requirement->get_location_id();
$cust_attribute_id =
$attribute_requirement->get_cust_attribute_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];
-
+
$attrib_data = $custom->get('property',
".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
-
+
$attribute_requirement_array[] =
$attrib_data;
}
$tabs = $this->make_tab_menu($requirement_id);
-
+
$data = array
(
'tabs'
=> $GLOBALS['phpgw']->common->create_tabs($tabs, 0),
@@ -381,24 +424,24 @@
'distict_locations' =>
$distict_locations_array,
'editable' => true,
);
-
+
if($activity_id > 0)
{
$data['activity'] = $activity;
}
-
-
-
$GLOBALS['phpgw']->jqcal->add_listener('start_date');
-
$GLOBALS['phpgw']->jqcal->add_listener('end_date');
+
+
$GLOBALS['phpgw']->jqcal->add_listener('start_date', 'datetime');
+
$GLOBALS['phpgw']->jqcal->add_listener('end_date', 'datetime');
+
self::render_template_xsl(array('requirement/requirement_tabs',
'requirement/requirement_item'), $data);
}
}
-
+
public function add_requirement_values()
{
$requirement_id = phpgw::get_var('requirement_id');
-
+
if ($requirement_id && is_numeric($requirement_id))
{
$requirement =
$this->so->get_single($requirement_id);
@@ -407,17 +450,17 @@
{
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement.edit'));
}
-
+
if (isset($_POST['save_requirement_values']))
{
$attributes_array = array();
$attributes_array =
phpgw::get_var('cust_attributes');
-
+
$this->so_requirement_value->delete_values($requirement_id);
-
+
foreach($attributes_array as $attribute)
{
- $attribute_array = explode ( ":",
$attribute );
+ $attribute_array = explode ( ":",
$attribute );
$cust_attribute_id =
$attribute_array[0];
$operator = $attribute_array[1];
$attrib_value = $attribute_array[2];
@@ -426,43 +469,43 @@
$requirement_value->set_requirement_id(
$requirement_id );
$requirement_value->set_value(
$attrib_value );
$requirement_value->set_operator(
$operator );
-
$requirement_value->set_cust_attribute_id( $cust_attribute_id );
+
$requirement_value->set_cust_attribute_id( $cust_attribute_id );
$user_id =
$GLOBALS['phpgw_info']['user']['id'];
$requirement_value->set_create_user($user_id);
-
-
$this->so_requirement_value->store($requirement_value);
+
+
$this->so_requirement_value->store($requirement_value);
}
-
+
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement.view_requirement_values',
'requirement_id' => $requirement_id));
}
else
{
$location_id = $requirement->get_location_id();
$activity_id = $requirement->get_activity_id();
-
+
$custom_attributes_array = array();
$custom_attributes_array =
$this->get_custom_attributes($location_id, $activity_id);
-
+
$filters = array('requirement_id' =>
$requirement_id);
$requirement_values_array =
$this->so_requirement_value->get($start_index, $num_of_objects, $sort_field,
$sort_ascending, $search_for, $search_type, $filters);
-
+
$custom =
createObject('phpgwapi.custom_fields');
if( count( $requirement_values_array ) > 0 )
{
foreach($requirement_values_array as
$requirement_value)
{
- $location_id =
$requirement->get_location_id();
+ $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];
$cust_attribute_id =
$requirement_value->get_cust_attribute_id();
-
+
$attrib_data =
$custom->get('property', ".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
-
+
$temp_requirement_attributes_array[$cust_attribute_id][] = array(
"id"
=> $requirement_value->get_id(),
"attrib_value"
=> $requirement_value->get_value(),
@@ -470,8 +513,8 @@
"cust_attribute"
=> $attrib_data
);
}
-
-
+
+
foreach($temp_requirement_attributes_array as $req_attrib)
{
if( count( $req_attrib ) > 1 )
@@ -486,14 +529,14 @@
$constraint_1 =
$req_attrib[1];
$constraint_2 =
$req_attrib[0];
}
-
+
$req_attrib[0]['operator'] = 'btw';
$req_attrib[0]['attrib_value'] = $constraint_1['attrib_value'] . ":" .
$constraint_2['attrib_value'];
$requirement_attributes_array[] = $req_attrib[0];
}
else
{
-
$requirement_attributes_array[] = $req_attrib[0];
+
$requirement_attributes_array[] = $req_attrib[0];
}
}
}
@@ -509,9 +552,9 @@
);
}
}
-
+
$tabs = $this->make_tab_menu($requirement_id);
-
+
$data = array
(
'tabs'
=>
$GLOBALS['phpgw']->common->create_tabs($tabs, 1),
@@ -521,19 +564,19 @@
'distict_locations'
=> $distict_locations_array,
'editable'
=> true,
);
-
+
if($activity_id > 0)
{
$data['activity'] = $activity;
}
-
+
phpgwapi_jquery::load_widget('core');
-
+
self::add_javascript('logistic', 'logistic',
'requirement.js');
self::render_template_xsl(array('requirement/requirement_tabs',
'requirement/requirement_values'), $data);
}
}
-
+
public function view_requirement_values()
{
$requirement_id = phpgw::get_var('requirement_id');
@@ -546,38 +589,38 @@
{
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement.edit'));
}
-
+
if (isset($_POST['edit_requirement_values']))
{
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uirequirement.add_requirement_values',
'requirement_id' => $requirement_id));
}
-
+
$filters = array('requirement_id' => $requirement_id);
$requirement_values_array =
$this->so_requirement_value->get($start_index, $num_of_objects, $sort_field,
$sort_ascending, $search_for, $search_type, $filters);
-
+
$custom = createObject('phpgwapi.custom_fields');
-
+
foreach($requirement_values_array as $requirement_value)
{
- $location_id = $requirement->get_location_id();
-
+ $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];
$cust_attribute_id =
$requirement_value->get_cust_attribute_id();
-
+
$attrib_data = $custom->get('property',
".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
$temp_requirement_attributes_array[$cust_attribute_id][] = array(
"id"
=> $requirement_value->get_id(),
"attrib_value"
=> $requirement_value->get_value(),
- "operator"
=> $requirement_value->get_operator(),
+ "operator"
=> $requirement_value->get_operator(),
"cust_attribute" => $attrib_data
);
}
-
+
foreach($temp_requirement_attributes_array as
$req_attrib)
{
if( count( $req_attrib ) > 1 )
@@ -592,19 +635,19 @@
$constraint_1 = $req_attrib[1];
$constraint_2 = $req_attrib[0];
}
-
+
$req_attrib[0]['operator'] = 'btw';
$req_attrib[0]['attrib_value'] =
$constraint_1['attrib_value'] . ":" . $constraint_2['attrib_value'];
$requirement_attributes_array[] =
$req_attrib[0];
}
else
{
- $requirement_attributes_array[] =
$req_attrib[0];
+ $requirement_attributes_array[] =
$req_attrib[0];
}
}
-
+
$tabs = $this->make_tab_menu($requirement_id);
-
+
$data = array
(
'tabs'
=>
$GLOBALS['phpgw']->common->create_tabs($tabs, 1),
@@ -612,78 +655,78 @@
'requirement'
=> $requirement,
'requirement_attributes_array' =>
$requirement_attributes_array
);
-
-
self::render_template_xsl(array('requirement/requirement_tabs',
'requirement/requirement_values'), $data);
+
+
self::render_template_xsl(array('requirement/requirement_tabs',
'requirement/requirement_values'), $data);
}
-
+
public function get_custom_attributes($location_id,
$activity_id){
-
+
if($location_id == "")
{
$location_id =
phpgw::get_var('location_id');
}
-
+
if($activity_id == "")
{
$activity_id =
phpgw::get_var('activity_id');
}
$activity = $this->so_activity->get_single(
$activity_id );
- $project = $this->so_project->get_single(
$activity->get_project_id() );
- $project_type_id =
$project->get_project_type_id();
-
+ $project = $this->so_project->get_single(
$activity->get_project_id() );
+ $project_type_id =
$project->get_project_type_id();
+
$filters = array('location_id' => $location_id,
'project_type_id' => $project_type_id);
$requirement_custom_attributes_array =
$this->so_resource_type_requirement->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
-
+
$custom =
createObject('phpgwapi.custom_fields');
-
+
$attribute_requirement_array = array();
-
+
foreach($requirement_custom_attributes_array as
$attribute_requirement){
$location_id =
$attribute_requirement->get_location_id();
$cust_attribute_id =
$attribute_requirement->get_cust_attribute_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];
-
+
$attrib_data = $custom->get('property',
".entity.{$entity_id}.{$cat_id}", $cust_attribute_id);
-
+
$attribute_requirement_array[] =
$attrib_data;
}
-
- return $attribute_requirement_array;
+
+ return $attribute_requirement_array;
}
-
+
function make_tab_menu($requirement_id)
{
$tabs = array();
-
+
if($requirement_id > 0){
-
+
$requirement =
$this->so->get_single($requirement_id);
-
- $tabs = array(
+
+ $tabs = array(
array(
'label' => "1: " .
lang('Requirement details'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'logistic.uirequirement.edit',
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'logistic.uirequirement.edit',
'id' => $requirement->get_id()))
), array(
'label' => "2: " .
lang('Add constraints'),
- 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'logistic.uirequirement.add_requirement_values',
+ 'link' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'logistic.uirequirement.add_requirement_values',
'requirement_id' => $requirement->get_id()))
));
}else{
- $tabs = array(
+ $tabs = array(
array(
'label' => "1: " .
lang('Requirement details')
), array(
'label' => "2: " .
lang('Add constraints')
));
}
-
+
return $tabs;
- }
- }
\ No newline at end of file
+ }
+ }
Modified: trunk/logistic/setup/phpgw_no.lang
===================================================================
--- trunk/logistic/setup/phpgw_no.lang 2012-10-22 06:21:29 UTC (rev 10282)
+++ trunk/logistic/setup/phpgw_no.lang 2012-10-22 06:25:58 UTC (rev 10283)
@@ -55,3 +55,5 @@
Add constraints logistic no Legg til kriterier på behovet
No of items logistic no Antall
Resource type logistic no Ressurstype
+t_new_booking_allocation logistic no Registrer ny booking på
dette behovet
+t_view_booking_allocations logistic no Vis registrerte
bookinger på dette behovet
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10283] added time to requirement date,
Erik Holm-Larsen <=