db = $db; $this->user = $user; } /** * */ public function getProductByBarcode(string $barcode): ?Product { $result = null; $product = new Product($this->db); if ($product->fetch('', '', '', $barcode, 0, 0, 1) > 0) { $result = $product; } return $result; } /** * */ public function getProductLot(int $productId, string $batchNumber): ?Productlot { $result = null; $productLot = new Productlot($this->db); if ($productLot->fetch(0, $productId, $batchNumber) > 0) { $result = $productLot; } return $result; } /** * */ public function sellProductLot(Productlot $productLot): void { $productLot->array_options['options_usedat'] = time(); $productLot->update($this->user); } }