2
0
forked from Wavyzz/dolibarr

API can receive documents

This commit is contained in:
jfefe
2016-12-12 15:19:47 +01:00
parent 24914e8e4f
commit b8284447fd
4 changed files with 354 additions and 25 deletions

View File

@@ -56,16 +56,18 @@ if (empty($conf->global->MAIN_MODULE_API))
exit;
}
$api = new DolibarrApi($db);
// Enable the Restler API Explorer.
// See https://github.com/Luracast/Restler-API-Explorer for more info.
$api->r->addAPIClass('Luracast\\Restler\\Explorer');
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat');
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat');
$api->r->addAuthenticationClass('DolibarrApiAccess','');
// Define accepted mime types
UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
$listofapis = array();
$modulesdir = dolGetModulesDirs();
@@ -86,7 +88,7 @@ foreach ($modulesdir as $dir)
$module = strtolower($reg[1]);
$moduledirforclass = $module;
$moduleforperm = $module;
if ($module == 'propale') {
$moduledirforclass = 'comm/propal';
$moduleforperm='propal';
@@ -119,7 +121,7 @@ foreach ($modulesdir as $dir)
$moduledirforclass = 'fourn';
}
//dol_syslog("Found module file ".$file." - module=".$module." - moduledirforclass=".$moduledirforclass);
// Defined if module is enabled
$enabled=true;
if (empty($conf->$moduleforperm->enabled)) $enabled=false;
@@ -142,7 +144,7 @@ foreach ($modulesdir as $dir)
while (($file_searched = readdir($handle_part))!==false)
{
if ($file_searched == 'api_access.class.php') continue;
// Support of the deprecated API.
if (is_readable($dir_part.$file_searched) && preg_match("/^api_deprecated_(.*)\.class\.php$/i",$file_searched,$reg))
{