[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15816] update data from external source
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15816] update data from external source |
Date: |
Wed, 12 Oct 2016 15:17:57 +0000 (UTC) |
Revision: 15816
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15816
Author: sigurdne
Date: 2016-10-12 15:17:56 +0000 (Wed, 12 Oct 2016)
Log Message:
-----------
update data from external source
Modified Paths:
--------------
trunk/property/inc/class.bocommon.inc.php
trunk/property/inc/class.sogeneric.inc.php
trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php 2016-10-12 11:56:11 UTC (rev
15815)
+++ trunk/property/inc/class.bocommon.inc.php 2016-10-12 15:17:56 UTC (rev
15816)
@@ -2526,7 +2526,8 @@
}
$sogeneric = CreateObject('property.sogeneric', $type);
- $values = $sogeneric->read(array('query' => $query));
+ $filter = array('active' => 1);
+ $values = $sogeneric->read(array('filter' =>
$filter,'query' => $query));
foreach ($values as &$value)
{
@@ -2579,7 +2580,8 @@
$query = phpgw::get_var('query');
$sogeneric = CreateObject('property.sogeneric', 'dimb');
- $values = $sogeneric->read(array('query' => $query));
+ $filter = array('active' => 1);
+ $values = $sogeneric->read(array('filter' =>
$filter,'query' => $query));
foreach ($values as &$value)
{
Modified: trunk/property/inc/class.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php 2016-10-12 11:56:11 UTC (rev
15815)
+++ trunk/property/inc/class.sogeneric.inc.php 2016-10-12 15:17:56 UTC (rev
15816)
@@ -137,6 +137,17 @@
'get_single_value' => 'property.sogeneric.get_name',
'method_input' => array('type' => 'org_unit', 'selected' => '##org_unit_id##')
)
+ ),
+ array(
+ 'name' =>
'active',
+ 'descr' =>
lang('active'),
+ 'type' =>
'checkbox',
+ 'default' =>
'checked',
+ 'filter' =>
true,
+ 'sortable' =>
true,
+ 'values_def' =>
array(
+
'valueset' => array(array('id' => 1, 'name' => lang('active'))),
+ )
)
),
'custom_criteria' => array
Modified:
trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
===================================================================
--- trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
2016-10-12 11:56:11 UTC (rev 15815)
+++ trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
2016-10-12 15:17:56 UTC (rev 15816)
@@ -51,7 +51,7 @@
$fellesdata->set_debug($this->debug);
-
+ $fellesdata->update_dimb();
$fellesdata->get_org_unit_ids_from_top();
if ($this->debug)
@@ -328,6 +328,44 @@
$db->transaction_commit();
}
+ function update_dimb()
+ {
+ if (!$db = $this->get_db())
+ {
+ return;
+ }
+
+ $sql = "SELECT V_ANSVAR.ANSVAR,
V_ANSVAR.BESKRIVELSE,V_ANSVAR.STATUS, V_ORG_ENHET.ORG_ENHET_ID"
+ . " FROM V_ANSVAR JOIN V_ORG_ENHET ON
(V_ANSVAR.RESULTATENHET = V_ORG_ENHET.RESULTATENHET)";
+
+ $db->query($sql, __LINE__, __FILE__);
+ $values = array();
+ while ($db->next_record())
+ {
+ $values[] = array(
+ 'id' => (int)$db->f('ANSVAR'),
+ 'descr' =>
$GLOBALS['phpgw']->db->db_addslashes($db->f('BESKRIVELSE', true)),
+ 'active' => $db->f('STATUS') == 'C' ? 0
: 1,
+ 'org_unit_id' =>
(int)$db->f('ORG_ENHET_ID')
+ );
+ }
+
+ foreach ($values as $entry)
+ {
+ $GLOBALS['phpgw']->db->query("SELECT id FROM
fm_ecodimb WHERE id = {$entry['id']}", __LINE__, __FILE__);
+ if($GLOBALS['phpgw']->db->next_record())
+ {
+ $sql = "UPDATE fm_ecodimb SET descr =
'{$entry['descr']}', active = {$entry['active']}, org_unit_id =
{$entry['org_unit_id']} WHERE id = {$entry['id']}";
+ }
+ else
+ {
+ $sql = "INSERT INTO fm_ecodimb (id,
descr, active, org_unit_id)"
+ . " VALUES ({$entry['id']},
'{$entry['descr']}', {$entry['active']}, {$entry['org_unit_id']})";
+ }
+ $GLOBALS['phpgw']->db->query($sql, __LINE__,
__FILE__);
+ }
+ }
+
function get_org_unit_ids_from_top()
{
if (!$db = $this->get_db())
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2016-10-12 11:56:11 UTC (rev 15815)
+++ trunk/property/setup/setup.inc.php 2016-10-12 15:17:56 UTC (rev 15816)
@@ -11,7 +11,7 @@
* @version $Id$
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.706';
+ $setup_info['property']['version'] = '0.9.17.707';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2016-10-12 11:56:11 UTC (rev
15815)
+++ trunk/property/setup/tables_current.inc.php 2016-10-12 15:17:56 UTC (rev
15816)
@@ -1453,6 +1453,7 @@
'id' => array('type' => 'int', 'precision' =>
'4', 'nullable' => False),
'descr' => array('type' => 'varchar',
'precision' => '50', 'nullable' => False),
'org_unit_id' => array('type' => 'int',
'precision' => '4', 'nullable' => False),
+ 'active' => array('type' => 'int', 'precision'
=> '2', 'nullable' => True, 'default' => 1),
),
'pk' => array('id'),
'ix' => array(),
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2016-10-12 11:56:11 UTC (rev
15815)
+++ trunk/property/setup/tables_update.inc.php 2016-10-12 15:17:56 UTC (rev
15816)
@@ -9346,3 +9346,32 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+
+ /**
+ * Update property version from 0.9.17.706 to 0.9.17.707
+ *
+ */
+ $test[] = '0.9.17.706';
+
+ function property_upgrade0_9_17_706()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_ecodimb', 'id',
array('type' => 'int', 'precision' => '4', 'nullable' => False));
+
+ $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_ecodimb",
'active', array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => True,
+ 'default' => 1
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.707';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
+
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15816] update data from external source,
sigurdne <=