From: <dai...@us...> - 2011-01-13 09:34:06
|
Revision: 4466 http://web-erp.svn.sourceforge.net/web-erp/?rev=4466&view=rev Author: daintree Date: 2011-01-13 09:33:59 +0000 (Thu, 13 Jan 2011) Log Message: ----------- PO_Items.php birthday Modified Paths: -------------- trunk/PO_Items.php trunk/SupplierCredit.php trunk/SupplierInvoice.php trunk/Z_ChangeCustomerCode.php trunk/doc/Change.log.html Modified: trunk/PO_Items.php =================================================================== --- trunk/PO_Items.php 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/PO_Items.php 2011-01-13 09:33:59 UTC (rev 4466) @@ -32,44 +32,25 @@ echo '<a href="'.$rootpath.'/PO_Header.php?' . SID . 'identifier=' . $identifier. '">' ._('Back To Purchase Order Header') . '</a><br>'; } -if (isset($_POST['StockID2']) AND $_GET['Edit']=='') { -/* If a stock item is selected and a purchdata record - * exists for it then find that record. - */ - $sql = "SELECT stockmaster.description, - purchdata.suppliers_partno, - purchdata.converstionfactor, - stockmaster.pkg_type, - stockmaster.units, - stockmaster.netweight, - stockmaster.kgs, - stockmaster.volume - FROM purchdata INNER JOIN stockmaster - ON purchdata.stockid=stockmaster.stockid - WHERE purchdata.stockid='" . $_POST['StockID2'] . "' AND - purchdata.supplierno='".$_SESSION['PO'.$identifier]->SupplierID."'"; - - $ErrMsg = _('The stock record of the stock selected') . ': ' . $_POST['Stock'] . ' ' . - _('cannot be retrieved because'); - $DbgMsg = _('The SQL used to retrieve the supplier details and failed was'); - $result =DB_query($sql,$db,$ErrMsg,$DbgMsg); - $myrow = DB_fetch_array($result); - - $_POST['ItemDescription'] = $myrow['description']; - $_POST['Suppliers_PartNo'] = $myrow['suppliers_partno']; - $_POST['Package'] = $myrow['pkg_type']; - $_POST['uom'] = $myrow['units']; - $_POST['NetWeight'] = $myrow['netweight']; - $_POST['KGs'] = $myrow['kgs']; - $_POST['ConversionFactor']=$myrow['conversionfactor']; - $_POST['CuFt'] = $myrow[6]; -} // end if (isset($_POST['StockID2']) && $_GET['Edit']=='') - -if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { +if (isset($_POST['UpdateLines']) OR isset($_POST['Commit'])) { foreach ($_SESSION['PO'.$identifier]->LineItems as $POLine) { if ($POLine->Deleted == false) { - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=$_POST['Qty'.$POLine->LineNo]; - $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=$_POST['Price'.$POLine->LineNo]; + if (!is_numeric($_POST['ConversionFactor'.$POLine->LineNo])){ + prnMsg(_('The conversion factor is expected to be numeric - the figure which converts from our units to the supplier units. e.g. if the supplier units is a tonne and our unit is a kilogram then the conversion factor that converts our unit to the suppliers unit is 1000'),'error'); + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = 1; + } else { //a valid number for the conversion factor is entered + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor = $_POST['ConversionFactor'.$POLine->LineNo]; + } + if (!is_numeric($_POST['SuppQty'.$POLine->LineNo])){ + prnMsg(_('The quantity in the supplier units is expected to be numeric. Please re-enter as a number'),'error'); + } else { //ok to update the PO object variables + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Quantity=$_POST['SuppQty'.$POLine->LineNo]*$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor; + } + if (!is_numeric($_POST['SuppPrice'.$POLine->LineNo])){ + prnMsg(_('The supplier price is expected to be numeric. Please re-enter as a number'),'error'); + } else { //ok to update the PO object variables + $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->Price=$_POST['SuppPrice'.$POLine->LineNo]/$_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ConversionFactor; + } $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->NetWeight=$_POST['NetWeight'.$POLine->LineNo]; $_SESSION['PO'.$identifier]->LineItems[$POLine->LineNo]->ReqDelDate=$_POST['ReqDelDate'.$POLine->LineNo]; } @@ -522,30 +503,6 @@ } -if (isset($_POST['LookupPrice']) and isset($_POST['StockID2'])){ - $sql = "SELECT purchdata.price, - purchdata.conversionfactor, - purchdata.suppliersuom, - purchdata.supplierdescription - FROM purchdata - WHERE purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' - AND purchdata.stockid = '". strtoupper($_POST['StockID2']) . "'"; - - $ErrMsg = _('The supplier pricing details for') . ' ' . strtoupper($_POST['StockID']) . ' ' . _('could not be retrieved because'); - $DbgMsg = _('The SQL used to retrieve the pricing details but failed was'); - $LookupResult = DB_query($sql,$db,$ErrMsg,$DbgMsg); - - if (DB_num_rows($LookupResult)==1){ - $myrow = DB_fetch_array($LookupResult); - $_POST['Price'] = $myrow['price']/$myrow['conversionfactor']; - $_POST['SuppliersUOM'] = $myrow['suppliersuom']; - $_POST['ConversionFactor'] = $myrow['conversionfactor']; - - } else { - prnMsg(_('There is no purchasing data set up for this supplier') . ' - ' . $_SESSION['PO'.$identifier]->SupplierID . ' ' . _('and item') . ' ' . strtoupper($_POST['StockID']),'warn'); - } -} - if (isset($_POST['UpdateLine'])){ $AllowUpdate=true; /*Start assuming the best ... now look for the worst*/ @@ -730,9 +687,12 @@ /*end if Enter line button was hit */ -if (isset($_POST['NewItem'])){ /* NewItem is set from the part selection list as the part code selected */ -/* take the form entries and enter the data from the form into the PurchOrder class variable - * A series of form variables of the format "Qty" with the ItemCode concatenated are created on the search for adding new items for each of these form variables need to parse out the items and look up the details to add them to the purchase order $_POST is of course the global array of all posted form variables */ +if (isset($_POST['NewItem'])){ + /* NewItem is set from the part selection list as the part code selected + * take the form entries and enter the data from the form into the PurchOrder class variable + * A series of form variables of the format "Qty" with the ItemCode concatenated are created on the search for adding new + * items for each of these form variables need to parse out the items and look up the details to add them to the purchase + * order $_POST is of course the global array of all posted form variables */ foreach ($_POST as $FormVariableName => $Quantity) { if (substr($FormVariableName, 0, 6)=='NewQty') { //if the form variable represents a Qty to add to the order @@ -783,13 +743,12 @@ ON purchdata.suppliersuom=unitsofmeasure.unitid AND purchdata.supplierno = '" . $_SESSION['PO'.$identifier]->SupplierID . "' WHERE chartmaster.accountcode = stockcategory.stockact - AND stockcategory.categoryid = stockmaster.categoryid - AND stockmaster.stockid = '". $ItemCode . "' - AND purchdata.effectivefrom = - (SELECT max(effectivefrom) - FROM purchdata - WHERE purchdata.stockid='". $ItemCode . "' - AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "')"; + AND stockcategory.categoryid = stockmaster.categoryid + AND stockmaster.stockid = '". $ItemCode . "' + AND purchdata.effectivefrom = (SELECT max(effectivefrom) + FROM purchdata + WHERE purchdata.stockid='". $ItemCode . "' + AND purchdata.supplierno='" . $_SESSION['PO'.$identifier]->SupplierID . "')"; } else { $sql="SELECT stockmaster.description, stockmaster.stockid, @@ -884,7 +843,7 @@ } else { prnMsg (_('The item code') . ' ' . $ItemCode . ' ' . _('does not exist in the database and therefore cannot be added to the order'),'error'); if ($debug==1){ - echo "<br>".$sql; + echo '<br / >'.$sql; } include('includes/footer.inc'); exit; @@ -913,12 +872,13 @@ echo '<tr> <th>' . _('Item Code') . '</th> <th>' . _('Description') . '</th> - <th>' . _('Quantity') . '</th> - <th>' . _('Our Unit') .'</th> - <th>' . _('Quantity') . '<th> - <th>' . _('Supp Unit') . '</th> <th>' . _('Weight') . '</th> + <th>' . _('Quantity Our Units') . '</th> + <th>' . _('Our Unit') .'</th> <th>' . _('Price Our Units') .' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> + <th>' . _('Unit Conversion Factor') . '</th> + <th>' . _('Quantity Supplier Units') . '</th> + <th>' . _('Supplier Unit') . '</th> <th>' . _('Price Supp Units') . ' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> <th>' . _('Subtotal') .' ('.$_SESSION['PO'.$identifier]->CurrCode. ')</th> <th>' . _('Deliver By') .'</th> @@ -931,7 +891,7 @@ if ($POLine->Deleted==False) { $LineTotal = $POLine->Quantity * $POLine->Price; - $DisplayLineTotal = number_format($LineTotal,$POLine->DecimalPlaces); + $DisplayLineTotal = number_format($LineTotal,2); // Note if the price is greater than 1 use 2 decimal place, if the price is a fraction of 1, use 4 decimal places // This should help display where item-price is a fraction if ($POLine->Price > 1) { @@ -950,29 +910,29 @@ echo '<td>' . $POLine->StockID . '</td> <td>' . $POLine->ItemDescription . '</td> - <td><input type="text" class="number" name="Qty' . $POLine->LineNo .'" size="11" value="' . number_format($POLine->Quantity,$POLine->DecimalPlaces) . '"></td> + <td><input type="text" class="number" name="NetWeight' . $POLine->LineNo . '" size="8" value="' . $POLine->NetWeight . '"></td> + <td class="number">' . number_format($POLine->Quantity,$POLine->DecimalPlaces) . '</td> <td>' . $POLine->Units . '</td> - <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="11" value="' . number_format($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> + <td class="number">' . $DisplayPrice . '</td> + <td><input type="text" class="number" name="ConversionFactor' . $POLine->LineNo .'" size="8" value="' . $POLine->ConversionFactor . '"></td> + <td><input type="text" class="number" name="SuppQty' . $POLine->LineNo .'" size="10" value="' . number_format($POLine->Quantity/$POLine->ConversionFactor,$POLine->DecimalPlaces) . '"></td> <td>' . $POLine->SuppUOM . '</td> - <td><input type="text" class="number" name="NetWeight' . $POLine->LineNo . '" size="11" value="' . $POLine->NetWeight . '"></td> - <td><input type="text" class="number" name="Price' . $POLine->LineNo . '" size="11" value="' .$DisplayPrice.'"></td> + <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="10" value="' .number_format(($POLine->Price *$POLine->ConversionFactor),2) .'"></td> <td class="number">' . $DisplayLineTotal . '</td> - <td><input type="text" class="number" name="SuppPrice' . $POLine->LineNo . '" size="11" value="' .number_format($POLine->Price/$POLine->ConversionFactor,2) .'"></td> - <td class="number">' . $DisplayLineTotal . '</td> - <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="11" value="' .$POLine->ReqDelDate .'"></td> + <td><input type="text" class="date" alt="' .$_SESSION['DefaultDateFormat'].'" name="ReqDelDate' . $POLine->LineNo.'" size="10" value="' .$POLine->ReqDelDate .'"></td> <td><a href="' . $_SERVER['PHP_SELF'] . '?' . SID . 'identifier='.$identifier. '&Delete=' . $POLine->LineNo . '">' . _('Delete') . '</a></td></tr>'; $_SESSION['PO'.$identifier]->Total = $_SESSION['PO'.$identifier]->Total + $LineTotal; } } $DisplayTotal = number_format($_SESSION['PO'.$identifier]->Total,2); - echo '<tr><td colspan=6 class=number>' . _('TOTAL') . _(' excluding Tax') . '</td><td class=number><b>' . $DisplayTotal . '</b></td></tr></table>'; + echo '<tr><td colspan="10" class=number>' . _('TOTAL') . _(' excluding Tax') . '</td> + <td class=number><b>' . $DisplayTotal . '</b></td> + </tr></table>'; echo '<br><div class="centre"><input type="submit" name="UpdateLines" value="Update Order Lines">'; + echo ' <input type="submit" name="Commit" value="Process Order"></div>'; - if (!isset($_POST['NewItem']) and isset($_GET['Edit'])) { - - /*show a form for putting in a new line item with or without a stock entry */ - } + } /*Only display the order line items if there are any !! */ Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/SupplierCredit.php 2011-01-13 09:33:59 UTC (rev 4466) @@ -611,8 +611,8 @@ }elseif ($_SESSION['SuppTrans']->ExRate <= 0){ $InputError = True; prnMsg(_('The credit note as entered cannot be processed because the exchange rate for the credit note has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'),'warn'); - }elseif ($_SESSION['SuppTrans']->OvAmount < round($TotalShiptValue + $TotalGLValue + $TotalAssetValue + $TotalGRNValue,2)){ - prnMsg(_('The credit note total as entered is less than the sum of the shipment charges') . ', ' . _('the general ledger entries (if any) and the charges for goods received') . '. ' . _('There must be a mistake somewhere') . ', ' . _('the credit note as entered will not be processed'),'error'); + }elseif ($_SESSION['SuppTrans']->OvAmount < round($TotalGRNValue + $TotalGLValue + $TotalAssetValue + $TotalShiptValue + $TotalContractsValue,2)){ + prnMsg(_('The credit note total as entered is less than the sum of the shipment charges, the general ledger entries (if any) and the charges for goods received, contracts and fixed assets. There must be a mistake somewhere, the credit note as entered will not be processed'),'error'); $InputError = True; } else { Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/SupplierInvoice.php 2011-01-13 09:33:59 UTC (rev 4466) @@ -577,18 +577,17 @@ prnMsg( _('The invoice as entered cannot be processed because the exchange rate for the invoice has been entered as a negative or zero number') . '. ' . _('The exchange rate is expected to show how many of the suppliers currency there are in 1 of the local currency'),'error'); }elseif ( $_SESSION['SuppTrans']->OvAmount < round($TotalShiptValue + $TotalGLValue + $TotalContractsValue+ $TotalAssetValue+$TotalGRNValue,2)){ - prnMsg( _('The invoice total as entered is less than the sum of the shipment charges, the general ledger entries (if any) and the charges for goods received') . '. ' . _('There must be a mistake somewhere, the invoice as entered will not be processed'),'error'); + prnMsg( _('The invoice total as entered is less than the sum of the shipment charges, the general ledger entries (if any), the charges for goods received, contract charges and fixed asset charges. There must be a mistake somewhere, the invoice as entered will not be processed'),'error'); $InputError = True; } else { $sql = "SELECT count(*) - FROM supptrans - WHERE supplierno='" . $_SESSION['SuppTrans']->SupplierID . "' - AND supptrans.suppreference='" . $_POST['SuppReference'] . "'"; + FROM supptrans + WHERE supplierno='" . $_SESSION['SuppTrans']->SupplierID . "' + AND supptrans.suppreference='" . $_POST['SuppReference'] . "'"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The sql to check for the previous entry of the same invoice failed'); - $DbgMsg = _('The following SQL to start an SQL transaction was used'); - + $DbgMsg = _('The following SQL to test for a previous invoice with the same reference from the same supplier was used'); $result=DB_query($sql, $db, $ErrMsg, $DbgMsg, True); $myrow=DB_fetch_row($result); @@ -601,7 +600,6 @@ if ($InputError == False){ /* SQL to process the postings for purchase invoice */ - /*Start an SQL transaction */ $Result = DB_Txn_Begin($db); @@ -647,21 +645,21 @@ the credit is to creditors control act done later for the total invoice value + tax*/ $SQL = "INSERT INTO gltrans (type, - typeno, - trandate, - periodno, - account, - narrative, - amount, - jobref) - VALUES (20, - '" . $InvoiceNo . "', - '" . $SQLInvoiceDate . "', - '" . $PeriodNo . "', - '" . $EnteredGLCode->GLCode . "', - '" . $_SESSION['SuppTrans']->SupplierID . ' ' . $EnteredGLCode->Narrative . "', - '" . round($EnteredGLCode->Amount/ $_SESSION['SuppTrans']->ExRate,2) . "', - '" . $EnteredGLCode->JobRef . "')"; + typeno, + trandate, + periodno, + account, + narrative, + amount, + jobref) + VALUES (20, + '" . $InvoiceNo . "', + '" . $SQLInvoiceDate . "', + '" . $PeriodNo . "', + '" . $EnteredGLCode->GLCode . "', + '" . $_SESSION['SuppTrans']->SupplierID . ' ' . $EnteredGLCode->Narrative . "', + '" . round($EnteredGLCode->Amount/ $_SESSION['SuppTrans']->ExRate,2) . "', + '" . $EnteredGLCode->JobRef . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction could not be added because'); $DbgMsg = _('The following SQL to insert the GL transaction was used'); @@ -684,12 +682,12 @@ narrative, amount) VALUES (20, - '" . $InvoiceNo . "', - '" . $SQLInvoiceDate . "', - '" . $PeriodNo . "', - '" . $_SESSION['SuppTrans']->GRNAct . "', - '" . $_SESSION['SuppTrans']->SupplierID . ' ' . _('Shipment charge against') . ' ' . $ShiptChg->ShiptRef . "', - '" . round($ShiptChg->Amount/ $_SESSION['SuppTrans']->ExRate,2) . "')"; + '" . $InvoiceNo . "', + '" . $SQLInvoiceDate . "', + '" . $PeriodNo . "', + '" . $_SESSION['SuppTrans']->GRNAct . "', + '" . $_SESSION['SuppTrans']->SupplierID . ' ' . _('Shipment charge against') . ' ' . $ShiptChg->ShiptRef . "', + '" . round($ShiptChg->Amount/ $_SESSION['SuppTrans']->ExRate,2) . "')"; $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The general ledger transaction for the shipment') . ' ' . $ShiptChg->ShiptRef . ' ' . _('could not be added because'); Modified: trunk/Z_ChangeCustomerCode.php =================================================================== --- trunk/Z_ChangeCustomerCode.php 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/Z_ChangeCustomerCode.php 2011-01-13 09:33:59 UTC (rev 4466) @@ -35,59 +35,59 @@ prnMsg(_('Inserting the new debtors master record'),'info'); $sql = "INSERT INTO debtorsmaster (`debtorno`, - `name`, - `address1`, - `address2`, - `address3`, - `address4`, - `currcode`, - `salestype`, - `clientsince`, - `holdreason`, - `paymentterms`, - `discount`, - `discountcode`, - `pymtdiscount`, - `lastpaid`, - `lastpaiddate`, - `creditlimit`, - `invaddrbranch`, - `ediinvoices`, - `ediorders`, - `edireference`, - `editransport`, - `ediaddress`, - `ediserveruser`, - `ediserverpwd`, - `typeid`) - SELECT '" . $_POST['NewDebtorNo'] . "', - `name`, - `address1`, - `address2`, - `address3`, - `address4`, - `currcode`, - `salestype`, - `clientsince`, - `holdreason`, - `paymentterms`, - `discount`, - `discountcode`, - `pymtdiscount`, - `lastpaid`, - `lastpaiddate`, - `creditlimit`, - `invaddrbranch`, - `ediinvoices`, - `ediorders`, - `edireference`, - `editransport`, - `ediaddress`, - `ediserveruser`, - `ediserverpwd`, - `typeid` - FROM debtorsmaster - WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; + `name`, + `address1`, + `address2`, + `address3`, + `address4`, + `currcode`, + `salestype`, + `clientsince`, + `holdreason`, + `paymentterms`, + `discount`, + `discountcode`, + `pymtdiscount`, + `lastpaid`, + `lastpaiddate`, + `creditlimit`, + `invaddrbranch`, + `ediinvoices`, + `ediorders`, + `edireference`, + `editransport`, + `ediaddress`, + `ediserveruser`, + `ediserverpwd`, + `typeid`) + SELECT '" . $_POST['NewDebtorNo'] . "', + `name`, + `address1`, + `address2`, + `address3`, + `address4`, + `currcode`, + `salestype`, + `clientsince`, + `holdreason`, + `paymentterms`, + `discount`, + `discountcode`, + `pymtdiscount`, + `lastpaid`, + `lastpaiddate`, + `creditlimit`, + `invaddrbranch`, + `ediinvoices`, + `ediorders`, + `edireference`, + `editransport`, + `ediaddress`, + `ediserveruser`, + `ediserverpwd`, + `typeid` + FROM debtorsmaster + WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; $DbgMsg =_('The SQL that failed was'); $ErrMsg = _('The SQL to insert the new debtors master record failed') . ', ' . _('the SQL statement was'); @@ -95,63 +95,63 @@ prnMsg(_('Inserting new customer branch records'),'info'); $sql = "INSERT INTO custbranch ( `branchcode`, - `debtorno`, - `brname`, - `braddress1`, - `braddress2`, - `braddress3`, - `braddress4`, - `braddress5`, - `braddress6`, - `estdeliverydays`, - `area`, - `salesman`, - `fwddate`, - `phoneno`, - `faxno`, - `contactname`, - `email`, - `defaultlocation`, - `taxgroupid`, - `disabletrans`, - `brpostaddr1`, - `brpostaddr2`, - `brpostaddr3`, - `brpostaddr4`, - `brpostaddr5`, - `brpostaddr6`, - `defaultshipvia`, - `custbranchcode`) - SELECT branchcode, - '" . $_POST['NewDebtorNo'] . "', - `brname`, - `braddress1`, - `braddress2`, - `braddress3`, - `braddress4`, - `braddress5`, - `braddress6`, - `estdeliverydays`, - `area`, - `salesman`, - `fwddate`, - `phoneno`, - `faxno`, - `contactname`, - `email`, - `defaultlocation`, - `taxgroupid`, - `disabletrans`, - `brpostaddr1`, - `brpostaddr2`, - `brpostaddr3`, - `brpostaddr4`, - `brpostaddr5`, - `brpostaddr6`, - `defaultshipvia`, - `custbranchcode` - FROM custbranch - WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; + `debtorno`, + `brname`, + `braddress1`, + `braddress2`, + `braddress3`, + `braddress4`, + `braddress5`, + `braddress6`, + `estdeliverydays`, + `area`, + `salesman`, + `fwddate`, + `phoneno`, + `faxno`, + `contactname`, + `email`, + `defaultlocation`, + `taxgroupid`, + `disabletrans`, + `brpostaddr1`, + `brpostaddr2`, + `brpostaddr3`, + `brpostaddr4`, + `brpostaddr5`, + `brpostaddr6`, + `defaultshipvia`, + `custbranchcode`) + SELECT branchcode, + '" . $_POST['NewDebtorNo'] . "', + `brname`, + `braddress1`, + `braddress2`, + `braddress3`, + `braddress4`, + `braddress5`, + `braddress6`, + `estdeliverydays`, + `area`, + `salesman`, + `fwddate`, + `phoneno`, + `faxno`, + `contactname`, + `email`, + `defaultlocation`, + `taxgroupid`, + `disabletrans`, + `brpostaddr1`, + `brpostaddr2`, + `brpostaddr3`, + `brpostaddr4`, + `brpostaddr5`, + `brpostaddr6`, + `defaultshipvia`, + `custbranchcode` + FROM custbranch + WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; $ErrMsg = _('The SQL to insert new customer branch records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); @@ -204,6 +204,8 @@ $ErrMsg = _('The SQL to update contract header records failed'); $result = DB_query($sql,$db,$ErrMsg,$DbgMsg,true); + $result = DB_IgnoreForeignKeys($db); + prnMsg(_('Deleting the old customer branch records from the CustBranch table'),'info'); $sql = "DELETE FROM custbranch WHERE debtorno='" . $_POST['OldDebtorNo'] . "'"; $ErrMsg = _('The SQL to delete the old CustBranch records for the old debtor record failed'); @@ -218,6 +220,7 @@ $result = DB_Txn_Commit($db); + $result = DB_ReinstateForeignKeys($db); } Modified: trunk/doc/Change.log.html =================================================================== --- trunk/doc/Change.log.html 2011-01-12 09:19:59 UTC (rev 4465) +++ trunk/doc/Change.log.html 2011-01-13 09:33:59 UTC (rev 4466) @@ -1,12 +1,13 @@ <p><font SIZE=4 COLOR=BLUE><b>webERP Change Log</b></font></p> <p></p> +<p>13/1/11:Phil PO_Items.php remove redundant code, setup entry of lines in supplier units</p> +<p>13/1/11:Tim Z_ChangeCustomerCode.php now has foreign key checks defeated when deleting the old customer record and custbranch record </p> +<p>13/1/11:Phil SupplierInvoice.php and SupplierCredit.php now check to ensure the total of contracts fixed asset charges goods received charges, shipment charges and GL charges are at least equal to the amount of the invoice or credit. It was possible when GL interface turned off to get strange results</p> <p>12/1/11:Phil DailyBankTransactions.php made it so a range of dates can be selected but defaults to just today</p> <p>11/1/11:Phil fix choice of portrait or landscape invoices - fix landscape default form layout. Fix portrait invoice logo position</p> <p>11/1/11:Phil fix customer transaction inquiries to show correct links where user is not authorised for credit notes or GL inquiries</p> <p>11/1/11:Phil SupplierCredit.php and SupplierInvoice.php recalculate price variance to post differences on fixed asset additions correctly</p> <p>11/1/11:Phil PO_PDFPurchOrder.php - fixed for coding conventions removed uneccessary sql calls</p> -<p>11/1/11:Phil -<p>11/1/11:Phil <p>11/1/11: Murray Collingwood: Emailing invoices was writing the pdf file twice - once with fwrite and once with the TCPDF output function with the option 'F'</p> <p>8/1/11 Ricard Andreu: Z_ChangeCustomerCode.php added typeid field that made change customer code fail. Also corrected typo for foreign key checking side stepping for Z_ChangeBranchCode.php</p> <p>5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts</p> @@ -14,7 +15,7 @@ <p>5/1/11 Phil: Bug fixes AssetLocationTransfer and Supplier Contacts</p> <p>4/1/11 Phil: Start rework of purchase order scripts ... again.</p> <p>4/1/11 Phil: Select Purchase orders now defaults to just pending and authorised/printed - other statii are options</p> -<p>1/1/11 Phil: Upgrade script make capable of upgrades from any earlier version - and email a backup to the user.</p> +<p>1/1/11 Phil: Upgrade script make capable of upgrades from any earlier version - and email a backup to the user. Deleted DBUpgradeNumber config variable now use the VersionNumber already there</p> <p>31/12/10 Tim: Tidy up of CounterSales.php - CamelCasing, quoting SQL, closing slashes in xhtml tags</p> <p>29/12/10 Phil: Reverted to single SQL upgrade file per release - but retaining Tim's upgrade mechanism if the DBUpgradeNumber is out of date. Removed pseudo SQL language required for upgrade script and the 52 update files - just applies plain vanilla SQL from the scripts required</p> <p>29/12/10 Tim: DB upgrade mechanism with separate pseudo SQL for each database change in a separate file + 52 files of updates since 3.11.4</p> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |