mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 09:38:23 +01:00
Refactor contact deletion logic in API proposals (#35668)
* Refactor contact deletion logic in API proposals * Fix formatting issue in delete contact logic --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
@@ -782,9 +782,8 @@ class Proposals extends DolibarrApi
|
|||||||
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
if (!DolibarrApi::_checkAccessToResource('propal', $this->propal->id)) {
|
||||||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||||
}
|
}
|
||||||
|
foreach (array('internal', 'external') as $source) {
|
||||||
$contacts = $this->propal->liste_contact();
|
$contacts = $this->propal->liste_contact(-1, $source);
|
||||||
|
|
||||||
foreach ($contacts as $contact) {
|
foreach ($contacts as $contact) {
|
||||||
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
if ($contact['id'] == $contactid && $contact['code'] == $type) {
|
||||||
$result = $this->propal->delete_contact($contact['rowid']);
|
$result = $this->propal->delete_contact($contact['rowid']);
|
||||||
@@ -794,7 +793,7 @@ class Proposals extends DolibarrApi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $this->_cleanObjectDatas($this->propal);
|
return $this->_cleanObjectDatas($this->propal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user