| @@ 121-133 (lines=13) @@ | ||
| 118 | $etm->persist($settings); |
|
| 119 | } |
|
| 120 | // Saving of articles in the inventory |
|
| 121 | foreach ($articles as $article) { |
|
| 122 | foreach ($article->getZoneStorages()->getSnapshot() as $zoneStorage) { |
|
| 123 | $inventoryArticles = new InventoryArticles(); |
|
| 124 | $inventoryArticles->setArticle($article); |
|
| 125 | $inventoryArticles->setInventory($inventory); |
|
| 126 | $inventoryArticles->setQuantity($article->getQuantity()); |
|
| 127 | $inventoryArticles->setRealstock(0); |
|
| 128 | $inventoryArticles->setUnitStorage($article->getUnitStorage()); |
|
| 129 | $inventoryArticles->setPrice($article->getPrice()); |
|
| 130 | $inventoryArticles->setZoneStorage($zoneStorage->getName()); |
|
| 131 | $etm->persist($inventoryArticles); |
|
| 132 | } |
|
| 133 | } |
|
| 134 | $etm->flush(); |
|
| 135 | ||
| 136 | return $this->redirectToRoute( |
|
| @@ 248-259 (lines=12) @@ | ||
| 245 | */ |
|
| 246 | private function saveOrdersArticles($articles, $orders, $etm) |
|
| 247 | { |
|
| 248 | foreach ($articles as $article) { |
|
| 249 | $ordersArticles = new OrdersArticles(); |
|
| 250 | $ordersArticles->setOrders($orders); |
|
| 251 | $ordersArticles->setArticle($article); |
|
| 252 | $ordersArticles->setUnitStorage($article->getUnitStorage()); |
|
| 253 | if ($article->getMinstock() > $article->getQuantity()) { |
|
| 254 | $ordersArticles->setQuantity($article->getMinstock() - $article->getQuantity()); |
|
| 255 | } |
|
| 256 | $ordersArticles->setPrice($article->getPrice()); |
|
| 257 | $ordersArticles->setTva($article->getTva()); |
|
| 258 | $etm->persist($ordersArticles); |
|
| 259 | } |
|
| 260 | } |
|
| 261 | ||
| 262 | /** |
|