Closed tuimz closed 1 month ago
Yes, looks like the same issue. I suspect that Exact attempts to update the inventory (or at least to verify if updates are necessary based on the purchase order executed) but lacks the necessary permissions because of the basic license, which then leads to an error being triggered.
Ok I will contact Exact support and see what comes back.
I will reply here with a solution for future reference ;)
That would be awesome. I will keep this issue open.
Response from Exact:
If you have a "project license" you cannot PUT the WarehouseID parameter.
I am not 100% sure that leaving out the parameter on the object does not post the parameter? E.g:
$model = (new \Picqer\Financials\Exact\PurchaseOrder($this->connection))->find('some-guid-of-purchase-order');
$model->Description = "Test 123";
$model->save();
Does that still post the WarehouseID parameter but empty?
That makes sense as I am pretty sure the package performs a PUT request based on the source objects contents plus your changes. In this case it will probably try to store an empty string for the warehouse while it is not allowed to. This is however something that you cannot easy change. Also it is not clear from the Exact Online documentation which properties are restricted by licenses and should be omitted in some cases. Tricky one. Someone else wants to chip in on this one?
I could extends PurchaseOrder::class
and override isFillable
and then return false if we are doing anything with a key like 'WarehouseID'
I will try this and test if that works for us. Though it is not my preferred way to go but I might have no other choice.
In the meantime I have a workaround
I extend your PurchaseOrder class with the following:
<?php
namespace App\Exact;
class PurchaseOrder extends \Picqer\Financials\Exact\PurchaseOrder
{
private $hidden = [
'Warehouse',
'WarehouseCode',
'WarehouseDescription',
];
public function isFillable($key)
{
if (in_array($key, $this->hidden)) {
return false;
}
return parent::isFillable($key);
}
}
That solves the issue for now. It is unfortunate though since the Exact specification does not mention anything about this and even allows the setting of WarehouseID upon creation but no longer allows editing the value afterwards if you have the wrong licence.
Hello,
I am currently receiving this error "Error 500: Not allow to update in Basic : Warehouse."
Even though I am not updating the warehouse at all. Or updating anything for that matter since this example code already fails.
Which is strange since we have one "default" warehouse in Exact and upon creation of the purchase order that gets initialized. But once I try to update the Purchase order in question even without changing the warehouseID value I get this error.
If I need to provide any more info, examples or anything let me know. This might be related to #492 but that got closed without a proper answer from the user that made it.