[Weberp-svn] SF.net SVN: weberp:[8911] trunk
Brought to you by:
sotandeka,
tim_schofield
From: <tim...@us...> - 2012-05-17 10:02:59
|
Revision: 8911 http://weberp.svn.sourceforge.net/weberp/?rev=8911&view=rev Author: tim_schofield Date: 2012-05-17 10:02:53 +0000 (Thu, 17 May 2012) Log Message: ----------- Ahmed Fawzy: Fixes to tendering system Modified Paths: -------------- trunk/SupplierTenders.php trunk/includes/DefineOfferClass.php Modified: trunk/SupplierTenders.php =================================================================== --- trunk/SupplierTenders.php 2012-05-17 10:02:42 UTC (rev 8910) +++ trunk/SupplierTenders.php 2012-05-17 10:02:53 UTC (rev 8911) @@ -265,7 +265,7 @@ /*The supplier has chosen option 1 */ -if (isset($_POST['TenderType']) and $_POST['TenderType']==1 and !isset($_POST['Refresh'])) { +if (isset($_POST['TenderType']) AND $_POST['TenderType']==1 AND !isset($_POST['Refresh']) AND !isset($_GET['Delete'])) { $sql="SELECT offers.offerid, offers.stockid, stockmaster.description, @@ -506,6 +506,7 @@ echo '<td>' . $myrow['currcode'] . '</td>'; echo '<td><input type="text" class="number" size="10" name="Price'. $i . '" value="0.00" /></td>'; echo '<td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'] .'" name="RequiredByDate'. $i . '" size="11" value="' . ConvertSQLDate($MyItemRow['requiredbydate']) . '" /></td>'; + $i++; } echo '</form>'; } Modified: trunk/includes/DefineOfferClass.php =================================================================== --- trunk/includes/DefineOfferClass.php 2012-05-17 10:02:42 UTC (rev 8910) +++ trunk/includes/DefineOfferClass.php 2012-05-17 10:02:53 UTC (rev 8911) @@ -109,22 +109,31 @@ } } else { foreach ($this->LineItems as $LineItem) { - $sql="UPDATE offers SET - quantity='".$LineItem->Quantity."', - price='".$LineItem->Price."', - expirydate='".FormatDateForSQL($LineItem->ExpiryDate)."' - WHERE offerid='".$LineItem->LineNo . "'"; - $ErrMsg = _('The suppliers offer could not be updated on the database because'); - $DbgMsg = _('The SQL statement used to update the suppliers offer record and failed was'); - $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); - if (DB_error_no($db)==0) { - prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('has been updated in the database'), 'success'); - $this->OfferMailText .= $LineItem->Quantity.' '.$LineItem->Units.' '._('of').' '.$LineItem->StockID.' '._('at a price of'). - ' '.$this->CurrCode.$LineItem->Price."\n"; - } else { - prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('could not be updated in the database'), 'error'); - include('includes/footer.inc'); - exit; + if ($LineItem->Deleted==false){ //Update only the LineItems which is not flagged as deleted + $sql="UPDATE offers SET quantity='".$LineItem->Quantity."', + price='".$LineItem->Price."', + expirydate='".FormatDateForSQL($LineItem->ExpiryDate)."' + WHERE offerid='".$LineItem->LineNo . "'"; + $ErrMsg = _('The suppliers offer could not be updated on the database because'); + $DbgMsg = _('The SQL statement used to update the suppliers offer record and failed was'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + if (DB_error_no($db)==0) { + prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('has been updated in the database'), 'success'); + $this->OfferMailText .= $LineItem->Quantity.' '.$LineItem->Units.' '._('of').' '.$LineItem->StockID.' '._('at a price of'). + ' '.$this->CurrCode.$LineItem->Price."\n"; + } else { + prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('could not be updated in the database'), 'error'); + include('includes/footer.inc'); + exit; + } + } else { // the LineItem is Deleted flag is true so delete it + $sql = "DELETE from offers WHERE offerid='".$LineItem->LineNo . "'"; + $ErrMsg = _('The suppliers offer could not be deleted on the database because'); + $DbgMsg = _('The SQL statement used to delete the suppliers offer record and failed was'); + $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + if (DB_error_no($db)==0) { + prnMsg( _('The offer for').' '.$LineItem->StockID.' '._('has been deleted in the database'), 'success'); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |