When I create and submit a PO and then go back to it and try to delete some items, they disappear from the screen but not from the database. When I print the PO, the deleted items are still there.
Does anybody know how to fix this?
Thanks
When you delete an item this code marks it deleted
$_SESSION['PO'.$identifier]->LineItems[$_GET['Delete']]->Deleted=True;
When you commit the order there is no items marked as deleted and sql statement does not execute
foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) {
if ($POLine->Deleted==true) {
if ($POLine->PODetailRec!='') {
$sql="DELETE FROM purchorderdetails WHERE podetailitem='" . $POLine->PODetailRec . "'";
(01-31-2012, 07:44 AM)tim_schofield Wrote: Hi Phil,
The fix is to check whether there are lines in purchorderdetails not in the purchase order session object and delete them if not. It was in the original, but got removed when you improved it.
Tim
Don't know if will help, but running the v 4.05.1 set of scripts it works OK. After upgrading to 4.06.6 the bug appears.
I think I found it
function Order_Value() {
$TotalValue=0;
foreach ($this->LineItems as $OrderedItems) {
if ($OrderedItems->Deleted = False){
$TotalValue += ($OrderedItems->Price)*($OrderedItems->Quantity);
}
}
return $TotalValue;
}
Should it be $OrderedItems->Deleted != False instead of = False?
or $OrderedItems->Deleted == False?