[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15777] logistic: php7 adaption
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15777] logistic: php7 adaption |
Date: |
Sun, 2 Oct 2016 13:14:24 +0000 (UTC) |
Revision: 15777
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15777
Author: sigurdne
Date: 2016-10-02 13:14:24 +0000 (Sun, 02 Oct 2016)
Log Message:
-----------
logistic: php7 adaption
Modified Paths:
--------------
trunk/logistic/inc/class.soactivity.inc.php
trunk/logistic/inc/class.socommon.inc.php
trunk/logistic/inc/class.soproject.inc.php
trunk/logistic/inc/class.sorequirement.inc.php
trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
trunk/logistic/inc/class.sorequirement_value.inc.php
trunk/logistic/inc/class.soresource_type_requirement.inc.php
trunk/logistic/inc/class.uiactivity.inc.php
trunk/logistic/inc/class.uiproject.inc.php
trunk/logistic/inc/class.uirequirement.inc.php
trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
trunk/logistic/inc/class.uiresource_type_requirement.inc.php
trunk/logistic/inc/model/class.model.inc.php
Modified: trunk/logistic/inc/class.soactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.soactivity.inc.php 2016-10-01 15:45:46 UTC (rev
15776)
+++ trunk/logistic/inc/class.soactivity.inc.php 2016-10-02 13:14:24 UTC (rev
15777)
@@ -143,7 +143,7 @@
return $ret;
}
- protected function get_query( string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count )
+ protected function get_query( string $sort_field, bool
$ascending, string $search_for, string $search_type, array $filters, bool
$return_count )
{
$clauses = array('1=1');
@@ -207,7 +207,7 @@
* @param $start_index int with index of first object.
* @param $num_of_objects int with max number of objects to
return.
* @param $sort_field string representing the object field to
sort on.
- * @param $ascending boolean true for ascending sort on sort
field, false
+ * @param $ascending bool true for ascending sort on sort
field, false
* for descending.
* @param $search_for string with free text search query.
* @param $search_type string with the query type.
@@ -236,7 +236,7 @@
public function get_single( int $id )
{
- $objects = parent::get(null, null, null, null, null,
null, array($this->get_id_field_name() => $id));
+ $objects = parent::get(0, 0, '', false, '', '',
array($this->get_id_field_name() => $id));
if (count($objects) > 0)
{
$keys = array_keys($objects);
Modified: trunk/logistic/inc/class.socommon.inc.php
===================================================================
--- trunk/logistic/inc/class.socommon.inc.php 2016-10-01 15:45:46 UTC (rev
15776)
+++ trunk/logistic/inc/class.socommon.inc.php 2016-10-02 13:14:24 UTC (rev
15777)
@@ -92,11 +92,11 @@
{
if ($type == 'bool')
{
- return (boolean)$value;
+ return (bool)$value;
}
- else if ($type == 'boolean')
+ else if ($type == 'bool')
{
- return (boolean)$value;
+ return (bool)$value;
}
else if ($type == 'int')
{
@@ -149,7 +149,7 @@
*/
public function get_single( int $id )
{
- $objects = $this->get(null, null, null, null, null,
null, array($this->get_id_field_name() => $id));
+ $objects = $this->get(0, 0, '', false, '', '',
array($this->get_id_field_name() => $id));
if (count($objects) > 0)
{
$keys = array_keys($objects);
@@ -172,7 +172,7 @@
* @param $start_index int with index of first object.
* @param $num_of_objects int with max number of objects to
return.
* @param $sort_field string representing the object field to
sort on.
- * @param $ascending boolean true for ascending sort on sort
field, false
+ * @param $ascending bool true for ascending sort on sort
field, false
* for descending.
* @param $search_for string with free text search query.
* @param $search_type string with the query type.
@@ -180,7 +180,7 @@
* @return array of objects. May return an empty
* array, never null. The array keys are the respective index
numbers.
*/
- public function get( int $start_index, int $num_of_objects,
string $sort_field, boolean $ascending, string $search_for, string
$search_type, array $filters )
+ public function get( int $start_index, int $num_of_objects,
string $sort_field, bool $ascending, string $search_for, string $search_type,
array $filters )
{
$results = array(); // Array to store result objects
$map = array(); // Array to hold number of records per
target object
@@ -309,7 +309,7 @@
*/
public function get_count( string $search_for, string
$search_type, array $filters )
{
- return $this->get_query_count($this->get_query(null,
null, $search_for, $search_type, $filters, true));
+ return $this->get_query_count($this->get_query('',
false, $search_for, $search_type, $filters, true));
}
/**
@@ -326,16 +326,16 @@
* @param $start_index int with index of first object.
* @param $num_of_objects int with max number of objects to
return.
* @param $sort_field string representing the object field to
sort on.
- * @param $ascending boolean true for ascending sort on sort
field, false
+ * @param $ascending bool true for ascending sort on sort
field, false
* for descending.
* @param $search_for string with free text search query.
* @param $search_type string with the query type.
* @param $filters array with key => value of filters.
- * @param $return_count boolean telling to return only the
count of the
+ * @param $return_count bool telling to return only the count
of the
* matching objects, or the objects themself.
* @return string with SQL.
*/
- protected abstract function get_query( string $sort_field,
boolean $ascending, string $search_for, string $search_type, array $filters,
boolean $return_count );
+ protected abstract function get_query( string $sort_field, bool
$ascending, string $search_for, string $search_type, array $filters, bool
$return_count );
protected abstract function populate( int $object_id, &$object
);
Modified: trunk/logistic/inc/class.soproject.inc.php
===================================================================
--- trunk/logistic/inc/class.soproject.inc.php 2016-10-01 15:45:46 UTC (rev
15776)
+++ trunk/logistic/inc/class.soproject.inc.php 2016-10-02 13:14:24 UTC (rev
15777)
@@ -139,7 +139,7 @@
return $ret;
}
- protected function get_query( string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count )
+ protected function get_query( string $sort_field, bool
$ascending, string $search_for, string $search_type, array $filters, bool
$return_count )
{
$clauses = array('1=1');
$project_type = false;
Modified: trunk/logistic/inc/class.sorequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.sorequirement.inc.php 2016-10-01 15:45:46 UTC
(rev 15776)
+++ trunk/logistic/inc/class.sorequirement.inc.php 2016-10-02 13:14:24 UTC
(rev 15777)
@@ -130,7 +130,7 @@
return $ret;
}
- protected function get_query( string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count )
+ protected function get_query( string $sort_field, bool
$ascending, string $search_for, string $search_type, array $filters, bool
$return_count )
{
$clauses = array('1=1');
Modified: trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
2016-10-01 15:45:46 UTC (rev 15776)
+++ trunk/logistic/inc/class.sorequirement_resource_allocation.inc.php
2016-10-02 13:14:24 UTC (rev 15777)
@@ -181,7 +181,7 @@
return $ret;
}
- protected function get_query( string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count )
+ protected function get_query( string $sort_field, bool
$ascending, string $search_for, string $search_type, array $filters, bool
$return_count )
{
$clauses = array('1=1');
@@ -222,7 +222,8 @@
$cols .= "lg_calendar.item_inventory_amount as
count,";
$cols .= "lg_calendar.item_inventory_id as
inventory_id,";
$cols .= "phpgw_locations.descr AS
resource_type_descr, ";
- $cols .= "fm_bim_item.location_code AS
location_code, (xpath('//address/node()',
fm_bim_item.xml_representation))[1]::text AS fm_bim_item_address,
(xpath('//navn[1]/text()', fm_bim_item.xml_representation))[1]::text AS
fm_bim_item_name ";
+// $cols .= "fm_bim_item.location_code AS
location_code, (xpath('//address/node()',
fm_bim_item.xml_representation))[1]::text AS fm_bim_item_address,
(xpath('//navn[1]/text()', fm_bim_item.xml_representation))[1]::text AS
fm_bim_item_name ";
+ $cols .= "fm_bim_item.location_code AS
location_code, fm_bim_item.json_representation->>'address' AS
fm_bim_item_address, fm_bim_item.json_representation->>'navn' AS
fm_bim_item_name ";
}
$dir = $ascending ? 'ASC' : 'DESC';
Modified: trunk/logistic/inc/class.sorequirement_value.inc.php
===================================================================
--- trunk/logistic/inc/class.sorequirement_value.inc.php 2016-10-01
15:45:46 UTC (rev 15776)
+++ trunk/logistic/inc/class.sorequirement_value.inc.php 2016-10-02
13:14:24 UTC (rev 15777)
@@ -111,7 +111,7 @@
return $ret;
}
- protected function get_query( string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count )
+ protected function get_query( string $sort_field, bool
$ascending, string $search_for, string $search_type, array $filters, bool
$return_count )
{
$clauses = array('1=1');
Modified: trunk/logistic/inc/class.soresource_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.soresource_type_requirement.inc.php
2016-10-01 15:45:46 UTC (rev 15776)
+++ trunk/logistic/inc/class.soresource_type_requirement.inc.php
2016-10-02 13:14:24 UTC (rev 15777)
@@ -83,7 +83,7 @@
return $ret;
}
- protected function get_query( string $sort_field, boolean
$ascending, string $search_for, string $search_type, array $filters, boolean
$return_count )
+ protected function get_query( string $sort_field, bool
$ascending, string $search_for, string $search_type, array $filters, bool
$return_count )
{
$clauses = array('1=1');
Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2016-10-01 15:45:46 UTC (rev
15776)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2016-10-02 13:14:24 UTC (rev
15777)
@@ -262,8 +262,8 @@
$params = array(
'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
'results' => phpgw::get_var('length', 'int',
'REQUEST', $user_rows_per_page),
- 'query' => $search['value'],
- 'order' =>
$columns[$order[0]['column']]['data'],
+ 'query' => !empty($search['value']) ?
$search['value'] : '',
+ 'order' =>
!empty($columns[$order[0]['column']]['data']) ?
$columns[$order[0]['column']]['data'] : '',
'sort' => $order[0]['dir'],
'allrows' => phpgw::get_var('length', 'int') ==
-1,
);
@@ -274,7 +274,7 @@
$sort_ascending = $params['sort'] == 'desc' ? false :
true;
// Form variables
$search_for = $params['query'];
- $search_type = phpgw::get_var('search_option');
+ $search_type = phpgw::get_var('search_option',
'string', 'REQUEST', '');
// Create an empty result set
$result_objects = array();
@@ -298,7 +298,7 @@
$activity_id =
phpgw::get_var('activity_id');
$filters = array('id' => $activity_id);
$result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters, $params['allrows']);
- $object_count = $this->so->get_count();
+ $object_count =
$this->so->get_count('', '', array());
array_shift($result_objects);
if ($result_objects)
{
@@ -327,7 +327,7 @@
if (isset($activity))
{
$filters = array('activity' =>
$activity->get_id());
- $requirements_for_activity =
$this->so_requirement->get(0, null, null, null, null, null, $filters);
+ $requirements_for_activity =
$this->so_requirement->get(0, 0, '', false, '', '', $filters);
if (count($requirements_for_activity) >
0)
{
@@ -337,7 +337,7 @@
foreach
($requirements_for_activity as $requirement)
{
$filters =
array('requirement_id' => $requirement->get_id());
- $num_allocated =
$this->so_resource_allocation->get_count(null, null, $filters);
+ $num_allocated =
$this->so_resource_allocation->get_count('', '', $filters);
$num_required =
$requirement->get_no_of_items();
@@ -435,7 +435,7 @@
$accounts =
$GLOBALS['phpgw']->acl->get_user_list_right(PHPGW_ACL_READ, 'run', 'logistic');
- $activities = $this->so->get(0, 0, 'name', true, null,
null, null, true);
+ $activities = $this->so->get(0, 0, 'name', true, '',
'', array(), true);
if ($activity_id)
{
@@ -475,7 +475,7 @@
// if( $activity_id )
if ($project_id)
{
- $parent_activity =
$this->so->get_single($activity->get_parent_id());
+ $parent_activity =
$this->so->get_single((int)$activity->get_parent_id());
$data['parent_activity'] = $parent_activity;
}
else
Modified: trunk/logistic/inc/class.uiproject.inc.php
===================================================================
--- trunk/logistic/inc/class.uiproject.inc.php 2016-10-01 15:45:46 UTC (rev
15776)
+++ trunk/logistic/inc/class.uiproject.inc.php 2016-10-02 13:14:24 UTC (rev
15777)
@@ -86,8 +86,8 @@
$params = array(
'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
'results' => phpgw::get_var('length', 'int',
'REQUEST', $user_rows_per_page),
- 'query' => $search['value'],
- 'order' =>
$columns[$order[0]['column']]['data'],
+ 'query' => !empty($search['value']) ?
$search['value'] : '',
+ 'order' =>
!empty($columns[$order[0]['column']]['data']) ?
$columns[$order[0]['column']]['data'] : '',
'sort' => $order[0]['dir'],
'allrows' => phpgw::get_var('length', 'int') ==
-1,
);
@@ -98,7 +98,7 @@
$sort_ascending = $params['sort'] == 'desc' ? false :
true;
// Form variables
$search_for = $params['query'];
- $search_type = phpgw::get_var('search_option');
+ $search_type = phpgw::get_var('search_option',
'string', 'REQUEST', '');
// Create an empty result set
$result_objects = array();
$result_count = 0;
Modified: trunk/logistic/inc/class.uirequirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement.inc.php 2016-10-01 15:45:46 UTC
(rev 15776)
+++ trunk/logistic/inc/class.uirequirement.inc.php 2016-10-02 13:14:24 UTC
(rev 15777)
@@ -127,8 +127,8 @@
$params = array(
'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
'results' => phpgw::get_var('length', 'int',
'REQUEST', $user_rows_per_page),
- 'query' => $search['value'],
- 'order' =>
$columns[$order[0]['column']]['data'],
+ 'query' => !empty($search['value']) ?
$search['value'] : '',
+ 'order' =>
!empty($columns[$order[0]['column']]['data']) ?
$columns[$order[0]['column']]['data'] : '',
'sort' => $order[0]['dir'],
'allrows' => phpgw::get_var('length', 'int') ==
-1,
);
@@ -142,7 +142,7 @@
$activity_id = phpgw::get_var('activity_id');
- $search_type = phpgw::get_var('search_option');
+ $search_type = phpgw::get_var('search_option',
'string', 'REQUEST', '');
// Create an empty result set
$result_objects = array();
$result_count = 0;
@@ -155,7 +155,7 @@
if (isset($exp_param))
{
$export = true;
- $num_of_objects = null;
+ $num_of_objects = 0;
}
//Retrieve the type of query and perform type specific
logic
@@ -166,7 +166,7 @@
default: // ... all composites, filters (active
and vacant)
phpgwapi_cache::session_set('logistic',
'requirement_query', $search_for);
$filters = array('activity' =>
$activity_id);
- $result_objects =
$this->so->get($start_index, $num_of_objects, $sort_field, $sort_ascending,
$search_for, $search_type, $filters, $params['allrows']);
+ $result_objects =
$this->so->get($start_index, (int)$num_of_objects, $sort_field,
$sort_ascending, $search_for, $search_type, $filters, $params['allrows']);
$object_count =
$this->so->get_count($search_for, $search_type, $filters);
break;
}
@@ -470,7 +470,7 @@
$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 =
$this->so_resource_type_requirement->get((int)$start_index,
(int)$num_of_objects, (string)$sort_field, (bool)$sort_ascending,
(string)$search_for, (string)$search_type, $filters);
$distict_location_ids_array = array();
Modified: trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
===================================================================
--- trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
2016-10-01 15:45:46 UTC (rev 15776)
+++ trunk/logistic/inc/class.uirequirement_resource_allocation.inc.php
2016-10-02 13:14:24 UTC (rev 15777)
@@ -183,8 +183,8 @@
$params = array(
'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
'results' => phpgw::get_var('length', 'int',
'REQUEST', $user_rows_per_page),
- 'query' => $search['value'],
- 'order' =>
$columns[$order[0]['column']]['data'],
+ 'query' => !empty($search['value']) ?
$search['value'] : '',
+ 'order' =>
!empty($columns[$order[0]['column']]['data']) ?
$columns[$order[0]['column']]['data'] : '',
'sort' => $order[0]['dir'],
'allrows' => phpgw::get_var('length', 'int') ==
-1,
);
@@ -196,7 +196,7 @@
// Form variables
$search_for = $params['query'];
- $search_type = phpgw::get_var('search_option');
+ $search_type = phpgw::get_var('search_option',
'string', 'REQUEST', '');
// Create an empty result set
$result_objects = array();
@@ -362,7 +362,7 @@
if ($requirement)
{
- $requirement_values =
$this->so_requirement_value->get(null, null, null, null, null, null, array(
+ $requirement_values =
$this->so_requirement_value->get(0, 0, '', false, '', '', array(
'requirement_id' =>
$requirement->get_id()));
$criterias_array = array();
@@ -534,7 +534,7 @@
//FIXME: Bruk 'allocation_id' i staden.
//_debug_array($inventory_ids_orig);die();
$filters = array('requirement_id' =>
$requirement->get_id());
- $num_allocated = $this->so->get_count($search_for,
$search_type, $filters);
+ $num_allocated =
$this->so->get_count((string)$search_for, (string)$search_type, $filters);
$num_required = $requirement->get_no_of_items();
Modified: trunk/logistic/inc/class.uiresource_type_requirement.inc.php
===================================================================
--- trunk/logistic/inc/class.uiresource_type_requirement.inc.php
2016-10-01 15:45:46 UTC (rev 15776)
+++ trunk/logistic/inc/class.uiresource_type_requirement.inc.php
2016-10-02 13:14:24 UTC (rev 15777)
@@ -89,8 +89,8 @@
$params = array(
'start' => phpgw::get_var('start', 'int',
'REQUEST', 0),
'results' => phpgw::get_var('length', 'int',
'REQUEST', $user_rows_per_page),
- 'query' => $search['value'],
- 'order' =>
$columns[$order[0]['column']]['data'],
+ 'query' => !empty($search['value']) ?
$search['value'] : '',
+ 'order' =>
!empty($columns[$order[0]['column']]['data']) ?
$columns[$order[0]['column']]['data'] : '',
'sort' => $order[0]['dir'],
'allrows' => phpgw::get_var('length', 'int') ==
-1,
);
@@ -104,7 +104,7 @@
$activity_id = phpgw::get_var('activity_id');
- $search_type = phpgw::get_var('search_option');
+ $search_type = phpgw::get_var('search_option',
'string', 'REQUEST', '');
// Form variables
$search_type = phpgw::get_var('search_option');
Modified: trunk/logistic/inc/model/class.model.inc.php
===================================================================
--- trunk/logistic/inc/model/class.model.inc.php 2016-10-01 15:45:46 UTC
(rev 15776)
+++ trunk/logistic/inc/model/class.model.inc.php 2016-10-02 13:14:24 UTC
(rev 15777)
@@ -82,7 +82,7 @@
* in order to validate against the standard database rules.
The subclasses can in addition
* add their own specific validation logic.
*
- * @return boolean true if the object is valid, false otherwise
+ * @return bool true if the object is valid, false otherwise
*/
public function validates()
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15777] logistic: php7 adaption,
sigurdne <=