From: <tu...@us...> - 2018-02-05 02:34:35
|
Revision: 7936 http://sourceforge.net/p/web-erp/reponame/7936 Author: turbopt Date: 2018-02-05 02:34:31 +0000 (Mon, 05 Feb 2018) Log Message: ----------- Remove unused $db and $conn parameters from DB_Last_Insert_ID() and (where present) from DB_show_tables(), and DB_show_fields(). Also, remove any unused 'global $db' references across the code base. Modified Paths: -------------- trunk/AuditTrail.php trunk/BOMs.php trunk/BOMs_SingleLevel.php trunk/ConfirmDispatch_Invoice.php trunk/ContractCosting.php trunk/CounterReturns.php trunk/CounterSales.php trunk/Credit_Invoice.php trunk/FixedAssetItems.php trunk/GLProfit_Loss.php trunk/GoodsReceived.php trunk/InternalStockRequestFulfill.php trunk/InternalStockRequestInquiry.php trunk/MailingGroupMaintenance.php trunk/PcClaimExpensesFromTab.php trunk/RecurringSalesOrders.php trunk/RecurringSalesOrdersProcess.php trunk/ReverseGRN.php trunk/SelectCreditItems.php trunk/SelectOrderItems.php trunk/SelectQASamples.php trunk/StockAdjustments.php trunk/StockLocTransferReceive.php trunk/StockTransfers.php trunk/SupplierCredit.php trunk/SupplierInvoice.php trunk/TaxAuthorities.php trunk/TaxCategories.php trunk/TaxProvinces.php trunk/WorkOrderIssue.php trunk/WorkOrderReceive.php trunk/Z_AutoCustomerAllocations.php trunk/Z_ChangeSupplierCode.php trunk/Z_ImportFixedAssets.php trunk/Z_ImportGLTransactions.php trunk/api/api_debtortransactions.php trunk/api/api_salesorders.php trunk/doc/Change.log trunk/includes/ConnectDB_mysql.inc trunk/includes/ConnectDB_mysqli.inc trunk/includes/ConnectDB_postgres.inc trunk/includes/DefineCartClass.php trunk/includes/DefineContractClass.php trunk/includes/DefineOfferClass.php trunk/includes/DefineReceiptClass.php trunk/includes/DefineSerialItems.php trunk/includes/DefineSuppTransClass.php trunk/includes/GetPrice.inc trunk/includes/PDFPaymentRun_PymtFooter.php trunk/includes/SQL_CommonFunctions.inc trunk/index.php trunk/reportwriter/FormMaker.php trunk/reportwriter/ReportMaker.php trunk/reportwriter/WriteForm.inc trunk/reportwriter/WriteReport.inc trunk/reportwriter/admin/RCFunctions.inc trunk/reportwriter/admin/ReportCreator.php trunk/reportwriter/install/ReportListForm.php trunk/reportwriter/install/ReportListLinks.php Modified: trunk/AuditTrail.php =================================================================== --- trunk/AuditTrail.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/AuditTrail.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -29,7 +29,7 @@ } // Get list of tables -$TableResult = DB_show_tables($db); +$TableResult = DB_show_tables(); // Get list of users $UserResult = DB_query("SELECT userid FROM www_users ORDER BY userid"); @@ -226,4 +226,4 @@ } include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/BOMs.php =================================================================== --- trunk/BOMs.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/BOMs.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -11,7 +11,6 @@ function display_children($Parent, $Level, &$BOMTree) { - global $db; global $i; // retrive all children of parent @@ -1097,4 +1096,4 @@ return strlen(substr(strrchr($SQLNumber, "."),1)); } -?> +?> \ No newline at end of file Modified: trunk/BOMs_SingleLevel.php =================================================================== --- trunk/BOMs_SingleLevel.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/BOMs_SingleLevel.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -11,7 +11,6 @@ function display_children($Parent, $Level, &$BOMTree) { - global $db; global $i; // retrive all children of parent Modified: trunk/ConfirmDispatch_Invoice.php =================================================================== --- trunk/ConfirmDispatch_Invoice.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/ConfirmDispatch_Invoice.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -890,7 +890,7 @@ $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -1251,7 +1251,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($OrderLine->Taxes as $Tax) { Modified: trunk/ContractCosting.php =================================================================== --- trunk/ContractCosting.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/ContractCosting.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -370,7 +370,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /* If GLLink_Stock then insert GLTrans to debit the GL Code and credit GRN Suspense account at standard cost*/ if ($_SESSION['CompanyRecord']['gllink_stock']==1 AND ($OtherReqtsBudget+$ContractBOMBudget)!=0){ Modified: trunk/CounterReturns.php =================================================================== --- trunk/CounterReturns.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/CounterReturns.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -948,7 +948,7 @@ $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($_SESSION['Items' . $identifier]->TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -1172,7 +1172,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($ReturnItemLine->Taxes as $Tax) { @@ -1569,7 +1569,7 @@ $ErrMsg = _('Cannot insert a receipt transaction against the customer because') ; $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $ReceiptDebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $ReceiptDebtorTransID = DB_Last_Insert_ID('debtortrans','id'); //and finally add the allocation record between receipt and invoice @@ -1826,4 +1826,4 @@ } echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/CounterSales.php =================================================================== --- trunk/CounterSales.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/CounterSales.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1359,7 +1359,7 @@ $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($_SESSION['Items'.$identifier]->TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -1584,7 +1584,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($OrderLine->Taxes as $Tax) { @@ -2021,7 +2021,7 @@ $ErrMsg = _('Cannot insert a receipt transaction against the customer because') ; $result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $ReceiptDebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $ReceiptDebtorTransID = DB_Last_Insert_ID('debtortrans','id'); $SQL = "UPDATE debtorsmaster SET lastpaiddate = '" . $DefaultDispatchDate . "', lastpaid='" . filter_number_format($_POST['AmountPaid']) . "' @@ -2398,4 +2398,4 @@ echo '</form>'; } include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/Credit_Invoice.php =================================================================== --- trunk/Credit_Invoice.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Credit_Invoice.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -658,7 +658,7 @@ $DbgMsg = _('The following SQL to insert the customer credit note was used'); $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); - $CreditTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $CreditTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach($TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -958,7 +958,7 @@ $DbgMsg = _('The following SQL to insert the stock movement records was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ //echo "<div align="left"><pre>"; var_dump($CreditLine); echo "</pre> </div>"; if($CreditLine->Controlled ==1) { @@ -1060,7 +1060,7 @@ $DbgMsg = _('The following SQL to insert the stock movement records was used'); $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); $SQL = "INSERT INTO stockmoves(stockid, type, @@ -1145,7 +1145,7 @@ $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); } /*Insert the taxes that applied to this line */ @@ -1652,4 +1652,4 @@ echo '</div>'; echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/FixedAssetItems.php =================================================================== --- trunk/FixedAssetItems.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/FixedAssetItems.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -277,7 +277,7 @@ $result = DB_query($sql, $ErrMsg, $DbgMsg); if (DB_error_no() ==0) { - $NewAssetID = DB_Last_Insert_ID($db,'fixedassets', 'assetid'); + $NewAssetID = DB_Last_Insert_ID('fixedassets', 'assetid'); prnMsg( _('The new asset has been added to the database with an asset code of:') . ' ' . $NewAssetID,'success'); unset($_POST['LongDescription']); unset($_POST['Description']); @@ -692,4 +692,4 @@ </div> </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/GLProfit_Loss.php =================================================================== --- trunk/GLProfit_Loss.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/GLProfit_Loss.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -93,7 +93,7 @@ $RetResult = DB_data_seek($Periods,0); - while ($myrow=DB_fetch_array($Periods,$db)){ + while ($myrow=DB_fetch_array($Periods)){ if($myrow['periodno']==$DefaultToPeriod){ echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>'; @@ -1320,4 +1320,4 @@ echo '</div>';// div class=? echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/GoodsReceived.php =================================================================== --- trunk/GoodsReceived.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/GoodsReceived.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -591,7 +591,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /* Do the Controlled Item INSERTS HERE */ if ($OrderLine->Controlled ==1){ @@ -825,4 +825,4 @@ echo '</div>'; echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/InternalStockRequestFulfill.php =================================================================== --- trunk/InternalStockRequestFulfill.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/InternalStockRequestFulfill.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -91,7 +91,7 @@ /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); $SQL="UPDATE stockrequestitems SET qtydelivered=qtydelivered+" . $Quantity . " @@ -368,4 +368,4 @@ include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/InternalStockRequestInquiry.php =================================================================== --- trunk/InternalStockRequestInquiry.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/InternalStockRequestInquiry.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -35,10 +35,10 @@ <td>' . _('From Stock Location') . ':</td> <td><select name="StockLocation">'; $sql = "SELECT locations.loccode, locationname, canview FROM locations - INNER JOIN locationusers - ON locationusers.loccode=locations.loccode + INNER JOIN locationusers + ON locationusers.loccode=locations.loccode AND locationusers.userid='" . $_SESSION['UserID'] . "' - AND locationusers.canview=1 + AND locationusers.canview=1 AND locations.internalrequest=1"; $LocResult = DB_query($sql); $LocationCounter = DB_num_rows($LocResult); @@ -55,7 +55,7 @@ echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; } } else { - if ($LocationCounter>1 AND $locallctr == 0) {//we show All only when it is necessary + if ($LocationCounter>1 AND $locallctr == 0) {//we show All only when it is necessary echo '<option value="All">' . _('All') . '</option>'; $locallctr = 1; } @@ -71,7 +71,7 @@ $LocationCounter = DB_num_rows($authresult); if ($LocationCounter>0) { $Authorizer = true; - + while ($myrow = DB_fetch_array($authresult)) { $Locations[] = $myrow['loccode']; if (isset($_POST['StockLocation'])) { @@ -90,8 +90,8 @@ } } echo '</select></td>'; - + } else { prnMsg(_('You have no authority to do the internal request inquiry'),'error'); include('includes/footer.php'); @@ -122,16 +122,16 @@ echo '<td>' . _('Department') . '</td> <td><select name="Department">'; //now lets retrieve those deparment available for this user; - $sql = "SELECT departments.departmentid, + $sql = "SELECT departments.departmentid, departments.description - FROM departments LEFT JOIN stockrequest + FROM departments LEFT JOIN stockrequest ON departments.departmentid = stockrequest.departmentid - AND (departments.authoriser = '" . $_SESSION['UserID'] . "' OR stockrequest.initiator = '" . $_SESSION['UserID'] . "') - WHERE stockrequest.dispatchid IS NOT NULL - GROUP BY stockrequest.departmentid";//if a full request is need, the users must have all of those departments' authority + AND (departments.authoriser = '" . $_SESSION['UserID'] . "' OR stockrequest.initiator = '" . $_SESSION['UserID'] . "') + WHERE stockrequest.dispatchid IS NOT NULL + GROUP BY stockrequest.departmentid";//if a full request is need, the users must have all of those departments' authority $depresult = DB_query($sql); if (DB_num_rows($depresult)>0) { - $Departments = array(); + $Departments = array(); if (isset($_POST['Department']) AND $_POST['Department'] == 'All') { echo '<option selected="selected" value="All">' . _('All') . '</option>'; } else { @@ -161,12 +161,10 @@ $_POST['FromDate'] = ''; } echo '<td>' . _('Date From') . '</td> - <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" vaue="' . $_POST['FromDate'] .'" /></td> + <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="FromDate" maxlength="10" size="11" vaue="' . $_POST['FromDate'] .'" /></td> <td>' . _('Date To') . '</td> <td><input type="text" class="date" alt="' . $_SESSION['DefaultDateFormat'] . '" name="ToDate" maxlength="10" size="11" value="' . $_POST['ToDate'] . '" /></td> - <td><input type="submit" name="Search" value="' ._('Search') . '" /></td></tr></table> - - '; + <td><input type="submit" name="Search" value="' ._('Search') . '" /></td></tr></table>'; if (!isset($_POST['ShowDetails'])) { $_POST['ShowDetails'] = 1; } @@ -173,9 +171,9 @@ $Checked = ($_POST['ShowDetails'] == 1)?'checked="checked"':''; echo '<td>' . _('Show Details') . ' <input type="checkbox" ' . $Checked . ' name="ShowDetails" /> </td>'; - //following is the item search parts which belong to the existed internal request, we should not search it generally, it'll be rediculous + //following is the item search parts which belong to the existed internal request, we should not search it generally, it'll be rediculous //hereby if the authorizer is login, we only show all category available, even if there is problem, it'll be correceted later when items selected -:) - if (isset($Authorizer)) { + if (isset($Authorizer)) { $WhereAuthorizer = ''; } else { $WhereAuthorizer = " AND internalstockcatrole.secroleid = '" . $_SESSION['AccessLevel'] . "' "; @@ -193,7 +191,7 @@ if ($Cats >0) { - + echo '<br /><table class="selection"> <tr> <th colspan="6"><h3>' . _('To search for internal request for a specific part use the part selection facilities below') . '</h3></th> @@ -201,7 +199,7 @@ <tr> <td>' . _('Stock Category') . '</td> <td><select name="StockCat">'; - + if (!isset($_POST['StockCat'])) { $_POST['StockCat'] = ''; } @@ -222,7 +220,7 @@ if (!isset($_POST['Keywords'])) { $_POST['Keywords'] = ''; } - echo '<td><input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" /></td>'; + echo '<td><input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" /></td>'; echo '</tr> <tr> <td></td> @@ -254,7 +252,7 @@ } -} +} if(isset($StockItemsResult)){ @@ -297,7 +295,7 @@ echo '</table>'; } - + } elseif(isset($_POST['Search']) OR isset($StockID)) {//lets show the search result here if (isset($StockItemsResult) AND DB_num_rows($StockItemsResult) == 1) { $StockID = DB_fetch_array($StockItemsResult); @@ -305,7 +303,7 @@ } if (isset($_POST['ShowDetails']) OR isset($StockID)) { - $SQL = "SELECT stockrequest.dispatchid, + $SQL = "SELECT stockrequest.dispatchid, stockrequest.loccode, stockrequest.departmentid, departments.description, @@ -321,11 +319,10 @@ stockrequestitems.decimalplaces, uom, completed - FROM stockrequest INNER JOIN stockrequestitems ON stockrequest.dispatchid=stockrequestitems.dispatchid - INNER JOIN departments ON stockrequest.departmentid=departments.departmentid - INNER JOIN locations ON locations.loccode=stockrequest.loccode - INNER JOIN stockmaster ON stockrequestitems.stockid=stockmaster.stockid - "; + FROM stockrequest INNER JOIN stockrequestitems ON stockrequest.dispatchid=stockrequestitems.dispatchid + INNER JOIN departments ON stockrequest.departmentid=departments.departmentid + INNER JOIN locations ON locations.loccode=stockrequest.loccode + INNER JOIN stockmaster ON stockrequestitems.stockid=stockmaster.stockid"; } else { $SQL = "SELECT stockrequest.dispatchid, stockrequest.loccode, @@ -338,7 +335,7 @@ narrative, initiator FROM stockrequest INNER JOIN departments ON stockrequest.departmentid=departments.departmentid - INNER JOIN locations ON locations.loccode=stockrequest.loccode "; + INNER JOIN locations ON locations.loccode=stockrequest.loccode"; } //lets add the condition selected by users if (isset($_POST['RequestNo']) AND $_POST['RequestNo'] !== '') { @@ -368,9 +365,9 @@ $Departments = unserialize(base64_decode($_POST['Departments'])); $Departments = implode("','", $Departments); $SQL .= " AND stockrequest.departmentid IN ('" . $Departments . "')"; - + } //IF there are no departments set,so forgot it - + } } else { $SQL .= " AND stockrequest.departmentid='" . $_POST['Department'] . "'"; @@ -382,7 +379,7 @@ if (isset($_POST['ToDate']) AND is_date($_POST['ToDate'])) { $SQL .= " AND despatchdate<='" . $_POST['ToDate'] . "'"; } - //item selected + //item selected if (isset($StockID)) { $SQL .= " AND stockrequestitems.stockid='" . $StockID . "'"; } @@ -415,12 +412,12 @@ <th>' . _('Locations') . '</th> <th>' . _('Department') . '</th> <th>' . _('Authorization') . '</th> - <th>' . _('Dispatch Date') . '</th> + <th>' . _('Dispatch Date') . '</th> </tr>'; } if (isset($_POST['ShowDetails']) OR isset($StockID)) { - $ID = '';//mark the ID change of the internal request + $ID = '';//mark the ID change of the internal request } $i = 0; //There are items without details AND with it @@ -443,7 +440,7 @@ $Disp = ConvertSQLDate($myrow['despatchdate']); } if (isset($ID)) { - if ($myrow['completed'] == 0) { + if ($myrow['completed'] == 0) { $Comp = _('No'); } else { $Comp = _('Yes'); @@ -484,28 +481,17 @@ }//end of while loop; $Html .= '</table>'; echo '<a href="' . $RootPath . '/InternalStockRequestInquiry.php">' . _('Select Others') . '</a>'; - + echo $Html; } else { prnMsg(_('There are no stock request available'),'warn'); - } + } +} - - - - - - - - - -} - include('includes/footer.php'); exit; function GetSearchItems ($SQLConstraint='') { - global $db; if ($_POST['Keywords'] AND $_POST['StockCode']) { echo _('Stock description keywords have been used in preference to the Stock code extract entered'); } @@ -518,7 +504,7 @@ INNER JOIN departments ON stockrequest.departmentid = departments.departmentid INNER JOIN stockmaster ON stockrequestitems.stockid = stockmaster.stockid"; - if (isset($_POST['StockCat']) + if (isset($_POST['StockCat']) AND ((trim($_POST['StockCat']) == '') OR $_POST['StockCat'] == 'All')){ $WhereStockCat = ''; } else { @@ -552,4 +538,4 @@ return $StockItemsResult; } -?> +?> \ No newline at end of file Modified: trunk/MailingGroupMaintenance.php =================================================================== --- trunk/MailingGroupMaintenance.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/MailingGroupMaintenance.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -8,7 +8,7 @@ if(!isset($_POST['Clean']) and !isset($_GET['Delete']) and !isset($_GET['Edit']) and !isset($_GET['Add']) and !isset($_GET['Remove'])){ GetMailGroup(); } -//validate the input +//validate the input if(isset($_POST['Enter'])){ //user has input a new value $InputError = 0; if(!empty($_POST['MailGroup']) and mb_strlen(trim($_POST['MailGroup']))<=100 and !ContainsIllegalCharacters($_POST['MailGroup'])){ @@ -71,7 +71,7 @@ prnMsg(_('The group id must be numeric'),'error'); include('includes/footer.php'); exit; - + } } @@ -88,7 +88,7 @@ include('includes/footer.php'); exit; } - + }else{ prnMsg(_('The page must be called with a group id'),'error'); include('includes/footer.php'); @@ -95,9 +95,9 @@ exit; } GetUsers($GroupId,$GroupName); - include('includes/footer.php'); - + include('includes/footer.php'); + } //Users remove one user from the group if(isset($_GET['Remove'])){ @@ -146,7 +146,7 @@ </form> -<?php +<?php include('includes/footer.php'); } @@ -153,15 +153,8 @@ ?> - - - - - - <?php function GetMailGroup () { -global $db; //GET the mailing group data if there are any $sql = "SELECT groupname, id FROM mailgroups ORDER BY groupname"; $ErrMsg = _('Failed to retrieve mail groups information'); @@ -174,7 +167,7 @@ while($myrow = DB_fetch_array($result)){ ?> <tr><td><?php echo $myrow['groupname']; ?></td> - + <td><?php echo '<a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'?GroupId='.$myrow['id'].'&Edit=1&GroupName='.$myrow['groupname'].'" >' . _('Edit') . '</a>'; ?></td> <td><?php echo '<a href="'.htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8').'?Id='.$myrow['id'].'&Delete=1" onclick="return confirm(\'' ._('Are you sure you wish to delete this group?').'\');">' . _('Delete') . '</a>'; ?></td> </tr> @@ -188,25 +181,24 @@ } function GetUsers ($GroupId,$GroupName) { - global $db; $sql = "SELECT userid FROM mailgroups INNER JOIN mailgroupdetails ON mailgroups.groupname=mailgroupdetails.groupname WHERE mailgroups.id = '".$GroupId."'"; $ErrMsg = _('Failed to retrieve userid'); $result = DB_query($sql,$ErrMsg); - + $UsersAssigned = array(); if(DB_num_rows($result) != 0){ - $i = 0; + $i = 0; while($myrow = DB_fetch_array($result)){ $UsersAssigned[$i] = $myrow['userid']; $i++; } } - + $sql = "SELECT userid, realname, email FROM www_users ORDER BY realname"; $ErrMsg = _('Failed to retrieve user information'); $result = DB_query($sql,$ErrMsg); if(DB_num_rows($result) != 0){ - + ?> <div class="centre"><?php echo _('Current Mail Group').' : '.$GroupName; ?></div> <div class="centre"><a href="<?php echo htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8'); ?>"><?php echo _('View All Groups'); ?></a></div> @@ -230,7 +222,7 @@ <?php $k = 0; } - + if(in_array($myrow['userid'],$UsersAssigned)){ ?> <td><?php echo $myrow['userid']; ?></td> @@ -267,4 +259,4 @@ exit; } } -?> +?> \ No newline at end of file Modified: trunk/PcClaimExpensesFromTab.php =================================================================== --- trunk/PcClaimExpensesFromTab.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/PcClaimExpensesFromTab.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -165,7 +165,7 @@ )"; $Msg = _('The expense claim on tab') . ' ' . $_POST['SelectedTabs'] . ' ' . _('has been created'); $Result = DB_query($SQL); - $SelectedIndex = DB_Last_Insert_ID($db, 'pcashdetails', 'counterindex'); + $SelectedIndex = DB_Last_Insert_ID('pcashdetails', 'counterindex'); foreach ($_POST as $Index => $Value) { if (substr($Index, 0, 5) == 'index') { $Index = $Value; Modified: trunk/RecurringSalesOrders.php =================================================================== --- trunk/RecurringSalesOrders.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/RecurringSalesOrders.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -267,7 +267,7 @@ $DbgMsg = _('The SQL that failed was'); $InsertQryResult = DB_query($HeaderSQL,$ErrMsg,$DbgMsg,true); - $RecurrOrderNo = DB_Last_Insert_ID($db,'recurringsalesorders','recurrorderno'); + $RecurrOrderNo = DB_Last_Insert_ID('recurringsalesorders','recurrorderno'); echo 'xxx'.$RecurrOrderNo; $StartOf_LineItemsSQL = "INSERT INTO recurrsalesorderdetails (recurrorderno, stkcode, Modified: trunk/RecurringSalesOrdersProcess.php =================================================================== --- trunk/RecurringSalesOrdersProcess.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/RecurringSalesOrdersProcess.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -367,7 +367,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($LineTaxes[$LineCounter] as $Tax) { @@ -683,7 +683,7 @@ $DbgMsg = _('The following SQL to insert the debtor transaction record was used'); $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); $SQL = "INSERT INTO debtortranstaxes (debtortransid, @@ -724,4 +724,4 @@ }/*end while there are recurring orders due to have a new order created */ include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/ReverseGRN.php =================================================================== --- trunk/ReverseGRN.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/ReverseGRN.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -257,7 +257,7 @@ $DbgMsg = _('The following SQL to insert the stock movement records was used'); $Result=DB_query($SQL,$ErrMsg,$DbgMsg,true); - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); if ($Controlled==true){ while ($SerialStockMoves = DB_fetch_array($GetStockMoveResult)){ @@ -463,4 +463,4 @@ } } include ('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/SelectCreditItems.php =================================================================== --- trunk/SelectCreditItems.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SelectCreditItems.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1171,7 +1171,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); - $CreditTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $CreditTransID = DB_Last_Insert_ID('debtortrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($TaxTotals AS $TaxAuthID => $TaxAmount) { @@ -1332,7 +1332,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the stockmoveno from above - need to ref StockMoveTaxes and possibly SerialStockMoves */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($CreditLine->Taxes as $Tax) { @@ -1613,7 +1613,7 @@ /*Its a write off too still so need to process the serial items written off */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); foreach($CreditLine->SerialItems as $Item){ /*no need to check StockSerialItems record exists @@ -2024,4 +2024,4 @@ } /*end of process credit note */ include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/SelectOrderItems.php =================================================================== --- trunk/SelectOrderItems.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SelectOrderItems.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1888,7 +1888,6 @@ include('includes/footer.php'); function GetCustBranchDetails($identifier) { - global $db; $sql = "SELECT custbranch.brname, custbranch.branchcode, custbranch.braddress1, @@ -1917,4 +1916,4 @@ $result = DB_query($sql,$ErrMsg,$DbgMsg); return $result; } -?> +?> \ No newline at end of file Modified: trunk/SelectQASamples.php =================================================================== --- trunk/SelectQASamples.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SelectQASamples.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -106,7 +106,7 @@ } else { CreateQASample($_POST['ProdSpecKey'],$_POST['LotKey'], $_POST['Identifier'], $_POST['Comments'], $_POST['Cert'], $_POST['DuplicateOK'],$db); - $SelectedSampleID=DB_Last_Insert_ID($db,'qasamples','sampleid'); + $SelectedSampleID=DB_Last_Insert_ID('qasamples','sampleid'); if ($SelectedSampleID > '') { $msg = _('Created New Sample'); prnMsg($msg , 'success'); Modified: trunk/StockAdjustments.php =================================================================== --- trunk/StockAdjustments.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/StockAdjustments.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -240,7 +240,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ @@ -540,4 +540,4 @@ </div> </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/StockLocTransferReceive.php =================================================================== --- trunk/StockLocTransferReceive.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/StockLocTransferReceive.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -113,7 +113,7 @@ $Result = DB_query($SQL,$ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ @@ -267,7 +267,7 @@ /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ if($TrfLine->Controlled ==1) { Modified: trunk/StockTransfers.php =================================================================== --- trunk/StockTransfers.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/StockTransfers.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -283,7 +283,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ @@ -437,7 +437,7 @@ $Result = DB_query($SQL,$ErrMsg,$DbgMsg,true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the StockSerialMovements and update the StockSerialItems for controlled items*/ Modified: trunk/SupplierCredit.php =================================================================== --- trunk/SupplierCredit.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SupplierCredit.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1145,7 +1145,7 @@ $DbgMsg = _('The following SQL to insert the supplier credit note was used'); $Result = DB_query($SQL, $ErrMsg, $DbgMsg, True); - $SuppTransID = DB_Last_Insert_ID($db,'supptrans','id'); + $SuppTransID = DB_Last_Insert_ID('supptrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($_SESSION['SuppTrans']->Taxes AS $TaxTotals) { @@ -1341,4 +1341,4 @@ echo '</div> </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/SupplierInvoice.php =================================================================== --- trunk/SupplierInvoice.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/SupplierInvoice.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -1518,7 +1518,7 @@ $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The supplier invoice transaction could not be added to the database because'); $DbgMsg = _('The following SQL to insert the supplier invoice was used'); $Result = DB_query($SQL, $ErrMsg, $DbgMsg, True); - $SuppTransID = DB_Last_Insert_ID($db,'supptrans','id'); + $SuppTransID = DB_Last_Insert_ID('supptrans','id'); /* Insert the tax totals for each tax authority where tax was charged on the invoice */ foreach ($_SESSION['SuppTrans']->Taxes AS $TaxTotals) { @@ -1925,4 +1925,4 @@ } //end of return link for input errors include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/TaxAuthorities.php =================================================================== --- trunk/TaxAuthorities.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/TaxAuthorities.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -74,7 +74,7 @@ $msg = _('The new tax authority record has been added to the database'); - $NewTaxID = DB_Last_Insert_ID($db,'taxauthorities','taxid'); + $NewTaxID = DB_Last_Insert_ID('taxauthorities','taxid'); $sql = "INSERT INTO taxauthrates ( taxauthority, @@ -337,4 +337,4 @@ </div>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/TaxCategories.php =================================================================== --- trunk/TaxCategories.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/TaxCategories.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -88,7 +88,7 @@ $ErrMsg = _('The new tax category could not be added'); $result = DB_query($sql,$ErrMsg,true); - $LastTaxCatID = DB_Last_Insert_ID($db, 'taxcategories','taxcatid'); + $LastTaxCatID = DB_Last_Insert_ID('taxcategories','taxcatid'); $sql = "INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, @@ -256,4 +256,4 @@ </div>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/TaxProvinces.php =================================================================== --- trunk/TaxProvinces.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/TaxProvinces.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -90,7 +90,7 @@ $ErrMsg = _('Could not add tax province'); $result = DB_query($sql, $ErrMsg); - $TaxProvinceID = DB_Last_Insert_ID($db, 'taxprovinces', 'taxprovinceid'); + $TaxProvinceID = DB_Last_Insert_ID('taxprovinces', 'taxprovinceid'); $sql = "INSERT INTO taxauthrates (taxauthority, dispatchtaxprovince, taxcatid) SELECT taxauthorities.taxid, '" . $TaxProvinceID . "', taxcategories.taxcatid FROM taxauthorities CROSS JOIN taxcategories"; @@ -247,4 +247,4 @@ </div>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/WorkOrderIssue.php =================================================================== --- trunk/WorkOrderIssue.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/WorkOrderIssue.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -233,7 +233,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /* Do the Controlled Item INSERTS HERE */ if ($IssueItemRow['controlled'] ==1){ @@ -1190,4 +1190,4 @@ </form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/WorkOrderReceive.php =================================================================== --- trunk/WorkOrderReceive.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/WorkOrderReceive.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -492,7 +492,7 @@ $Result = DB_query($SQL, $ErrMsg, $DbgMsg, true); /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /* Do the Controlled Item INSERTS HERE */ if ($WORow['controlled'] ==1){ @@ -1021,4 +1021,4 @@ echo '</form>'; include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/Z_AutoCustomerAllocations.php =================================================================== --- trunk/Z_AutoCustomerAllocations.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Z_AutoCustomerAllocations.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -116,7 +116,6 @@ include('includes/footer.php'); function ProcessAllocation() { - global $db; if ($InputError==0) { // //========[ START TRANSACTION ]=========== @@ -240,4 +239,4 @@ } } -?> +?> \ No newline at end of file Modified: trunk/Z_ChangeSupplierCode.php =================================================================== --- trunk/Z_ChangeSupplierCode.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Z_ChangeSupplierCode.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -37,7 +37,6 @@ function ProcessSupplier($oldCode, $newCode) { - global $db; $table_key= array ( 'grns' => 'supplierid', 'offers'=>'supplierid', @@ -106,7 +105,6 @@ } function checkSupplierExist($codeSupplier) { - global $db; $result=DB_query("SELECT supplierid FROM suppliers WHERE supplierid='" . $codeSupplier . "'"); if (DB_num_rows($result)==0) return false; return true; @@ -121,4 +119,4 @@ } return true; } -?> +?> \ No newline at end of file Modified: trunk/Z_ImportFixedAssets.php =================================================================== --- trunk/Z_ImportFixedAssets.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Z_ImportFixedAssets.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -219,7 +219,7 @@ if (DB_error_no() ==0) { //the insert of the new code worked so bang in the fixedassettrans records too - $AssetID = DB_Last_Insert_ID($db, 'fixedassets','assetid'); + $AssetID = DB_Last_Insert_ID('fixedassets','assetid'); $sql = "INSERT INTO fixedassettrans ( assetid, transtype, transno, @@ -313,4 +313,4 @@ } include('includes/footer.php'); -?> +?> \ No newline at end of file Modified: trunk/Z_ImportGLTransactions.php =================================================================== --- trunk/Z_ImportGLTransactions.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/Z_ImportGLTransactions.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -266,8 +266,6 @@ include('includes/footer.php'); function IsBankAccount($Account) { - global $db; - $sql ="SELECT accountcode FROM bankaccounts WHERE accountcode='" . $Account . "'"; $result = DB_query($sql); if (DB_num_rows($result)==0) { @@ -277,4 +275,4 @@ } } -?> +?> \ No newline at end of file Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/api/api_debtortransactions.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -803,7 +803,7 @@ $Result = api_DB_query($SQL,'','',true); } /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($LineTaxes[$LineCounter] as $Tax) { @@ -1088,7 +1088,7 @@ $Result = api_DB_query($SQL,'','',true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /*for each Tax - need to insert into debtortranstaxes */ foreach ($TaxTotals AS $TaxAuthID => $Tax) { Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/api/api_salesorders.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -970,7 +970,7 @@ $Result = api_DB_query($SQL,'','',true); } /*Get the ID of the StockMove... */ - $StkMoveNo = DB_Last_Insert_ID($db,'stockmoves','stkmoveno'); + $StkMoveNo = DB_Last_Insert_ID('stockmoves','stkmoveno'); /*Insert the taxes that applied to this line */ foreach ($LineTaxes[$LineCounter] as $Tax) { @@ -1263,7 +1263,7 @@ $Result = api_DB_query($SQL,'','',true); - $DebtorTransID = DB_Last_Insert_ID($db,'debtortrans','id'); + $DebtorTransID = DB_Last_Insert_ID('debtortrans','id'); /*for each Tax - need to insert into debtortranstaxes */ foreach ($TaxTotals AS $TaxAuthID => $Tax) { Modified: trunk/doc/Change.log =================================================================== --- trunk/doc/Change.log 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/doc/Change.log 2018-02-05 02:34:31 UTC (rev 7936) @@ -1,5 +1,6 @@ webERP Change Log +2/4/18 PaulT: Remove unused $db and $conn parameters from DB_Last_Insert_ID() and (where present) from DB_show_tables(), and DB_show_fields(). Also, remove any unused 'global $db' references across the code base. 2/4/18 Paul Becker (PaulT commit): MRPPlannedPurchaseOrders.php: Add capability to review planned purchase orders and add a new link to convert to a new PO. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8061) 2/4/18 Paul Becker (PaulT commit): PrintCustOrder.php, PrintCustOrder_generic.php, PDFOrderPageHeader_generic.inc: Add units, volume, and weight info, date/signature lines, sales order details narrative, plus other minor PDF formatting. (Reported in forums: http://www.weberp.org/forum/showthread.php?tid=8048) 2/4/18 PaulT: Remove unused $db parameter from DB_fetch_array() and DB_Query() functions. Also, rename several DB_Query names to match function definition name: DB_query. Modified: trunk/includes/ConnectDB_mysql.inc =================================================================== --- trunk/includes/ConnectDB_mysql.inc 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/ConnectDB_mysql.inc 2018-02-05 02:34:31 UTC (rev 7936) @@ -4,10 +4,11 @@ define('LIKE', 'LIKE'); -global $db;// Make sure it IS global, regardless of our context if(!isset($mysqlport)) { $mysqlport = 3306; } +global $db;// Make sure it IS global, regardless of our context + $db = mysql_connect($host . ':' . $mysqlport, $DBUser, $DBPassword); //this statement sets the charset to be used for sending data to and from the db server @@ -14,10 +15,6 @@ //if not set, both mysql server and mysql client/library may assume otherwise mysql_set_charset('utf8', $db); -//$varabc = mysql_client_encoding($db); -//printf("client encoding is %s\n", $varabc); - - if(!$db) { echo '<br />' . _('The configuration in the file config.php for the database user name and password do not provide the information required to connect to the database server'); session_unset(); @@ -29,10 +26,9 @@ /* Update to allow RecurringSalesOrdersProcess.php to run via cron */ if(isset($DatabaseName)) { - if(! mysql_select_db($_SESSION['DatabaseName'],$db)) { echo '<br />' . _('The company name entered does not correspond to a database on the database server specified in the config.php configuration file. Try logging in with a different company name'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</A>'; + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; unset($_SESSION['DatabaseName']); exit; } @@ -39,14 +35,12 @@ } else { if(! mysql_select_db($_SESSION['DatabaseName'],$db)) { echo '<br />' . _('The company name entered does not correspond to a database on the database server specified in the config.php configuration file. Try logging in with a different company name'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</A>'; + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; unset($_SESSION['DatabaseName']); exit; } } -require_once($PathPrefix . 'includes/MiscFunctions.php'); - //DB wrapper functions to change only once for whole application function DB_query($SQL, $ErrorMessage='', $DebugMessage= '', $Transaction=false, $TrapErrors=true) { @@ -69,12 +63,12 @@ prnMsg($ErrorMessage . '<br />' . DB_error_msg(), 'error', _('Database Error')); if($debug == 1) { prnMsg($DebugMessage . '<br />' . $SQL . '<br />', 'error', _('Database SQL Failure')); - } + } if($Transaction) { $SQL = 'rollback'; $Result = DB_query($SQL); if(DB_error_no() != 0) { - prnMsg(_('Error Rolling Back Transaction'), '', _('Database Rollback Error') ); + prnMsg(_('Error Rolling Back Transaction'), 'error', _('Database Rollback Error') ); } } if($TrapErrors) { @@ -103,7 +97,6 @@ } return $result; - } function DB_fetch_row($ResultIndex) { @@ -147,7 +140,7 @@ return mysql_error($db); } -function DB_Last_Insert_ID(&$Conn='',$table, $fieldname) { +function DB_Last_Insert_ID($table, $fieldname) { // return mysql_insert_id($db); if (isset($_SESSION['LastInsertId'])) { $Last_Insert_ID = $_SESSION['LastInsertId']; @@ -162,58 +155,58 @@ return mysql_real_escape_string($String); } -function DB_show_tables(&$Conn='') { +function DB_show_tables() { $Result = DB_query('SHOW TABLES'); return $Result; } -function DB_show_fields($TableName, &$Conn='') { +function DB_show_fields($TableName) { $Result = DB_query("DESCRIBE $TableName"); return $Result; } function interval( $val, $Inter ) { - global $DBType; - return "\n".'interval ' . $val . ' '. $Inter."\n"; + return "\n".'interval ' . $val . ' ' . $Inter . "\n"; } function DB_Maintenance() { prnMsg(_('The system has just run the regular database administration and optimisation routine.'),'info'); - $TablesResult = DB_query('SHOW TABLES'); + + $TablesResult = DB_show_tables(); while ($myrow = DB_fetch_row($TablesResult)) { $Result = DB_query('OPTIMIZE TABLE ' . $myrow[0]); } $Result = DB_query("UPDATE config - SET confvalue='" . Date('Y-m-d') . "' - WHERE confname='DB_Maintenance_LastRun'"); + SET confvalue = CURRENT_DATE + WHERE confname = 'DB_Maintenance_LastRun'"); } function DB_Txn_Begin() { global $db; - mysql_query("SET autocommit=0",$db); - mysql_query("START TRANSACTION",$db); + mysql_query('SET autocommit=0',$db); + mysql_query('START TRANSACTION',$db); } function DB_Txn_Commit() { global $db; - mysql_query("COMMIT",$db); - mysql_query("SET autocommit=1",$db); + mysql_query('COMMIT',$db); + mysql_query('SET autocommit=1',$db); } function DB_Txn_Rollback() { global $db; - mysql_query("ROLLBACK",$db); + mysql_query('ROLLBACK',$db); } function DB_IgnoreForeignKeys() { global $db; - mysql_query("SET FOREIGN_KEY_CHECKS=0",$db); + mysql_query('SET FOREIGN_KEY_CHECKS=0',$db); } function DB_ReinstateForeignKeys() { global $db; - mysql_query("SET FOREIGN_KEY_CHECKS=1",$db); + mysql_query('SET FOREIGN_KEY_CHECKS=1',$db); } -?> +?> \ No newline at end of file Modified: trunk/includes/ConnectDB_mysqli.inc =================================================================== --- trunk/includes/ConnectDB_mysqli.inc 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/ConnectDB_mysqli.inc 2018-02-05 02:34:31 UTC (rev 7936) @@ -15,9 +15,7 @@ global $db; // Make sure it IS global, regardless of our context $db = mysqli_connect($host , $DBUser, $DBPassword,$_SESSION['DatabaseName'], $mysqlport); -//$result=DB_query('SET sql_mode = ANSI'); - //this statement sets the charset to be used for sending data to and from the db server //if not set, both mysqli server and mysqli client/library may assume otherwise mysqli_set_charset($db, 'utf8'); @@ -40,7 +38,7 @@ if(isset($DatabaseName)) { if(!mysqli_select_db($db,$DatabaseName)) { echo '<br />' . _('The company name entered does not correspond to a database on the database server specified in the config.php configuration file. Try logging in with a different company name'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</A>'; + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; unset ($DatabaseName); exit; } @@ -47,8 +45,7 @@ } else { if(!mysqli_select_db($db,$_SESSION['DatabaseName'])) { echo '<br />' . _('The company name entered does not correspond to a database on the database server specified in the config.php configuration file. Try logging in with a different company name'); - echo '<br /><a href="index.php">' . _('Back to login page') . '</A>'; - + echo '<br /><a href="index.php">' . _('Back to login page') . '</a>'; unset ($_SESSION['DatabaseName']); exit; } @@ -63,7 +60,6 @@ global $db; $result = mysqli_query($db, $SQL); - $_SESSION['LastInsertId'] = mysqli_insert_id($db); if($DebugMessage == '') { @@ -111,6 +107,7 @@ } } } + return $result; } @@ -146,7 +143,6 @@ function DB_affected_rows($ResultIndex) { global $db; return mysqli_affected_rows($db); - } function DB_error_no() { @@ -159,7 +155,7 @@ return mysqli_error($db); } -function DB_Last_Insert_ID($Conn='', $Table, $FieldName) { +function DB_Last_Insert_ID($Table, $FieldName) { // return mysqli_insert_id($Conn); if(isset($_SESSION['LastInsertId'])) { $Last_Insert_ID = $_SESSION['LastInsertId']; @@ -175,33 +171,31 @@ return mysqli_real_escape_string($db, $String); } -function DB_show_tables($Conn='') { - global $db; +function DB_show_tables() { $Result = DB_query('SHOW TABLES'); return $Result; } -function DB_show_fields($TableName, $Conn='') { +function DB_show_fields($TableName) { $Result = DB_query("DESCRIBE $TableName"); return $Result; } -function interval($val, $Inter) { - global $dbtype; - return "\n".'interval ' . $val . ' ' . $Inter . "\n"; +function interval( $val, $Inter ) { + return "\n".'interval ' . $val . ' ' . $Inter . "\n"; } function DB_Maintenance() { prnMsg(_('The system has just run the regular database administration and optimisation routine.'),'info'); - $TablesResult = DB_query("SHOW TABLES"); + $TablesResult = DB_show_tables(); while ($myrow = DB_fetch_row($TablesResult)) { $Result = DB_query('OPTIMIZE TABLE ' . $myrow[0]); } $Result = DB_query("UPDATE config - SET confvalue='" . Date('Y-m-d') . "' - WHERE confname='DB_Maintenance_LastRun'"); + SET confvalue = CURRENT_DATE + WHERE confname = 'DB_Maintenance_LastRun'"); } function DB_Txn_Begin() { @@ -230,4 +224,4 @@ global $db; mysqli_query($db, 'SET FOREIGN_KEY_CHECKS=1'); } -?> +?> \ No newline at end of file Modified: trunk/includes/ConnectDB_postgres.inc =================================================================== --- trunk/includes/ConnectDB_postgres.inc 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/ConnectDB_postgres.inc 2018-02-05 02:34:31 UTC (rev 7936) @@ -18,15 +18,15 @@ } } -global $db; // Make sure it IS global, regardless of our context +global $db; // Make sure it IS global, regardless of our context $db = pg_connect( $PgConnStr ); if( !$db ) { if($debug==1) { - echo '<BR>' . $PgConnStr . '<BR>'; + echo '<br>' . $PgConnStr . '<br>'; } - echo '<BR>' . _('The company name entered together with the configuration in the file config.php for the database user name and password do not provide the information required to connect to the database.') . '<BR><BR>' . _(' Try logging in with an alternative company name.'); - echo '<BR><A HREF="index.php">' . _('Back to login page') . '</A>'; + echo '<br>' . _('The company name entered together with the configuration in the file config.php for the database user name and password do not provide the information required to connect to the database.') . '<br><br>' . _(' Try logging in with an alternative company name.'); + echo '<br><a href="index.php">' . _('Back to login page') . '</a>'; unset($_SESSION['DatabaseName']); exit; } @@ -48,7 +48,7 @@ if($DebugMessage == '') { $DebugMessage = _('The SQL that failed was:'); } - //if(DB_error_no($Conn) != 0) { + if( !$result AND $TrapErrors) { if($TrapErrors) { require_once($PathPrefix . 'includes/header.php'); @@ -60,7 +60,7 @@ if($Transaction) { $SQL = 'rollback'; $Result = DB_query($SQL); - if(DB_error_no($Conn) !=0) { + if(DB_error_no() !=0) { prnMsg('<br />' . _('Error Rolling Back Transaction!!'), '', _('DB DEBUG:') ); } } @@ -109,10 +109,11 @@ } function DB_error_msg() { + global $db; return pg_last_error($db); } -function DB_Last_Insert_ID(&$Conn, $table, $fieldname) { +function DB_Last_Insert_ID($table, $fieldname) { $tempres = DB_query ("SELECT currval('".$table."_".$fieldname."_seq') FROM ".$table); $Res = pg_fetch_result( $tempres, 0, 0 ); DB_free_result($tempres); @@ -124,14 +125,13 @@ } function INTERVAL( $val, $Inter ) { - global $dbtype; return "\n(CAST( (" . $val . ") as text ) || ' ". $Inter ."')::interval\n"; } -function DB_show_tables(&$Conn) { +function DB_show_tables() { $Result =DB_query("SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"); return $Result; } -function DB_show_fields($TableName,&$Conn) { +function DB_show_fields($TableName) { $Result = DB_query("SELECT table_name FROM information_schema.tables WHERE table_schema='public' AND table_name='" . $TableName . "'"); if(DB_num_rows($Result)==1) { $Result = DB_query("SELECT column_name FROM information_schema.columns WHERE table_name ='$TableName'"); @@ -145,8 +145,8 @@ $Result = DB_query('VACUUM ANALYZE'); $Result = DB_query("UPDATE config - SET confvalue='" . Date('Y-m-d') . "' - WHERE confname='DB_Maintenance_LastRun'"); + SET confvalue = CURRENT_DATE + WHERE confname = 'DB_Maintenance_LastRun'"); } -?> +?> \ No newline at end of file Modified: trunk/includes/DefineCartClass.php =================================================================== --- trunk/includes/DefineCartClass.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/DefineCartClass.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -155,7 +155,6 @@ being retrieved from the DB - dont want to add them again - would return errors anyway */ - global $db; $sql = "INSERT INTO salesorderdetails (orderlineno, orderno, stkcode, @@ -203,7 +202,6 @@ $this->LineItems[$UpdateLineNumber]->POLine = $POLine; $this->LineItems[$UpdateLineNumber]->GPPercent = $GPPercent; if ($UpdateDB=='Yes'){ - global $db; $result = DB_query("UPDATE salesorderdetails SET quantity=" . $Qty . ", unitprice=" . $Price . ", discountpercent=" . $Disc . ", @@ -223,7 +221,6 @@ return; } if ($UpdateDB=='Yes'){ - global $db; if ($this->Some_Already_Delivered($LineNumber)==0){ /* nothing has been delivered, delete it. */ $result = DB_query("DELETE FROM salesorderdetails @@ -295,9 +292,6 @@ } function GetExistingTaxes($LineNumber, $stkmoveno){ - - global $db; - /*Gets the Taxes and rates applicable to this line from the TaxGroup of the branch and TaxCategory of the item and the taxprovince of the dispatch location */ @@ -328,9 +322,6 @@ } //end method GetExistingTaxes function GetTaxes($LineNumber){ - - global $db; - /*Gets the Taxes and rates applicable to this line from the TaxGroup of the branch and TaxCategory of the item and the taxprovince of the dispatch location */ @@ -369,9 +360,6 @@ } //end method GetTaxes function GetFreightTaxes () { - - global $db; - /*Gets the Taxes and rates applicable to the freight based on the tax group of the branch combined with the tax category for this particular freight and SESSION['FreightTaxCategory'] the taxprovince of the dispatch location */ Modified: trunk/includes/DefineContractClass.php =================================================================== --- trunk/includes/DefineContractClass.php 2018-02-04 21:16:59 UTC (rev 7935) +++ trunk/includes/DefineContractClass.php 2018-02-05 02:34:31 UTC (rev 7936) @@ -36,7 +36,7 @@ $this->RequirementsCounter=0; $this->Status = 0; } - + function Contract() { self::__construct; } @@ -65,7 +65,6 @@ } function Remove_ContractComponent($ContractComponent_ID){ - global $db; $result = DB_query("DELETE FROM contractbom WHERE contractref='" . $this->ContractRef . "' AND stockid='" . $this->ContractBOM[$ContractComponent_ID]->StockID . "'"); @@ -89,7 +88,6 @@ } function Remove_ContractRequirement($ContractRequirementID){ - global $db; $result = DB_query("DELETE FROM contractreqts WHERE contractreqid='" . $this->ContractReqts[$ContractRequirementID]->ContractReqID . "'"); unset($this->ContractReqts[$ContractRequirementID]); } Modified:... [truncated message content] |