[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [6740] Merge 6735:6739 from trunk
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [6740] Merge 6735:6739 from trunk |
Date: |
Mon, 10 Jan 2011 08:53:37 +0000 |
Revision: 6740
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6740
Author: sigurdne
Date: 2011-01-10 08:53:36 +0000 (Mon, 10 Jan 2011)
Log Message:
-----------
Merge 6735:6739 from trunk
Modified Paths:
--------------
branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
branches/Version-1_0-branch/property/inc/class.boentity.inc.php
branches/Version-1_0-branch/property/inc/class.boifc.inc.php
branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
branches/Version-1_0-branch/property/inc/class.soadmin_location.inc.php
branches/Version-1_0-branch/property/inc/class.soagreement.inc.php
branches/Version-1_0-branch/property/inc/class.soentity.inc.php
branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php
branches/Version-1_0-branch/property/inc/class.uientity.inc.php
branches/Version-1_0-branch/property/inc/class.uitts.inc.php
branches/Version-1_0-branch/property/js/yahoo/entity.index.js
branches/Version-1_0-branch/property/setup/setup.inc.php
branches/Version-1_0-branch/property/setup/tables_update.inc.php
Property Changed:
----------------
branches/Version-1_0-branch/
Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
-
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734
+
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6629-6639,6641-6643,6645-6646,6648,6650-6654,6656-6659,6661-6663,6665-6666,6668-6669,6672-6673,6675,6677-6678,6680,6682-6686,6688-6717,6719,6721-6722,6724-6728,6730,6732-6734,6736-6739
Modified: branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/phpgwapi/inc/class.custom_fields.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -419,7 +419,7 @@
switch ( $attrib['datatype'] )
{
case 'CH':
- $attrib['value'] =
serialize($attrib['value']);
+ $attrib['value'] = ',' .
implode(',', $attrib['value']) . ',';
break;
case 'R':
Modified: branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.bocommon.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -1089,7 +1089,8 @@
{
if($values_attribute[$i]['datatype']=='CH' &&
$values_attribute[$i]['value'])
{
- $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+// $values_attribute[$i]['value'] =
serialize($values_attribute[$i]['value']);
+ $values_attribute[$i]['value'] = ',' .
implode(',', $values_attribute[$i]['value']) . ',';
}
if($values_attribute[$i]['datatype']=='R' &&
$values_attribute[$i]['value'])
{
Modified: branches/Version-1_0-branch/property/inc/class.boentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boentity.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.boentity.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -261,6 +261,31 @@
$data['allrows'] = true;
}
+ $custom = createObject('phpgwapi.custom_fields');
+ $attrib_data =
$custom->find($this->type_app[$this->type],".{$this->type}.{$this->entity_id}.{$this->cat_id}",
0, '','','',true, true);
+
+ $attrib_filter = array();
+ if($attrib_data)
+ {
+ foreach ( $attrib_data as $attrib )
+ {
+ if($attrib['datatype'] == 'LB' ||
$attrib['datatype'] == 'R')
+ {
+ if($_attrib_filter_value =
phpgw::get_var($attrib['column_name'], 'int'))
+ {
+ $attrib_filter[] =
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']} =
'{$_attrib_filter_value}'";
+ }
+ }
+ else if($attrib['datatype'] == 'CH')
+ {
+ if($_attrib_filter_value =
phpgw::get_var($attrib['column_name'], 'int'))
+ {
+ $attrib_filter[] =
"fm_{$this->type}_{$this->entity_id}_{$this->cat_id}.{$attrib['column_name']}
{$GLOBALS['phpgw']->db->like} '%,{$_attrib_filter_value},%'";
+ }
+ }
+ }
+ }
+
$entity = $this->so->read(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
'filter' => $this->filter,'cat_id' =>
$this->cat_id,'district_id' => $this->district_id,
'lookup'=>isset($data['lookup'])?$data['lookup']:'','allrows'=>isset($data['allrows'])?$data['allrows']:'',
@@ -268,7 +293,7 @@
'start_date'=>$this->bocommon->date_to_timestamp($data['start_date']),
'end_date'=>$this->bocommon->date_to_timestamp($data['end_date']),
'dry_run'=>$data['dry_run'],
'type'=>$data['type'], 'location_code' => $this->location_code,
- 'criteria_id' => $this->criteria_id));
+ 'criteria_id' => $this->criteria_id,
'attrib_filter' => $attrib_filter));
$this->total_records = $this->so->total_records;
$this->uicols = $this->so->uicols;
Modified: branches/Version-1_0-branch/property/inc/class.boifc.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.boifc.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.boifc.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -237,7 +237,8 @@
{
if($values_attribute[$i]['datatype']=='CH' && $values_attribute[$i]['value'])
{
- $values_attribute[$i]['value']
= serialize($values_attribute[$i]['value']);
+ // $values_attribute[$i]['value']
= serialize($values_attribute[$i]['value']);
+ $values_attribute[$i]['value']
= ',' . implode(',', $values_attribute[$i]['value']) . ',';
}
if($values_attribute[$i]['datatype']=='R' && $values_attribute[$i]['value'])
{
Modified: branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.custom_fields.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -208,7 +208,8 @@
if($attributes['datatype'] == 'CH')
{
- $attributes['value'] =
unserialize($attributes['value']);
+// $attributes['value'] =
unserialize($attributes['value']);
+ $attributes['value'] =
explode(',', trim($attributes['value'], ','));
if
(isset($attributes['choice']) AND is_array($attributes['choice']))
{
@@ -437,7 +438,8 @@
}
else if($data['datatype']=='CH' &&
$data['value'])
{
- $ch=
unserialize($data['value']);
+ // $ch=
unserialize($data['value']);
+ $ch = explode(',',
trim($data['value'], ','));
if (isset($ch) AND
is_array($ch))
{
for
($k=0;$k<count($ch);$k++)
Modified:
branches/Version-1_0-branch/property/inc/class.soadmin_location.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soadmin_location.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.soadmin_location.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -660,6 +660,7 @@
{
$this->db->query("SELECT * FROM fm_location_type ORDER
BY id ");
+ $location_type = array();
while ($this->db->next_record())
{
$location_type[] = array(
Modified: branches/Version-1_0-branch/property/inc/class.soagreement.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soagreement.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.soagreement.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -336,8 +336,8 @@
}
else
if($cols_return_extra[$i]['datatype']=='CH' && $value)
{
- $ch=
unserialize($value);
-
+// $ch=
unserialize($value);
+ $ch = explode(',',
trim($data['value'], ','));
if (isset($ch) AND
is_array($ch))
{
for
($k=0;$k<count($ch);$k++)
Modified: branches/Version-1_0-branch/property/inc/class.soentity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.soentity.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.soentity.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -118,6 +118,7 @@
$this->type = isset($data['type']) &&
$data['type'] ? $data['type'] : $this->type;
$location_code = isset($data['location_code']) ?
$data['location_code'] : '';
$criteria_id = isset($data['criteria_id']) ?
$data['criteria_id'] : '';
+ $attrib_filter = $data['attrib_filter'] ?
$data['attrib_filter'] : array();
if(!$entity_id || !$cat_id)
{
@@ -368,6 +369,13 @@
$where= 'AND';
}
+ if ($attrib_filter)
+ {
+ $filtermethod .= " $where " . implode(' AND ',
$attrib_filter);
+ $where= 'AND';
+ }
+
+
$_querymethod = array();
$__querymethod = array();
$_joinmethod_datatype = array();
Modified: branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.sos_agreement.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -427,8 +427,8 @@
}
else
if($return_extra['datatype']=='CH' && $value)
{
- $ch=
unserialize($value);
-
+// $ch=
unserialize($value);
+ $ch = explode(',',
trim($data['value'], ','));
if (isset($ch) AND
is_array($ch))
{
for
($k=0;$k<count($ch);$k++)
Modified: branches/Version-1_0-branch/property/inc/class.uientity.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.uientity.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -368,6 +368,7 @@
// enters the first time
if( phpgw::get_var('phpgw_return_as') != 'json' )
{
+
$datatable['menu']
= $this->bocommon->get_menu($this->type_app[$this->type]);
$datatable['config']['base_url'] =
$GLOBALS['phpgw']->link('/index.php', array
@@ -375,12 +376,7 @@
'menuaction'
=> 'property.uientity.index',
'entity_id'
=> $this->entity_id,
'cat_id' =>
$this->cat_id,
- 'type'
=> $this->type,
- //
'district_id' => $this->district_id,
- //
'status' => $this->status,
- //
'filter' => $this->filter,
- //
'location_code' => $this->location_code,
- //
'criteria_id' => $this->criteria_id
+ 'type'
=> $this->type
));
$datatable['config']['allow_allrows'] = true;
@@ -388,11 +384,6 @@
"entity_id:'{$this->entity_id}',".
"cat_id:'{$this->cat_id}',".
"type:'{$this->type}'";
- //
"district_id:'{$this->district_id}',".
- // "status:'{$this->status}',".
- // "filter:'{$this->filter}',".
- //
"criteria_id:'{$this->criteria_id}',".
- //
"location_code:'{$this->location_code}'";
// this array "$arr_filter_hide" indicate what
filters are hidden or not
$arr_filter_hide = array();
@@ -435,12 +426,13 @@
$arr_filter_hide[1] = 1;
}
}
- //// ---- STATUS filter----------------------
- $values_combo_box[2] =
$this->bo->select_status_list($group_filters,$this->status);
+ //// ---- USER filter----------------------
+ $values_combo_box[2] =
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl_location,array('all'),$default='all');
+
if(count($values_combo_box[2]))
{
- $default_value = array
('id'=>'','name'=>lang('no status'));
+ $default_value = array
('id'=>'','name'=>lang('no user'));
array_unshift
($values_combo_box[2],$default_value);
$arr_filter_hide[2] = 0;
}
@@ -449,24 +441,9 @@
$arr_filter_hide[2] = 1;
}
-
- //// ---- USER filter----------------------
- $values_combo_box[3] =
$this->bocommon->get_user_list_right2($group_filters,4,$this->filter,$this->acl_location,array('all'),$default='all');
-
- if(count($values_combo_box[3]))
- {
- $default_value = array
('id'=>'','name'=>lang('no user'));
- array_unshift
($values_combo_box[3],$default_value);
- $arr_filter_hide[3] = 0;
- }
- else
- {
- $arr_filter_hide[3] = 1;
- }
-
- $values_combo_box[4] =
$this->bo->get_criteria_list($this->criteria_id);
+ $values_combo_box[3] =
$this->bo->get_criteria_list($this->criteria_id);
$default_value = array
('id'=>'','name'=>lang('no criteria'));
- array_unshift
($values_combo_box[4],$default_value);
+ array_unshift
($values_combo_box[3],$default_value);
$datatable['actions']['form'] = array
(
@@ -478,10 +455,6 @@
'menuaction'
=> 'property.uientity.index',
'entity_id'
=> $this->entity_id,
'cat_id'
=> $this->cat_id,
- //
'district_id' => $this->district_id,
- //
'status' => $this->status,
- //
'filter' => $this->filter,
- //
'query' => $this->query,
'type'
=> $this->type
)),
'fields' => array
@@ -507,22 +480,13 @@
'tab_index' => 2
),
array
- (
//boton STATUS
-
'id' => 'btn_status_id',
-
'name' => 'status_id',
-
'value'=> lang('Status'),
-
'type' => 'button',
-
'style' => 'filter',
-
'tab_index' => 3
- ),
- array
(
//boton USER
'id' => 'btn_user_id',
'name' => 'user_id',
'value'=> lang('User'),
'type' => 'button',
'style' => 'filter',
-
'tab_index' => 4
+
'tab_index' => 3
),
array
(
//boton search criteria
@@ -531,7 +495,7 @@
'value' => lang('search criteria'),
'type' => 'button',
'style' => 'filter',
-
'tab_index' => 5
+
'tab_index' => 4
),
array
(//for
link "columns", next to Export button
@@ -631,14 +595,73 @@
'id' => 'values_combo_box_3',
'value' => $this->bocommon->select2String($values_combo_box[3])
),
- array
- (
-
'id' => 'values_combo_box_4',
-
'value' => $this->bocommon->select2String($values_combo_box[4])
- )
)
)));
+ $custom =
createObject('phpgwapi.custom_fields');
+ $attrib_data =
$custom->find($this->type_app[$this->type],".{$this->type}.{$this->entity_id}.{$this->cat_id}",
0, '','','',true, true);
+
+ $button_def[] = "oMenuButton_0";
+ $button_def[] = "oMenuButton_1";
+ $button_def[] = "oMenuButton_2";
+ $button_def[] = "oMenuButton_3";
+ $code_inner[] = "{order:0,
var_URL:'cat_id',name:'btn_cat_id',style:'genericbutton',dependiente:[]}";
+ $code_inner[] = "{order:1,
var_URL:'district_id',name:'btn_district_id',style:'genericbutton',dependiente:[]}";
+ $code_inner[] = "{order:2,
var_URL:'filter',name:'btn_user_id',style:'genericbutton',dependiente:[]}";
+ $code_inner[] = "{order:3,
var_URL:'criteria_id',name:'btn_criteria_id',style:'genericbutton',dependiente:[]}";
+
+
+ if($attrib_data)
+ {
+ $i = 4;
+ foreach ( $attrib_data as $attrib )
+ {
+ if($attrib['datatype'] == 'LB'
|| $attrib['datatype'] == 'CH' || $attrib['datatype'] == 'R')
+ {
+
$datatable['actions']['form'][0]['fields']['field'][] = array
+ (
+ 'id' =>
"btn_{$attrib['column_name']}",
+ 'name' =>
$attrib['column_name'],
+ 'value' =>
$attrib['input_text'],
+ 'type' =>
'button',
+ 'style' =>
'filter',
+ 'tab_index' =>
$i
+ );
+
+ $button_def[] =
"oMenuButton_{$i}";
+ $code_inner[] =
"{order:{$i},
var_URL:'{$attrib['column_name']}',name:'btn_{$attrib['column_name']}',style:'genericbutton',dependiente:[]}";
+
+ $values_combo_box[$i][]
= array
+ (
+ 'id' => '',
+ 'name' =>
$attrib['input_text'],
+ );
+
+
+
foreach($attrib['choice'] as $choice)
+ {
+
$values_combo_box[$i][] = array
+ (
+ 'id'
=> $choice['id'],
+ 'name'
=> htmlspecialchars($choice['value'], ENT_QUOTES, 'UTF-8'),
+ );
+ }
+
+
$datatable['actions']['form'][0]['fields']['hidden_value'][] = array
+ (
+ 'id' =>
"values_combo_box_{$i}",
+ 'value' =>
$this->bocommon->select2String($values_combo_box[$i])
+ );
+ $i++;
+ }
+ }
+ }
+
+ $code = 'var ' . implode(',', $button_def) .
";\n";
+ $code .= 'var selectsButtons = [' . "\n" .
implode(",\n",$code_inner) . "\n];";
+
+ $GLOBALS['phpgw']->js->add_code('', $code);
+
// eliminates those empty filters
$eliminate = 0;
foreach( $arr_filter_hide as $key => $value )
Modified: branches/Version-1_0-branch/property/inc/class.uitts.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uitts.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/inc/class.uitts.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -2575,12 +2575,12 @@
}
$note_def = array
- (
+ (
array('key' => 'value_count',
'label'=>'#', 'sortable'=>true,'resizeable'=>true),
array('key' => 'value_date',
'label'=>lang('Date'),'sortable'=>true,'resizeable'=>true),
array('key' => 'value_user',
'label'=>lang('User'),'sortable'=>true,'resizeable'=>true),
array('key' => 'value_note',
'label'=>lang('Note'),'sortable'=>true,'resizeable'=>true)
- );
+ );
if($access_order)
{
@@ -2588,17 +2588,22 @@
foreach($additional_notes as &$note)
{
$note['order_text'] = '<input
type="checkbox" name="values[order_text][]" value="'.$note['value_note'].'"
title="'.lang('Check to add text to order').'">';
+ }
+ }
-
+
if($GLOBALS['phpgw_info']['apps']['frontend']['enabled'])
+ {
+ $note_def[] = array('key' =>
'publish_note','label'=>lang('publish
text'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter');
+ foreach($additional_notes as &$note)
+ {
+ $_checked = $note['value_publish'] ?
'checked' : '';
+ $note['publish_note'] = "<input
type='checkbox' {$_checked} name='values[publish_note][]'
value='{$id}_{$note['value_id']}' title='".lang('Check to publish text at
frontend')."'>";
}
}
- $note_def[] = array('key' =>
'publish_note','label'=>lang('publish
text'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter');
foreach($additional_notes as &$note)
{
$note['value_note'] =
nl2br($note['value_note']);
- $_checked = $note['value_publish'] ? 'checked'
: '';
- $note['publish_note'] = "<input type='checkbox'
{$_checked} name='values[publish_note][]' value='{$id}_{$note['value_id']}'
title='".lang('Check to publish text at frontend')."'>";
}
Modified: branches/Version-1_0-branch/property/js/yahoo/entity.index.js
===================================================================
--- branches/Version-1_0-branch/property/js/yahoo/entity.index.js
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/js/yahoo/entity.index.js
2011-01-10 08:53:36 UTC (rev 6740)
@@ -2,6 +2,7 @@
// Declaration of location.index vars
//--------------------------------------------------------
//define SelectButton
+/*
var oMenuButton_0, oMenuButton_1, oMenuButton_2, oMenuButton_3,
oMenuButton_4;
var selectsButtons = [
{order:0, var_URL:'cat_id', name:'btn_cat_id',
style:'categorybutton', dependiente:''},
@@ -10,7 +11,7 @@
{order:3, var_URL:'filter', name:'btn_user_id',
style:'userIdbutton', dependiente:''},
{order:4, var_URL:'criteria_id',
name:'btn_criteria_id',style:'criteriabutton',dependiente:''}
]
-
+*/
// define buttons
var oNormalButton_0, oNormalButton_1, oNormalButton_2;
var normalButtons = [
Modified: branches/Version-1_0-branch/property/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/setup.inc.php 2011-01-09
20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/setup/setup.inc.php 2011-01-10
08:53:36 UTC (rev 6740)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.603';
+ $setup_info['property']['version'] = '0.9.17.604';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: branches/Version-1_0-branch/property/setup/tables_update.inc.php
===================================================================
--- branches/Version-1_0-branch/property/setup/tables_update.inc.php
2011-01-09 20:24:11 UTC (rev 6739)
+++ branches/Version-1_0-branch/property/setup/tables_update.inc.php
2011-01-10 08:53:36 UTC (rev 6740)
@@ -4837,4 +4837,88 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+ /**
+ * Update property version from 0.9.17.602 to 0.9.17.603
+ * convert data for datatype CH: from serialized array to comma
separated list
+ *
+ */
+ $test[] = '0.9.17.603';
+ function property_upgrade0_9_17_603()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->query('SELECT count(*) as cnt
FROM fm_location_type');
+ $GLOBALS['phpgw_setup']->oProc->next_record();
+ $levels = $GLOBALS['phpgw_setup']->oProc->f('cnt');
+
+ for ($i=1; $i<($levels +1); $i++)
+ {
+ $sql = "UPDATE phpgw_locations SET c_attrib_table =
'fm_location{$i}' WHERE name = '.location.{$i}' AND c_attrib_table IS NULL";
+ $GLOBALS['phpgw_setup']->oProc->query($sql);
+ }
+
+
+ $sql = "SELECT c_attrib_table, column_name FROM
phpgw_cust_attribute JOIN phpgw_locations ON phpgw_cust_attribute.location_id =
phpgw_locations.location_id WHERE datatype = 'CH' GROUP BY c_attrib_table,
column_name";
+
+ $GLOBALS['phpgw_setup']->oProc->query($sql);
+
+ $attribs = array();
+
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+
$attribs[$GLOBALS['phpgw_setup']->oProc->f('c_attrib_table')][] =
$GLOBALS['phpgw_setup']->oProc->f('column_name');
+ }
+
+ $value_set = array();
+ foreach($attribs as $table => $columns)
+ {
+ $id_name = 'id';
+ if(preg_match('/(^fm_location)/', $table))
+ {
+ $id_name = 'location_code';
+ }
+
+ foreach($columns as $column)
+ {
+ $sql = "SELECT {$id_name}, {$column} FROM
{$table} WHERE {$column} IS NOT NULL";
+ $GLOBALS['phpgw_setup']->oProc->query($sql);
+ while
($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ if($value =
$GLOBALS['phpgw_setup']->oProc->f($column))
+ {
+ if(@unserialize($value))
+ {
+ $value = ',' .
implode(',', unserialize($value)) . ',';
+ }
+ else
+ {
+ $value = ",{$value}";
+ }
+
+ $value_set[] = array
+ (
+ 'table' =>
$table,
+ 'id_name' =>
$id_name,
+ 'id_value' =>
$GLOBALS['phpgw_setup']->oProc->f($id_name),
+ 'column' =>
$column,
+ 'value' =>
$value
+ );
+ }
+ }
+ }
+ }
+
+ foreach($value_set as $update)
+ {
+ $sql = "UPDATE {$update['table']} SET
{$update['column']} = '{$update['value']}' WHERE {$update['id_name']} =
'{$update['id_value']}'";
+ $GLOBALS['phpgw_setup']->oProc->query($sql);
+ }
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.604';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [6740] Merge 6735:6739 from trunk,
Sigurd Nes <=