bug fix in sell mod
This commit is contained in:
parent
c6e4640431
commit
888c76c633
|
@ -158,9 +158,23 @@ class SellController extends AbstractController
|
||||||
if (!$doc)
|
if (!$doc)
|
||||||
return $this->json($extractor->notFound());
|
return $this->json($extractor->notFound());
|
||||||
|
|
||||||
|
// حذف سطرهای قبلی
|
||||||
$rows = $doc->getHesabdariRows();
|
$rows = $doc->getHesabdariRows();
|
||||||
foreach ($rows as $row)
|
foreach ($rows as $row)
|
||||||
$entityManager->remove($row);
|
$entityManager->remove($row);
|
||||||
|
|
||||||
|
// حذف سندهای پرداخت قبلی
|
||||||
|
$relatedDocs = $doc->getRelatedDocs();
|
||||||
|
foreach ($relatedDocs as $relatedDoc) {
|
||||||
|
if ($relatedDoc->getType() === 'sell_receive') {
|
||||||
|
$relatedRows = $relatedDoc->getHesabdariRows();
|
||||||
|
foreach ($relatedRows as $row) {
|
||||||
|
$entityManager->remove($row);
|
||||||
|
}
|
||||||
|
$entityManager->remove($relatedDoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$entityManager->flush();
|
||||||
} else {
|
} else {
|
||||||
$doc = new HesabdariDoc();
|
$doc = new HesabdariDoc();
|
||||||
$doc->setBid($acc['bid']);
|
$doc->setBid($acc['bid']);
|
||||||
|
@ -892,6 +906,19 @@ class SellController extends AbstractController
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$entityManager->remove($row);
|
$entityManager->remove($row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// حذف سندهای پرداخت قبلی
|
||||||
|
$relatedDocs = $doc->getRelatedDocs();
|
||||||
|
foreach ($relatedDocs as $relatedDoc) {
|
||||||
|
if ($relatedDoc->getType() === 'sell_receive') {
|
||||||
|
$relatedRows = $relatedDoc->getHesabdariRows();
|
||||||
|
foreach ($relatedRows as $row) {
|
||||||
|
$entityManager->remove($row);
|
||||||
|
}
|
||||||
|
$entityManager->remove($relatedDoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$entityManager->flush();
|
||||||
} else {
|
} else {
|
||||||
// ایجاد فاکتور جدید
|
// ایجاد فاکتور جدید
|
||||||
$doc = new HesabdariDoc();
|
$doc = new HesabdariDoc();
|
||||||
|
|
Loading…
Reference in a new issue