From: <tu...@us...> - 2018-02-16 07:48:33
|
Revision: 7964 http://sourceforge.net/p/web-erp/reponame/7964 Author: turbopt Date: 2018-02-16 07:42:05 +0000 (Fri, 16 Feb 2018) Log Message: ----------- PaulT: Remove unused $db parameter from many functions within the /api area. Modified Paths: -------------- trunk/api/api_branches.php trunk/api/api_customers.php trunk/api/api_debtortransactions.php trunk/api/api_glaccounts.php trunk/api/api_glgroups.php trunk/api/api_glsections.php trunk/api/api_locations.php trunk/api/api_purchdata.php trunk/api/api_salesareas.php trunk/api/api_salesorders.php trunk/api/api_stock.php trunk/api/api_stockcategories.php trunk/api/api_suppliers.php trunk/api/api_workorders.php trunk/doc/Change.log Modified: trunk/api/api_branches.php =================================================================== --- trunk/api/api_branches.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_branches.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -2,7 +2,7 @@ /* $Id$*/ /* Check that the debtor number exists*/ - function VerifyBranchDebtorExists($DebtorNumber, $i, $Errors, $db) { + function VerifyBranchDebtorExists($DebtorNumber, $i, $Errors) { $Searchsql = "SELECT count(debtorno) FROM debtorsmaster WHERE debtorno='".$DebtorNumber."'"; @@ -16,7 +16,7 @@ /* Verify that the branch number is valid, and doesn't already exist.*/ - function VerifyBranchNo($DebtorNumber, $BranchNumber, $i, $Errors, $db) { + function VerifyBranchNo($DebtorNumber, $BranchNumber, $i, $Errors) { if ((mb_strlen($BranchNumber)<1) or (mb_strlen($BranchNumber)>10)) { $Errors[$i] = IncorrectBranchNumberLength; } @@ -33,7 +33,7 @@ } /* Verify that the branch number exists.*/ - function VerifyBranchNoExists($DebtorNumber, $BranchNumber, $i, $Errors, $db) { + function VerifyBranchNoExists($DebtorNumber, $BranchNumber, $i, $Errors) { if ((mb_strlen($BranchNumber)<1) or (mb_strlen($BranchNumber)>10)) { $Errors[$i] = IncorrectBranchNumberLength; } @@ -91,7 +91,7 @@ } /* Check that the area code is set up in the weberp database */ - function VerifyAreaCode($AreaCode , $i, $Errors, $db) { + function VerifyAreaCode($AreaCode , $i, $Errors) { $Searchsql = "SELECT COUNT(areacode) FROM areas WHERE areacode='".$AreaCode."'"; @@ -104,7 +104,7 @@ } /* Check that the salesman is set up in the weberp database */ - function VerifySalesmanCode($SalesmanCode , $i, $Errors, $db) { + function VerifySalesmanCode($SalesmanCode , $i, $Errors) { $Searchsql = "SELECT COUNT(salesmancode) FROM salesman WHERE salesmancode='".$SalesmanCode."'"; @@ -165,7 +165,7 @@ } /* Check that the default location is set up in the weberp database */ - function VerifyDefaultLocation($DefaultLocation , $i, $Errors, $db) { + function VerifyDefaultLocation($DefaultLocation , $i, $Errors) { $Searchsql = "SELECT COUNT(loccode) FROM locations WHERE loccode='".$DefaultLocation."'"; @@ -178,7 +178,7 @@ } /* Check that the tax group id is set up in the weberp database */ - function VerifyTaxGroupId($TaxGroupId , $i, $Errors, $db) { + function VerifyTaxGroupId($TaxGroupId , $i, $Errors) { $Searchsql = "SELECT COUNT(taxgroupid) FROM taxgroups WHERE taxgroupid='".$TaxGroupId."'"; @@ -191,7 +191,7 @@ } /* Check that the default shipper is set up in the weberp database */ - function VerifyDefaultShipVia($DefaultShipVia , $i, $Errors, $db) { + function VerifyDefaultShipVia($DefaultShipVia , $i, $Errors) { $Searchsql = "SELECT COUNT(shipper_id) FROM shippers WHERE shipper_id='".$DefaultShipVia."'"; @@ -245,26 +245,26 @@ foreach ($BranchDetails as $key => $value) { $BranchDetails[$key] = DB_escape_string($value); } - $Errors=VerifyBranchDebtorExists($BranchDetails['debtorno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyBranchNo($BranchDetails['debtorno'], $BranchDetails['branchcode'], sizeof($Errors), $Errors, $db); - $Errors=VerifyBranchName($BranchDetails['brname'], sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchDebtorExists($BranchDetails['debtorno'], sizeof($Errors), $Errors); + $Errors=VerifyBranchNo($BranchDetails['debtorno'], $BranchDetails['branchcode'], sizeof($Errors), $Errors); + $Errors=VerifyBranchName($BranchDetails['brname'], sizeof($Errors), $Errors); if (isset($BranchDetails['address1'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address1'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address1'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['address2'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address2'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address2'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['address3'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address3'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address3'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['address4'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address4'], 50, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address4'], 50, sizeof($Errors), $Errors); } if (isset($BranchDetails['address5'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address5'], 20, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address5'], 20, sizeof($Errors), $Errors); } if (isset($BranchDetails['address6'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address6'], 15, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address6'], 15, sizeof($Errors), $Errors); } if (isset($BranchDetails['lat'])){ $Errors=VerifyLatitude($BranchDetails['lat'], sizeof($Errors), $Errors); @@ -276,10 +276,10 @@ $Errors=VerifyEstDeliveryDays($BranchDetails['estdeliverydays'], sizeof($Errors), $Errors); } if (isset($BranchDetails['area'])){ - $Errors=VerifyAreaCode($BranchDetails['area'], sizeof($Errors), $Errors, $db); + $Errors=VerifyAreaCode($BranchDetails['area'], sizeof($Errors), $Errors); } if (isset($BranchDetails['salesman'])){ - $Errors=VerifySalesmanCode($BranchDetails['salesman'], sizeof($Errors), $Errors, $db); + $Errors=VerifySalesmanCode($BranchDetails['salesman'], sizeof($Errors), $Errors); } if (isset($BranchDetails['fwddate'])){ $Errors=VerifyFwdDate($BranchDetails['fwddate'], sizeof($Errors), $Errors); @@ -297,13 +297,13 @@ $Errors=VerifyEmailAddress($BranchDetails['email'], sizeof($Errors), $Errors); } if (isset($BranchDetails['defaultlocation'])){ - $Errors=VerifyDefaultLocation($BranchDetails['defaultlocation'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDefaultLocation($BranchDetails['defaultlocation'], sizeof($Errors), $Errors); } if (isset($BranchDetails['taxgroupid'])){ - $Errors=VerifyTaxGroupId($BranchDetails['taxgroupid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyTaxGroupId($BranchDetails['taxgroupid'], sizeof($Errors), $Errors); } if (isset($BranchDetails['defaultshipvia'])){ - $Errors=VerifyDefaultShipVia($BranchDetails['defaultshipvia'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDefaultShipVia($BranchDetails['defaultshipvia'], sizeof($Errors), $Errors); } if (isset($BranchDetails['deliverblind'])){ $Errors=VerifyDeliverBlind($BranchDetails['deliverblind'], sizeof($Errors), $Errors); @@ -312,22 +312,22 @@ $Errors=VerifyDisableTrans($BranchDetails['disabletrans'], sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr1'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr1'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr1'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr2'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr2'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr2'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr3'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr3'], 30, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr3'], 30, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr4'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr4'], 20, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr4'], 20, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr5'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr5'], 20, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr5'], 20, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr6'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr6'], 15, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr6'], 15, sizeof($Errors), $Errors); } if (isset($BranchDetails['specialinstructions'])){ $Errors=VerifySpecialInstructions($BranchDetails['specialinstructions'], sizeof($Errors), $Errors); @@ -369,25 +369,25 @@ foreach ($BranchDetails as $key => $value) { $BranchDetails[$key] = DB_escape_string($value); } - $Errors=VerifyBranchNoExists($BranchDetails['debtorno'], $BranchDetails['branchcode'], sizeof($Errors), $Errors, $db); - $Errors=VerifyBranchName($BranchDetails['brname'], sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchNoExists($BranchDetails['debtorno'], $BranchDetails['branchcode'], sizeof($Errors), $Errors); + $Errors=VerifyBranchName($BranchDetails['brname'], sizeof($Errors), $Errors); if (isset($BranchDetails['address1'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address1'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address1'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['address2'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address2'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address2'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['address3'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address3'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address3'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['address4'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address4'], 50, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address4'], 50, sizeof($Errors), $Errors); } if (isset($BranchDetails['address5'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address5'], 20, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address5'], 20, sizeof($Errors), $Errors); } if (isset($BranchDetails['address6'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['address6'], 15, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['address6'], 15, sizeof($Errors), $Errors); } if (isset($BranchDetails['lat'])){ $Errors=VerifyLatitude($BranchDetails['lat'], sizeof($Errors), $Errors); @@ -399,10 +399,10 @@ $Errors=VerifyEstDeliveryDays($BranchDetails['estdeliverydays'], sizeof($Errors), $Errors); } if (isset($BranchDetails['area'])){ - $Errors=VerifyAreaCode($BranchDetails['area'], sizeof($Errors), $Errors, $db); + $Errors=VerifyAreaCode($BranchDetails['area'], sizeof($Errors), $Errors); } if (isset($BranchDetails['salesman'])){ - $Errors=VerifySalesmanCode($BranchDetails['salesman'], sizeof($Errors), $Errors, $db); + $Errors=VerifySalesmanCode($BranchDetails['salesman'], sizeof($Errors), $Errors); } if (isset($BranchDetails['fwddate'])){ $Errors=VerifyFwdDate($BranchDetails['fwddate'], sizeof($Errors), $Errors); @@ -420,13 +420,13 @@ $Errors=VerifyEmailAddress($BranchDetails['email'], sizeof($Errors), $Errors); } if (isset($BranchDetails['defaultlocation'])){ - $Errors=VerifyDefaultLocation($BranchDetails['defaultlocation'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDefaultLocation($BranchDetails['defaultlocation'], sizeof($Errors), $Errors); } if (isset($BranchDetails['taxgroupid'])){ - $Errors=VerifyTaxGroupId($BranchDetails['taxgroupid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyTaxGroupId($BranchDetails['taxgroupid'], sizeof($Errors), $Errors); } if (isset($BranchDetails['defaultshipvia'])){ - $Errors=VerifyDefaultShipVia($BranchDetails['defaultshipvia'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDefaultShipVia($BranchDetails['defaultshipvia'], sizeof($Errors), $Errors); } if (isset($BranchDetails['deliverblind'])){ $Errors=VerifyDeliverBlind($BranchDetails['deliverblind'], sizeof($Errors), $Errors); @@ -435,22 +435,22 @@ $Errors=VerifyDisableTrans($BranchDetails['disabletrans'], sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr1'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr1'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr1'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr2'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr2'], 40, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr2'], 40, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr3'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr3'], 30, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr3'], 30, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr4'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr4'], 20, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr4'], 20, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr5'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr5'], 20, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr5'], 20, sizeof($Errors), $Errors); } if (isset($BranchDetails['brpostaddr6'])){ - $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr6'], 15, sizeof($Errors), $Errors, $db); + $Errors=VerifyBranchAddressLine($BranchDetails['brpostaddr6'], 15, sizeof($Errors), $Errors); } if (isset($BranchDetails['specialinstructions'])){ $Errors=VerifySpecialInstructions($BranchDetails['specialinstructions'], sizeof($Errors), $Errors); @@ -520,7 +520,7 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $Errors = VerifyBranchNoExists($DebtorNumber, $BranchCode, sizeof($Errors), $Errors, $db); + $Errors = VerifyBranchNoExists($DebtorNumber, $BranchCode, sizeof($Errors), $Errors); if (sizeof($Errors)!=0) { return $Errors; } Modified: trunk/api/api_customers.php =================================================================== --- trunk/api/api_customers.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_customers.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -3,7 +3,7 @@ /* Verify that the debtor number is valid, and doesn't already exist.*/ - function VerifyDebtorNo($DebtorNumber, $i, $Errors, $db) { + function VerifyDebtorNo($DebtorNumber, $i, $Errors) { if ((mb_strlen($DebtorNumber)<1) or (mb_strlen($DebtorNumber)>10)) { $Errors[$i] = IncorrectDebtorNumberLength; } @@ -19,7 +19,7 @@ } /* Check that the debtor number exists*/ - function VerifyDebtorExists($DebtorNumber, $i, $Errors, $db) { + function VerifyDebtorExists($DebtorNumber, $i, $Errors) { $Searchsql = "SELECT count(debtorno) FROM debtorsmaster WHERE debtorno='".$DebtorNumber."'"; @@ -48,7 +48,7 @@ } /* Check that the currency code is set up in the weberp database */ - function VerifyCurrencyCode($CurrCode, $i, $Errors, $db) { + function VerifyCurrencyCode($CurrCode, $i, $Errors) { $Searchsql = "SELECT COUNT(currabrev) FROM currencies WHERE currabrev='".$CurrCode."'"; @@ -61,7 +61,7 @@ } /* Check that the sales type is set up in the weberp database */ - function VerifySalesType($SalesType, $i, $Errors, $db) { + function VerifySalesType($SalesType, $i, $Errors) { $Searchsql = "SELECT COUNT(typeabbrev) FROM salestypes WHERE typeabbrev='".$SalesType."'"; @@ -82,7 +82,7 @@ } /* Check that the hold reason is set up in the weberp database */ - function VerifyHoldReason($HoldReason , $i, $Errors, $db) { + function VerifyHoldReason($HoldReason , $i, $Errors) { $Searchsql = "SELECT COUNT(reasoncode) FROM holdreasons WHERE reasoncode='".$HoldReason."'"; @@ -95,7 +95,7 @@ } /* Check that the payment terms are set up in the weberp database */ - function VerifyPaymentTerms($PaymentTerms , $i, $Errors, $db) { + function VerifyPaymentTerms($PaymentTerms , $i, $Errors) { $Searchsql = "SELECT COUNT(termsindicator) FROM paymentterms WHERE termsindicator='".$PaymentTerms."'"; @@ -229,7 +229,7 @@ } /* Check that the customer type is set up in the weberp database */ - function VerifyCustomerType($debtortype , $i, $Errors, $db) { + function VerifyCustomerType($debtortype , $i, $Errors) { $Searchsql = "SELECT COUNT(typeid) FROM debtortype WHERE typeid='".$debtortype."'"; @@ -266,7 +266,7 @@ $autonumberresult=DB_query($autonumbersql); $autonumber=DB_fetch_row($autonumberresult); if ($autonumber[0]==0) { - $Errors=VerifyDebtorNo($CustomerDetails['debtorno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDebtorNo($CustomerDetails['debtorno'], sizeof($Errors), $Errors); } else { $CustomerDetails['debtorno']=''; } @@ -290,19 +290,19 @@ $Errors=VerifyAddressLine($CustomerDetails['address6'], 15, sizeof($Errors), $Errors); } if (isset($CustomerDetails['currcode'])){ - $Errors=VerifyCurrencyCode($CustomerDetails['currcode'], sizeof($Errors), $Errors, $db); + $Errors=VerifyCurrencyCode($CustomerDetails['currcode'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['salestype'])){ - $Errors=VerifySalesType($CustomerDetails['salestype'], sizeof($Errors), $Errors, $db); + $Errors=VerifySalesType($CustomerDetails['salestype'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['clientsince'])){ $Errors=VerifyClientSince($CustomerDetails['clientsince'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['holdreason'])){ - $Errors=VerifyHoldReason($CustomerDetails['holdreason'], sizeof($Errors), $Errors, $db); + $Errors=VerifyHoldReason($CustomerDetails['holdreason'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['paymentterms'])){ - $Errors=VerifyPaymentTerms($CustomerDetails['paymentterms'], sizeof($Errors), $Errors, $db); + $Errors=VerifyPaymentTerms($CustomerDetails['paymentterms'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['discount'])){ $Errors=VerifyDiscount($CustomerDetails['discount'], sizeof($Errors), $Errors); @@ -350,7 +350,7 @@ $Errors=VerifyCustomerPOLine($CustomerDetails['customerpoline'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['typeid'])){ - $Errors=VerifyCustomerType($CustomerDetails['typeid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyCustomerType($CustomerDetails['typeid'], sizeof($Errors), $Errors); } $FieldNames=''; $FieldValues=''; @@ -393,7 +393,7 @@ $Errors[sizeof($Errors)] = NoDebtorNumber; return $Errors; } - $Errors=VerifyDebtorExists($CustomerDetails['debtorno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDebtorExists($CustomerDetails['debtorno'], sizeof($Errors), $Errors); if (in_array(DebtorDoesntExist, $Errors)) { return $Errors; } @@ -419,19 +419,19 @@ $Errors=VerifyAddressLine($CustomerDetails['address6'], 15, sizeof($Errors), $Errors); } if (isset($CustomerDetails['currcode'])){ - $Errors=VerifyCurrencyCode($CustomerDetails['currcode'], sizeof($Errors), $Errors, $db); + $Errors=VerifyCurrencyCode($CustomerDetails['currcode'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['salestype'])){ - $Errors=VerifySalesType($CustomerDetails['salestype'], sizeof($Errors), $Errors, $db); + $Errors=VerifySalesType($CustomerDetails['salestype'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['clientsince'])){ $Errors=VerifyClientSince($CustomerDetails['clientsince'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['holdreason'])){ - $Errors=VerifyHoldReason($CustomerDetails['holdreason'], sizeof($Errors), $Errors, $db); + $Errors=VerifyHoldReason($CustomerDetails['holdreason'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['paymentterms'])){ - $Errors=VerifyPaymentTerms($CustomerDetails['paymentterms'], sizeof($Errors), $Errors, $db); + $Errors=VerifyPaymentTerms($CustomerDetails['paymentterms'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['discount'])){ $Errors=VerifyDiscount($CustomerDetails['discount'], sizeof($Errors), $Errors); @@ -479,7 +479,7 @@ $Errors=VerifyCustomerPOLine($CustomerDetails['customerpoline'], sizeof($Errors), $Errors); } if (isset($CustomerDetails['typeid'])){ - $Errors=VerifyCustomerType($CustomerDetails['typeid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyCustomerType($CustomerDetails['typeid'], sizeof($Errors), $Errors); } $sql='UPDATE debtorsmaster SET '; foreach ($CustomerDetails as $key => $value) { @@ -508,7 +508,7 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $Errors = VerifyDebtorExists($DebtorNumber, sizeof($Errors), $Errors, $db); + $Errors = VerifyDebtorExists($DebtorNumber, sizeof($Errors), $Errors); if (sizeof($Errors)!=0) { return $Errors; } Modified: trunk/api/api_debtortransactions.php =================================================================== --- trunk/api/api_debtortransactions.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_debtortransactions.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -3,7 +3,7 @@ /* Check that the transaction number is unique * for this type of transaction*/ - function VerifyTransNo($TransNo, $Type, $i, $Errors, $db) { + function VerifyTransNo($TransNo, $Type, $i, $Errors) { $Searchsql = "SELECT count(transno) FROM debtortrans WHERE type='".$Type."' and transno='".$TransNo . "'"; @@ -48,7 +48,7 @@ /* Check that the transaction date is a valid date. The date * must be in the same format as the date format specified in the * target webERP company */ - function VerifyTransactionDate($TranDate, $i, $Errors, $db) { + function VerifyTransactionDate($TranDate, $i, $Errors) { $sql="SELECT confvalue FROM config WHERE confname='" . DefaultDateFormat ."'"; $result=DB_query($sql); $myrow=DB_fetch_array($result); @@ -84,7 +84,7 @@ /* Find the period number from the transaction date */ /* Why use this function over GetPeriod we already have this function included in DateFunctions.inc * This function doesn't create periods if required so there is the danger of not being able to insert transactions*/ - function GetPeriodFromTransactionDate($TranDate, $i, $Errors, $db) { + function GetPeriodFromTransactionDate($TranDate, $i, $Errors) { $sql="SELECT confvalue FROM config WHERE confname='DefaultDateFormat'"; $result=DB_query($sql); $myrow=DB_fetch_array($result); @@ -248,7 +248,7 @@ * This function also in SQL_CommonFunctions...better to use it from there as it covers all cases * and not limited to stk='any'!! * - function GetSalesGLCode($salesarea, $partnumber, $db) { + function GetSalesGLCode($salesarea, $partnumber) { $sql="SELECT salesglcode FROM salesglpostings WHERE stkcat='any'"; $result=DB_query($sql); @@ -503,8 +503,8 @@ } - $Errors=VerifyDebtorExists($Header['debtorno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyBranchNoExists($Header['debtorno'],$Header['branchcode'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDebtorExists($Header['debtorno'], sizeof($Errors), $Errors); + $Errors=VerifyBranchNoExists($Header['debtorno'],$Header['branchcode'], sizeof($Errors), $Errors); /*Does not deal with serialised/lot track items - for use by POS */ /*Get Company Defaults */ $ReadCoyResult = api_DB_query("SELECT debtorsact, @@ -549,7 +549,7 @@ /*Start an SQL transaction */ $result = DB_Txn_Begin(); /*Now Get the next credit note number - function in SQL_CommonFunctions*/ - $CreditNoteNo = GetNextTransNo(11, $db); + $CreditNoteNo = GetNextTransNo(11); $PeriodNo = GetCurrentPeriod($db); $TotalFXNetCredit = 0; @@ -928,7 +928,7 @@ '" . $CreditNoteNo . "', '" . $Header['trandate'] . "', '" . $PeriodNo . "', - '" . GetCOGSGLAccount($CN_Header['area'], $CN_Line['stockid'], $Header['tpe'], $db) . "', + '" . GetCOGSGLAccount($CN_Header['area'], $CN_Line['stockid'], $Header['tpe']) . "', '" . $Header['debtorno'] . " - " . $CN_Line['stockid'] . " x " . $CN_Line['qty'] . " @ " . $StandardCost . "', '" . ($StandardCost * $CN_Line['qty']) . "')"; @@ -959,7 +959,7 @@ if ($CompanyRecord['gllink_debtors']==1 AND $CN_Line['price'] !=0){ //Post sales transaction to GL credit sales - $SalesGLAccounts = GetSalesGLAccount($CN_Header['area'], $CN_Line['stockid'], $Header['tpe'], $db); + $SalesGLAccounts = GetSalesGLAccount($CN_Header['area'], $CN_Line['stockid'], $Header['tpe']); $SQL = "INSERT INTO gltrans (type, typeno, @@ -1189,16 +1189,16 @@ $InvoiceDetails[$key] = DB_escape_string($value); } $PartCode=$InvoiceDetails['partcode']; - $Errors=VerifyStockCodeExists($PartCode, sizeof($Errors), $Errors, $db ); + $Errors=VerifyStockCodeExists($PartCode, sizeof($Errors), $Errors ); unset($InvoiceDetails['partcode']); $SalesArea=$InvoiceDetails['salesarea']; unset($InvoiceDetails['salesarea']); - $InvoiceDetails['transno']=GetNextTransactionNo(10, $db); + $InvoiceDetails['transno']=GetNextTransactionNo(10); $InvoiceDetails['type'] = 10; - $Errors=VerifyDebtorExists($InvoiceDetails['debtorno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyBranchNoExists($InvoiceDetails['debtorno'],$InvoiceDetails['branchcode'], sizeof($Errors), $Errors, $db); - $Errors=VerifyTransNO($InvoiceDetails['transno'], 10, sizeof($Errors), $Errors, $db); - $Errors=VerifyTransactionDate($InvoiceDetails['trandate'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDebtorExists($InvoiceDetails['debtorno'], sizeof($Errors), $Errors); + $Errors=VerifyBranchNoExists($InvoiceDetails['debtorno'],$InvoiceDetails['branchcode'], sizeof($Errors), $Errors); + $Errors=VerifyTransNO($InvoiceDetails['transno'], 10, sizeof($Errors), $Errors); + $Errors=VerifyTransactionDate($InvoiceDetails['trandate'], sizeof($Errors), $Errors); if (isset($InvoiceDetails['settled'])){ $Errors=VerifySettled($InvoiceDetails['settled'], sizeof($Errors), $Errors); } @@ -1247,7 +1247,7 @@ $FieldNames=''; $FieldValues=''; $InvoiceDetails['trandate']=ConvertToSQLDate($InvoiceDetails['trandate']); - $InvoiceDetails['prd']=GetPeriodFromTransactionDate($InvoiceDetails['trandate'], sizeof($Errors), $Errors, $db); + $InvoiceDetails['prd']=GetPeriodFromTransactionDate($InvoiceDetails['trandate'], sizeof($Errors), $Errors); foreach ($InvoiceDetails as $key => $value) { $FieldNames.=$key.', '; $FieldValues.='"'.$value.'", '; @@ -1257,13 +1257,13 @@ $sql = "INSERT INTO debtortrans (" . mb_substr($FieldNames,0,-2) .") VALUES ('" . mb_substr($FieldValues,0,-2) ."') "; $result = DB_query($sql); - $sql = "UPDATE systypes SET typeno='" . GetNextTransactionNo(10, $db) . "' WHERE typeid=10"; + $sql = "UPDATE systypes SET typeno='" . GetNextTransactionNo(10) . "' WHERE typeid=10"; $result = DB_query($sql); - $SalesGLCode=GetSalesGLCode($SalesArea, $PartCode, $db); + $SalesGLCode=GetSalesGLCode($SalesArea, $PartCode); $DebtorsGLCode=GetDebtorsGLCode($db); $sql="INSERT INTO gltrans VALUES(null, 10, - '" . GetNextTransactionNo(10, $db) . "', + '" . GetNextTransactionNo(10) . "', 0, '" . $InvoiceDetails['trandate'] ."', '" . $InvoiceDetails['prd'] . "', @@ -1276,7 +1276,7 @@ $result = api_DB_query($sql); $sql="INSERT INTO gltrans VALUES(null, 10, - '" . GetNextTransactionNo(10, $db) . "', + '" . GetNextTransactionNo(10) . "', 0, '" . $InvoiceDetails['trandate'] ."', '" . $InvoiceDetails['prd'] . "', @@ -1319,7 +1319,7 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $Errors=VerifyDebtorExists($AllocDetails['debtorno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDebtorExists($AllocDetails['debtorno'], sizeof($Errors), $Errors); /*Get the outstanding amount to allocate (all amounts in FX) from the transaction*/ if ($AllocDetails['type'] !='11' AND $AllocDetails['type'] !=12){ @@ -1487,16 +1487,16 @@ $CreditDetails[$key] = DB_escape_string($value); } $PartCode=$CreditDetails['partcode']; - $Errors=VerifyStockCodeExists($PartCode, sizeof($Errors), $Errors, $db ); + $Errors=VerifyStockCodeExists($PartCode, sizeof($Errors), $Errors ); unset($CreditDetails['partcode']); $SalesArea=$CreditDetails['salesarea']; unset($CreditDetails['salesarea']); - $CreditDetails['transno']=GetNextTransactionNo(11, $db); + $CreditDetails['transno']=GetNextTransactionNo(11); $CreditDetails['type'] = 10; - $Errors=VerifyDebtorExists($CreditDetails['debtorno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyBranchNoExists($CreditDetails['debtorno'],$CreditDetails['branchcode'], sizeof($Errors), $Errors, $db); - $Errors=VerifyTransNO($CreditDetails['transno'], 10, sizeof($Errors), $Errors, $db); - $Errors=VerifyTransactionDate($CreditDetails['trandate'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDebtorExists($CreditDetails['debtorno'], sizeof($Errors), $Errors); + $Errors=VerifyBranchNoExists($CreditDetails['debtorno'],$CreditDetails['branchcode'], sizeof($Errors), $Errors); + $Errors=VerifyTransNO($CreditDetails['transno'], 10, sizeof($Errors), $Errors); + $Errors=VerifyTransactionDate($CreditDetails['trandate'], sizeof($Errors), $Errors); if (isset($CreditDetails['settled'])){ $Errors=VerifySettled($CreditDetails['settled'], sizeof($Errors), $Errors); } @@ -1545,7 +1545,7 @@ $FieldNames=''; $FieldValues=''; $CreditDetails['trandate']=ConvertToSQLDate($CreditDetails['trandate']); - $CreditDetails['prd']=GetPeriodFromTransactionDate($CreditDetails['trandate'], sizeof($Errors), $Errors, $db); + $CreditDetails['prd']=GetPeriodFromTransactionDate($CreditDetails['trandate'], sizeof($Errors), $Errors); foreach ($CreditDetails as $key => $value) { $FieldNames.=$key.', '; $FieldValues.='"'.$value.'", '; @@ -1555,13 +1555,13 @@ $sql = "INSERT INTO debtortrans (" . mb_substr($FieldNames,0,-2) . ") VALUES ('".mb_substr($FieldValues,0,-2) ."') "; $result = DB_query($sql); - $sql = "UPDATE systypes SET typeno='" . GetNextTransactionNo(11, $db) ."' WHERE typeid=10"; + $sql = "UPDATE systypes SET typeno='" . GetNextTransactionNo(11) ."' WHERE typeid=10"; $result = DB_query($sql); - $SalesGLCode=GetSalesGLCode($SalesArea, $PartCode, $db); + $SalesGLCode=GetSalesGLCode($SalesArea, $PartCode); $DebtorsGLCode=GetDebtorsGLCode($db); $sql="INSERT INTO gltrans VALUES(null, 10, - '" . GetNextTransactionNo(11, $db). "', + '" . GetNextTransactionNo(11). "', 0, '" . $CreditDetails['trandate'] . "', '" . $CreditDetails['prd'] . "', @@ -1573,7 +1573,7 @@ $result = DB_query($sql); $sql="INSERT INTO gltrans VALUES(null, 10, - '" . GetNextTransactionNo(11, $db) . "', + '" . GetNextTransactionNo(11) . "', 0, '" . $CreditDetails['trandate'] ."', '" . $CreditDetails['prd'] . "', Modified: trunk/api/api_glaccounts.php =================================================================== --- trunk/api/api_glaccounts.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_glaccounts.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -2,7 +2,7 @@ /* $Id$*/ /* Check that the account code doesn't already exist'*/ - function VerifyAccountCode($AccountCode, $i, $Errors, $db) { + function VerifyAccountCode($AccountCode, $i, $Errors) { $Searchsql = "SELECT count(accountcode) FROM chartmaster WHERE accountcode='".$AccountCode."'"; @@ -15,7 +15,7 @@ } /* Check that the account code already exists'*/ - function VerifyAccountCodeExists($AccountCode, $i, $Errors, $db) { + function VerifyAccountCodeExists($AccountCode, $i, $Errors) { $Searchsql = "SELECT count(accountcode) FROM chartmaster WHERE accountcode='".$AccountCode."'"; @@ -36,7 +36,7 @@ } /* Check that the account group exists*/ - function VerifyAccountGroupExists($AccountGroup, $i, $Errors, $db) { + function VerifyAccountGroupExists($AccountGroup, $i, $Errors) { $Searchsql = "SELECT count(groupname) FROM accountgroups WHERE groupname='".$AccountGroup."'"; @@ -58,11 +58,11 @@ foreach ($AccountDetails as $key => $value) { $AccountDetails[$key] = DB_escape_string($value); } - $Errors=VerifyAccountCode($AccountDetails['accountcode'], sizeof($Errors), $Errors, $db); + $Errors=VerifyAccountCode($AccountDetails['accountcode'], sizeof($Errors), $Errors); if (isset($AccountDetails['accountname'])){ $Errors=VerifyAccountName($AccountDetails['accountname'], sizeof($Errors), $Errors); } - $Errors=VerifyAccountGroupExists($AccountDetails['group_'], sizeof($Errors), $Errors, $db); + $Errors=VerifyAccountGroupExists($AccountDetails['group_'], sizeof($Errors), $Errors); $FieldNames=''; $FieldValues=''; foreach ($AccountDetails as $key => $value) { Modified: trunk/api/api_glgroups.php =================================================================== --- trunk/api/api_glgroups.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_glgroups.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -2,7 +2,7 @@ /* $Id$*/ /* Check that the account group doesn't already exist'*/ - function VerifyAccountGroup($AccountGroup, $i, $Errors, $db) { + function VerifyAccountGroup($AccountGroup, $i, $Errors) { $Searchsql = "SELECT count(groupname) FROM accountgroups WHERE groupname='".$AccountGroup."'"; @@ -15,7 +15,7 @@ } /* Check that the account sectiont already exists'*/ - function VerifyAccountSectionExists($AccountSection, $i, $Errors, $db) { + function VerifyAccountSectionExists($AccountSection, $i, $Errors) { $Searchsql = "SELECT count(sectionid) FROM accountsection WHERE sectionid='".$AccountSection."'"; @@ -44,7 +44,7 @@ } /* Check that the parent group exists*/ - function VerifyParentGroupExists($AccountGroup, $i, $Errors, $db) { + function VerifyParentGroupExists($AccountGroup, $i, $Errors) { $Searchsql = "SELECT count(groupname) FROM accountgroups WHERE groupname='".$AccountGroup."'"; @@ -66,12 +66,12 @@ foreach ($AccountGroupDetails as $key => $value) { $AccountGroupDetails[$key] = DB_escape_string($value); } - $Errors=VerifyAccountGroup($AccountGroupDetails['groupname'], sizeof($Errors), $Errors, $db); - $Errors=VerifyAccountSectionExists($AccountGroupDetails['sectioninaccounts'], sizeof($Errors), $Errors, $db); + $Errors=VerifyAccountGroup($AccountGroupDetails['groupname'], sizeof($Errors), $Errors); + $Errors=VerifyAccountSectionExists($AccountGroupDetails['sectioninaccounts'], sizeof($Errors), $Errors); if (isset($AccountGroupDetails['pandl'])){ $Errors=VerifyPandL($AccountGroupDetails['pandl'], sizeof($Errors), $Errors); } - $Errors=VerifyParentGroupExists($AccountGroupDetails['parentgroupname'], sizeof($Errors), $Errors, $db); + $Errors=VerifyParentGroupExists($AccountGroupDetails['parentgroupname'], sizeof($Errors), $Errors); $FieldNames=''; $FieldValues=''; foreach ($AccountGroupDetails as $key => $value) { Modified: trunk/api/api_glsections.php =================================================================== --- trunk/api/api_glsections.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_glsections.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -2,7 +2,7 @@ /* $Id$*/ /* Check that the account section doesn't already exist'*/ - function VerifyAccountSection($AccountSection, $i, $Errors, $db) { + function VerifyAccountSection($AccountSection, $i, $Errors) { $Searchsql = "SELECT count(sectionid) FROM accountsection WHERE sectionid='".$AccountSection."'"; @@ -32,7 +32,7 @@ foreach ($AccountSectionDetails as $key => $value) { $AccountSectionDetails[$key] = DB_escape_string($value); } - $Errors=VerifyAccountSection($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors, $db); + $Errors=VerifyAccountSection($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors); if (isset($AccountSectionDetails['accountname'])){ $Errors=VerifySectionName($AccountSectionDetails['sectionname'], sizeof($Errors), $Errors); } Modified: trunk/api/api_locations.php =================================================================== --- trunk/api/api_locations.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_locations.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -8,7 +8,7 @@ /* Verify that the Location code is valid, and doesn't already exist.*/ - function VerifyLocationCode($LocationCode, $i, $Errors, $db) { + function VerifyLocationCode($LocationCode, $i, $Errors) { if ((mb_strlen($LocationCode)<1) or (mb_strlen($LocationCode)>5)) { $Errors[$i] = IncorrectLocationCodeLength; } @@ -24,7 +24,7 @@ } /* Check that the Location Code exists*/ - function VerifyLocationExists($LocationCode, $i, $Errors, $db) { + function VerifyLocationExists($LocationCode, $i, $Errors) { $Searchsql = "SELECT count(loccode) FROM locations WHERE loccode='".$LocationCode."'"; @@ -45,7 +45,7 @@ } /* Check that the tax province id is set up in the weberp database */ - function VerifyTaxProvinceId($TaxProvinceId , $i, $Errors, $db) { + function VerifyTaxProvinceId($TaxProvinceId , $i, $Errors) { $Searchsql = "SELECT COUNT(taxprovinceid) FROM taxprovinces WHERE taxprovinceid='".$TaxProvinceId."'"; @@ -109,9 +109,9 @@ foreach ($Location as $key => $value) { $Location[$key] = DB_escape_string($value); } - $Errors=VerifyLocationCode($Location['loccode'], sizeof($Errors), $Errors, $db); - $Errors=VerifyLocationName($Location['locationname'], sizeof($Errors), $Errors, $db); - $Errors=VerifyTaxProvinceId($Location['taxprovinceid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyLocationCode($Location['loccode'], sizeof($Errors), $Errors); + $Errors=VerifyLocationName($Location['locationname'], sizeof($Errors), $Errors); + $Errors=VerifyTaxProvinceId($Location['taxprovinceid'], sizeof($Errors), $Errors); if (isset($Location['deladd1'])){ $Errors=VerifyAddressLine($Location['deladd1'], 40, sizeof($Errors), $Errors); } @@ -175,9 +175,9 @@ foreach ($Location as $key => $value) { $Location[$key] = DB_escape_string($value); } - $Errors=VerifyLocationExists($Location['loccode'], sizeof($Errors), $Errors, $db); - $Errors=VerifyLocationName($Location['locationname'], sizeof($Errors), $Errors, $db); - $Errors=VerifyTaxProvinceId($Location['taxprovinceid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyLocationExists($Location['loccode'], sizeof($Errors), $Errors); + $Errors=VerifyLocationName($Location['locationname'], sizeof($Errors), $Errors); + $Errors=VerifyTaxProvinceId($Location['taxprovinceid'], sizeof($Errors), $Errors); if (isset($Location['deladd1'])){ $Errors=VerifyAddressLine($Location['deladd1'], 40, sizeof($Errors), $Errors); } Modified: trunk/api/api_purchdata.php =================================================================== --- trunk/api/api_purchdata.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_purchdata.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -1,9 +1,9 @@ <?php /* $Id$*/ - function VerifyPurchDataLineExists($SupplierID, $StockID, $i, $Errors, $db) { - if (VerifyStockCodeExists($StockID, $i, $Errors, $db)!=0 and - VerifySupplierNoExists($SupplierID, $i, $Errors, $db)!=0) { + function VerifyPurchDataLineExists($SupplierID, $StockID, $i, $Errors) { + if (VerifyStockCodeExists($StockID, $i, $Errors)!=0 and + VerifySupplierNoExists($SupplierID, $i, $Errors)!=0) { $Errors[$i] = StockSupplierLineDoesntExist; } } @@ -56,8 +56,8 @@ foreach ($PurchDataDetails as $key => $value) { $PurchDataDetails[$key] = DB_escape_string($value); } - $Errors=VerifyStockCodeExists($PurchDataDetails['stockid'], sizeof($Errors), $Errors, $db); - $Errors=VerifySupplierNoExists($PurchDataDetails['supplierno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyStockCodeExists($PurchDataDetails['stockid'], sizeof($Errors), $Errors); + $Errors=VerifySupplierNoExists($PurchDataDetails['supplierno'], sizeof($Errors), $Errors); if (isset($StockItemDetails['price'])){ $Errors=VerifyUnitPrice($PurchDataDetails['price'], sizeof($Errors), $Errors); } @@ -107,9 +107,9 @@ foreach ($PurchDataDetails as $key => $value) { $PurchDataDetails[$key] = DB_escape_string($value); } - $Errors=VerifyPurchDataLineExists($PurchDataDetails['supplierno'], $PurchDataDetails['stockid'], sizeof($Errors), $Errors, $db); - $Errors=VerifyStockCodeExists($PurchDataDetails['stockid'], sizeof($Errors), $Errors, $db); - $Errors=VerifySupplierNoExists($PurchDataDetails['supplierno'], sizeof($Errors), $Errors, $db); + $Errors=VerifyPurchDataLineExists($PurchDataDetails['supplierno'], $PurchDataDetails['stockid'], sizeof($Errors), $Errors); + $Errors=VerifyStockCodeExists($PurchDataDetails['stockid'], sizeof($Errors), $Errors); + $Errors=VerifySupplierNoExists($PurchDataDetails['supplierno'], sizeof($Errors), $Errors); if (isset($StockItemDetails['price'])){ $Errors=VerifyUnitPrice($PurchDataDetails['price'], sizeof($Errors), $Errors); } Modified: trunk/api/api_salesareas.php =================================================================== --- trunk/api/api_salesareas.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_salesareas.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -2,7 +2,7 @@ /* $Id$*/ /* Check that the area code is set up in the weberp database */ - function VerifyAreaCodeDoesntExist($AreaCode , $i, $Errors, $db) { + function VerifyAreaCodeDoesntExist($AreaCode , $i, $Errors) { $Searchsql = "SELECT COUNT(areacode) FROM areas WHERE areacode='".$AreaCode."'"; @@ -70,7 +70,7 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $Errors= VerifyAreaCodeDoesntExist($AreaDetails['areacode'], 0, $Errors, $db); + $Errors= VerifyAreaCodeDoesntExist($AreaDetails['areacode'], 0, $Errors); if (sizeof($Errors>0)) { // return $Errors; } Modified: trunk/api/api_salesorders.php =================================================================== --- trunk/api/api_salesorders.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_salesorders.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -38,7 +38,7 @@ /* Check that the order date is a valid date. The date * must be in the same format as the date format specified in the * target webERP company */ - function VerifyOrderDate($orddate, $i, $Errors, $db) { + function VerifyOrderDate($orddate, $i, $Errors) { $sql="SELECT confvalue FROM config WHERE confname='DefaultDateFormat'"; $result=api_DB_query($sql); $myrow=DB_fetch_array($result); @@ -72,7 +72,7 @@ } /* Check that the order type is set up in the weberp database */ - function VerifyOrderType($ordertype, $i, $Errors, $db) { + function VerifyOrderType($ordertype, $i, $Errors) { $Searchsql = "SELECT COUNT(typeabbrev) FROM salestypes WHERE typeabbrev='" . $ordertype."'"; @@ -101,7 +101,7 @@ } /* Check that the from stock location is set up in the weberp database */ - function VerifyFromStockLocation($FromStockLocn, $i, $Errors, $db) { + function VerifyFromStockLocation($FromStockLocn, $i, $Errors) { $Searchsql = "SELECT COUNT(loccode) FROM locations WHERE loccode='". $FromStockLocn."'"; @@ -116,7 +116,7 @@ /* Check that the delivery date is a valid date. The date * must be in the same format as the date format specified in the * target webERP company */ - function VerifyDeliveryDate($DeliveryDate, $i, $Errors, $db) { + function VerifyDeliveryDate($DeliveryDate, $i, $Errors) { $sql="SELECT confvalue FROM config WHERE confname='DefaultDateFormat'"; $result=api_DB_query($sql); $myrow=DB_fetch_array($result); @@ -158,7 +158,7 @@ } /* Fetch the next line number */ - function GetOrderLineNumber($OrderNo, $i, $Errors, $db) { + function GetOrderLineNumber($OrderNo, $i, $Errors) { $linesql = "SELECT MAX(orderlineno) FROM salesorderdetails WHERE orderno='" . $OrderNo . "'"; @@ -171,7 +171,7 @@ } /* Check that the order header already exists */ - function VerifyOrderHeaderExists($OrderNo, $i, $Errors, $db) { + function VerifyOrderHeaderExists($OrderNo, $i, $Errors) { $Searchsql = "SELECT COUNT(orderno) FROM salesorders WHERE orderno='".$OrderNo."'"; @@ -226,7 +226,7 @@ /* Check that the item due date is a valid date. The date * must be in the same format as the date format specified in the * target webERP company */ - function VerifyItemDueDate($ItemDue, $i, $Errors, $db) { + function VerifyItemDueDate($ItemDue, $i, $Errors) { $sql="SELECT confvalue FROM config WHERE confname='DefaultDateFormat'"; $result=api_DB_query($sql); $myrow=DB_fetch_array($result); @@ -272,8 +272,8 @@ foreach ($OrderHeader as $key => $value) { $OrderHeader[$key] = DB_escape_string($value); } - $Errors=VerifyDebtorExists($OrderHeader['debtorno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyBranchNoExists($OrderHeader['debtorno'],$OrderHeader['branchcode'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDebtorExists($OrderHeader['debtorno'], sizeof($Errors), $Errors); + $Errors=VerifyBranchNoExists($OrderHeader['debtorno'],$OrderHeader['branchcode'], sizeof($Errors), $Errors); if (isset($OrderHeader['customerref'])){ $Errors=VerifyCustomerRef($OrderHeader['customerref'], sizeof($Errors), $Errors); } @@ -284,13 +284,13 @@ $Errors=VerifyComments($OrderHeader['comments'], sizeof($Errors), $Errors); } if (isset($OrderHeader['orddate'])){ - $Errors=VerifyOrderDate($OrderHeader['orddate'], sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderDate($OrderHeader['orddate'], sizeof($Errors), $Errors); } if (isset($OrderHeader['ordertype'])){ - $Errors=VerifyOrderType($OrderHeader['ordertype'], sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderType($OrderHeader['ordertype'], sizeof($Errors), $Errors); } if (isset($OrderHeader['shipvia'])){ - $Errors=VerifyShipVia($OrderHeader['shipvia'], sizeof($Errors), $Errors, $db); + $Errors=VerifyShipVia($OrderHeader['shipvia'], sizeof($Errors), $Errors); } if (isset($OrderHeader['deladd1'])){ $Errors=VerifyAddressLine($OrderHeader['deladd1'], 40, sizeof($Errors), $Errors); @@ -326,10 +326,10 @@ $Errors=VerifyFreightCost($OrderHeader['freightcost'], sizeof($Errors), $Errors); } if (isset($OrderHeader['fromstkloc'])){ - $Errors=VerifyFromStockLocation($OrderHeader['fromstkloc'], sizeof($Errors), $Errors, $db); + $Errors=VerifyFromStockLocation($OrderHeader['fromstkloc'], sizeof($Errors), $Errors); } if (isset($OrderHeader['deliverydate'])){ - $Errors=VerifyDeliveryDate($OrderHeader['deliverydate'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDeliveryDate($OrderHeader['deliverydate'], sizeof($Errors), $Errors); } if (isset($OrderHeader['quotation'])){ $Errors=VerifyQuotation($OrderHeader['quotation'], sizeof($Errors), $Errors); @@ -374,9 +374,9 @@ foreach ($OrderHeader as $key => $value) { $OrderHeader[$key] = DB_escape_string($value); } - $Errors=VerifyOrderHeaderExists($OrderHeader['orderno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyDebtorExists($OrderHeader['debtorno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyBranchNoExists($OrderHeader['debtorno'],$OrderHeader['branchcode'], sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderHeaderExists($OrderHeader['orderno'], sizeof($Errors), $Errors); + $Errors=VerifyDebtorExists($OrderHeader['debtorno'], sizeof($Errors), $Errors); + $Errors=VerifyBranchNoExists($OrderHeader['debtorno'],$OrderHeader['branchcode'], sizeof($Errors), $Errors); if (isset($OrderHeader['customerref'])){ $Errors=VerifyCustomerRef($OrderHeader['customerref'], sizeof($Errors), $Errors); } @@ -387,13 +387,13 @@ $Errors=VerifyComments($OrderHeader['comments'], sizeof($Errors), $Errors); } if (isset($OrderHeader['orddate'])){ - $Errors=VerifyOrderDate($OrderHeader['orddate'], sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderDate($OrderHeader['orddate'], sizeof($Errors), $Errors); } if (isset($OrderHeader['ordertype'])){ - $Errors=VerifyOrderType($OrderHeader['ordertype'], sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderType($OrderHeader['ordertype'], sizeof($Errors), $Errors); } if (isset($OrderHeader['shipvia'])){ - $Errors=VerifyShipVia($OrderHeader['shipvia'], sizeof($Errors), $Errors, $db); + $Errors=VerifyShipVia($OrderHeader['shipvia'], sizeof($Errors), $Errors); } if (isset($OrderHeader['deladd1'])){ $Errors=VerifyAddressLine($OrderHeader['deladd1'], 40, sizeof($Errors), $Errors); @@ -429,10 +429,10 @@ $Errors=VerifyFreightCost($OrderHeader['freightcost'], sizeof($Errors), $Errors); } if (isset($OrderHeader['fromstkloc'])){ - $Errors=VerifyFromStockLocation($OrderHeader['fromstkloc'], sizeof($Errors), $Errors, $db); + $Errors=VerifyFromStockLocation($OrderHeader['fromstkloc'], sizeof($Errors), $Errors); } if (isset($OrderHeader['deliverydate'])){ - $Errors=VerifyDeliveryDate($OrderHeader['deliverydate'], sizeof($Errors), $Errors, $db); + $Errors=VerifyDeliveryDate($OrderHeader['deliverydate'], sizeof($Errors), $Errors); } if (isset($OrderHeader['quotation'])){ $Errors=VerifyQuotation($OrderHeader['quotation'], sizeof($Errors), $Errors); @@ -472,9 +472,9 @@ foreach ($OrderLine as $key => $value) { $OrderLine[$key] = DB_escape_string($value); } - $OrderLine['orderlineno'] = GetOrderLineNumber($OrderLine['orderno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyOrderHeaderExists($OrderLine['orderno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyStockCodeExists($OrderLine['stkcode'], sizeof($Errors), $Errors, $db); + $OrderLine['orderlineno'] = GetOrderLineNumber($OrderLine['orderno'], sizeof($Errors), $Errors); + $Errors=VerifyOrderHeaderExists($OrderLine['orderno'], sizeof($Errors), $Errors); + $Errors=VerifyStockCodeExists($OrderLine['stkcode'], sizeof($Errors), $Errors); if (isset($OrderLine['unitprice'])){ $Errors=VerifyUnitPrice($OrderLine['unitprice'], sizeof($Errors), $Errors); } @@ -537,8 +537,8 @@ foreach ($OrderLine as $key => $value) { $OrderLine[$key] = DB_escape_string($value); } - $Errors=VerifyOrderHeaderExists($OrderLine['orderno'], sizeof($Errors), $Errors, $db); - $Errors=VerifyStockCodeExists($OrderLine['stkcode'], sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderHeaderExists($OrderLine['orderno'], sizeof($Errors), $Errors); + $Errors=VerifyStockCodeExists($OrderLine['stkcode'], sizeof($Errors), $Errors); if (isset($OrderLine['unitprice'])){ $Errors=VerifyUnitPrice($OrderLine['unitprice'], sizeof($Errors), $Errors); } @@ -596,7 +596,7 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $Errors=VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors); if (sizeof($Errors)!=0) { return $Errors; } @@ -621,7 +621,7 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $Errors=VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors); if (sizeof($Errors)!=0) { return $Errors; } @@ -643,7 +643,7 @@ $Errors[]=NoAuthorisation; return $Errors; } - $Errors=VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors, $db); + $Errors=VerifyOrderHeaderExists($OrderNo, sizeof($Errors), $Errors); if (sizeof($Errors)!=0) { return $Errors; } @@ -721,7 +721,7 @@ /*Start an SQL transaction */ $result = DB_Txn_Begin(); /*Now Get the next invoice number - function in SQL_CommonFunctions*/ - $InvoiceNo = GetNextTransNo(10, $db); + $InvoiceNo = GetNextTransNo(10); $PeriodNo = GetCurrentPeriod($db); $TaxTotals =array(); @@ -1097,7 +1097,7 @@ '" . $InvoiceNo . "', '" . $OrderHeader['orddate'] . "', '" . $PeriodNo . "', - '" . GetCOGSGLAccount($OrderHeader['area'], $OrderLineRow['stkcode'], $OrderHeader['ordertype'], $db) . "', + '" . GetCOGSGLAccount($OrderHeader['area'], $OrderLineRow['stkcode'], $OrderHeader['ordertype']) . "', '" . $OrderHeader['debtorno'] . " - " . $OrderLineRow['stkcode'] . " x " . $OrderLineRow['quantity'] . " @ " . $StandardCost . "', '" . ($StandardCost * $OrderLineRow['quantity']) . "')"; @@ -1128,7 +1128,7 @@ if ($CompanyRecord['gllink_debtors']==1 AND $OrderLineRow['unitprice'] !=0){ //Post sales transaction to GL credit sales - $SalesGLAccounts = GetSalesGLAccount($OrderHeader['area'], $OrderLineRow['stkcode'], $OrderHeader['ordertype'], $db); + $SalesGLAccounts = GetSalesGLAccount($OrderHeader['area'], $OrderLineRow['stkcode'], $OrderHeader['ordertype']); $SQL = "INSERT INTO gltrans (type, typeno, Modified: trunk/api/api_stock.php =================================================================== --- trunk/api/api_stock.php 2018-02-16 07:19:54 UTC (rev 7963) +++ trunk/api/api_stock.php 2018-02-16 07:42:05 UTC (rev 7964) @@ -1,7 +1,7 @@ <?php /* Check that the stock code*/ - function VerifyStockCode($StockCode, $i, $Errors, $db) { + function VerifyStockCode($StockCode, $i, $Errors) { $Searchsql = "SELECT count(stockid) FROM stockmaster WHERE stockid='".$StockCode."'"; @@ -14,7 +14,7 @@ } /* Check that the stock code exists*/ - function VerifyStockCodeExists($StockCode, $i, $Errors, $db) { + function VerifyStockCodeExists($StockCode, $i, $Errors) { $Searchsql = "SELECT count(stockid) FROM stockmaster WHERE stockid='".$StockCode."'"; @@ -27,7 +27,7 @@ } /* Verify the category exists */ - function VerifyStockCategoryExists($StockCategory, $i, $Errors, $db) { + function VerifyStockCategoryExists($StockCategory, $i, $Errors) { $Searchsql = "SELECT count(categoryid) FROM stockcategory WHERE categoryid='".$StockCategory."'"; @@ -74,7 +74,7 @@ /* Check that the last current cost date is a valid date. The date * must be in the same format as the date format specified in the * target webERP company */ - function VerifyLastCurCostDate($CurCostDate, $i, $Errors, $db) { + function VerifyLastCurCostDate($CurCostDate, $i, $Errors) { $sql="SELECT confvalue FROM config WHERE confname='DefaultDateFormat'"; $result=DB_query($sql); $myrow=DB_fetch_array($result); @@ -212,7 +212,7 @@ } /* Check that the tax category exists*/ - function VerifyTaxCatExists($TaxCat, $i, $Errors, $db) { + function VerifyTaxCatExists($TaxCat, $i, $Errors) { $Searchsql = "SELECT count(taxcatid) FROM taxcategories WHERE taxcatid='".$TaxCat."'"; @@ -256,7 +256,7 @@ return $Errors; } - function GetCategoryGLCode($CategoryID, $field, $db) { + function GetCategoryGLCode($CategoryID, $field) { $sql='SELECT '.$field." FROM stockcategory WHERE categoryid='".$CategoryID."'"; $result = DB_query($sql); $myrow = DB_fetch_row($result); @@ -288,11 +288,11 @@ foreach ($StockItemDetails as $key => $value) { $StockItemDetails[$key] = DB_escape_string($value); } - $Errors=VerifyStockCode($StockItemDetails['stockid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyStockCode($StockItemDetails['stockid'], sizeof($Errors), $Errors); $Errors=VerifyStockDescription($StockItemDetails['decription'], sizeof($Errors), $Errors); $Errors=VerifyStockLongDescription($StockItemDetails['longdescription'], sizeof($Errors), $Errors); if (isset($StockItemDetails['categoryid'])){ - $Errors=VerifyStockCategoryExists($StockItemDetails['categoryid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyStockCategoryExists($StockItemDetails['categoryid'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['units'])){ $Errors=VerifyUnits($StockItemDetails['units'], sizeof($Errors), $Errors); @@ -301,7 +301,7 @@ $Errors=VerifyMBFlag($StockItemDetails['mbflag'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['lastcurcostdate'])){ - $Errors=VerifyLastCurCostDate($StockItemDetails['lastcurcostdate'], sizeof($Errors), $Errors, $db); + $Errors=VerifyLastCurCostDate($StockItemDetails['lastcurcostdate'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['actualcost'])){ $Errors=VerifyActualCost($StockItemDetails['actualcost'], sizeof($Errors), $Errors); @@ -343,7 +343,7 @@ $Errors=VerifyDiscountCategory($StockItemDetails['discountcategory'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['taxcatid'])){ - $Errors=VerifyTaxCatExists($StockItemDetails['taxcatid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyTaxCatExists($StockItemDetails['taxcatid'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['serialised'])){ $Errors=VerifySerialised($StockItemDetails['serialised'], sizeof($Errors), $Errors); @@ -401,7 +401,7 @@ foreach ($StockItemDetails as $key => $value) { $StockItemDetails[$key] = DB_escape_string($value); } - $Errors=VerifyStockCodeExists($StockItemDetails['stockid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyStockCodeExists($StockItemDetails['stockid'], sizeof($Errors), $Errors); if (in_array(StockCodeDoesntExist, $Errors)) { return $Errors; } @@ -412,7 +412,7 @@ $Errors=VerifyStockLongDescription($StockItemDetails['longdescription'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['categoryid'])){ - $Errors=VerifyStockCategoryExists($StockItemDetails['categoryid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyStockCategoryExists($StockItemDetails['categoryid'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['units'])){ $Errors=VerifyUnits($StockItemDetails['units'], sizeof($Errors), $Errors); @@ -421,7 +421,7 @@ $Errors=VerifyMBFlag($StockItemDetails['mbflag'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['lastcurcostdate'])){ - $Errors=VerifyLastCurCostDate($StockItemDetails['lascurcostdate'], sizeof($Errors), $Errors, $db); + $Errors=VerifyLastCurCostDate($StockItemDetails['lascurcostdate'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['actualcost'])){ $Errors=VerifyActualCost($StockItemDetails['actualcost'], sizeof($Errors), $Errors); @@ -463,7 +463,7 @@ $Errors=VerifyDiscountCategory($StockItemDetails['discountcategory'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['taxcatid'])){ - $Errors=VerifyTaxCatExists($StockItemDetails['taxcatid'], sizeof($Errors), $Errors, $db); + $Errors=VerifyTaxCatExists($StockItemDetails['taxcatid'], sizeof($Errors), $Errors); } if (isset($StockItemDetails['serialised'])){ $Errors=VerifySerialised($StockItemDetails['serialised'], sizeof($Errors), $Errors); @@ -505,7 +505,7 @@ $Errors[0]=NoAuthorisation; return $Errors; } - $Errors = VerifyStockCodeExists($StockID, sizeof($Errors), $Errors, $db); + $Errors = VerifyStockCodeExists($StockID, sizeof($Errors), $Errors); ... [truncated message content] |