/** * Deletes all associated InventoryLocations * @return void */ public function DeleteAllInventoryLocations() { if (is_null($this->intLocationId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryLocation on this unsaved Location.'); } // Get the Database Object for this Class $objDatabase = Location::GetDatabase(); // Journaling if ($objDatabase->JournalingDatabase) { foreach (InventoryLocation::LoadArrayByLocationId($this->intLocationId) as $objInventoryLocation) { $objInventoryLocation->Journal('DELETE'); } } // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `inventory_location` WHERE `location_id` = ' . $objDatabase->SqlVariable($this->intLocationId) . ' '); }
$objAuditScan->SystemCount = $objNewInventoryLocation->Quantity; } else { $objAuditScan->SystemCount = 0; } $objAuditScanArray[] = $objAuditScan; } } } } } // Submit if (!$blnError) { // Add missing inventories that should have been at a location covered by the audit session but were not scanned if ($intLocationIdArray) { foreach ($intLocationIdArray as $intLocationId) { $objInventoryLocationArray = InventoryLocation::LoadArrayByLocationId($intLocationId); if ($objInventoryLocationArray) { foreach ($objInventoryLocationArray as $objInventory) { if (!in_array($objInventory->InventoryModelId, $intInventoryIdArray)) { $objNewAuditScan = new AuditScan(); $objNewAuditScan->LocationId = $intLocationId; $objNewAuditScan->EntityId = $objInventory->InventoryModelId; $objNewAuditScan->Count = 0; $objNewAuditScan->SystemCount = $objInventory->Quantity; $objAuditScanArray[] = $objNewAuditScan; unset($objNewAuditScan); } } } } }
/** * Gets all associated InventoryLocations as an array of InventoryLocation objects * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query * @return InventoryLocation[] */ public function GetInventoryLocationArray($objOptionalClauses = null) { if (is_null($this->intLocationId)) { return array(); } try { return InventoryLocation::LoadArrayByLocationId($this->intLocationId, $objOptionalClauses); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }