Пример #1
0
    /**
     * Deletes all associated AssetTransactionCheckoutsAsTo
     * @return void
     */
    public function DeleteAllAssetTransactionCheckoutsAsTo()
    {
        if (is_null($this->intContactId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAssetTransactionCheckoutAsTo on this unsaved Contact.');
        }
        // Get the Database Object for this Class
        $objDatabase = Contact::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (AssetTransactionCheckout::LoadArrayByToContactId($this->intContactId) as $objAssetTransactionCheckout) {
                $objAssetTransactionCheckout->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`asset_transaction_checkout`
				WHERE
					`to_contact_id` = ' . $objDatabase->SqlVariable($this->intContactId) . '
			');
    }