commit a69bad6aca53e4de01d1e459d9771da913f1d9e6
parent 43499cf56858efaf36053b6c1040c5c04ec5b67e
Author: Felicitus <privat@timohummel.com>
Date: Mon, 23 May 2011 20:31:14 +0200
When a part is added, we also need to enter the stock level
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/de/RaumZeitLabor/PartDB2/Part/PartManager.php b/src/de/RaumZeitLabor/PartDB2/Part/PartManager.php
@@ -6,6 +6,8 @@ use de\RaumZeitLabor\PartDB2\StorageLocation\StorageLocationManager;
use de\RaumZeitLabor\PartDB2\Part\Part;
use de\RaumZeitLabor\PartDB2\Footprint\FootprintManager;
+use de\RaumZeitLabor\PartDB2\Session\SessionManager;
+use de\RaumZeitLabor\PartDB2\Stock\StockEntry;
declare(encoding = 'UTF-8');
@@ -141,7 +143,12 @@ class PartManager extends Singleton {
$category = CategoryManager::getInstance()->getCategory($aParameters["category"]);
$part->setCategory($category->getNode());
+ $user = SessionManager::getCurrentSession()->getUser();
+
+ $stock = new StockEntry($part, $aParameters["quantity"], $user);
+
PartDB2::getEM()->persist($part);
+ PartDB2::getEM()->persist($stock);
PartDB2::getEM()->flush();
}