Пример #1
0
    /**
     * Deletes an associated InventoryLocation
     * @param InventoryLocation $objInventoryLocation
     * @return void
     */
    public function DeleteAssociatedInventoryLocation(InventoryLocation $objInventoryLocation)
    {
        if (is_null($this->intLocationId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryLocation on this unsaved Location.');
        }
        if (is_null($objInventoryLocation->InventoryLocationId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryLocation on this Location with an unsaved InventoryLocation.');
        }
        // Get the Database Object for this Class
        $objDatabase = Location::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`inventory_location`
				WHERE
					`inventory_location_id` = ' . $objDatabase->SqlVariable($objInventoryLocation->InventoryLocationId) . ' AND
					`location_id` = ' . $objDatabase->SqlVariable($this->intLocationId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objInventoryLocation->Journal('DELETE');
        }
    }