Merge #8008 manually
This commit is contained in:
parent
6b8c7239cd
commit
24dc144cc4
@ -196,6 +196,20 @@ class Documents extends DolibarrApi
|
|||||||
throw new RestException(500, 'Error generating document');
|
throw new RestException(500, 'Error generating document');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif ($module_part == 'propal' || $module_part == 'proposal')
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
|
$this->propal = new Propal($this->db);
|
||||||
|
$result = $this->propal->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Proposal not found');
|
||||||
|
}
|
||||||
|
$templateused = $doctemplate?$doctemplate:$this->propal->modelpdf;
|
||||||
|
$result = $this->propal->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
if( $result <= 0 ) {
|
||||||
|
throw new RestException(500, 'Error generating document');
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new RestException(403, 'Generation not available for this modulepart');
|
throw new RestException(403, 'Generation not available for this modulepart');
|
||||||
|
|||||||
@ -531,6 +531,37 @@ class Proposals extends DolibarrApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a commercial proposal billed. Could be also called setbilled
|
||||||
|
*
|
||||||
|
* @param int $id Commercial proposal ID
|
||||||
|
*
|
||||||
|
* @url POST {id}/setbilled
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function setinvoiced($id)
|
||||||
|
{
|
||||||
|
if(! DolibarrApiAccess::$user->rights->propal->creer) {
|
||||||
|
throw new RestException(401);
|
||||||
|
}
|
||||||
|
$result = $this->propal->fetch($id);
|
||||||
|
if( ! $result ) {
|
||||||
|
throw new RestException(404, 'Commercial Proposal not found');
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! DolibarrApi::_checkAccessToResource('propal',$this->propal->id)) {
|
||||||
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = $this->propal->classifyBilled(DolibarrApiAccess::$user);
|
||||||
|
if( $result < 0) {
|
||||||
|
throw new RestException(400, $this->propal->error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate a commercial proposal
|
* Validate a commercial proposal
|
||||||
*
|
*
|
||||||
|
|||||||
@ -573,9 +573,8 @@ class Orders extends DolibarrApi
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classify the order as invoiced
|
* Classify the order as invoiced. Could be also called setbilled
|
||||||
*
|
*
|
||||||
* @param int $id Id of the order
|
* @param int $id Id of the order
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user