Advertisement
Advertisement
| 04.21.2008 at 11:52PM PDT, ID: 23342008 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: |
//Code for the class
include_once('functions/errorHandler.php');
class Soap_PDA
{
var $dbh; // The database connection for this class
var $dbh2; // The database connection for this class
var $error = ''; // Error messages returned stored in the class
/******************************************************************************************************
* Class Constructor, creates a database connection
*******************************************************************************************************/
function Soap_PDA()
{
// Connect to the database
include('includes/cosdb.conf');
$this->dbh = $dbh;
$this->dbh2 = $dbh2;
}
function authenticate_driver($driverNo, $password){
return true;
}
//this function stores the result from DB
function storeResult($output_array, $result){
$i = 0;
while ($row = ifx_fetch_row($result)){
while (list($key, $val) = each($row)){
$output_array[$i][$key] = trim($val);
}
$i++;
}
return($output_array);
}
//This function will get a drivers package details so they can scan them in the WH
function getParcels($driverNo, $password){
//Authenticate driver
if (!$this->authenticate_driver($driverNo, $password)){
$this->error = "Authentication failed";
return false;
}
$status = 200; //status for everything is OK
$sql = "SELECT a.order_number,
a.backorder_suffix,
a.order_status,
a.driver_no,
a.warehouse_code,
b.packtype_id,
b.pklbl_type,
b.pklbl_stkcode,
b.pklbl_stkqty,
b.label_id
FROM sales_order a, so_pack_details b
WHERE a.order_status IN ('66', '76')
AND a.driver_no = '".$driverNo."'
AND (b.pklbl_scanbin = 'Y' OR b.pklbl_scanbin is null)
AND a.order_number = b.order_number
AND a.backorder_suffix = b.backorder_suffix";
$result = ifx_query($sql, $this->dbh);
if (!$result) {
$this->error = "Database Error: Unable to perform query (getParcels)";
errorHandler("Soap_PDA.class.php $this->error", $sql, 3);
$status = 500;
return array($status, $result_array);
}
$result_array = $this->storeResult($result_array, $result);
if ($result){
ifx_free_result($result);
}
return array($status, $result_array);
}//end function
}//end class
//code for the server
include_once('classes/Soap_PDA.class.php');
function getParcels($driver_no, $password){
$Soap_PDA_OBJ = new Soap_PDA();
list($status, $result) = $Soap_PDA_OBJ->getParcels($driver_no, $password);
if ($status == 500){
return new SoapFault("Server", $Soap_PDA_OBJ->error);
}
return array($status, $result);
}
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer("http://users.tpg.com.au/lymber//COS_PDA_WSDL.wsdl");
$server->addFunction(SOAP_FUNCTIONS_ALL);
$server->handle();
|