Commit 9c8e4beb authored by thejoelinux's avatar thejoelinux

recherche de services

parent f039c116
......@@ -107,6 +107,17 @@ class Account extends Record {
// this has nothing to do here
// this should be a call to the compta API
public static function create_for_member($id) {
// FIXME : something like this
// create the context for posting things
// maybe you should use some component
$saas_service = Saas_Service::fetch($api_key, "compta", "account", "create");
$saas_service->configure(
array("name"=> "",
"description" => "",
"account_type_id" => 0));
return $saas_service->execute();
// SQL INSERT accounts SELECT members
$sql = " INSERT INTO accounts
......
<?php
class Saas_Service {
public static function fetch($api_key, $software, $object, $method) {
$postdata = http_build_query(
array(
'o' => 'saas_service',
'a' => 'fetch',
'i' => $api_key,
'software' => $software,
'service' => $object."@".$method,
'data' => base64_encode($data)
)
);
$opts = array('http' =>
array(
'method' => 'POST',
'header' => 'Content-type: application/x-www-form-urlencoded',
'content' => $postdata
)
);
$context = stream_context_create($opts);
return json_decode(file_get_contents($GLOBALS["saas_auth_url"], false, $context));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment