Skip to content

Commit

Permalink
Merge pull request #10701 from ptibogxiv/patch-135
Browse files Browse the repository at this point in the history
NEW ADD document's product support in API
  • Loading branch information
eldy committed Feb 27, 2019
2 parents 231f0db + 096bc47 commit ca1fa7b
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 @@ -355,6 +355,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 == 'produit' || $modulepart == 'product')
{
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';

if (!DolibarrApiAccess::$user->rights->produit->lire) {
throw new RestException(401);
}

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

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

0 comments on commit ca1fa7b

Please sign in to comment.