[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [16837] Stable: Merge 16834:16836 from trunk
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [16837] Stable: Merge 16834:16836 from trunk |
Date: |
Tue, 6 Jun 2017 05:07:26 -0400 (EDT) |
Revision: 16837
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16837
Author: sigurdne
Date: 2017-06-06 05:07:26 -0400 (Tue, 06 Jun 2017)
Log Message:
-----------
Stable: Merge 16834:16836 from trunk
Modified Paths:
--------------
branches/Version-2_0-branch/property/inc/class.boreport.inc.php
branches/Version-2_0-branch/property/inc/class.soreport.inc.php
branches/Version-2_0-branch/property/inc/class.uireport.inc.php
branches/Version-2_0-branch/property/js/portico/report.edit.js
branches/Version-2_0-branch/property/templates/base/report.xsl
Property Changed:
----------------
branches/Version-2_0-branch/
branches/Version-2_0-branch/booking/
branches/Version-2_0-branch/bookingfrontend/
Index: branches/Version-2_0-branch
===================================================================
--- branches/Version-2_0-branch 2017-06-06 09:05:36 UTC (rev 16836)
+++ branches/Version-2_0-branch 2017-06-06 09:07:26 UTC (rev 16837)
Property changes on: branches/Version-2_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
## -1,4 +1,4 ##
/branches/dev-syncromind:13653
-/branches/dev-syncromind-2:14933-16787
+/branches/dev-syncromind-2:14933-16835
/branches/stavangerkommune:12743-12875,12986
-/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614,16616-16618,16620-16621,16623-16624,16626,16628,16630,16632-16638,16640,16642,16644,16646-16651,16653-16663,16665,16667,16669,16671,16673,16675,16677,16679-16680,16682,16684,16686,16688-16692,16694-16695,16697-16699,16701,16703,16705-16706,16708,16710,16712,16714,16716-16718,16720-16728,16730-16732,16734-16739,16741,16743-16746,16748-16750,16752-16755,16757,16759-16761,16763,16765,16767,16769-16774,16776,16778-16783,16785-16788,16790,16792,16794,16796-16802,16804-16807,16809,16811-16817,16819,16821-16825,16827-16831,16833
\ No newline at end of property
+/trunk:14721-14732,14734-14735,14737,14739,14741,14743-14744,14746-14749,14751,14753,14755-14757,14759,14761-14764,14766-14768,14770-14783,14785-14792,14794-14813,14815-14816,14818,14820-14822,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14847,14849-14866,14868-14869,14871,14873-14875,14877-14878,14880-14884,14886-14896,14898,14900-14902,14904,14906-14909,14911-14915,14917-14919,14921-14922,14924-14978,14980-15258,15260-15261,15263-15264,15266-15285,15287-15288,15290-15291,15293,15295,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15356,15358,15360-15541,15543-15566,15568-15569,15571,15573-15581,15583,15585-15617,15619,15621-15630,15632-15635,15637-15639,15641-15643,15645,15647-15665,15667-15668,15670-15671,15673-15693,15695-15712,15714-15764,15766-15767,15769-15787,15789-15802,15804-15811,15813-15814,15816-15818,15820-15849,15851-15887,15889-15900,15902-16046,16048-16051,16053,16055,16057-16063,16065-16071,16073-16077,16079-16081,16083-16099,16101-16130,16132-16140,16142,16144-16212,16214-16219,16221,16223-16224,16226,16228-16229,16231,16233,16235,16237,16239-16240,16242,16244-16246,16248,16250-16251,16253-16255,16257-16259,16261,16263,16265,16267,16269-16276,16278,16280-16283,16285,16287-16288,16290,16292-16295,16297-16305,16307-16314,16316-16318,16320-16322,16324,16326-16330,16332,16334,16336,16338-16339,16341-16342,16344,16346,16348,16350,16352-16353,16355-16358,16360,16362,16364-16369,16371,16373,16375-16378,16380,16382-16383,16385,16387,16389,16391,16393-16395,16397,16399-16402,16404,16406,16408,16410-16415,16417,16419-16420,16422-16425,16427,16429-16440,16442,16444,16446,16448-16449,16451,16453,16455-16463,16465-16472,16474-16475,16477-16484,16486,16488,16490-16497,16499,16501-16503,16505-16512,16514-16517,16519,16521,16523,16525,16527-16532,16534,16536-16541,16543,16545-16554,16556,16558-16565,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16600-16601,16603-16608,16610-16614,16616-16618,16620-16621,16623-16624,16626,16628,16630,16632-16638,16640,16642,16644,16646-16651,16653-16663,16665,16667,16669,16671,16673,16675,16677,16679-16680,16682,16684,16686,16688-16692,16694-16695,16697-16699,16701,16703,16705-16706,16708,16710,16712,16714,16716-16718,16720-16728,16730-16732,16734-16739,16741,16743-16746,16748-16750,16752-16755,16757,16759-16761,16763,16765,16767,16769-16774,16776,16778-16783,16785-16788,16790,16792,16794,16796-16802,16804-16807,16809,16811-16817,16819,16821-16825,16827-16831,16833,16835-16836
\ No newline at end of property
Index: branches/Version-2_0-branch/booking
===================================================================
--- branches/Version-2_0-branch/booking 2017-06-06 09:05:36 UTC (rev 16836)
+++ branches/Version-2_0-branch/booking 2017-06-06 09:07:26 UTC (rev 16837)
Property changes on: branches/Version-2_0-branch/booking
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
-/branches/dev-syncromind-2/booking:14933-16787
+/branches/dev-syncromind-2/booking:14933-16835
/branches/stavangerkommune/booking:9468-12740,12743-12875,12986
-/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900,15902-16046,16055,16101-16130,16144-16212,16297-16305,16307-16314,16393-16395,16490-16497,16514-16517,16534,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16616-16618,16730,16734-16739,16748-16750,16769-16774,16785-16788,16796-16802
\ No newline at end of property
+/trunk/booking:14721-14732,14824-14825,14827-14829,14831-14834,14836,14838,14840-14842,14844-14845,14871,14886-14896,14900-14902,14917-14919,14924-14978,14980-15258,15266-15285,15287-15288,15297,15299-15305,15307-15310,15312-15335,15337-15352,15354,15360-15541,15543-15566,15568-15569,15585-15617,15621-15630,15637-15639,15641-15643,15645,15647-15665,15667-15668,15695-15712,15714-15764,15820-15849,15889-15900,15902-16046,16055,16101-16130,16144-16212,16297-16305,16307-16314,16393-16395,16490-16497,16514-16517,16534,16567-16575,16577-16584,16586-16588,16590,16592-16593,16595-16596,16598,16616-16618,16730,16734-16739,16748-16750,16769-16774,16785-16788,16796-16802,16835-16836
\ No newline at end of property
Index: branches/Version-2_0-branch/bookingfrontend
===================================================================
--- branches/Version-2_0-branch/bookingfrontend 2017-06-06 09:05:36 UTC (rev
16836)
+++ branches/Version-2_0-branch/bookingfrontend 2017-06-06 09:07:26 UTC (rev
16837)
Property changes on: branches/Version-2_0-branch/bookingfrontend
___________________________________________________________________
Modified: svn:mergeinfo
## -1,3 +1,3 ##
-/branches/dev-syncromind-2/bookingfrontend:14933-16787
+/branches/dev-syncromind-2/bookingfrontend:14933-16835
/branches/stavangerkommune/bookingfrontend:9468-12740,12986
-/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258,15297,15312-15335,15585-15617,15621-15630,15714-15764,15813-15814,15820-15849,15889-15900,15902-16046,16101-16130,16144-16212,16297-16305,16307-16314,16316-16318,16385,16387,16393-16395,16399-16402,16586-16588,16603-16608,16734-16739,16752-16755,16785-16788,16796-16802
\ No newline at end of property
+/trunk/bookingfrontend:14721-14732,14770-14783,14794-14808,14824-14825,14838,14886-14894,14906-14909,14917-14919,14924-14978,14980-15258,15297,15312-15335,15585-15617,15621-15630,15714-15764,15813-15814,15820-15849,15889-15900,15902-16046,16101-16130,16144-16212,16297-16305,16307-16314,16316-16318,16385,16387,16393-16395,16399-16402,16586-16588,16603-16608,16734-16739,16752-16755,16785-16788,16796-16802,16835-16836
\ No newline at end of property
Modified: branches/Version-2_0-branch/property/inc/class.boreport.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.boreport.inc.php
2017-06-06 09:05:36 UTC (rev 16836)
+++ branches/Version-2_0-branch/property/inc/class.boreport.inc.php
2017-06-06 09:07:26 UTC (rev 16837)
@@ -43,7 +43,6 @@
$this->operators = $this->so->operators;
$this->operators_equal = $this->so->operators_equal;
- $this->operators_between = $this->so->operators_between;
$this->operators_like = $this->so->operators_like;
$this->operators_in = $this->so->operators_in;
$this->operators_null = $this->so->operators_null;
Modified: branches/Version-2_0-branch/property/inc/class.soreport.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.soreport.inc.php
2017-06-06 09:05:36 UTC (rev 16836)
+++ branches/Version-2_0-branch/property/inc/class.soreport.inc.php
2017-06-06 09:07:26 UTC (rev 16837)
@@ -46,10 +46,6 @@
'greater' => '>',
'greater_equal' => '>='
);
- $this->operators_between = array(
- 'between' => 'BETWEEN',
- 'not_between' => 'NOT BETWEEN'
- );
$this->operators_like = array(
'like' => 'LIKE',
'not_like' => 'NOT LIKE',
@@ -64,7 +60,7 @@
'is_null' => 'IS NULL',
'is_not_null' => 'IS NOT NULL'
);
- $this->operators = array_merge($this->operators_equal,
$this->operators_between, $this->operators_like, $this->operators_in,
$this->operators_null);
+ $this->operators = array_merge($this->operators_equal,
$this->operators_like, $this->operators_in, $this->operators_null);
}
function read_single ( $id, $values = array() )
@@ -284,10 +280,6 @@
case 'character varying':
case 'text':
$result = $param['field']."
".$this->operators[$param['operator']]." '".$param['value1']."'";
- if ($param['conector'] &&
$param['value2'] != '')
- {
- $result .= "
".$param['conector']." ".$param['field']."
".$this->operators[$param['operator']]." '".$param['value2']."'";
- }
break;
case 'integer':
case 'smallint':
@@ -295,10 +287,6 @@
if (is_numeric($param['value1']))
{
$result = $param['field']."
".$this->operators[$param['operator']]." ".$param['value1'];
- if ($param['conector'] &&
is_numeric(['value2']))
- {
- $result .= "
".$param['conector']." ".$param['field']."
".$this->operators[$param['operator']]." ".$param['value2'];
- }
}
break;
case 'date':
@@ -306,10 +294,6 @@
if ($this->_is_date($param['value1']))
{
$result = $param['field']."
".$this->operators[$param['operator']]." '".$param['value1']."'";
- if ($param['conector'] &&
$this->_is_date($param['value2']))
- {
- $result .= "
".$param['conector']." ".$param['field']."
".$this->operators[$param['operator']]." '".$param['value1']."'";
- }
}
}
@@ -325,6 +309,7 @@
$_columns[$column['name']] = $column['type'];
}
+ $n = 1;
$where = array();
foreach ($criteria as $param)
{
@@ -333,20 +318,10 @@
case
(array_key_exists($param['operator'], $this->operators_equal)):
$result =
$this->_build_conditions_equal($param, $_columns[$param['field']]);
break;
- case
(array_key_exists($param['operator'], $this->operators_between)):
- if ($param['value1'] != '' &&
$param['value2'] != '')
- {
- $result =
$param['field']."::text ".$this->operators[$param['operator']]."
'".$param['value1']."' AND '".$param['value2']."'";
- }
- break;
case
(array_key_exists($param['operator'], $this->operators_like)):
if ($param['value1'] != '')
{
- $result =
$param['field']."::text ".$this->operators[$param['operator']]."
'%".$param['value1']."%'";
- if ($param['conector']
&& $param['value2'] != '')
- {
- $result .= "
".$param['conector']." ".$param['field']."::text
".$this->operators[$param['operator']]." '%".$param['value2']."%'";
- }
+ $result =
$param['field']."::text ".$this->operators[$param['operator']]."
'%".$param['value1']."%'";
}
break;
case
(array_key_exists($param['operator'], $this->operators_null)):
@@ -360,12 +335,13 @@
$result =
$param['field']."::text ".$this->operators[$param['operator']]."
(".$_string.")";
}
break;
- }
+ }
if ($result)
{
- $where[] = $result;
+ $where[] = $result."
".$param['conector'];
}
+ $n++;
}
return $where;
@@ -388,16 +364,31 @@
$string_columns = implode(',', $jsonB['columns']);
+ $array_order = array();
$group = implode(',', $jsonB['group']);
- $order = 'ORDER BY '.$group.' ASC';
+ if ($group)
+ {
+ $array_order[] = $group.' ASC';
+ }
+ $order = implode(',', $jsonB['order']);
+ if ($order)
+ {
+ $array_order[] = $order.' ASC';
+ }
+
+ if (count($array_order))
+ {
+ $ordering = 'ORDER BY '.implode(', ',
array_unique($array_order));
+ }
+
$cond = $this->_build_conditions($jsonB['criteria'],
$id);
if ($cond)
{
- $where = 'WHERE '.implode(' AND ', $cond);
+ $where = 'WHERE '.implode(' ', $cond);
}
- $sql = "SELECT ".$string_columns." FROM
".$dataset['view_name']." ".$where." ".$order;
+ $sql = "SELECT ".$string_columns." FROM
".$dataset['view_name']." ".$where." ".$ordering;
if (count($data))
{
@@ -416,6 +407,8 @@
while ($this->db->next_record())
{
+ $_group = ($group) ? $this->db->f($group) :
'any_group';
+
$value = array();
foreach ($columns as $column)
{
@@ -426,18 +419,21 @@
{
if ($v == 'sum')
{
-
$array_sum[$this->db->f($group)][$k][] = $this->db->f($k);
+ $array_sum[$_group][$k][] =
$this->db->f($k);
}
if ($v == 'count')
{
-
$array_count[$this->db->f($group)][$k][] = $this->db->f($k);
+ $array_count[$_group][$k][] =
$this->db->f($k);
}
}
- $values[$this->db->f($group)][] = $value;
+ $values[$_group][] = $value;
}
-
- $result = $this->_generate_total_sum($values,
$array_sum, $array_count);
+
+ if (count($values))
+ {
+ $result = $this->_generate_total_sum($values,
$array_sum, $array_count);
+ }
return $result;
}
@@ -472,7 +468,10 @@
}
$array_operations[] = $operations;
- $group[] = $operations;
+ if ($k != 'any_group')
+ {
+ $group[] = $operations;
+ }
$group[] = $empty;
$result = array_merge($result, $group);
Modified: branches/Version-2_0-branch/property/inc/class.uireport.inc.php
===================================================================
--- branches/Version-2_0-branch/property/inc/class.uireport.inc.php
2017-06-06 09:05:36 UTC (rev 16836)
+++ branches/Version-2_0-branch/property/inc/class.uireport.inc.php
2017-06-06 09:07:26 UTC (rev 16837)
@@ -63,7 +63,6 @@
$this->operators = $this->bo->operators;
$this->operators_equal = $this->bo->operators_equal;
- $this->operators_between = $this->bo->operators_between;
$this->operators_like = $this->bo->operators_like;
$this->operators_in = $this->bo->operators_in;
$this->operators_null = $this->bo->operators_null;
@@ -333,7 +332,29 @@
$active_tab = 'report';
$msgbox_data =
$this->bocommon->msgbox_data($this->receipt);
-
+
+ $lang = array(
+ 'select_one_column' => lang('Select at least
one column'),
+ 'select_group' => lang('Select a group'),
+ 'select_count_sum' => lang('Select at least one
count/sum operation'),
+ 'select_operator' => lang('Select an operator
for:'),
+ 'enter_value' => lang('Enter a value for:'),
+ 'enter_second_value' => lang('Enter a second
value for:'),
+
+ 'choose_dataset' => lang('choose dataset'),
+ 'and' => lang('AND'),
+ 'or' => lang('OR'),
+ 'count' => lang('COUNT'),
+ 'sum' => lang('SUM'),
+
+ 'restricted_value' => lang('Restricted value'),
+ 'operator' => lang('Operator'),
+ 'value' => lang('Value'),
+ 'conector' => lang('Conector'),
+ 'uselect' => lang('Unselect'),
+ 'delete' => lang('Delete')
+ );
+
$data = array
(
'datatable_def' => array(),
@@ -345,11 +366,12 @@
'operators' => json_encode($this->operators),
'operators_equal' =>
json_encode($this->operators_equal),
- 'operators_between' =>
json_encode($this->operators_between),
'operators_like' =>
json_encode($this->operators_like),
'operators_in' =>
json_encode($this->operators_in),
'operators_null' =>
json_encode($this->operators_null),
+ 'lang' => json_encode($lang),
+
'report_id' => $values['id'],
'report_name' => $values['report_name'],
'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
@@ -365,6 +387,54 @@
self::render_template_xsl(array('report'), array('edit'
=> $data));
}
+ private function _validate_criteria ()
+ {
+ $values = phpgw::get_var('values');
+
+ if ($values)
+ {
+ $restricted_values =
$values['cbo_restricted_value'];
+ $operators = $values['cbo_operator'];
+ $values_1 = $values['txt_value1'];
+ $conector = $values['cbo_conector'];
+ }
+ else {
+ $restricted_values =
phpgw::get_var('cbo_restricted_value');
+ $operators = phpgw::get_var('cbo_operator');
+ $values_1 = phpgw::get_var('txt_value1');
+ $conector = phpgw::get_var('cbo_conector');
+ }
+
+ $criteria = array();
+ foreach ($restricted_values as $k => $field)
+ {
+ if ($field && $operators[$k])
+ {
+ $criteria[] = array('field'=>$field,
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]),
'conector'=>$conector[$k]);
+ }
+ }
+
+ $n = 0;
+ $result = array();
+ $last = count($criteria) - 1;
+ foreach ($criteria as $item)
+ {
+ if ($n == $last)
+ {
+ $item['conector'] = '';
+ $result[] = $item;
+ }
+ else if ($item['conector'] != '')
+ {
+ $result[] = $item;
+ }
+
+ $n++;
+ }
+
+ return $result;
+ }
+
private function _populate( $data = array() )
{
$report_id = phpgw::get_var('report_id');
@@ -377,22 +447,10 @@
$aggregate = phpgw::get_var('aggregate');
$cbo_aggregate = phpgw::get_var('cbo_aggregate');
- $restricted_values =
phpgw::get_var('cbo_restricted_value');
- $operators = phpgw::get_var('cbo_operator');
- $values_1 = phpgw::get_var('txt_value1');
- $conector = phpgw::get_var('cbo_conector');
- $values_2 = phpgw::get_var('txt_value2');
+ $criteria = $this->_validate_criteria();
- $criteria = array();
- foreach ($restricted_values as $k => $field)
- {
- if ($field && $operators[$k])
- {
- $criteria[] = array('field'=>$field,
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]),
'conector'=>$conector[$k], 'value2'=>trim($values_2[$k]));
- }
- }
-
- $group = array($group_by => $group_by);
+ $group = ($group_by) ? array($group_by => $group_by) :
array();
+
$order = array($order_by => $order_by);
$columns = array();
@@ -412,11 +470,6 @@
{
$this->receipt['error'][] = array('msg' =>
lang('Please select dataset name !'));
}
-
- if (!count($group))
- {
- $this->receipt['error'][] = array('msg' =>
lang('Please select a group !'));
- }
if (!count($aggregate))
{
@@ -754,24 +807,17 @@
$data['aggregate'] = $values['aggregate'];
$data['cbo_aggregate'] = $values['cbo_aggregate'];
- $restricted_values = $values['cbo_restricted_value'];
- $operators = $values['cbo_operator'];
- $values_1 = $values['txt_value1'];
- $conector = $values['cbo_conector'];
- $values_2 = $values['txt_value2'];
+ $criteria = $this->_validate_criteria();
- $criteria = array();
- foreach ($restricted_values as $k => $field)
- {
- if ($field && $operators[$k])
- {
- $criteria[] = array('field'=>$field,
'operator'=>$operators[$k], 'value1'=>trim($values_1[$k]),
'conector'=>$conector[$k], 'value2'=>trim($values_2[$k]));
- }
- }
$data['criteria'] = $criteria;
$list = $this->bo->read_to_export($dataset_id, $data);
+ if (!count($list))
+ {
+ return lang('No records');
+ }
+
$html_table = '<table class="pure-table
pure-table-bordered">';
$html_table .= '<thead><tr>';
foreach ($list[0] as $c => $v)
@@ -790,7 +836,7 @@
}
- public function get_operators()
+ /*public function get_operators()
{
$operators = array(
'equal' => '=',
@@ -812,5 +858,5 @@
);
return $operators;
- }
+ }*/
}
\ No newline at end of file
Modified: branches/Version-2_0-branch/property/js/portico/report.edit.js
===================================================================
--- branches/Version-2_0-branch/property/js/portico/report.edit.js
2017-06-06 09:05:36 UTC (rev 16836)
+++ branches/Version-2_0-branch/property/js/portico/report.edit.js
2017-06-06 09:07:26 UTC (rev 16837)
@@ -36,14 +36,17 @@
columns = result.columns;
var row = '<span style="display:table-row;">\n\
- <span
style="display:table-cell;">Restricted value</span>\n\
- <span
style="display:table-cell;">Operator</span>\n\
- <span
style="display:table-cell;">Value</span>\n\
- <span
style="display:table-cell;">Conector</span>\n\
- <span
style="display:table-cell;">Value</span>\n\
+ <span
style="display:table-cell;">'+ lang['restricted_value'] +'</span>\n\
+ <span
style="display:table-cell;">'+ lang['operator'] +'</span>\n\
+ <span
style="display:table-cell;">'+ lang['value'] +'</span>\n\
+ <span
style="display:table-cell;">'+ lang['conector'] +'</span>\n\
</span>';
$('#container_criteria').append(row);
- n = 0;
+
+ var el = '<span style="display:block;"><input
type="checkbox" onchange="unselect_group()" id="unselect" value="1"/><b>'+
lang['uselect'] +'</b></span>';
+ $('#container_groups').append(el);
+
+ order_criteria = 0;
if (jsonB !== '')
{
@@ -61,7 +64,7 @@
if ($('#cbo_dataset_id').val() == '')
{
- alert('choose dataset');
+ alert(lang['choose_dataset']);
return;
}
@@ -76,7 +79,6 @@
values['cbo_operator'] = {};
values['txt_value1'] = {};
values['cbo_conector'] = {};
- values['txt_value2'] = {};
$('input[name^="columns"]').each(function() {
@@ -86,22 +88,22 @@
}
});
- var invalid_groups = true;
+ //var invalid_groups = true;
$('input[name="group"]').each(function() {
if ($(this).is(":checked"))
{
values['group'][$(this).val()] = $(this).val();
- invalid_groups = false;
+ //invalid_groups = false;
}
});
- if (invalid_groups)
+ /*if (invalid_groups)
{
- alert('Choose group');
+ alert(lang['select_group']);
$('#responsiveTabsGroups').responsiveTabs('activate',
1);
return;
- }
+ }*/
$('input[name="order"]').each(function() {
@@ -129,27 +131,24 @@
if (invalid_aggregate)
{
$('#responsiveTabsGroups').responsiveTabs('activate',
3);
- alert('Choose COUNT/SUM option');
+ alert(lang['select_count_sum']);
return;
}
- var idx = 0;
- var size = 0;
+ var order = 0;
$('.criteria').each(function()
{
- idx = $(this).val();
- if ($('#cbo_restricted_value_' + idx).val())
+ order = $(this).val();
+ if ($('#cbo_restricted_value_' + order).val())
{
- values['cbo_restricted_value'][idx] =
$('#cbo_restricted_value_' + idx).val();
- values['cbo_operator'][idx] =
$('#cbo_operator_' + idx).val();
- values['txt_value1'][idx] = $('#txt_value1_' +
idx).val();
- values['cbo_conector'][idx] =
$('#cbo_conector_' + idx).val();
- values['txt_value2'][idx] = $('#txt_value2_' +
idx).val();
- size ++;
+ values['cbo_restricted_value'][order] =
$('#cbo_restricted_value_' + order).val();
+ values['cbo_operator'][order] =
$('#cbo_operator_' + order).val();
+ values['txt_value1'][order] = $('#txt_value1_'
+ order).val();
+ values['cbo_conector'][order] =
$('#cbo_conector_' + order).val();
}
});
- if (size && !validate_criteria(values))
+ if (!validate_criteria())
{
$('#responsiveTabsGroups').responsiveTabs('activate',
4);
return;
@@ -180,8 +179,8 @@
var combo_conector = $("<select></select>");
combo_conector.append("<option value=''></option>");
- combo_conector.append("<option value='and'>AND</option>");
- combo_conector.append("<option value='or'>OR</option>");
+ combo_conector.append("<option value='and'>"+ lang['and']
+"</option>");
+ combo_conector.append("<option value='or'>"+ lang['or']
+"</option>");
var combo_restricted_value = $("<select></select>");
combo_restricted_value.append("<option value=''></option>");
@@ -190,21 +189,20 @@
combo_restricted_value.append("<option value='"+
value.name +"'>"+ value.name +"</option>");
});
- var el_1 = "<span style='display:table-cell;'><select
id='cbo_restricted_value_"+ n +"' name='cbo_restricted_value[]'>" +
$(combo_restricted_value).html() + "</select></span>";
- var el_2 = "<span style='display:table-cell;'><select
id='cbo_operator_"+ n +"' name='cbo_operator[]'>" + $(combo_operator).html() +
"</select></span>";
- var el_3 = "<span style='display:table-cell;'><input
type='text' id='txt_value1_"+ n +"' name='txt_value1[]'></input></span>";
- var el_4 = "<span style='display:table-cell;'><select
id='cbo_conector_"+ n +"' name='cbo_conector[]'>" + $(combo_conector).html() +
"</select></span>";
- var el_5 = "<span style='display:table-cell;'><input
type='text' id='txt_value2_"+ n +"' name='txt_value2[]'></input></span>";
- var el_6 = "<span style='display:table-cell;'><input
type='hidden' class='criteria' value='"+ n +"'><input type='button'
class='pure-button pure-button-primary' onclick='delete_restricted_value(this)'
name='btn_del' value='Delete'></input></span>";
+ var el_1 = "<span style='display:table-cell;'><select
id='cbo_restricted_value_"+ order_criteria +"' name='cbo_restricted_value[]'>"
+ $(combo_restricted_value).html() + "</select></span>";
+ var el_2 = "<span style='display:table-cell;'><select
id='cbo_operator_"+ order_criteria +"' name='cbo_operator[]'>" +
$(combo_operator).html() + "</select></span>";
+ var el_3 = "<span style='display:table-cell;'><input
type='text' id='txt_value1_"+ order_criteria +"'
name='txt_value1[]'></input></span>";
+ var el_4 = "<span style='display:table-cell;'><select
id='cbo_conector_"+ order_criteria +"' name='cbo_conector[]'>" +
$(combo_conector).html() + "</select></span>";
+ var el_5 = "<span style='display:table-cell;'><input
type='hidden' class='criteria' value='"+ order_criteria +"'><input
type='button' class='pure-button pure-button-primary'
onclick='delete_restricted_value(this)' name='btn_del' value='"+ lang['delete']
+"'></input></span>";
- var row = '<span style="display:table-row;">'+ el_1 + el_2 +
el_3 + el_4 + el_5 + el_6 +'</span>';
- n ++;
+ var row = '<span style="display:table-row;">'+ el_1 + el_2 +
el_3 + el_4 + el_5 +'</span>';
+ order_criteria ++;
$('#container_criteria').append(row);
});
});
- var n = 0;
+ var order_criteria = 0;
function delete_restricted_value (e)
{
@@ -211,6 +209,21 @@
$(e).parent().parent().remove();
}
+function unselect_group ()
+{
+ if ($("#unselect").is(":checked"))
+ {
+ $('input[name="group"]').each(function() {
+ $(this).prop('checked', false);
+ $(this).prop('disabled', true);
+ });
+ } else {
+ $('input[name="group"]').each(function() {
+ $(this).prop('disabled', false);
+ });
+ }
+}
+
function in_array_object (key_operator, array_object)
{
var result = false;
@@ -226,55 +239,47 @@
return result;
}
-function validate_criteria (values)
+function validate_criteria ()
{
var result = true;
- $.each(values.cbo_restricted_value, function(key, value)
+ var order = "";
+ var field = "";
+ var operator = "";
+
+ $('.criteria').each(function()
{
- if (values.cbo_operator[key] == "")
+ order = $(this).val();
+ field = $("#cbo_restricted_value_" + order).val();
+ operator = $("#cbo_operator_" + order).val();
+
+ if (field == "")
{
+ return true;
+ }
+
+ if (field && operator == "")
+ {
result = false;
- alert('Select an operator for: ' + value);
- $("#cbo_operator_" + key).focus();
- return;
+ alert(lang['select_operator'] + ' ' + field);
+ $("#cbo_operator_" + order).focus();
+
+ return false;
}
- });
-
- if (!result)
- {
- return result;
- }
-
- $.each(values.cbo_operator, function(key, value)
- {
+
switch (true)
{
- case (in_array_object(value, operators_between)):
- if ($("#txt_value1_" + key).val() == '')
- {
- result = false;
- alert('Enter a value for ' +
values.cbo_restricted_value[key]);
- $("#txt_value1_" + key).focus();
- }
- if ($("#txt_value2_" + key).val() == '')
- {
- result = false;
- alert('Enter a second value for: ' +
values.cbo_restricted_value[key]);
- $("#txt_value2_" + key).focus();
- }
+ case (in_array_object(operator, operators_null)):
break;
- case (in_array_object(value, operators_null)):
- break;
default:
- if ($("#txt_value1_" + key).val() == '')
+ if ($("#txt_value1_" + order).val() == "")
{
result = false;
- alert('Enter a value for: ' +
values.cbo_restricted_value[key]);
- $("#txt_value1_" + key).focus();
+ alert(lang['enter_value'] + ' ' +
field);
+ $("#txt_value1_" + order).focus();
}
- }
+ }
});
-
+
return result;
}
@@ -315,7 +320,6 @@
$("#cbo_operator_" + key).val(value.operator);
$("#txt_value1_" + key).val(value.value1);
$("#cbo_conector_" + key).val(value.conector);
- $("#txt_value2_" + key).val(value.value2);
});
}
@@ -350,10 +354,10 @@
function build_list_aggregates(name, type)
{
var combo = $("<select></select>");
- combo.append("<option value='count'>Count</option>");
+ combo.append("<option value='count'>"+ lang['count'] +"</option>");
if (type == 'integer' || type == 'numeric')
{
- combo.append("<option value='sum'>Sum</option>");
+ combo.append("<option value='sum'>"+ lang['sum'] +"</option>");
}
return "<span style='display:table-cell;'><select disabled='true'
id='cbo_" + name + "' name='cbo_aggregate["+ name +"]'>" + $(combo).html() +
"</select></span>";
Modified: branches/Version-2_0-branch/property/templates/base/report.xsl
===================================================================
--- branches/Version-2_0-branch/property/templates/base/report.xsl
2017-06-06 09:05:36 UTC (rev 16836)
+++ branches/Version-2_0-branch/property/templates/base/report.xsl
2017-06-06 09:07:26 UTC (rev 16837)
@@ -88,10 +88,6 @@
<xsl:if test="operators_equal != ''">
operators_equal = <xsl:value-of
select="operators_equal"/>;
</xsl:if>
- var operators_between = {};
- <xsl:if test="operators_between != ''">
- operators_between = <xsl:value-of
select="operators_between"/>;
- </xsl:if>
var operators_like = {};
<xsl:if test="operators_like != ''">
operators_like = <xsl:value-of
select="operators_like"/>;
@@ -105,6 +101,11 @@
operators_null = <xsl:value-of
select="operators_null"/>;
</xsl:if>
+ var lang = {};
+ <xsl:if test="lang != ''">
+ lang = <xsl:value-of select="lang"/>;
+ </xsl:if>
+
var columns = {};
</script>
@@ -240,6 +241,141 @@
$('#responsiveTabsGroups').responsiveTabs({
startCollapsed: 'accordion'
});
+
+ function validate_group ()
+ {
+ if ($('input[name="group"]:checked').length == 0)
+ {
+ return {
+ element : $('input[name="group"]'),
+ message : lang['select_group']
+ }
+ }
+ else {
+ return {};
+ }
+ }
+
+ function validate_column ()
+ {
+ if ($('input[name^="columns"]:checked').length == 0)
+ {
+ return {
+ element : $('input[name^="columns"]'),
+ message : lang['select_one_column']
+ }
+ }
+ else {
+ return {};
+ }
+ }
+
+ function validate_aggregate ()
+ {
+ if ($('input[name^="aggregate"]:checked').length == 0)
+ {
+ return {
+ element : $('input[name^="aggregate"]'),
+ message : lang['select_count_sum']
+ }
+ }
+ else {
+ return {};
+ }
+ }
+
+ function validate_criteria_2 ()
+ {
+ var result = {};
+ var order = "";
+ var field = "";
+ var operator = "";
+
+ $('.criteria').each(function()
+ {
+ order = $(this).val();
+ field = $("#cbo_restricted_value_" +
order).val();
+ operator = $("#cbo_operator_" + order).val();
+
+ if (field == "")
+ {
+ return true;
+ }
+
+ if (field && operator == "")
+ {
+ result = {
+ element : $("#cbo_operator_" +
order),
+ message :
lang['select_operator'] + ' ' + field
+ }
+
+ return false;
+ }
+
+ switch (true)
+ {
+ case (in_array_object(operator,
operators_null)):
+ break;
+ default:
+ if ($("#txt_value1_" +
order).val() == "")
+ {
+ result = {
+ element :
$("#txt_value1_" + order),
+ message :
lang['enter_value'] + ' ' + field
+ }
+ }
+ }
+
+ });
+
+ return result;
+ }
+
+ $(document).ready(function ()
+ {
+ $.validate({
+ lang: 'en', // (supported languages are fr, de,
se, sv, en, pt, no)
+ modules : "location,date,security,file",
+ form: '#form',
+ validateOnBlur : false,
+ scrollToTopOnError : false,
+ errorMessagePosition : 'top',
+ scrollToTopOnError: true,
+ onValidate : function($form)
+ {
+ var result = validate_column();
+ if (!jQuery.isEmptyObject(result))
+ {
+
$('#responsiveTabsGroups').responsiveTabs('activate', 0);
+ return result;
+ }
+
+ /*result = validate_group();
+ if (!jQuery.isEmptyObject(result))
+ {
+
$('#responsiveTabsGroups').responsiveTabs('activate', 1);
+ return result;
+ }*/
+
+ result = validate_aggregate();
+ if (!jQuery.isEmptyObject(result))
+ {
+
$('#responsiveTabsGroups').responsiveTabs('activate', 3);
+ return result;
+ }
+
+ result = validate_criteria_2();
+ if (!jQuery.isEmptyObject(result))
+ {
+
$('#responsiveTabsGroups').responsiveTabs('activate', 4);
+ return result;
+ }
+
+ return true;
+ }
+ });
+ });
+
</script>
</xsl:template>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [16837] Stable: Merge 16834:16836 from trunk,
sigurdne <=