Skip to content

Commit

Permalink
Module SynergiesTech: task Dolibarr#1039 : Ignore la mise à 0 des dis…
Browse files Browse the repository at this point in the history
…ponibiltés lors de la création d'une demande (Spécifique Synergies Tech) lorsqu'il est créer via l'API
  • Loading branch information
kkhelifa-opendsi authored and Alexis LAURIER committed Jan 6, 2021
1 parent 4fd3260 commit 9460dea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ function post($request_data = null)
$requestmanager->$field = $value;
}

$requestmanager->context['created_by_api'] = true;
if ($requestmanager->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error while creating the request", [ 'details' => $this->_getErrors($requestmanager) ]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,12 @@ public function runTrigger($action, $object, User $user, Translate $langs, Conf
}
}

// Set the availability of the request at no by default
$object->availability_for_thirdparty_principal = 0;
$object->availability_for_thirdparty_benefactor = 0;
$object->availability_for_thirdparty_watcher = 0;
// Set the availability of the request at no by default if not created by API
if (empty($object->context['created_by_api'])) {
$object->availability_for_thirdparty_principal = 0;
$object->availability_for_thirdparty_benefactor = 0;
$object->availability_for_thirdparty_watcher = 0;
}
$result = $object->update($user, 1);
if ($result < 0) {
array_merge($this->errors, $object->errors);
Expand Down

0 comments on commit 9460dea

Please sign in to comment.