mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 03:40:10 +00:00
Squashed commit
Always execute migration 9999 (can be used to fix things manually) Optimized meal plan navigation / date range filtering Prepared next release Pulled translations from Transifex Various code optimizations
This commit is contained in:
@@ -4,6 +4,12 @@ namespace Grocy\Helpers;
|
||||
|
||||
abstract class BaseBarcodeLookupPlugin
|
||||
{
|
||||
final public function __construct($locations, $quantityUnits)
|
||||
{
|
||||
$this->Locations = $locations;
|
||||
$this->QuantityUnits = $quantityUnits;
|
||||
}
|
||||
|
||||
protected $Locations;
|
||||
|
||||
protected $QuantityUnits;
|
||||
@@ -50,28 +56,24 @@ abstract class BaseBarcodeLookupPlugin
|
||||
|
||||
// Check referenced entity ids are valid
|
||||
$locationId = $pluginOutput['location_id'];
|
||||
|
||||
if (FindObjectInArrayByPropertyValue($this->Locations, 'id', $locationId) === null)
|
||||
{
|
||||
throw new \Exception("Location $locationId is not a valid location id");
|
||||
}
|
||||
|
||||
$quIdPurchase = $pluginOutput['qu_id_purchase'];
|
||||
|
||||
if (FindObjectInArrayByPropertyValue($this->QuantityUnits, 'id', $quIdPurchase) === null)
|
||||
{
|
||||
throw new \Exception("Location $quIdPurchase is not a valid quantity unit id");
|
||||
}
|
||||
|
||||
$quIdStock = $pluginOutput['qu_id_stock'];
|
||||
|
||||
if (FindObjectInArrayByPropertyValue($this->QuantityUnits, 'id', $quIdStock) === null)
|
||||
{
|
||||
throw new \Exception("Location $quIdStock is not a valid quantity unit id");
|
||||
}
|
||||
|
||||
$quFactor = $pluginOutput['qu_factor_purchase_to_stock'];
|
||||
|
||||
if (empty($quFactor) || !is_numeric($quFactor))
|
||||
{
|
||||
throw new \Exception('Quantity unit factor is empty or not a number');
|
||||
@@ -80,11 +82,5 @@ abstract class BaseBarcodeLookupPlugin
|
||||
return $pluginOutput;
|
||||
}
|
||||
|
||||
final public function __construct($locations, $quantityUnits)
|
||||
{
|
||||
$this->Locations = $locations;
|
||||
$this->QuantityUnits = $quantityUnits;
|
||||
}
|
||||
|
||||
abstract protected function ExecuteLookup($barcode);
|
||||
}
|
||||
|
Reference in New Issue
Block a user