fix photo upload endpoint and align CommessaWeb field names with API docs

- CommessaWeb POST: rename fields per documentation — CustomerManager, PriceMultiplier, CertestObjectMasterData, CertestServiceMasterData, CustomerSupplier
- Move DeliveryRequest (ConsegnaRichiesta) from CommessaWeb to Campione
- Photo upload: change endpoint from AllegatoCommessaWeb to Campione({id})/UploadCampioneFile, upload to all campioni
- postMultipart(): remove commessaId param, send only file field
This commit is contained in:
2026-02-28 02:07:40 +03:00
parent 1fed113c5c
commit c7416ba4a9
3 changed files with 82 additions and 72 deletions
@@ -206,13 +206,12 @@ class VisualLimsApiClient
/**
* POST a file as multipart/form-data (used for photo/attachment uploads).
*
* @param string $endpoint OData endpoint, e.g. "AllegatoCommessaWeb"
* @param string $filePath Absolute path to the file on disk
* @param string $fileName Original file name to send
* @param int $commessaId CommessaWeb ID to link the attachment to
* @return array|null Decoded JSON response
* @param string $endpoint OData endpoint, e.g. "Campione(613388)/UploadCampioneFile"
* @param string $filePath Absolute path to the file on disk
* @param string $fileName Original file name to send
* @return array|null Decoded JSON response
*/
public function postMultipart($endpoint, $filePath, $fileName, $commessaId)
public function postMultipart($endpoint, $filePath, $fileName)
{
$token = $this->getToken();
$url = "{$this->baseUrl}/api/odata/{$endpoint}";
@@ -220,9 +219,7 @@ class VisualLimsApiClient
$cfile = new CURLFile($filePath, mime_content_type($filePath) ?: 'application/octet-stream', $fileName);
$payload = [
'IdCommessa' => $commessaId,
'NomeFile' => $fileName,
'file' => $cfile,
'file' => $cfile,
];
$ch = curl_init($url);