bug fix : replacing orders by donations and setting required field to allow post action in rest API for url donations. See issue #17700
This commit is contained in:
parent
93501a1147
commit
67cab8c1f2
@ -33,7 +33,7 @@ class Donations extends DolibarrApi
|
|||||||
* @var array $FIELDS Mandatory fields, checked when create and update object
|
* @var array $FIELDS Mandatory fields, checked when create and update object
|
||||||
*/
|
*/
|
||||||
static $FIELDS = array(
|
static $FIELDS = array(
|
||||||
'socid'
|
'amount'
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -193,7 +193,7 @@ class Donations extends DolibarrApi
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
if ($this->don->create(DolibarrApiAccess::$user) < 0) {
|
if ($this->don->create(DolibarrApiAccess::$user) < 0) {
|
||||||
throw new RestException(500, "Error creating order", array_merge(array($this->don->error), $this->don->errors));
|
throw new RestException(500, "Error creating donation", array_merge(array($this->don->error), $this->don->errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->don->id;
|
return $this->don->id;
|
||||||
@ -355,7 +355,7 @@ class Donations extends DolibarrApi
|
|||||||
private function _validate($data)
|
private function _validate($data)
|
||||||
{
|
{
|
||||||
$don = array();
|
$don = array();
|
||||||
foreach (Orders::$FIELDS as $field) {
|
foreach (Donations::$FIELDS as $field) {
|
||||||
if (!isset($data[$field]))
|
if (!isset($data[$field]))
|
||||||
throw new RestException(400, $field." field missing");
|
throw new RestException(400, $field." field missing");
|
||||||
$don[$field] = $data[$field];
|
$don[$field] = $data[$field];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user