public function Save($blnForceInsert = false, $blnForceUpdate = false) { if (!$this->__blnRestored || $blnForceInsert) { $this->CreatedBy = QApplication::$objUserAccount->UserAccountId; $this->CreationDate = new QDateTime(QDateTime::Now); parent::Save($blnForceInsert, $blnForceUpdate); // If we have no errors then will add the data to the helper table $objDatabase = InventoryModel::GetDatabase(); $strQuery = sprintf('INSERT INTO `inventory_model_custom_field_helper` (`inventory_model_id`) VALUES (%s);', $this->InventoryModelId); $objDatabase->NonQuery($strQuery); } else { $this->ModifiedBy = QApplication::$objUserAccount->UserAccountId; parent::Save($blnForceInsert, $blnForceUpdate); } }
/** * Deletes all associated InventoryLocations * @return void */ public function DeleteAllInventoryLocations() { if (is_null($this->intInventoryModelId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryLocation on this unsaved InventoryModel.'); } // Get the Database Object for this Class $objDatabase = InventoryModel::GetDatabase(); // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `inventory_location` WHERE `inventory_model_id` = ' . $objDatabase->SqlVariable($this->intInventoryModelId) . ' '); }