Skip to content

Commit

Permalink
Merge pull request #9101 from hregis/develop_api
Browse files Browse the repository at this point in the history
NEW can add documents on agenda events using API REST
  • Loading branch information
eldy committed Jul 15, 2018
2 parents 4279ba6 + e1dabe3 commit b796c10
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions htdocs/api/class/api_documents.class.php
Expand Up @@ -356,6 +356,22 @@ function getDocumentsListByElement($modulepart, $id=0, $ref='', $sortfield='', $

$upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice');
}
else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event')
{
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';

if (!DolibarrApiAccess::$user->rights->agenda->myactions->read && !DolibarrApiAccess::$user->rights->agenda->allactions->read) {
throw new RestException(401);
}

$object = new ActionComm($this->db);
$result=$object->fetch($id, $ref);
if ( ! $result ) {
throw new RestException(404, 'Event not found');
}

$upload_dir = $conf->agenda->dir_output.'/'.dol_sanitizeFileName($object->ref);
}
else
{
throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.');
Expand Down

0 comments on commit b796c10

Please sign in to comment.