Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
354364da9d
@ -545,8 +545,9 @@ class Orders extends DolibarrApi
|
|||||||
*
|
*
|
||||||
* @param int $id Id of order to update
|
* @param int $id Id of order to update
|
||||||
* @param int $rowid Row key of the contact in the array contact_ids.
|
* @param int $rowid Row key of the contact in the array contact_ids.
|
||||||
|
* @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER).
|
||||||
*
|
*
|
||||||
* @url DELETE {id}/contact/{rowid}
|
* @url DELETE {id}/contact/{contactid}/{type}
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*
|
*
|
||||||
@ -554,7 +555,7 @@ class Orders extends DolibarrApi
|
|||||||
* @throws RestException 404
|
* @throws RestException 404
|
||||||
* @throws RestException 500
|
* @throws RestException 500
|
||||||
*/
|
*/
|
||||||
public function deleteContact($id, $rowid)
|
public function deleteContact($id, $contactid, $type)
|
||||||
{
|
{
|
||||||
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
if (!DolibarrApiAccess::$user->rights->commande->creer) {
|
||||||
throw new RestException(401);
|
throw new RestException(401);
|
||||||
@ -569,10 +570,16 @@ class Orders extends DolibarrApi
|
|||||||
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = $this->commande->delete_linked_contact($rowid);
|
$contacts = $this->commande->liste_contact();
|
||||||
|
|
||||||
if (!$result) {
|
foreach ($contacts as $contact) {
|
||||||
throw new RestException(500, 'Error when deleted the contact');
|
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||||
|
$result = $this->commande->delete_contact($contact['rowid']);
|
||||||
|
|
||||||
|
if (!$result) {
|
||||||
|
throw new RestException(500, 'Error when deleted the contact');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
* Copyright (C) 2017 Josep Lluís Amador <joseplluis@lliuretic.cat>
|
||||||
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
|
||||||
* Copyright (C) 2019-2020 Thibault FOUCART <support@ptibogxiv.net>
|
* Copyright (C) 2019-2020 Thibault FOUCART <support@ptibogxiv.net>
|
||||||
|
* Copyright (C) 2020 Pierre Ardoin <mapiolca@me.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -2387,7 +2388,11 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete')
|
|||||||
// Documents
|
// Documents
|
||||||
$objectref = dol_sanitizeFileName($object->ref);
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
$relativepath = $comref.'/'.$objectref.'.pdf';
|
$relativepath = $comref.'/'.$objectref.'.pdf';
|
||||||
$filedir = $conf->product->dir_output.'/'.$objectref;
|
if (!empty($conf->product->multidir_output[$object->entity])) {
|
||||||
|
$filedir = $conf->product->multidir_output[$object->entity].'/'.$objectref; //Check repertories of current entities
|
||||||
|
} else {
|
||||||
|
$filedir = $conf->product->dir_output.'/'.$objectref;
|
||||||
|
}
|
||||||
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
|
||||||
$genallowed = $usercanread;
|
$genallowed = $usercanread;
|
||||||
$delallowed = $usercancreate;
|
$delallowed = $usercancreate;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user