get thirdparty specimen with api

This commit is contained in:
Frédéric FRANCE 2020-10-29 23:56:42 +01:00
parent c41459abe4
commit 30b67aaa4f
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
2 changed files with 6 additions and 2 deletions

View File

@ -1850,8 +1850,11 @@ class Thirdparties extends DolibarrApi
if (!DolibarrApiAccess::$user->rights->societe->lire) {
throw new RestException(401);
}
$result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias);
if ($rowid == 0) {
$result = $this->company->initAsSpecimen();
} else {
$result = $this->company->fetch($rowid, $ref, $ref_ext, $barcode, $idprof1, $idprof2, $idprof3, $idprof4, $idprof5, $idprof6, $email, $ref_alias);
}
if (!$result) {
throw new RestException(404, 'Thirdparty not found');
}

View File

@ -3774,6 +3774,7 @@ class Societe extends CommonObject
// Initialize parameters
$this->id = 0;
$this->entity = 1;
$this->name = 'THIRDPARTY SPECIMEN '.dol_print_date($now, 'dayhourlog');
$this->nom = $this->name; // For backward compatibility
$this->ref_ext = 'Ref ext';