예제 #1
0
    /**
     * Deletes an associated AssetTransactionCheckoutAsTo
     * @param AssetTransactionCheckout $objAssetTransactionCheckout
     * @return void
     */
    public function DeleteAssociatedAssetTransactionCheckoutAsTo(AssetTransactionCheckout $objAssetTransactionCheckout)
    {
        if (is_null($this->intContactId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAssetTransactionCheckoutAsTo on this unsaved Contact.');
        }
        if (is_null($objAssetTransactionCheckout->AssetTransactionCheckoutId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAssetTransactionCheckoutAsTo on this Contact with an unsaved AssetTransactionCheckout.');
        }
        // Get the Database Object for this Class
        $objDatabase = Contact::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`asset_transaction_checkout`
				WHERE
					`asset_transaction_checkout_id` = ' . $objDatabase->SqlVariable($objAssetTransactionCheckout->AssetTransactionCheckoutId) . ' AND
					`to_contact_id` = ' . $objDatabase->SqlVariable($this->intContactId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objAssetTransactionCheckout->Journal('DELETE');
        }
    }