Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0

This commit is contained in:
Laurent Destailleur 2024-10-07 15:17:49 +02:00
commit b07cc82058
3 changed files with 15 additions and 4 deletions

View File

@ -278,8 +278,8 @@ class Categories extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
if (!$this->category->delete(DolibarrApiAccess::$user)) {
throw new RestException(401, 'error when delete category');
if ($this->category->delete(DolibarrApiAccess::$user) <= 0) {
throw new RestException(500, 'Error when delete category : ' . $this->category->error);
}
return array(

View File

@ -6127,6 +6127,7 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $
if (dol_strlen($decpart) > $nbdecimal) {
$nbdecimal = dol_strlen($decpart);
}
// If nbdecimal is higher than max to show
$nbdecimalmaxshown = (int) str_replace('...', '', getDolGlobalString('MAIN_MAX_DECIMALS_SHOWN'));
if ($trunc && $nbdecimal > $nbdecimalmaxshown) {

View File

@ -373,7 +373,7 @@ class Contacts extends DolibarrApi
* Delete contact
*
* @param int $id Contact ID
* @return integer
* @return array[]
*/
public function delete($id)
{
@ -389,7 +389,17 @@ class Contacts extends DolibarrApi
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$this->contact->oldcopy = clone $this->contact;
return $this->contact->delete(DolibarrApiAccess::$user);
if ($this->contact->delete(DolibarrApiAccess::$user) <= 0) {
throw new RestException(500, 'Error when delete contact ' . $this->contact->error);
}
return array(
'success' => array(
'code' => 200,
'message' => 'Contact deleted'
)
);
}
/**