Skip to content

Commit

Permalink
Remove unused $db parameter from DB_query(), DB_error_no() and DB_err…
Browse files Browse the repository at this point in the history
…or_msg() other DB-related function calls.
  • Loading branch information
TurboPT authored and timschofield committed Feb 26, 2018
1 parent 439e346 commit e506e54
Show file tree
Hide file tree
Showing 23 changed files with 70 additions and 69 deletions.
4 changes: 2 additions & 2 deletions BOMIndented.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
FROM stockmaster
WHERE stockid = " . "'" . $_POST['Part'] . "'";
$result = DB_query($sql);
$myrow = DB_fetch_array($result,$db);
$myrow = DB_fetch_array($result);
$assembly = $_POST['Part'];
$assemblydesc = $myrow['description'];

Expand All @@ -190,7 +190,7 @@

$ListCount = DB_num_rows($result);

while ($myrow = DB_fetch_array($result,$db)){
while ($myrow = DB_fetch_array($result)){

$YPos -=$line_height;
$FontSize=8;
Expand Down
4 changes: 2 additions & 2 deletions BOMIndentedReverse.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
FROM stockmaster
WHERE stockid = '" . $_POST['Part'] . "'";
$result = DB_query($sql);
$myrow = DB_fetch_array($result,$db);
$myrow = DB_fetch_array($result);
$Assembly = $_POST['Part'];
$AssemblyDesc = $myrow['description'];

Expand All @@ -176,7 +176,7 @@

$ListCount = DB_num_rows($result);

While ($myrow = DB_fetch_array($result,$db)){
While ($myrow = DB_fetch_array($result)){

$YPos -=$line_height;
$FontSize=8;
Expand Down
4 changes: 2 additions & 2 deletions BOMs.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) {
AND ! isset($_POST['submit'])) {

/* It could still be the second time the page has been run and a record has been selected for modification - SelectedParent will exist because it was sent with the new call. if its the first time the page has been displayed with no parameters then none of the above are true and the list of components will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/
//DisplayBOMItems($SelectedParent, $db);
//DisplayBOMItems($SelectedParent);

} //BOM editing/insertion ifs

Expand All @@ -487,7 +487,7 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) {
$SelectedParent = $_GET['ReSelect'];
}

//DisplayBOMItems($SelectedParent, $db);
//DisplayBOMItems($SelectedParent);
$sql = "SELECT stockmaster.description,
stockmaster.mbflag
FROM stockmaster
Expand Down
4 changes: 2 additions & 2 deletions BOMs_SingleLevel.php
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) {
AND ! isset($_POST['submit'])) {

/* It could still be the second time the page has been run and a record has been selected for modification - SelectedParent will exist because it was sent with the new call. if its the first time the page has been displayed with no parameters then none of the above are true and the list of components will be displayed with links to delete or edit each. These will call the same page again and allow update/input or deletion of the records*/
//DisplayBOMItems($SelectedParent, $db);
//DisplayBOMItems($SelectedParent);

} //BOM editing/insertion ifs

Expand All @@ -409,7 +409,7 @@ function DisplayBOMItems($UltimateParent, $Parent, $Component,$Level, $db) {
$SelectedParent = $_GET['ReSelect'];
}

//DisplayBOMItems($SelectedParent, $db);
//DisplayBOMItems($SelectedParent);
$sql = "SELECT stockmaster.description,
stockmaster.mbflag
FROM stockmaster
Expand Down
4 changes: 2 additions & 2 deletions GLBalanceSheet.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
$periodno=GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
$sql = "SELECT lastdate_in_period FROM periods WHERE periodno='".$periodno . "'";
$result = DB_query($sql);
$myrow=DB_fetch_array($result, $db);
$myrow=DB_fetch_array($result);
$lastdate_in_period=$myrow[0];

$sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno DESC";
$Periods = DB_query($sql);

while ($myrow=DB_fetch_array($Periods,$db)){
while ($myrow=DB_fetch_array($Periods)){
if( $myrow['periodno']== $periodno){
echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . ConvertSQLDate($lastdate_in_period) . '</option>';
} else {
Expand Down
6 changes: 3 additions & 3 deletions GLTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//first off test there are no transactions created with this tag
$Result = DB_query("SELECT counterindex
FROM gltrans
WHERE tag='" . $_GET['SelectedTag'] . "'",$db);
WHERE tag='" . $_GET['SelectedTag'] . "'");
if (DB_num_rows($Result)>0){
prnMsg(_('This tag cannot be deleted since there are already general ledger transactions created using it.'),'error');
} else {
Expand All @@ -30,7 +30,7 @@
WHERE tagref='".$_GET['SelectedTag']."'";

$result= DB_query($sql);
$myrow = DB_fetch_array($result,$db);
$myrow = DB_fetch_array($result);
$ref=$myrow['tagref'];
$Description = $myrow['tagdescription'];
}
Expand Down Expand Up @@ -89,7 +89,7 @@

$result= DB_query($sql);

while ($myrow = DB_fetch_array($result,$db)){
while ($myrow = DB_fetch_array($result)){
echo '<tr>
<td>' . $myrow['tagref'] . '</td>
<td>' . $myrow['tagdescription'] . '</td>
Expand Down
8 changes: 4 additions & 4 deletions MRPPlannedPurchaseOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
$totalpartcost = 0;
$Total_Extcost = 0;

while ($myrow = DB_fetch_array($result,$db)){
while ($myrow = DB_fetch_array($result)){
$YPos -=$line_height;

// Print information on part break
Expand Down Expand Up @@ -370,21 +370,21 @@ function GetPartInfo(&$db,$part) {
ORDER BY orddate DESC LIMIT 1";
$result = DB_query($sql);
if (DB_num_rows($result)>0) {
$myrow = DB_fetch_array($result,$db);
$myrow = DB_fetch_array($result);
$PartInfo[] = ConvertSQLDate($myrow['maxdate']);
$OrderNo= $myrow['orderno'];
$sql = "SELECT supplierno
FROM purchorders
WHERE purchorders.orderno = '" .$OrderNo. "'";
$result = DB_query($sql);
$myrow = DB_fetch_array($result,$db);
$myrow = DB_fetch_array($result);
$PartInfo[] = $myrow['supplierno'];
$sql = "SELECT supplierno
FROM purchdata
WHERE stockid = '" . $part . "'
AND preferred='1'";
$result = DB_query($sql);
$myrow = DB_fetch_array($result,$db);
$myrow = DB_fetch_array($result);
$PartInfo[] = $myrow['supplierno'];
return $PartInfo;
} else {
Expand Down
4 changes: 2 additions & 2 deletions PDFSalesBySalesperson.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
AND salesorders.quotation=0
ORDER BY custbranch.salesman, salesorders.orderno";

$Result=DB_query($sql,$db,'','',false,false); //dont trap errors here
$Result=DB_query($sql,'','',false,false); //dont trap errors here

if (DB_error_no($db)!=0){
if (DB_error_no()!=0){
include('includes/header.php');
echo '<br />' . _('An error occurred getting the orders details');
if ($debug==1){
Expand Down
8 changes: 4 additions & 4 deletions PDFWeeklyOrders.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
AND salesorders.quotation=0
ORDER BY salesorders.orderno";

$Result=DB_query($sql,$db,'','',false,false); //dont trap errors here
$Result=DB_query($sql,'','',false,false); //dont trap errors here

if (DB_error_no($db)!=0){
if (DB_error_no()!=0){
include('includes/header.php');
echo '<br />' . _('An error occurred getting the orders details');
if ($debug==1){
Expand Down Expand Up @@ -169,8 +169,8 @@
AND trandate>='" . $_POST['FromDate'] . "'
AND trandate<='" . $_POST['ToDate'] . "'";

$ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg($db);
$SalesResult = DB_query($sql, $db,$ErrMsg);
$ErrMsg = _('The sales data could not be retrieved because') . ' - ' . DB_error_msg();
$SalesResult = DB_query($sql, $ErrMsg);
while ($DaySalesRow=DB_fetch_array($SalesResult)) {
$TotalSalesValue += $DaySalesRow['salesvalue'];
$TotalSalesCost += $DaySalesRow['cost'];
Expand Down
14 changes: 7 additions & 7 deletions PcAssignCashTabToTab.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
FROM pctabs
WHERE tabcode IN ('" . $SelectedTabs . "','" . $SelectedTabsTo . "')";

$ResultLimit = DB_query($SQLLimit,$db);
$ResultLimit = DB_query($SQLLimit);
while ($LimitRow = DB_fetch_array($ResultLimit)){
if ($LimitRow['tabcode'] == $SelectedTabs) {
if (($_POST['CurrentAmount'] + $_POST['Amount']) > $LimitRow['tablimit']){
Expand Down Expand Up @@ -140,7 +140,7 @@

if ( $InputError != 1) {
//run the SQL from either of the above possibilites
$Result = DB_query($SQL,$db);
$Result = DB_query($SQL);
prnMsg($msg,'success');
unset($_POST['SelectedExpense']);
unset($_POST['Amount']);
Expand All @@ -165,7 +165,7 @@
WHERE assigner = '" . $_SESSION['UserID'] . "'
ORDER BY tabcode";

$Result = DB_query($SQL,$db);
$Result = DB_query($SQL);

echo '<br /><table class="selection">'; //Main table

Expand Down Expand Up @@ -242,7 +242,7 @@
FROM currencies,pctabs
WHERE currencies.currabrev = pctabs.currency
AND tabcode = '" . $SelectedTabs . "'";
$Result = DB_query($SQLDecimalPlaces,$db);
$Result = DB_query($SQLDecimalPlaces);
$MyRow = DB_fetch_array($Result);
$CurrDecimalPlaces = $MyRow['decimalplaces'];

Expand All @@ -259,7 +259,7 @@
WHERE tabcode='" . $SelectedTabs . "'
AND date >= DATE_SUB(CURDATE(), INTERVAL " . $Days . " DAY)
ORDER BY date, counterindex ASC";
$Result = DB_query($SQL,$db);
$Result = DB_query($SQL);

echo '<form method="post" action="' . htmlspecialchars($_SERVER['PHP_SELF'],ENT_QUOTES,'UTF-8') . '">
<div>
Expand Down Expand Up @@ -301,7 +301,7 @@
FROM pcexpenses
WHERE codeexpense='" . $MyRow['codeexpense'] . "'";

$ResultDes = DB_query($SQLDes,$db);
$ResultDes = DB_query($SQLDes);
$Description = DB_fetch_array($ResultDes);
if (!isset($Description[0])) {
$ExpenseCodeDes = 'ASSIGNCASH';
Expand Down Expand Up @@ -354,7 +354,7 @@
WHERE tabcode IN ('" . $SelectedTabs . "','" . $SelectedTabsTo . "')
GROUP BY tabcode";

$ResultAmount = DB_query($SQLAmount,$db);
$ResultAmount = DB_query($SQLAmount);
if (DB_num_rows($ResultAmount) > 0) {
while ($AmountRow = DB_fetch_array($ResultAmount)) {
if (is_null($AmountRow['amt'])) {
Expand Down
2 changes: 1 addition & 1 deletion PrintCheque.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
decimalplaces,
currency
FROM currencies
WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'",$db);
WHERE currabrev='" . $_SESSION['PaymentDetail' . $identifier]->Currency . "'");

If (DB_num_rows($result) == 0){
include ('includes/header.php');
Expand Down
2 changes: 1 addition & 1 deletion PrintCustStatements.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@
$CustomerResult = DB_query($SQL);

/*there should be only one record returned ?? */
$AgedAnalysis = DB_fetch_array($CustomerResult,$db);
$AgedAnalysis = DB_fetch_array($CustomerResult);


/*Now print out the footer and totals */
Expand Down
2 changes: 1 addition & 1 deletion QATests.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
// PREVENT DELETES IF DEPENDENT RECORDS

$sql= "SELECT COUNT(*) FROM prodspec WHERE prodspec.testid='".$SelectedQATest."'";
//$result = DB_query($sql,$db);
//$result = DB_query($sql);
//$myrow = DB_fetch_row($result);
if ($myrow[0]>0) {
prnMsg(_('Cannot delete this QA Test because Product Specs are using it'),'error');
Expand Down
2 changes: 1 addition & 1 deletion SellThroughSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
decimalplaces
FROM suppliers INNER JOIN currencies
ON suppliers.currcode=currencies.currabrev
WHERE supplierid='" . $SupplierID . "'",$db);
WHERE supplierid='" . $SupplierID . "'");
$SuppRow = DB_fetch_array($SuppResult);

echo '<p class="page_title_text"><img src="' . $RootPath . '/css/' . $Theme . '/images/maintenance.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . ' ' . _('For Supplier') . ' - ' . $SupplierID . ' - ' . $SuppRow['suppname'] . '</p><br />';
Expand Down
2 changes: 1 addition & 1 deletion StockQuantityByDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@

$LocStockResult = DB_query($sql, $ErrMsg);

$NumRows = DB_num_rows($LocStockResult, $db);
$NumRows = DB_num_rows($LocStockResult);

$j = 1;
$k=0; //row colour counter
Expand Down
Loading

0 comments on commit e506e54

Please sign in to comment.