/** * Load a Pending Shipment AssetTransaction * Checks for any AssetTransaction where the source_location_id > 5 (any custom created location) and the destination is NULL (still pending) * @param integer $intAssetIed * @return AssetTransaction */ public static function PendingShipment($intAssetId) { // Call to QueryHelper to Get Database Object and Get SQL Clauses AssetTransaction::QueryHelper($objDatabase); // Properly Escape All Input Parameters using Database->SqlVariable() $intAssetId = $objDatabase->SqlVariable($intAssetId); // Setup the SQL Query $strQuery = sprintf(' SELECT `asset_transaction_id`, `asset_id`, `transaction_id`, `source_location_id`, `destination_location_id` FROM `asset_transaction` WHERE `asset_id` = %s AND `source_location_id` > 5 AND `destination_location_id` IS NULL', $intAssetId); // Perform the Query and Instantiate the Row $objDbResult = $objDatabase->Query($strQuery); return AssetTransaction::InstantiateDbRow($objDbResult->GetNextRow()); }