fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [15820] update from external


From: sigurdne
Subject: [Fmsystem-commits] [15820] update from external
Date: Thu, 13 Oct 2016 10:39:14 +0000 (UTC)

Revision: 15820
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15820
Author:   sigurdne
Date:     2016-10-13 10:39:14 +0000 (Thu, 13 Oct 2016)
Log Message:
-----------
update from external

Modified Paths:
--------------
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.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 17:25:25 UTC (rev 
15819)
+++ trunk/property/inc/class.bocommon.inc.php   2016-10-13 10:39:14 UTC (rev 
15820)
@@ -2455,7 +2455,7 @@
                }
 
                /**
-                * Gets vendor canidated to be used as vendor - called as ajax 
from edit form
+                * called as ajax from edit form
                 *
                 * @param string  $query
                 *

Modified: 
trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php
===================================================================
--- trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php   
2016-10-12 17:25:25 UTC (rev 15819)
+++ trunk/property/inc/cron/default/synkroniser_avdelinger_med_fellesdata.php   
2016-10-13 10:39:14 UTC (rev 15820)
@@ -51,9 +51,27 @@
 
                        $fellesdata->set_debug($this->debug);
 
-                       $fellesdata->update_dimb();
+                       /*
+                        * ansvar
+                        * art
+                        * objekt
+                        * prosjekt
+                        * tjeneste
+                        */
+       //              $fellesdata->update_agresso_prosjekt(); //for mange 
treff
+       //              $fellesdata->update_art();                              
//for mange treff
+                       $fellesdata->update_tjeneste();
+                       $fellesdata->update_dimb(); // ansvar
                        $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/tilskudd/leverandorer?leverandorNr=722920
                        if ($this->debug)
                        {
                                _debug_array($fellesdata->unit_ids);
@@ -328,6 +346,125 @@
                        $db->transaction_commit();
                }
 
+               /*
+                * ansvar
+                * art
+                * objekt
+                * prosjekt
+                * tjeneste
+                */
+               function update_agresso_prosjekt()
+               {
+                       //det er for mange...16396 stk...
+                       return;
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/prosjekt
+
+                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/tilskudd/prosjekt';
+                       $values = array();
+                       try
+                       {
+                               $values = $this->check_external_register($url);
+
+                       }
+                       catch (Exception $exc)
+                       {
+                               echo $exc->getTraceAsString();
+                       }
+
+                       _debug_array($values);
+
+               }
+               function update_art()
+               {
+                       //det er for mange...
+                       return;
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/art
+
+                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/tilskudd/art';
+                       $values = array();
+                       try
+                       {
+                               $values = $this->check_external_register($url);
+
+                       }
+                       catch (Exception $exc)
+                       {
+                               echo $exc->getTraceAsString();
+                       }
+
+               }
+
+               function update_tjeneste()
+               {
+                       //curl -s -u portico:BgPor790gfol 
http://tjenester.usrv.ubergenkom.no/api/tilskudd/tjeneste?id=88010
+                       //fm_eco_service
+
+                       $url = 
'http://tjenester.usrv.ubergenkom.no/api/tilskudd/tjeneste';
+                       $values = array();
+                       try
+                       {
+                               $values = $this->check_external_register($url);
+
+                       }
+                       catch (Exception $exc)
+                       {
+                               echo $exc->getTraceAsString();
+                       }
+//                     [tab] => A
+//          [dimValue] => 19050
+//          [description] => Renholdstjenester
+//          [periodFrom] => 200200
+//          [periodTo] => 209912
+//          [status] => N
+
+                       if($values)
+                       {
+                               $GLOBALS['phpgw']->db->query("UPDATE 
fm_eco_service SET active = 0" , __LINE__, __FILE__);
+                       }
+
+                       foreach ($values as $entry)
+                       {
+                               $active = $entry['status'] == 'C' ? 0 : 1;
+                               $GLOBALS['phpgw']->db->query("SELECT id FROM 
fm_eco_service WHERE id =" . (int) $entry['dimValue'], __LINE__, __FILE__);
+                               if($GLOBALS['phpgw']->db->next_record())
+                               {
+                                       $sql = "UPDATE fm_eco_service SET name 
= '{$entry['dimValue']} {$entry['description']}', active = {$active} WHERE id = 
" . (int) $entry['dimValue'];
+                               }
+                               else
+                               {
+                                       $sql = "INSERT INTO fm_eco_service (id, 
name, active)"
+                                               . " VALUES 
({$entry['dimValue']}, '{$entry['dimValue']} {$entry['description']}',  
{$active})";
+                               }
+                               $GLOBALS['phpgw']->db->query($sql, __LINE__, 
__FILE__);
+                       }
+               }
+
+               public function check_external_register($url)
+               {
+
+                       $username = 'portico';
+                       $password = 'BgPor790gfol';
+
+                       $ch = curl_init();
+                       curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
+                       curl_setopt($ch, CURLOPT_URL, $url);
+                       curl_setopt($ch, CURLOPT_USERPWD, 
"{$username}:{$password}");
+                       curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+                       curl_setopt($ch, CURLOPT_HTTPHEADER, array( 
'Content-Type: application/json'));
+                       curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
+
+                       $result = curl_exec($ch);
+
+                       $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+                       curl_close($ch);
+
+                       return json_decode($result, true);
+               }
+
+
+               /**
+                * ansvar
+                */
                function update_dimb()
                {
                        if (!$db = $this->get_db())

Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2016-10-12 17:25:25 UTC (rev 
15819)
+++ trunk/property/setup/tables_current.inc.php 2016-10-13 10:39:14 UTC (rev 
15820)
@@ -1237,7 +1237,7 @@
                'fm_eco_service' => array(
                        'fd' => array(
                                'id' => array('type' => 'int', 'precision' => 
'4', 'nullable' => False),
-                               'name' => array('type' => 'varchar', 
'precision' => '50', 'nullable' => False),
+                               'name' => array('type' => 'varchar', 
'precision' => '255', 'nullable' => False),
                                'active' => array('type' => 'int', 'precision' 
=> '2', 'nullable' => True, 'default' => 1),
                        ),
                        'pk' => array('id'),

Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php  2016-10-12 17:25:25 UTC (rev 
15819)
+++ trunk/property/setup/tables_update.inc.php  2016-10-13 10:39:14 UTC (rev 
15820)
@@ -9367,6 +9367,8 @@
                        )
                );
 
+               $GLOBALS['phpgw_setup']->oProc->AlterColumn('fm_eco_service', 
'name', array('type' => 'varchar', 'precision' => '255', 'nullable' => False));
+
                if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
                {
                        $GLOBALS['setup_info']['property']['currentver'] = 
'0.9.17.707';




reply via email to

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