Example #1
0
    /**
     * Deletes an associated InventoryTransactionAsDestination
     * @param InventoryTransaction $objInventoryTransaction
     * @return void
     */
    public function DeleteAssociatedInventoryTransactionAsDestination(InventoryTransaction $objInventoryTransaction)
    {
        if (is_null($this->intLocationId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryTransactionAsDestination on this unsaved Location.');
        }
        if (is_null($objInventoryTransaction->InventoryTransactionId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryTransactionAsDestination on this Location with an unsaved InventoryTransaction.');
        }
        // Get the Database Object for this Class
        $objDatabase = Location::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`inventory_transaction`
				WHERE
					`inventory_transaction_id` = ' . $objDatabase->SqlVariable($objInventoryTransaction->InventoryTransactionId) . ' AND
					`destination_location_id` = ' . $objDatabase->SqlVariable($this->intLocationId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objInventoryTransaction->Journal('DELETE');
        }
    }
    /**
     * Deletes an associated InventoryTransactionAsModifiedBy
     * @param InventoryTransaction $objInventoryTransaction
     * @return void
     */
    public function DeleteAssociatedInventoryTransactionAsModifiedBy(InventoryTransaction $objInventoryTransaction)
    {
        if (is_null($this->intUserAccountId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryTransactionAsModifiedBy on this unsaved UserAccount.');
        }
        if (is_null($objInventoryTransaction->InventoryTransactionId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryTransactionAsModifiedBy on this UserAccount with an unsaved InventoryTransaction.');
        }
        // Get the Database Object for this Class
        $objDatabase = UserAccount::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`inventory_transaction`
				WHERE
					`inventory_transaction_id` = ' . $objDatabase->SqlVariable($objInventoryTransaction->InventoryTransactionId) . ' AND
					`modified_by` = ' . $objDatabase->SqlVariable($this->intUserAccountId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objInventoryTransaction->Journal('DELETE');
        }
    }