From: <ex...@us...> - 2016-09-04 10:26:42
|
Revision: 7615 http://sourceforge.net/p/web-erp/reponame/7615 Author: exsonqu Date: 2016-09-04 10:26:40 +0000 (Sun, 04 Sep 2016) Log Message: ----------- 04/09/16 Exson: Add WO items delete constraint in WorkOrderEntry.php. Thanks for Phil's reminder. Modified Paths: -------------- trunk/WorkOrderEntry.php Modified: trunk/WorkOrderEntry.php =================================================================== --- trunk/WorkOrderEntry.php 2016-09-04 08:15:04 UTC (rev 7614) +++ trunk/WorkOrderEntry.php 2016-09-04 10:26:40 UTC (rev 7615) @@ -483,7 +483,19 @@ } } if (isset($_GET['Delete'])) { + $CancelDelete=false; //always assume the best + + // can't delete it there are open work issues + $HasTransResult = DB_query("SELECT transno + FROM stockmoves + WHERE (stockmoves.type= 26 OR stockmoves.type=28) + AND reference " . LIKE . " '%" . $_POST['WO'] . "%'"); + if (DB_num_rows($HasTransResult)>0){ + prnMsg(_('This work order cannot be deleted because it has issues or receipts related to it'),'error'); + $CancelDelete=true; + } //delete items + if ($CancelDelete===false) { DB_Txn_Begin(); $ErrMsg = _('The work order could not be deleted'); $DbgMsg = _('The SQL used to delete the work order was'); @@ -500,6 +512,7 @@ DB_Txn_Commit(); prnMsg(_('The item in this work order has been cancelled'),'success'); header('Location: '. $_SERVER['PHP_SELF'] . '?WO=' . $_GET['WO']); + } } |