fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [15853] more on integration


From: sigurdne
Subject: [Fmsystem-commits] [15853] more on integration
Date: Tue, 18 Oct 2016 14:44:34 +0000 (UTC)

Revision: 15853
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15853
Author:   sigurdne
Date:     2016-10-18 14:44:33 +0000 (Tue, 18 Oct 2016)
Log Message:
-----------
more on integration

Modified Paths:
--------------
    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.sogeneric.inc.php
===================================================================
--- trunk/property/inc/class.sogeneric.inc.php  2016-10-18 12:37:24 UTC (rev 
15852)
+++ trunk/property/inc/class.sogeneric.inc.php  2016-10-18 14:44:33 UTC (rev 
15853)
@@ -414,16 +414,24 @@
                                                (
                                                'table' => 'fm_vendor',
                                                'id' => array('name' => 'id', 
'type' => 'int'),
-                                               'fields' => array
-                                                       (
-                                                       array
-                                                               (
+                                               'fields' => array(
+                                                       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'))),
+                                                               )
+                                                       ),
+                                                       array(
                                                                'name' => 
'contact_phone',
                                                                'descr' => 
lang('contact phone'),
                                                                'type' => 
'varchar'
                                                        ),
-                                                       array
-                                                               (
+                                                       array(
                                                                'name' => 
'category',
                                                                'descr' => 
lang('category'),
                                                                'type' => 
'select',

Modified: 
trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
===================================================================
--- trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php   
2016-10-18 12:37:24 UTC (rev 15852)
+++ trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php   
2016-10-18 14:44:33 UTC (rev 15853)
@@ -58,6 +58,7 @@
                         * prosjekt
                         * tjeneste
                         */
+       //              $fellesdata->update_vendor();
        //              $fellesdata->update_agresso_prosjekt(); //for mange 
treff
        //              $fellesdata->update_art();                              
//for mange treff
        //              $fellesdata->update_tjeneste();
@@ -65,13 +66,13 @@
                        $fellesdata->get_org_unit_ids_from_top();
 
 
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/art
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/ansvar?id=013000
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/objekt?id=5001
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/prosjekt?id=5001
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/tjeneste?id=88010
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/art
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/ansvar?id=013000
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/objekt?id=5001
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/prosjekt?id=5001
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/tjeneste?id=88010
 
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/leverandorer?leverandorNr=722920
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/leverandorer?leverandorNr=722920
                        if ($this->debug)
                        {
                                _debug_array($fellesdata->unit_ids);
@@ -357,9 +358,9 @@
                {
                        //det er for mange...16396 stk...
                        return;
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/prosjekt
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/prosjekt
 
-                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/tilskudd/prosjekt';
+                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/agresso/prosjekt';
                        $values = array();
                        try
                        {
@@ -378,9 +379,9 @@
                {
                        //det er for mange...
                        return;
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/art
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/art
 
-                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/tilskudd/art';
+                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/agresso/art';
                        $values = array();
                        try
                        {
@@ -396,10 +397,10 @@
 
                function update_tjeneste()
                {
-                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/tjeneste?id=88010
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/tjeneste?id=88010
                        //fm_eco_service
 
-                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/tilskudd/tjeneste';
+                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/agresso/tjeneste';
                        $values = array();
                        try
                        {
@@ -439,6 +440,183 @@
                        }
                }
 
+               function update_vendor()
+               {
+                       $metadata = 
$GLOBALS['phpgw']->db->metadata('fm_vendor_temp');
+//_debug_array($metadata);
+                       if (!$metadata)
+                       {
+                               $sql_table = <<<SQL
+                               CREATE TABLE fm_vendor_temp
+                               (
+                                 id integer NOT NULL,
+                                 status character varying(1),
+                                 navn character varying(255),
+                                 adresse character varying(255),
+                                 postnummer character varying(10),
+                                 sted character varying(50),
+                                 organisasjonsnr character varying(50),
+                                 bankkontonr character varying(50),
+                                 aktiv integer,
+                                 CONSTRAINT fm_vendor_temp_pkey PRIMARY KEY 
(id)
+                               );
+SQL;
+                               $GLOBALS['phpgw']->db->query($sql_table, 
__LINE__, __FILE__);
+                       }
+                       $GLOBALS['phpgw']->db->query('DELETE FROM 
fm_vendor_temp', __LINE__, __FILE__);
+
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/agresso/leverandorer?leverandorNr=**
+                       //fm_vendor
+
+                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/agresso/leverandorer?leverandorNr=**';
+                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/agresso/leverandorer?leverandorNr=100304';
+
+                       $values = array();
+                       try
+                       {
+                               $values = $this->check_external_register($url);
+
+                       }
+                       catch (Exception $exc)
+                       {
+                               echo $exc->getTraceAsString();
+                       }
+                       _debug_array($values);die();
+                       $sql = 'INSERT INTO fm_vendor_temp (id, status, navn, 
adresse, postnummer, sted, organisasjonsnr, bankkontonr, aktiv)'
+                               . ' VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?)';
+                       $valueset = array();
+
+                       foreach ($values as $entry)
+                       {
+                               $valueset[] = array
+                                       (
+                                       1 => array
+                                               (
+                                               'value' => 
(int)$entry['leverandornummer'],
+                                               'type' => PDO::PARAM_INT
+                                       ),
+                                       2 => array
+                                               (
+                                               'value' => $entry['status'],
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       3 => array
+                                               (
+                                               'value' => $entry['navn'],
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       4 => array
+                                               (
+                                               'value' => $entry['adresse'],
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       5 => array
+                                               (
+                                               'value' => $entry['postnummer'],
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       6 => array
+                                               (
+                                               'value' => $entry['sted'],
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       7 => array
+                                               (
+                                               'value' => 
$entry['organisasjonsNr'],
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       8 => array
+                                               (
+                                               'value' => 
$entry['bankkontoNr'],
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       9 => array
+                                               (
+                                               'value' => (int)$entry['aktiv'],
+                                               'type' => PDO::PARAM_INT
+                                       )
+                               );
+                       }
+
+                       $GLOBALS['phpgw']->db->insert($sql, $valueset, 
__LINE__, __FILE__);
+
+/*
+            [leverandornummer] => 9906
+            [status] => N
+            [navn] => Bergen Vann KF (BV)
+            [adresse] => Postboks 7700
+            [postnummer] => 5020
+            [sted] => BERGEN
+            [organisasjonsNr] => 987328096
+            [bankkontoNr] => 52020801786
+            [aktiv] => 1
+*/
+                       _debug_array($values);die();
+
+
+                       $sql = "SELECT fm_vendor_temp.*"
+                               . " FROM fm_vendor RIGHT OUTER JOIN 
fm_vendor_temp ON (fm_vendor.id = fm_vendor_temp.id)"
+                               . " WHERE fm_vendor.id IS NULL";
+
+                       $GLOBALS['phpgw']->db->query($sql, __LINE__, __FILE__);
+                       $vendors = array();
+                       while ($GLOBALS['phpgw']->db->next_record())
+                       {
+                               $vendors[] = array(
+                                       1 => array(
+                                               'value' => 
(int)$GLOBALS['phpgw']->db->f('id'),
+                                               'type' => PDO::PARAM_INT
+                                       ),
+                                       2 => array(
+                                               'value' => 
$GLOBALS['phpgw']->db->f('navn'),
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       3 => array(
+                                               'value' => 1,
+                                               'type' => PDO::PARAM_INT
+                                       ),
+                                       4 => array(
+                                               'value' => 6,
+                                               'type' => PDO::PARAM_INT
+                                       ),
+                                       5 => array(
+                                               'value' => 
(int)$GLOBALS['phpgw']->db->f('aktiv'),
+                                               'type' => PDO::PARAM_INT
+                                       ),
+                                       6 => array(
+                                               'value' => 
$GLOBALS['phpgw']->db->f('adresse'),
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       7 => array(
+                                               'value' => 
$GLOBALS['phpgw']->db->f('postnummer'),
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       8 => array(
+                                               'value' => 
$GLOBALS['phpgw']->db->f('sted'),
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       9 => array(
+                                               'value' => 
$GLOBALS['phpgw']->db->f('organisasjonsnr'),
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       10 => array(
+                                               'value' => 
$GLOBALS['phpgw']->db->f('bankkontonr'),
+                                               'type' => PDO::PARAM_STR
+                                       ),
+                                       10 => array(
+                                               'value' => time(),
+                                               'type' => PDO::PARAM_INT
+                                       )
+                               );
+                       }
+                       $sql = 'INSERT INTO fm_vendor (id, org_name,category, 
owner_id, active, adresse, postnr, poststed, org_nr, konto_nr,entry_date)'
+                               . ' VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)';
+                       if($vendors)
+                       {
+                               $GLOBALS['phpgw']->db->insert($sql, $vendors, 
__LINE__, __FILE__);
+                       }
+               }
+
                public function check_external_register($url)
                {
 

Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php  2016-10-18 12:37:24 UTC (rev 15852)
+++ trunk/property/setup/setup.inc.php  2016-10-18 14:44:33 UTC (rev 15853)
@@ -11,7 +11,7 @@
         * @version $Id$
        */
        $setup_info['property']['name']                 = 'property';
-       $setup_info['property']['version']              = '0.9.17.707';
+       $setup_info['property']['version']              = '0.9.17.708';
        $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-18 12:37:24 UTC (rev 
15852)
+++ trunk/property/setup/tables_current.inc.php 2016-10-18 14:44:33 UTC (rev 
15853)
@@ -88,7 +88,7 @@
                'fm_vendor' => array(
                        'fd' => array(
                                'id' => array('type' => 'int', 'precision' => 
'4', 'nullable' => False),
-                               'entry_date' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
+                               'entry_date' => array('type' => 'int', 
'precision' => 8, 'nullable' => True, 'default' => 'current_timestamp'),
                                'org_name' => array('type' => 'varchar', 
'precision' => '100', 'nullable' => True),
                                'email' => array('type' => 'varchar', 
'precision' => '64', 'nullable' => True),
                                'contact_phone' => array('type' => 'varchar', 
'precision' => '20', 'nullable' => True),
@@ -96,7 +96,8 @@
                                'member_of' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => True),
                                'category' => array('type' => 'int', 
'precision' => '2', 'nullable' => True),
                                'mva' => array('type' => 'int', 'precision' => 
'4', 'nullable' => True),
-                               'owner_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => True)
+                               'owner_id' => array('type' => 'int', 
'precision' => '4', 'nullable' => True),
+                               'active' => array('type' => 'int', 'precision' 
=> '2', 'nullable' => True, 'default' => 1)
                        ),
                        'pk' => array('id'),
                        'fk' => array(),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2016-10-18 12:37:24 UTC (rev 
15852)
+++ trunk/property/setup/tables_update.inc.php  2016-10-18 14:44:33 UTC (rev 
15853)
@@ -9376,4 +9376,33 @@
                }
        }
 
+       /**
+       * Update property version from 0.9.17.707 to 0.9.17.708
+       *
+       */
+       $test[] = '0.9.17.707';
+
+       function property_upgrade0_9_17_707()
+       {
+               $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
+               $GLOBALS['phpgw_setup']->oProc->AddColumn("fm_vendor", 
'active', array(
+                       'type' => 'int',
+                       'precision' => 2,
+                       'nullable' => True,
+                       'default' => 1
+                       )
+               );
+
+               $GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_vendor', 
'entry_date',
+                               array('type' => 'int', 'precision' => 8, 
'nullable' => True, 'default' => 'current_timestamp')
+                       );
+
+               if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+               {
+                       $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.708';
+                       return $GLOBALS['setup_info']['property']['currentver'];
+               }
+       }
        
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]