/** * Deletes all associated InventoryTransactions * @return void */ public function DeleteAllInventoryTransactions() { if (is_null($this->intInventoryLocationId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryTransaction on this unsaved InventoryLocation.'); } // Get the Database Object for this Class $objDatabase = InventoryLocation::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (InventoryTransaction::LoadArrayByInventoryLocationId($this->intInventoryLocationId) as $objInventoryTransaction) { $objInventoryTransaction->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `inventory_transaction` WHERE `inventory_location_id` = ' . $objDatabase->SqlVariable($this->intInventoryLocationId) . ' '); }