- OAIDs are now auto assigned to preorders/wohneinheiten on save - OAIDs can be exported to rimo via Preorder Admin functions - Preorder admin function createWorkorder automatically creates, exports and assigns OAIDs
71 lines
1.8 KiB
PHP
71 lines
1.8 KiB
PHP
#!/usr/bin/php
|
|
<?php
|
|
die("disabled");
|
|
//require 'vendor/autoload.php';
|
|
require("../../config/config.php");
|
|
|
|
define('FRONKDB_SQLDEBUG',false);
|
|
error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED));
|
|
|
|
require_once(LIBDIR."/mvcfronk/mfRouter/mfRouter.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseModel.php");
|
|
require_once(LIBDIR."/mvcfronk/mfBase/mfBaseController.php");
|
|
|
|
$me = new User(1);
|
|
define("INTERNAL_USER_ID", $me->id);
|
|
define("INTERNAL_USER_USERNAME", $me->username);
|
|
|
|
$params['apiKey'] = RIMO_API_JSON_APIKEY;
|
|
$params['limit'] = 1000;
|
|
$params['offset'] = 1;
|
|
|
|
$ctx_opts = [
|
|
'http' => [
|
|
'method' => 'GET',
|
|
'header' => 'accept: application/json'
|
|
]
|
|
];
|
|
|
|
$qs = http_build_query($params);
|
|
//echo $qs."\n";
|
|
|
|
$createOrderEp = RIMO_API_JSON_URL."/v1/oaid-management/oaids";
|
|
$get_url = $createOrderEp."?".$qs;
|
|
$ctx = stream_context_create($ctx_opts);
|
|
echo " Getting all OAIDs in Rimo: $get_url\n";
|
|
$response = file_get_contents($get_url, false, $ctx);
|
|
|
|
//var_dump($response);exit;
|
|
if($response === false) {
|
|
echo "Fehler beim Auslesen der OAIDs aus RIMO\n";
|
|
$workorders_failed++;
|
|
return false;
|
|
}
|
|
|
|
$all_oaids_json = json_decode($response);
|
|
$all_oaids = $all_oaids_json->item;
|
|
|
|
foreach($all_oaids as $oaid_obj) {
|
|
if(!$oaid_obj->name) continue;
|
|
|
|
$params = [];
|
|
$params['apiKey'] = RIMO_API_JSON_APIKEY;
|
|
$params['oaidName'] = $oaid_obj->name;
|
|
|
|
$ctx_opts = [
|
|
'http' => [
|
|
'method' => 'DELETE',
|
|
'header' => 'accept: application/json'
|
|
]
|
|
];
|
|
|
|
$qs = http_build_query($params);
|
|
//echo $qs."\n";
|
|
|
|
$createOrderEp = RIMO_API_JSON_URL."/v1/oaid-management/oaids";
|
|
$delete_url = $createOrderEp."?".$qs;
|
|
$ctx = stream_context_create($ctx_opts);
|
|
echo " Deleting OAID ".$oaid_obj->name." from Rimo: $delete_url\n";
|
|
$response = file_get_contents($delete_url, false, $ctx);
|
|
echo "$response\n";
|
|
} |