public function __toStringFullAddressWithWebsite($cssClass = null) { $objCompany = Company::Load($this->CompanyId); $strWebsite = $objCompany->Website; $strToReturn = sprintf('%s<br>%s', $this->__toStringFullAddress(), $strWebsite); return $strToReturn; }
protected function SetupCompany() { // Lookup Object PK information from Query String (if applicable) // Set mode to Edit or New depending on what's found $intCompanyId = QApplication::QueryString('intCompanyId'); if ($intCompanyId) { $this->objCompany = Company::Load($intCompanyId); if (!$this->objCompany) { throw new Exception('Could not find a Company object with PK arguments: ' . $intCompanyId); } $this->strTitleVerb = QApplication::Translate('Edit'); $this->blnEditMode = true; } else { $this->objCompany = new Company(); $this->strTitleVerb = QApplication::Translate('Create'); $this->blnEditMode = false; } }
public function lstCompany_Select() { // Clear out the items from lstAddress $this->lstAddress->RemoveAllItems(); if ($this->lstCompany->SelectedValue) { // Load the selected company $objCompany = Company::Load($this->lstCompany->SelectedValue); // Get all available addresses for that company if ($objCompany) { $objAddressArray = $objCompany->GetAddressArray(); $this->lstAddress->Enabled = true; } else { $objAddressArray = null; $this->lstAddress->Enabled = false; } } else { // Or load all addresses for all companies //$objAddressArray = Address::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription))); //$this->lstAddress->Enabled = true; $objAddressArray = null; } $this->lstAddress->AddItem('- Select One -', null); if ($objAddressArray) { foreach ($objAddressArray as $objAddress) { $objListItem = new QListItem($objAddress->__toString(), $objAddress->AddressId); // Select the proper AddressID if editing an existing contact if ($this->blnEditMode && $this->objContact->Address && $this->objContact->AddressId == $objAddress->AddressId) { $objListItem->Selected = true; } $this->lstAddress->AddItem($objListItem); } } /* if ($this->lstCompany->SelectedValue && $this->lstCompany->SelectedValue == -1) { $this->pnlNewCompany->Visible = true; } else { $this->pnlNewCompany->Visible = false; }*/ }
/** * Reload this Company from the database. * @return void */ public function Reload() { // Make sure we are actually Restored from the database if (!$this->__blnRestored) { throw new QCallerException('Cannot call Reload() on a new, unsaved Company object.'); } // Reload the Object $objReloaded = Company::Load($this->intCompanyId); // Update $this's local variables to match $this->AddressId = $objReloaded->AddressId; $this->strShortDescription = $objReloaded->strShortDescription; $this->strWebsite = $objReloaded->strWebsite; $this->strTelephone = $objReloaded->strTelephone; $this->strFax = $objReloaded->strFax; $this->strEmail = $objReloaded->strEmail; $this->strLongDescription = $objReloaded->strLongDescription; $this->CreatedBy = $objReloaded->CreatedBy; $this->dttCreationDate = $objReloaded->dttCreationDate; $this->ModifiedBy = $objReloaded->ModifiedBy; $this->strModifiedDate = $objReloaded->strModifiedDate; }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'ShipmentId': // Gets the value for intShipmentId (Read-Only PK) // @return integer return $this->intShipmentId; case 'ShipmentNumber': // Gets the value for strShipmentNumber (Unique) // @return string return $this->strShipmentNumber; case 'TransactionId': // Gets the value for intTransactionId (Unique) // @return integer return $this->intTransactionId; case 'FromCompanyId': // Gets the value for intFromCompanyId (Not Null) // @return integer return $this->intFromCompanyId; case 'FromContactId': // Gets the value for intFromContactId (Not Null) // @return integer return $this->intFromContactId; case 'FromAddressId': // Gets the value for intFromAddressId (Not Null) // @return integer return $this->intFromAddressId; case 'ToCompanyId': // Gets the value for intToCompanyId (Not Null) // @return integer return $this->intToCompanyId; case 'ToContactId': // Gets the value for intToContactId (Not Null) // @return integer return $this->intToContactId; case 'ToAddressId': // Gets the value for intToAddressId (Not Null) // @return integer return $this->intToAddressId; case 'CourierId': // Gets the value for intCourierId // @return integer return $this->intCourierId; case 'TrackingNumber': // Gets the value for strTrackingNumber // @return string return $this->strTrackingNumber; case 'ShipDate': // Gets the value for dttShipDate (Not Null) // @return QDateTime return $this->dttShipDate; case 'ShippedFlag': // Gets the value for blnShippedFlag // @return boolean return $this->blnShippedFlag; case 'CreatedBy': // Gets the value for intCreatedBy // @return integer return $this->intCreatedBy; case 'CreationDate': // Gets the value for dttCreationDate // @return QDateTime return $this->dttCreationDate; case 'ModifiedBy': // Gets the value for intModifiedBy // @return integer return $this->intModifiedBy; case 'ModifiedDate': // Gets the value for strModifiedDate (Read-Only Timestamp) // @return string return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Transaction': // Gets the value for the Transaction object referenced by intTransactionId (Unique) // @return Transaction try { if (!$this->objTransaction && !is_null($this->intTransactionId)) { $this->objTransaction = Transaction::Load($this->intTransactionId); } return $this->objTransaction; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromCompany': // Gets the value for the Company object referenced by intFromCompanyId (Not Null) // @return Company try { if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) { $this->objFromCompany = Company::Load($this->intFromCompanyId); } return $this->objFromCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromContact': // Gets the value for the Contact object referenced by intFromContactId (Not Null) // @return Contact try { if (!$this->objFromContact && !is_null($this->intFromContactId)) { $this->objFromContact = Contact::Load($this->intFromContactId); } return $this->objFromContact; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromAddress': // Gets the value for the Address object referenced by intFromAddressId (Not Null) // @return Address try { if (!$this->objFromAddress && !is_null($this->intFromAddressId)) { $this->objFromAddress = Address::Load($this->intFromAddressId); } return $this->objFromAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToCompany': // Gets the value for the Company object referenced by intToCompanyId (Not Null) // @return Company try { if (!$this->objToCompany && !is_null($this->intToCompanyId)) { $this->objToCompany = Company::Load($this->intToCompanyId); } return $this->objToCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToContact': // Gets the value for the Contact object referenced by intToContactId (Not Null) // @return Contact try { if (!$this->objToContact && !is_null($this->intToContactId)) { $this->objToContact = Contact::Load($this->intToContactId); } return $this->objToContact; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToAddress': // Gets the value for the Address object referenced by intToAddressId (Not Null) // @return Address try { if (!$this->objToAddress && !is_null($this->intToAddressId)) { $this->objToAddress = Address::Load($this->intToAddressId); } return $this->objToAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Courier': // Gets the value for the Courier object referenced by intCourierId // @return Courier try { if (!$this->objCourier && !is_null($this->intCourierId)) { $this->objCourier = Courier::Load($this->intCourierId); } return $this->objCourier; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ShipmentCustomFieldHelper': // Gets the value for the ShipmentCustomFieldHelper object that uniquely references this Shipment // by objShipmentCustomFieldHelper (Unique) // @return ShipmentCustomFieldHelper try { if ($this->objShipmentCustomFieldHelper === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objShipmentCustomFieldHelper) { $this->objShipmentCustomFieldHelper = ShipmentCustomFieldHelper::LoadByShipmentId($this->intShipmentId); } return $this->objShipmentCustomFieldHelper; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
protected function btnSave_Click() { $intCompanyId = $this->lstCompany->SelectedValue; $objCompany = Company::Load($intCompanyId); // Altered $TracmorSettings __set() method so that just setting a value will save it in the database. QApplication::$TracmorSettings->CompanyId = $intCompanyId; QApplication::$TracmorSettings->PackingListTerms = $this->txtPackingListTerms->Text; QApplication::$TracmorSettings->AutodetectTrackingNumbers = $this->chkAutoDetectTrackingNumbers->Checked; QApplication::$TracmorSettings->ReceiveToLastLocation = $this->chkReceiveToLastLocation->Checked; QApplication::$TracmorSettings->CustomShipmentNumbers = (string) $this->chkCustomShipmentNumbers->Checked; QApplication::$TracmorSettings->CustomReceiptNumbers = (string) $this->chkCustomReceiptNumbers->Checked; // Show saved notification $this->pnlSaveNotification->Display = true; }
protected function btnMassDelete_Click($strFormId, $strControlId, $strParameter) { $items = $this->dtgCompany->getSelected('CompanyId'); // Show confirm "Are you sure you want to {delete/edit} these objects?" if (count($items) > 0) { $this->lblMassActionError->Text = ""; if (!$this->dlgMassDelete->Display) { $arrToBeSkipped = array(); foreach ($items as $item) { // Check if any Shipments or Receipts include selected contact if (Shipment::hasCompany($item)) { // append $item to be skipped $arrToBeSkipped[] = $item; } else { $this->arrToDelete[] = $item; } } if (count($arrToBeSkipped) > 0) { if (count($arrToBeSkipped) == 1) { $toBe = 'is'; $ending1 = 'y'; $ending2 = ''; } else { $toBe = 'are'; $ending1 = 'ies'; $ending2 = 's'; } // Show dialog box "There are {number} {entity_type}s that are not able to be deleted. Would you like to continue the deletion process, skipping these items?" $this->dlgMassDelete->Text = sprintf("There %s %s compan%s that %s not able to be deleted.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t Would you like to continue the deletion process,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t skipping these item%s?<br />", $toBe, count($arrToBeSkipped), $ending1, $toBe, $ending2); $this->dlgMassDelete->ShowDialogBox(); } else { if (count($this->arrToDelete) > 0) { try { // Get an instance of the database $objDatabase = QApplication::$Database[1]; // Begin a MySQL Transaction to be either committed or rolled back $objDatabase->TransactionBegin(); foreach ($this->arrToDelete as $intCompanyId) { Company::Load($intCompanyId)->Delete(); } $objDatabase->TransactionCommit(); $this->arrToDelete = array(); QApplication::Redirect(''); } catch (QMySqliDatabaseException $objExc) { $objDatabase->TransactionRollback(); throw new QDatabaseException(); } } } // print_r(get_class_methods(get_class($this->dlgDelete)));exit;//$this->dlgDelete->ShowDialogBox() ; } } else { $this->lblMassActionError->Text = "You haven't chosen any Company to Delete"; } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'ContactId': /** * Gets the value for intContactId (Read-Only PK) * @return integer */ return $this->intContactId; case 'CompanyId': /** * Gets the value for intCompanyId (Not Null) * @return integer */ return $this->intCompanyId; case 'AddressId': /** * Gets the value for intAddressId * @return integer */ return $this->intAddressId; case 'FirstName': /** * Gets the value for strFirstName * @return string */ return $this->strFirstName; case 'LastName': /** * Gets the value for strLastName (Not Null) * @return string */ return $this->strLastName; case 'Title': /** * Gets the value for strTitle * @return string */ return $this->strTitle; case 'Email': /** * Gets the value for strEmail * @return string */ return $this->strEmail; case 'PhoneOffice': /** * Gets the value for strPhoneOffice * @return string */ return $this->strPhoneOffice; case 'PhoneHome': /** * Gets the value for strPhoneHome * @return string */ return $this->strPhoneHome; case 'PhoneMobile': /** * Gets the value for strPhoneMobile * @return string */ return $this->strPhoneMobile; case 'Fax': /** * Gets the value for strFax * @return string */ return $this->strFax; case 'Description': /** * Gets the value for strDescription * @return string */ return $this->strDescription; case 'CreatedBy': /** * Gets the value for intCreatedBy * @return integer */ return $this->intCreatedBy; case 'CreationDate': /** * Gets the value for dttCreationDate * @return QDateTime */ return $this->dttCreationDate; case 'ModifiedBy': /** * Gets the value for intModifiedBy * @return integer */ return $this->intModifiedBy; case 'ModifiedDate': /** * Gets the value for strModifiedDate (Read-Only Timestamp) * @return string */ return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Company': /** * Gets the value for the Company object referenced by intCompanyId (Not Null) * @return Company */ try { if (!$this->objCompany && !is_null($this->intCompanyId)) { $this->objCompany = Company::Load($this->intCompanyId); } return $this->objCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Address': /** * Gets the value for the Address object referenced by intAddressId * @return Address */ try { if (!$this->objAddress && !is_null($this->intAddressId)) { $this->objAddress = Address::Load($this->intAddressId); } return $this->objAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': /** * Gets the value for the UserAccount object referenced by intCreatedBy * @return UserAccount */ try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': /** * Gets the value for the UserAccount object referenced by intModifiedBy * @return UserAccount */ try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_ReceiptAsFrom': /** * Gets the value for the private _objReceiptAsFrom (Read-Only) * if set due to an expansion on the receipt.from_contact_id reverse relationship * @return Receipt */ return $this->_objReceiptAsFrom; case '_ReceiptAsFromArray': /** * Gets the value for the private _objReceiptAsFromArray (Read-Only) * if set due to an ExpandAsArray on the receipt.from_contact_id reverse relationship * @return Receipt[] */ return (array) $this->_objReceiptAsFromArray; case '_ReceiptAsTo': /** * Gets the value for the private _objReceiptAsTo (Read-Only) * if set due to an expansion on the receipt.to_contact_id reverse relationship * @return Receipt */ return $this->_objReceiptAsTo; case '_ReceiptAsToArray': /** * Gets the value for the private _objReceiptAsToArray (Read-Only) * if set due to an ExpandAsArray on the receipt.to_contact_id reverse relationship * @return Receipt[] */ return (array) $this->_objReceiptAsToArray; case '_ShipmentAsFrom': /** * Gets the value for the private _objShipmentAsFrom (Read-Only) * if set due to an expansion on the shipment.from_contact_id reverse relationship * @return Shipment */ return $this->_objShipmentAsFrom; case '_ShipmentAsFromArray': /** * Gets the value for the private _objShipmentAsFromArray (Read-Only) * if set due to an ExpandAsArray on the shipment.from_contact_id reverse relationship * @return Shipment[] */ return (array) $this->_objShipmentAsFromArray; case '_ShipmentAsTo': /** * Gets the value for the private _objShipmentAsTo (Read-Only) * if set due to an expansion on the shipment.to_contact_id reverse relationship * @return Shipment */ return $this->_objShipmentAsTo; case '_ShipmentAsToArray': /** * Gets the value for the private _objShipmentAsToArray (Read-Only) * if set due to an ExpandAsArray on the shipment.to_contact_id reverse relationship * @return Shipment[] */ return (array) $this->_objShipmentAsToArray; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
public function lstCompany_Change() { // Clear out the items from lstAddress $this->lstAddress->RemoveAllItems(); if ($this->lstCompany->SelectedValue) { // Load the selected company $objCompany = Company::Load($this->lstCompany->SelectedValue); // Get all available addresses for that company if ($objCompany) { $objAddressArray = $objCompany->GetAddressArray(); $this->lstAddress->Enabled = true; } else { $objAddressArray = null; $this->lstAddress->Enabled = false; } } else { // Or load all addresses for all companies $objAddressArray = Address::LoadAll(QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription))); $this->lstAddress->Enabled = true; } $this->lstAddress->AddItem('- Select One -', null); if ($objAddressArray) { foreach ($objAddressArray as $objAddress) { $objListItem = new QListItem($objAddress->__toString(), $objAddress->AddressId); $this->lstAddress->AddItem($objListItem); } } }
public function btnEdit_Click($strFormId, $strControlId, $strParameter) { $strParameterArray = explode(',', $strParameter); $objCompany = Company::Load($strParameterArray[0]); $objEditPanel = new CompanyEditPanel($this, $this->strCloseEditPanelMethod, $objCompany); $strMethodName = $this->strSetEditPanelMethod; $this->objForm->{$strMethodName}($objEditPanel); }
protected function btnSave_Click($strFormId, $strControlId, $strParameter) { $blnError = false; if ($this->objAssetTransactionArray && $this->objInventoryTransactionArray) { $intEntityQtypeId = EntityQtype::AssetInventory; } elseif ($this->objAssetTransactionArray) { $intEntityQtypeId = EntityQtype::Asset; } elseif ($this->objInventoryTransactionArray) { $intEntityQtypeId = EntityQtype::Inventory; } else { $blnError = true; $this->btnCancel->Warning = 'There are no assets or inventory in this shipment.'; } if (QApplication::$TracmorSettings->CustomShipmentNumbers) { if ($objShipment = Shipment::LoadByShipmentNumber($this->txtShipmentNumber->Text)) { if ($objShipment->ShipmentId != $this->objShipment->ShipmentId) { $blnError = true; $this->txtShipmentNumber->Warning = 'That is a duplicate shipment number.'; } } } if ($this->lstFxServiceType->SelectedValue) { $objtoFxAddress = Address::Load($this->lstToAddress->SelectedValue); if (!$objtoFxAddress || !$objtoFxAddress->PostalCode || !$objtoFxAddress->CountryId || !$objtoFxAddress->Address1) { $blnError = true; $this->lstFxServiceType->Warning = "Not a valid To Address."; } $objfromFxAddress = Address::Load($this->lstFromAddress->SelectedValue); if (!$objfromFxAddress || !$objfromFxAddress->PostalCode || !$objfromFxAddress->Address1 || !$objfromFxAddress->CountryId) { $blnError = true; $this->lstFxServiceType->Warning = "Not a valid From Address."; } $objfromFxContact = Contact::Load($this->lstFromContact->SelectedValue); if (!$objfromFxContact) { $blnError = true; $this->lstFxServiceType->Warning = "Not a valid From Contact."; } $objfromFxCompany = Company::Load($this->lstFromCompany->SelectedValue); if (!$objfromFxCompany) { $blnError = true; $this->lstFxServiceType->Warning = "Not a valid From Company."; } elseif (!$objfromFxCompany->Telephone) { $blnError = true; $this->lstFxServiceType->Warning = "The Shipping Company must have a telephone number."; } $objShippingAccount = ShippingAccount::Load($this->lstShippingAccount->SelectedValue); if (!$objShippingAccount) { $blnError = true; $this->lstFxServiceType->Warning = "Not a valid Shipping Account."; } /* $fed = new FedExDC($objShippingAccount->Value); $aRet = $fed->subscribe( array( 1 => $this->lblShipmentNumber->Text, // Don't really need this but can be used for ref 4003 => $objfromFxContact->__toString(), 4008 => $objfromFxAddress->Address1, 4009 => $objfromFxAddress->Address2, 4011 => $objfromFxAddress->City, 4012 => $objfromFxAddress->__toStringStateProvinceAbbreviation(), 4013 => $objfromFxAddress->PostalCode, 4014 => $objfromFxAddress->__toStringCountryAbbreviation(), 4015 => $this->FxStrip($objfromFxCompany->Telephone), ) ); if ($error = $fed->getError()) { $blnError = true; $this->lstFxServiceType->Warning = $error; } elseif (!$aRet[498]) { $blnError = true; $this->lstFxServiceType->Warning = "Fedex response is improperly formed."; } else { $this->objShipment->FedexMeterNumber = $aRet[498]; }*/ } if (!$blnError) { if (!$this->blnEditMode) { try { // Get an instance of the database $objDatabase = QApplication::$Database[1]; // Begin a MySQL Transaction to be either committed or rolled back $objDatabase->TransactionBegin(); // Create the new transaction object and save it $this->objTransaction = new Transaction(); $this->objTransaction->EntityQtypeId = $intEntityQtypeId; $this->objTransaction->TransactionTypeId = 6; $this->objTransaction->Note = $this->txtNote->Text; $this->objTransaction->Save(); if ($intEntityQtypeId == EntityQtype::AssetInventory || $intEntityQtypeId == EntityQtype::Asset) { // Assign different source and destinations depending on transaction type foreach ($this->objAssetTransactionArray as $objAssetTransaction) { if ($objAssetTransaction->Asset instanceof Asset) { // Save the asset just to update the modified_date field so it can trigger an Optimistic Locking Exception when appropriate $objAssetTransaction->Asset->Save(); // Assign the TransactionId $objAssetTransaction->TransactionId = $this->objTransaction->TransactionId; // Create the new asset if it was scheduled for receipt if ($objAssetTransaction->ScheduleReceiptFlag && $objAssetTransaction->NewAsset && $objAssetTransaction->NewAsset instanceof Asset) { $objReceiptAsset = new Asset(); $objReceiptAsset->AssetModelId = $objAssetTransaction->NewAsset->AssetModelId; $objReceiptAsset->LocationId = $objAssetTransaction->NewAsset->LocationId; //if ($objReceiptAsset->AssetCode == '') { if ($objAssetTransaction->NewAsset->AssetCode == '') { $objReceiptAsset->AssetCode = Asset::GenerateAssetCode(); } else { $objReceiptAsset->AssetCode = $objAssetTransaction->NewAsset->AssetCode; } $objReceiptAsset->Save(); // Assign any default custom field values CustomField::AssignNewEntityDefaultValues(1, $objReceiptAsset->AssetId); // Associate the new Asset with the AssetTransaction $objAssetTransaction->NewAsset = $objReceiptAsset; } // $objAssetTransaction->DestinationLocationId = $DestinationLocationId; $objAssetTransaction->Save(); /*$objLinkedAssetArray = Asset::LoadChildLinkedArrayByParentAssetId($objAssetTransaction->Asset->AssetId); if ($objLinkedAssetArray) { foreach ($objLinkedAssetArray as $objLinkedAsset) { $objLinkedAssetTransaction = new AssetTransaction(); $objLinkedAssetTransaction->AssetId = $objLinkedAsset->AssetId; $objLinkedAssetTransaction->SourceLocationId = $objLinkedAsset->LocationId; $objLinkedAssetTransaction->TransactionId = $objAssetTransaction->TransactionId; $objLinkedAssetTransaction->Save(); } }*/ } } } if ($intEntityQtypeId == EntityQtype::AssetInventory || $intEntityQtypeId == EntityQtype::Inventory) { // Assign different source and destinations depending on transaction type foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) { // Save the inventory location just to update the modified_date field so it can triggern an Optimistic Locking Exception when appropriate $objInventoryTransaction->InventoryLocation->Save(); // Assign the TransactionId $objInventoryTransaction->TransactionId = $this->objTransaction->TransactionId; // $objInventoryTransaction->DestinationLocationId = $DestinationLocationId; $objInventoryTransaction->Save(); } } $this->UpdateShipmentFields(); $this->objShipment->ShippedFlag = false; $this->objShipment->Save(); if ($this->arrCustomFields) { // Save the values from all of the custom field controls to save the shipment CustomField::SaveControls($this->objShipment->objCustomFieldArray, $this->blnEditMode, $this->arrCustomFields, $this->objShipment->ShipmentId, 10); } // If the courier is FedEx, create new fedexShipment if ($this->lstCourier->SelectedValue === 1) { $this->objFedexShipment = new FedexShipment(); $this->objFedexShipment->Shipment = $this->objShipment; $this->UpdateFedexFields(); $this->objFedexShipment->Save(); } $objDatabase->TransactionCommit(); QApplication::Redirect('shipment_list.php'); } catch (QExtendedOptimisticLockingException $objExc) { // Rollback the database $objDatabase->TransactionRollback(); if ($objExc->Class == 'Asset') { // $this->btnRemoveAssetTransaction_Click($this->FormId, 'btnRemoveAsset' . $objExc->EntityId, $objExc->EntityId); $this->btnRemoveAssetTransaction_Click($this->FormId, null, $objExc->EntityId); $objAsset = Asset::Load($objExc->EntityId); if ($objAsset) { $this->btnCancel->Warning = sprintf('The Asset %s has been modified by another user and removed from this shipment. You may add the asset again or save the transaction without it.', $objAsset->AssetCode); } else { $this->btnCancel->Warning = 'An Asset has been deleted by another user and removed from this shipment.'; } } if ($objExc->Class == 'InventoryLocation') { $this->btnRemoveInventory_Click($this->FormId, 'btnRemoveInventory' . $objExc->EntityId, $objExc->EntityId); $objInventoryLocation = InventoryLocation::Load($objExc->EntityId); if ($objInventoryLocation) { $this->btnCancel->Warning = sprintf('The Inventory %s has been modified by another user and removed from this shipment. You may add the inventory again or save the shipment without it.', $objInventoryLocation->InventoryModel->InventoryModelCode); } else { $this->btnCancel->Warning = 'Inventory has been deleted by another user and removed from this shipment.'; } } } } elseif ($this->blnEditMode) { try { // Get an instance of the database $objDatabase = QApplication::$Database[1]; // Begin a MySQL Transaction to be either committed or rolled back $objDatabase->TransactionBegin(); $this->objTransaction = Transaction::Load($this->objShipment->TransactionId); $this->objTransaction->EntityQtypeId = $intEntityQtypeId; $this->objTransaction->Note = $this->txtNote->Text; $this->objTransaction->Save(); // Remove AssetTransactions that were removed when editing if ($this->arrAssetTransactionToDelete) { foreach ($this->arrAssetTransactionToDelete as $intAssetTransactionId) { $objAssetTransactionToDelete = AssetTransaction::Load($intAssetTransactionId); // Make sure that it wasn't added and then removed if ($objAssetTransactionToDelete) { // Change back location $objAssetTransactionToDelete->Asset->LocationId = $objAssetTransactionToDelete->SourceLocationId; $objAssetTransactionToDelete->Asset->Save(); // Delete the asset that was created for a new receipt if ($objAssetTransactionToDelete->NewAsset && $objAssetTransactionToDelete->NewAsset instanceof Asset && $objAssetTransactionToDelete->ScheduleReceiptFlag) { $objAssetTransactionToDelete->NewAsset->Delete(); } // Delete the asset transaction $objAssetTransactionToDelete->Delete(); unset($objAssetTransactionToDelete); } } } // Save new AssetTransactions if ($this->objAssetTransactionArray) { foreach ($this->objAssetTransactionArray as $objAssetTransaction) { // If the AssetTransaction has not been saved if (!$objAssetTransaction->AssetTransactionId) { $objAssetTransaction->TransactionId = $this->objTransaction->TransactionId; // Save the asset just to update the modified_date field so it can trigger an Optimistic Locking Exception when appropriate $objAssetTransaction->Asset->Save(); // Create the new asset if it was scheduled for receipt // $DestinationLocationId = 2; // Shipped // $objAssetTransaction->DestinationLocationId = $DestinationLocationId; // $objAssetTransaction->Asset->LocationId = $DestinationLocationId; // $objAssetTransaction->Asset->Save(); } if ($objAssetTransaction->ScheduleReceiptFlag && $objAssetTransaction->NewAsset && $objAssetTransaction->NewAsset instanceof Asset && !$objAssetTransaction->NewAssetId) { $objReceiptAsset = new Asset(); $objReceiptAsset->AssetModelId = $objAssetTransaction->NewAsset->AssetModelId; $objReceiptAsset->LocationId = $objAssetTransaction->NewAsset->LocationId; if ($objAssetTransaction->NewAsset->AssetCode == '') { $objReceiptAsset->AssetCode = Asset::GenerateAssetCode(); } else { $objReceiptAsset->AssetCode = $objAssetTransaction->NewAsset->AssetCode; } $objReceiptAsset->Save(); // Assign any default custom field values CustomField::AssignNewEntityDefaultValues(1, $objReceiptAsset->AssetId); // Associate the new Asset with the AssetTransaction $objAssetTransaction->NewAsset = $objReceiptAsset; } $objAssetTransaction->Save(); } } // Remove InventoryTransactions if ($this->arrInventoryTransactionToDelete) { foreach ($this->arrInventoryTransactionToDelete as $intInventoryTransactionId) { $objInventoryTransactionToDelete = InventoryTransaction::Load($intInventoryTransactionId); // Make sure that it wasn't added then removed if ($objInventoryTransactionToDelete) { // Change back the quantity $objInventoryTransactionToDelete->InventoryLocation->Quantity += $objInventoryTransactionToDelete->Quantity; $objInventoryTransactionToDelete->InventoryLocation->Save(); // Delete the InventoryTransaction $objInventoryTransactionToDelete->Delete(); unset($objInventoryTransactionToDelete); } } } // Save InventoryTransactions if ($this->objInventoryTransactionArray) { foreach ($this->objInventoryTransactionArray as $objInventoryTransaction) { if (!$objInventoryTransaction->InventoryTransactionId) { // Reload the InventoryLocation. If it was deleted and added in the same save click, then it will throw an Optimistic Locking Exception $objInventoryTransaction->InventoryLocation = InventoryLocation::Load($objInventoryTransaction->InventoryLocationId); $objInventoryTransaction->TransactionId = $this->objTransaction->TransactionId; // Save the inventory location just to update the modified_date field so it can triggern an Optimistic Locking Exception when appropriate $objInventoryTransaction->InventoryLocation->Save(); // $DestinationLocationId = 2; // Shipped // $objInventoryTransaction->DestinationLocationId = $DestinationLocationId; // $objInventoryTransaction->InventoryLocation->Quantity -= $objInventoryTransaction->Quantity; // $objInventoryTransaction->InventoryLocation->Save(); $objInventoryTransaction->Save(); } } } $this->UpdateShipmentFields(); // $this->objShipment->Save(false, true); $this->objShipment->Save(); if ($this->arrCustomFields) { // Save the values from all of the custom field controls to save the shipment CustomField::SaveControls($this->objShipment->objCustomFieldArray, $this->blnEditMode, $this->arrCustomFields, $this->objShipment->ShipmentId, 10); } // If the courier is FedEx, save the fedexShipment if ($this->lstCourier->SelectedValue === 1) { if ($this->objFedexShipment) { // FedexShipment already exists, so update it $this->UpdateFedexFields(); $this->objFedexShipment->Save(); } else { // FedexShipment doesn't exist yet, so create it $this->objFedexShipment = new FedexShipment(); $this->objFedexShipment->Shipment = $this->objShipment; $this->UpdateFedexFields(); $this->objFedexShipment->Save(); } } else { if ($this->objFedexShipment) { // FedexShipment exists - delete it because the selected courier is no longer FedEx $this->objFedexShipment->Delete(); $this->objFedexShipment = null; } } $objDatabase->TransactionCommit(); $this->UpdateShipmentLabels(); $this->SetupShipment(); $this->DisplayLabels(); if ($this->objShipment->CourierId == 1) { $this->txtTrackingNumber->Enabled = false; $this->lstPackageType->Enabled = true; } else { $this->txtTrackingNumber->Enabled = true; $this->lstPackageType->Enabled = false; } // Reload lstPackageType $this->lstPackageType->RemoveAllItems(); $this->LoadPackageTypes(); } catch (QExtendedOptimisticLockingException $objExc) { $objDatabase->TransactionRollback(); if ($objExc->Class == 'Shipment') { $this->btnCancel->Warning = sprintf('This shipment has been modified by another user. You must <a href="shipment_edit.php?intShipmentId=%s">Refresh</a> to edit this shipment.', $this->objShipment->ShipmentId); } elseif ($objExc->Class == 'Asset') { //$this->btnRemoveAssetTransaction_Click($this->FormId, 'btnRemoveAsset' . $objExc->EntityId, $objExc->EntityId); $this->btnRemoveAssetTransaction_Click($this->FormId, null, $objExc->EntityId); $objAsset = Asset::Load($objExc->EntityId); if ($objAsset) { $this->btnCancel->Warning = sprintf('The Asset %s has been modified by another user and removed from this shipment. You may add the asset again or save the transaction without it.', $objAsset->AssetCode); } else { $this->btnCancel->Warning = 'An Asset has been deleted by another user and removed from this shipment.'; } } elseif ($objExc->Class == 'InventoryLocation') { $this->btnRemoveInventory_Click($this->FormId, 'btnRemoveInventory' . $objExc->EntityId, $objExc->EntityId); $objInventoryLocation = InventoryLocation::Load($objExc->EntityId); if ($objInventoryLocation) { $this->btnCancel->Warning = sprintf('The Inventory %s has been modified by another user and removed from this shipment. You may add the inventory again or save the shipment without it.', $objInventoryLocation->InventoryModel->InventoryModelCode); } else { $this->btnCancel->Warning = 'Inventory has been deleted by another user and removed from this shipment.'; } } } } } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'ContactId': // Gets the value for intContactId (Read-Only PK) // @return integer return $this->intContactId; case 'CompanyId': // Gets the value for intCompanyId (Not Null) // @return integer return $this->intCompanyId; case 'AddressId': // Gets the value for intAddressId // @return integer return $this->intAddressId; case 'FirstName': // Gets the value for strFirstName // @return string return $this->strFirstName; case 'LastName': // Gets the value for strLastName (Not Null) // @return string return $this->strLastName; case 'Title': // Gets the value for strTitle // @return string return $this->strTitle; case 'Email': // Gets the value for strEmail // @return string return $this->strEmail; case 'PhoneOffice': // Gets the value for strPhoneOffice // @return string return $this->strPhoneOffice; case 'PhoneHome': // Gets the value for strPhoneHome // @return string return $this->strPhoneHome; case 'PhoneMobile': // Gets the value for strPhoneMobile // @return string return $this->strPhoneMobile; case 'Fax': // Gets the value for strFax // @return string return $this->strFax; case 'Description': // Gets the value for strDescription // @return string return $this->strDescription; case 'CreatedBy': // Gets the value for intCreatedBy // @return integer return $this->intCreatedBy; case 'CreationDate': // Gets the value for dttCreationDate // @return QDateTime return $this->dttCreationDate; case 'ModifiedBy': // Gets the value for intModifiedBy // @return integer return $this->intModifiedBy; case 'ModifiedDate': // Gets the value for strModifiedDate (Read-Only Timestamp) // @return string return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Company': // Gets the value for the Company object referenced by intCompanyId (Not Null) // @return Company try { if (!$this->objCompany && !is_null($this->intCompanyId)) { $this->objCompany = Company::Load($this->intCompanyId); } return $this->objCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Address': // Gets the value for the Address object referenced by intAddressId // @return Address try { if (!$this->objAddress && !is_null($this->intAddressId)) { $this->objAddress = Address::Load($this->intAddressId); } return $this->objAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ContactCustomFieldHelper': // Gets the value for the ContactCustomFieldHelper object that uniquely references this Contact // by objContactCustomFieldHelper (Unique) // @return ContactCustomFieldHelper try { if ($this->objContactCustomFieldHelper === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objContactCustomFieldHelper) { $this->objContactCustomFieldHelper = ContactCustomFieldHelper::LoadByContactId($this->intContactId); } return $this->objContactCustomFieldHelper; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_AssetTransactionCheckoutAsTo': // Gets the value for the private _objAssetTransactionCheckoutAsTo (Read-Only) // if set due to an expansion on the asset_transaction_checkout.to_contact_id reverse relationship // @return AssetTransactionCheckout return $this->_objAssetTransactionCheckoutAsTo; case '_AssetTransactionCheckoutAsToArray': // Gets the value for the private _objAssetTransactionCheckoutAsToArray (Read-Only) // if set due to an ExpandAsArray on the asset_transaction_checkout.to_contact_id reverse relationship // @return AssetTransactionCheckout[] return (array) $this->_objAssetTransactionCheckoutAsToArray; case '_ReceiptAsFrom': // Gets the value for the private _objReceiptAsFrom (Read-Only) // if set due to an expansion on the receipt.from_contact_id reverse relationship // @return Receipt return $this->_objReceiptAsFrom; case '_ReceiptAsFromArray': // Gets the value for the private _objReceiptAsFromArray (Read-Only) // if set due to an ExpandAsArray on the receipt.from_contact_id reverse relationship // @return Receipt[] return (array) $this->_objReceiptAsFromArray; case '_ReceiptAsTo': // Gets the value for the private _objReceiptAsTo (Read-Only) // if set due to an expansion on the receipt.to_contact_id reverse relationship // @return Receipt return $this->_objReceiptAsTo; case '_ReceiptAsToArray': // Gets the value for the private _objReceiptAsToArray (Read-Only) // if set due to an ExpandAsArray on the receipt.to_contact_id reverse relationship // @return Receipt[] return (array) $this->_objReceiptAsToArray; case '_ShipmentAsFrom': // Gets the value for the private _objShipmentAsFrom (Read-Only) // if set due to an expansion on the shipment.from_contact_id reverse relationship // @return Shipment return $this->_objShipmentAsFrom; case '_ShipmentAsFromArray': // Gets the value for the private _objShipmentAsFromArray (Read-Only) // if set due to an ExpandAsArray on the shipment.from_contact_id reverse relationship // @return Shipment[] return (array) $this->_objShipmentAsFromArray; case '_ShipmentAsTo': // Gets the value for the private _objShipmentAsTo (Read-Only) // if set due to an expansion on the shipment.to_contact_id reverse relationship // @return Shipment return $this->_objShipmentAsTo; case '_ShipmentAsToArray': // Gets the value for the private _objShipmentAsToArray (Read-Only) // if set due to an ExpandAsArray on the shipment.to_contact_id reverse relationship // @return Shipment[] return (array) $this->_objShipmentAsToArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'AddressId': // Gets the value for intAddressId (Read-Only PK) // @return integer return $this->intAddressId; case 'CompanyId': // Gets the value for intCompanyId (Not Null) // @return integer return $this->intCompanyId; case 'ShortDescription': // Gets the value for strShortDescription (Not Null) // @return string return $this->strShortDescription; case 'CountryId': // Gets the value for intCountryId (Not Null) // @return integer return $this->intCountryId; case 'Address1': // Gets the value for strAddress1 (Not Null) // @return string return $this->strAddress1; case 'Address2': // Gets the value for strAddress2 // @return string return $this->strAddress2; case 'City': // Gets the value for strCity (Not Null) // @return string return $this->strCity; case 'StateProvinceId': // Gets the value for intStateProvinceId // @return integer return $this->intStateProvinceId; case 'PostalCode': // Gets the value for strPostalCode (Not Null) // @return string return $this->strPostalCode; case 'CreatedBy': // Gets the value for intCreatedBy // @return integer return $this->intCreatedBy; case 'CreationDate': // Gets the value for dttCreationDate // @return QDateTime return $this->dttCreationDate; case 'ModifiedBy': // Gets the value for intModifiedBy // @return integer return $this->intModifiedBy; case 'ModifiedDate': // Gets the value for strModifiedDate (Read-Only Timestamp) // @return string return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Company': // Gets the value for the Company object referenced by intCompanyId (Not Null) // @return Company try { if (!$this->objCompany && !is_null($this->intCompanyId)) { $this->objCompany = Company::Load($this->intCompanyId); } return $this->objCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Country': // Gets the value for the Country object referenced by intCountryId (Not Null) // @return Country try { if (!$this->objCountry && !is_null($this->intCountryId)) { $this->objCountry = Country::Load($this->intCountryId); } return $this->objCountry; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'StateProvince': // Gets the value for the StateProvince object referenced by intStateProvinceId // @return StateProvince try { if (!$this->objStateProvince && !is_null($this->intStateProvinceId)) { $this->objStateProvince = StateProvince::Load($this->intStateProvinceId); } return $this->objStateProvince; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': // Gets the value for the UserAccount object referenced by intCreatedBy // @return UserAccount try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': // Gets the value for the UserAccount object referenced by intModifiedBy // @return UserAccount try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'AddressCustomFieldHelper': // Gets the value for the AddressCustomFieldHelper object that uniquely references this Address // by objAddressCustomFieldHelper (Unique) // @return AddressCustomFieldHelper try { if ($this->objAddressCustomFieldHelper === false) { // We've attempted early binding -- and the reverse reference object does not exist return null; } if (!$this->objAddressCustomFieldHelper) { $this->objAddressCustomFieldHelper = AddressCustomFieldHelper::LoadByAddressId($this->intAddressId); } return $this->objAddressCustomFieldHelper; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_Company': // Gets the value for the private _objCompany (Read-Only) // if set due to an expansion on the company.address_id reverse relationship // @return Company return $this->_objCompany; case '_CompanyArray': // Gets the value for the private _objCompanyArray (Read-Only) // if set due to an ExpandAsArray on the company.address_id reverse relationship // @return Company[] return (array) $this->_objCompanyArray; case '_Contact': // Gets the value for the private _objContact (Read-Only) // if set due to an expansion on the contact.address_id reverse relationship // @return Contact return $this->_objContact; case '_ContactArray': // Gets the value for the private _objContactArray (Read-Only) // if set due to an ExpandAsArray on the contact.address_id reverse relationship // @return Contact[] return (array) $this->_objContactArray; case '_ReceiptAsTo': // Gets the value for the private _objReceiptAsTo (Read-Only) // if set due to an expansion on the receipt.to_address_id reverse relationship // @return Receipt return $this->_objReceiptAsTo; case '_ReceiptAsToArray': // Gets the value for the private _objReceiptAsToArray (Read-Only) // if set due to an ExpandAsArray on the receipt.to_address_id reverse relationship // @return Receipt[] return (array) $this->_objReceiptAsToArray; case '_ShipmentAsFrom': // Gets the value for the private _objShipmentAsFrom (Read-Only) // if set due to an expansion on the shipment.from_address_id reverse relationship // @return Shipment return $this->_objShipmentAsFrom; case '_ShipmentAsFromArray': // Gets the value for the private _objShipmentAsFromArray (Read-Only) // if set due to an ExpandAsArray on the shipment.from_address_id reverse relationship // @return Shipment[] return (array) $this->_objShipmentAsFromArray; case '_ShipmentAsTo': // Gets the value for the private _objShipmentAsTo (Read-Only) // if set due to an expansion on the shipment.to_address_id reverse relationship // @return Shipment return $this->_objShipmentAsTo; case '_ShipmentAsToArray': // Gets the value for the private _objShipmentAsToArray (Read-Only) // if set due to an ExpandAsArray on the shipment.to_address_id reverse relationship // @return Shipment[] return (array) $this->_objShipmentAsToArray; case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
protected function btnSave_Click() { $intCompanyId = $this->lstCompany->SelectedValue; $objCompany = Company::Load($intCompanyId); $intAccountId = $this->lstFedexAccount->SelectedValue; $objAccount = ShippingAccount::Load($intAccountId); if ($objCompany && !$objCompany->Telephone) { $this->lstCompany->Warning = "The Shipping/Receiving company must have a valid telephone number."; } elseif ($objAccount && (!$objAccount->AccessId || !$objAccount->AccessCode)) { $this->lstFedexAccount->Warning = "The FedEx Account must have a valid account number and meter number."; } else { // Altered $TracmorSettings __set() method so that just setting a value will save it in the database. QApplication::$TracmorSettings->CompanyId = $intCompanyId; QApplication::$TracmorSettings->FedexAccountId = $intAccountId; QApplication::$TracmorSettings->FedexGatewayUri = $this->txtFedexGatewayUri->Text; QApplication::$TracmorSettings->PackingListTerms = $this->fckPackingListTerms->Text; QApplication::$TracmorSettings->AutodetectTrackingNumbers = $this->chkAutoDetectTrackingNumbers->Checked; QApplication::$TracmorSettings->ReceiveToLastLocation = $this->chkReceiveToLastLocation->Checked; // Show saved notification $this->pnlSaveNotification->Display = true; } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'CompanyId': // Gets the value for intCompanyId (PK) // @return integer return $this->intCompanyId; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Company': // Gets the value for the Company object referenced by intCompanyId (PK) // @return Company try { if (!$this->objCompany && !is_null($this->intCompanyId)) { $this->objCompany = Company::Load($this->intCompanyId); } return $this->objCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '__Restored': return $this->__blnRestored; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
protected function lstToCompany_Select() { $this->disableAdvancedIfInternal(); // Clear any displayed warnings if ($this->lblNewToContact) { $this->lblNewToContact->Warning = ''; $this->lblNewToAddress->Warning = ''; } if ($this->lstToCompany->SelectedValue) { $objCompany = Company::Load($this->lstToCompany->SelectedValue); if ($objCompany) { // Load the values for the 'To Contact' List if ($this->lstToContact) { $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); if ($this->lstToContact->SelectedValue) { $SelectedContactId = $this->lstToContact->SelectedValue; } elseif ($this->objShipment->ToContactId) { $SelectedContactId = $this->objShipment->ToContactId; } else { $SelectedContactId = null; } $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); if ($SelectedContactId == $objToContact->ContactId) { $objListItem->Selected = true; } $this->lstToContact->AddItem($objListItem); } $this->lstToContact->Enabled = true; } } // Load the values for the 'To Address' List if ($this->lstToAddress) { $objToAddressArray = Address::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription))); if ($this->lstToAddress->SelectedValue) { $SelectedAddressId = $this->lstToAddress->SelectedValue; } elseif ($this->objShipment->ToAddressId) { $SelectedAddressId = $this->objShipment->ToAddressId; } else { $SelectedAddressId = null; } $this->lstToAddress->RemoveAllItems(); $this->lstToAddress->AddItem('- Select One -', null); if ($objToAddressArray) { foreach ($objToAddressArray as $objToAddress) { $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId); if ($SelectedAddressId == $objToAddress->AddressId) { $objListItem->Selected = true; } $this->lstToAddress->AddItem($objListItem); } $this->lstToAddress->Enabled = true; $this->lstToAddress_Select(); } } } } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'ReceiptId': /** * Gets the value for intReceiptId (Read-Only PK) * @return integer */ return $this->intReceiptId; case 'TransactionId': /** * Gets the value for intTransactionId (Unique) * @return integer */ return $this->intTransactionId; case 'FromCompanyId': /** * Gets the value for intFromCompanyId (Not Null) * @return integer */ return $this->intFromCompanyId; case 'FromContactId': /** * Gets the value for intFromContactId (Not Null) * @return integer */ return $this->intFromContactId; case 'ToContactId': /** * Gets the value for intToContactId (Not Null) * @return integer */ return $this->intToContactId; case 'ToAddressId': /** * Gets the value for intToAddressId (Not Null) * @return integer */ return $this->intToAddressId; case 'ReceiptNumber': /** * Gets the value for strReceiptNumber (Unique) * @return string */ return $this->strReceiptNumber; case 'DueDate': /** * Gets the value for dttDueDate * @return QDateTime */ return $this->dttDueDate; case 'ReceiptDate': /** * Gets the value for dttReceiptDate * @return QDateTime */ return $this->dttReceiptDate; case 'ReceivedFlag': /** * Gets the value for blnReceivedFlag * @return boolean */ return $this->blnReceivedFlag; case 'CreatedBy': /** * Gets the value for intCreatedBy * @return integer */ return $this->intCreatedBy; case 'CreationDate': /** * Gets the value for dttCreationDate * @return QDateTime */ return $this->dttCreationDate; case 'ModifiedBy': /** * Gets the value for intModifiedBy * @return integer */ return $this->intModifiedBy; case 'ModifiedDate': /** * Gets the value for strModifiedDate (Read-Only Timestamp) * @return string */ return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Transaction': /** * Gets the value for the Transaction object referenced by intTransactionId (Unique) * @return Transaction */ try { if (!$this->objTransaction && !is_null($this->intTransactionId)) { $this->objTransaction = Transaction::Load($this->intTransactionId); } return $this->objTransaction; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromCompany': /** * Gets the value for the Company object referenced by intFromCompanyId (Not Null) * @return Company */ try { if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) { $this->objFromCompany = Company::Load($this->intFromCompanyId); } return $this->objFromCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromContact': /** * Gets the value for the Contact object referenced by intFromContactId (Not Null) * @return Contact */ try { if (!$this->objFromContact && !is_null($this->intFromContactId)) { $this->objFromContact = Contact::Load($this->intFromContactId); } return $this->objFromContact; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToContact': /** * Gets the value for the Contact object referenced by intToContactId (Not Null) * @return Contact */ try { if (!$this->objToContact && !is_null($this->intToContactId)) { $this->objToContact = Contact::Load($this->intToContactId); } return $this->objToContact; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToAddress': /** * Gets the value for the Address object referenced by intToAddressId (Not Null) * @return Address */ try { if (!$this->objToAddress && !is_null($this->intToAddressId)) { $this->objToAddress = Address::Load($this->intToAddressId); } return $this->objToAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': /** * Gets the value for the UserAccount object referenced by intCreatedBy * @return UserAccount */ try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': /** * Gets the value for the UserAccount object referenced by intModifiedBy * @return UserAccount */ try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
public function lstToCompany_Select() { if ($this->lstToCompany->SelectedValue) { $objCompany = Company::Load($this->lstToCompany->SelectedValue); if ($objCompany) { // Load the values for the 'To Contact' List if ($this->lstToContact) { $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); $this->lstToContact->AddItem($objListItem); } $this->lstToContact->Enabled = true; } } } } else { $this->lstToContact->Enabled = false; $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); } }
protected function lstFromCompany_Select() { if ($this->lstFromCompany->SelectedValue) { $objCompany = Company::Load($this->lstFromCompany->SelectedValue); if ($objCompany) { // Load the values for the 'From Contact' List if ($this->lstFromContact) { $objFromContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId); if ($this->lstFromContact->SelectedValue) { $SelectedContactId = $this->lstFromContact->SelectedValue; } elseif ($this->objReceipt->FromContactId) { $SelectedContactId = $this->objReceipt->FromContactId; } else { $SelectedContactId = null; } $this->lstFromContact->RemoveAllItems(); $this->lstFromContact->AddItem('- Select One -', null); if ($objFromContactArray) { foreach ($objFromContactArray as $objFromContact) { $objListItem = new QListItem($objFromContact->__toString(), $objFromContact->ContactId); if ($SelectedContactId == $objFromContact->ContactId) { $objListItem->Selected = true; } $this->lstFromContact->AddItem($objListItem); } } $this->lstFromContact->Enabled = true; } } } }
public function lstToCompany_Select() { if ($this->pnlShipmentMassEdit->lstToCompany->SelectedValue) { $objCompany = Company::Load($this->pnlShipmentMassEdit->lstToCompany->SelectedValue); if ($objCompany) { // Load the values for the 'To Contact' List if ($this->pnlShipmentMassEdit->lstToContact) { $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); $this->pnlShipmentMassEdit->lstToContact->RemoveAllItems(); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); $this->pnlShipmentMassEdit->lstToContact->AddItem($objListItem); } $this->pnlShipmentMassEdit->lstToContact->Enabled = true; } } // Load the values for the 'To Address' List if ($this->pnlShipmentMassEdit->lstToAddress) { $objToAddressArray = Address::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Address()->ShortDescription))); $this->pnlShipmentMassEdit->lstToAddress->RemoveAllItems(); if ($objToAddressArray) { foreach ($objToAddressArray as $objToAddress) { $objListItem = new QListItem($objToAddress->__toString(), $objToAddress->AddressId); $this->pnlShipmentMassEdit->lstToAddress->AddItem($objListItem); } $this->pnlShipmentMassEdit->lstToAddress->Enabled = true; //$this->lstToAddress_Select(); } } } } }
public function lstToCompany_Select() { if ($this->lstToCompany->SelectedValue) { $objCompany = Company::Load($this->lstToCompany->SelectedValue); if ($objCompany) { // Load the values for the 'To Contact' List if ($this->lstToContact) { $objToContactArray = Contact::LoadArrayByCompanyId($objCompany->CompanyId, QQ::Clause(QQ::OrderBy(QQN::Contact()->LastName, QQN::Contact()->FirstName))); $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('Any', 'any_' . $objCompany->CompanyId); if ($objToContactArray) { foreach ($objToContactArray as $objToContact) { $objListItem = new QListItem($objToContact->__toString(), $objToContact->ContactId); $this->lstToContact->AddItem($objListItem); } //$this->lstToContact->Enabled = true; } // For companies that have no contacts // Removed because SQL-query causes no errors /*else { $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); }*/ } } } else { //$this->lstToContact->Enabled = false; $this->lstToContact->RemoveAllItems(); $this->lstToContact->AddItem('- Select One -', null); $this->lstToContact->AddItem('Any', 'any'); } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'ShipmentId': /** * Gets the value for intShipmentId (Read-Only PK) * @return integer */ return $this->intShipmentId; case 'ShipmentNumber': /** * Gets the value for strShipmentNumber (Unique) * @return string */ return $this->strShipmentNumber; case 'TransactionId': /** * Gets the value for intTransactionId (Unique) * @return integer */ return $this->intTransactionId; case 'FromCompanyId': /** * Gets the value for intFromCompanyId (Not Null) * @return integer */ return $this->intFromCompanyId; case 'FromContactId': /** * Gets the value for intFromContactId (Not Null) * @return integer */ return $this->intFromContactId; case 'FromAddressId': /** * Gets the value for intFromAddressId (Not Null) * @return integer */ return $this->intFromAddressId; case 'ToCompanyId': /** * Gets the value for intToCompanyId (Not Null) * @return integer */ return $this->intToCompanyId; case 'ToContactId': /** * Gets the value for intToContactId (Not Null) * @return integer */ return $this->intToContactId; case 'ToAddressId': /** * Gets the value for intToAddressId (Not Null) * @return integer */ return $this->intToAddressId; case 'CourierId': /** * Gets the value for intCourierId * @return integer */ return $this->intCourierId; case 'TrackingNumber': /** * Gets the value for strTrackingNumber * @return string */ return $this->strTrackingNumber; case 'ShipDate': /** * Gets the value for dttShipDate (Not Null) * @return QDateTime */ return $this->dttShipDate; case 'ShippedFlag': /** * Gets the value for blnShippedFlag * @return boolean */ return $this->blnShippedFlag; case 'CreatedBy': /** * Gets the value for intCreatedBy * @return integer */ return $this->intCreatedBy; case 'CreationDate': /** * Gets the value for dttCreationDate * @return QDateTime */ return $this->dttCreationDate; case 'ModifiedBy': /** * Gets the value for intModifiedBy * @return integer */ return $this->intModifiedBy; case 'ModifiedDate': /** * Gets the value for strModifiedDate (Read-Only Timestamp) * @return string */ return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Transaction': /** * Gets the value for the Transaction object referenced by intTransactionId (Unique) * @return Transaction */ try { if (!$this->objTransaction && !is_null($this->intTransactionId)) { $this->objTransaction = Transaction::Load($this->intTransactionId); } return $this->objTransaction; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromCompany': /** * Gets the value for the Company object referenced by intFromCompanyId (Not Null) * @return Company */ try { if (!$this->objFromCompany && !is_null($this->intFromCompanyId)) { $this->objFromCompany = Company::Load($this->intFromCompanyId); } return $this->objFromCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromContact': /** * Gets the value for the Contact object referenced by intFromContactId (Not Null) * @return Contact */ try { if (!$this->objFromContact && !is_null($this->intFromContactId)) { $this->objFromContact = Contact::Load($this->intFromContactId); } return $this->objFromContact; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'FromAddress': /** * Gets the value for the Address object referenced by intFromAddressId (Not Null) * @return Address */ try { if (!$this->objFromAddress && !is_null($this->intFromAddressId)) { $this->objFromAddress = Address::Load($this->intFromAddressId); } return $this->objFromAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToCompany': /** * Gets the value for the Company object referenced by intToCompanyId (Not Null) * @return Company */ try { if (!$this->objToCompany && !is_null($this->intToCompanyId)) { $this->objToCompany = Company::Load($this->intToCompanyId); } return $this->objToCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToContact': /** * Gets the value for the Contact object referenced by intToContactId (Not Null) * @return Contact */ try { if (!$this->objToContact && !is_null($this->intToContactId)) { $this->objToContact = Contact::Load($this->intToContactId); } return $this->objToContact; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ToAddress': /** * Gets the value for the Address object referenced by intToAddressId (Not Null) * @return Address */ try { if (!$this->objToAddress && !is_null($this->intToAddressId)) { $this->objToAddress = Address::Load($this->intToAddressId); } return $this->objToAddress; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Courier': /** * Gets the value for the Courier object referenced by intCourierId * @return Courier */ try { if (!$this->objCourier && !is_null($this->intCourierId)) { $this->objCourier = Courier::Load($this->intCourierId); } return $this->objCourier; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': /** * Gets the value for the UserAccount object referenced by intCreatedBy * @return UserAccount */ try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': /** * Gets the value for the UserAccount object referenced by intModifiedBy * @return UserAccount */ try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_FedexShipment': /** * Gets the value for the private _objFedexShipment (Read-Only) * if set due to an expansion on the fedex_shipment.shipment_id reverse relationship * @return FedexShipment */ return $this->_objFedexShipment; case '_FedexShipmentArray': /** * Gets the value for the private _objFedexShipmentArray (Read-Only) * if set due to an ExpandAsArray on the fedex_shipment.shipment_id reverse relationship * @return FedexShipment[] */ return (array) $this->_objFedexShipmentArray; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
/** * Override method to perform a property "Get" * This will get the value of $strName * * @param string $strName Name of the property to get * @return mixed */ public function __get($strName) { switch ($strName) { /////////////////// // Member Variables /////////////////// case 'AddressId': /** * Gets the value for intAddressId (Read-Only PK) * @return integer */ return $this->intAddressId; case 'CompanyId': /** * Gets the value for intCompanyId (Not Null) * @return integer */ return $this->intCompanyId; case 'ShortDescription': /** * Gets the value for strShortDescription (Not Null) * @return string */ return $this->strShortDescription; case 'CountryId': /** * Gets the value for intCountryId (Not Null) * @return integer */ return $this->intCountryId; case 'Address1': /** * Gets the value for strAddress1 (Not Null) * @return string */ return $this->strAddress1; case 'Address2': /** * Gets the value for strAddress2 * @return string */ return $this->strAddress2; case 'City': /** * Gets the value for strCity (Not Null) * @return string */ return $this->strCity; case 'StateProvinceId': /** * Gets the value for intStateProvinceId * @return integer */ return $this->intStateProvinceId; case 'PostalCode': /** * Gets the value for strPostalCode (Not Null) * @return string */ return $this->strPostalCode; case 'CreatedBy': /** * Gets the value for intCreatedBy * @return integer */ return $this->intCreatedBy; case 'CreationDate': /** * Gets the value for dttCreationDate * @return QDateTime */ return $this->dttCreationDate; case 'ModifiedBy': /** * Gets the value for intModifiedBy * @return integer */ return $this->intModifiedBy; case 'ModifiedDate': /** * Gets the value for strModifiedDate (Read-Only Timestamp) * @return string */ return $this->strModifiedDate; /////////////////// // Member Objects /////////////////// /////////////////// // Member Objects /////////////////// case 'Company': /** * Gets the value for the Company object referenced by intCompanyId (Not Null) * @return Company */ try { if (!$this->objCompany && !is_null($this->intCompanyId)) { $this->objCompany = Company::Load($this->intCompanyId); } return $this->objCompany; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Country': /** * Gets the value for the Country object referenced by intCountryId (Not Null) * @return Country */ try { if (!$this->objCountry && !is_null($this->intCountryId)) { $this->objCountry = Country::Load($this->intCountryId); } return $this->objCountry; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'StateProvince': /** * Gets the value for the StateProvince object referenced by intStateProvinceId * @return StateProvince */ try { if (!$this->objStateProvince && !is_null($this->intStateProvinceId)) { $this->objStateProvince = StateProvince::Load($this->intStateProvinceId); } return $this->objStateProvince; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'CreatedByObject': /** * Gets the value for the UserAccount object referenced by intCreatedBy * @return UserAccount */ try { if (!$this->objCreatedByObject && !is_null($this->intCreatedBy)) { $this->objCreatedByObject = UserAccount::Load($this->intCreatedBy); } return $this->objCreatedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'ModifiedByObject': /** * Gets the value for the UserAccount object referenced by intModifiedBy * @return UserAccount */ try { if (!$this->objModifiedByObject && !is_null($this->intModifiedBy)) { $this->objModifiedByObject = UserAccount::Load($this->intModifiedBy); } return $this->objModifiedByObject; } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// //////////////////////////// // Virtual Object References (Many to Many and Reverse References) // (If restored via a "Many-to" expansion) //////////////////////////// case '_Company': /** * Gets the value for the private _objCompany (Read-Only) * if set due to an expansion on the company.address_id reverse relationship * @return Company */ return $this->_objCompany; case '_CompanyArray': /** * Gets the value for the private _objCompanyArray (Read-Only) * if set due to an ExpandAsArray on the company.address_id reverse relationship * @return Company[] */ return (array) $this->_objCompanyArray; case '_Contact': /** * Gets the value for the private _objContact (Read-Only) * if set due to an expansion on the contact.address_id reverse relationship * @return Contact */ return $this->_objContact; case '_ContactArray': /** * Gets the value for the private _objContactArray (Read-Only) * if set due to an ExpandAsArray on the contact.address_id reverse relationship * @return Contact[] */ return (array) $this->_objContactArray; case '_ReceiptAsTo': /** * Gets the value for the private _objReceiptAsTo (Read-Only) * if set due to an expansion on the receipt.to_address_id reverse relationship * @return Receipt */ return $this->_objReceiptAsTo; case '_ReceiptAsToArray': /** * Gets the value for the private _objReceiptAsToArray (Read-Only) * if set due to an ExpandAsArray on the receipt.to_address_id reverse relationship * @return Receipt[] */ return (array) $this->_objReceiptAsToArray; case '_ShipmentAsFrom': /** * Gets the value for the private _objShipmentAsFrom (Read-Only) * if set due to an expansion on the shipment.from_address_id reverse relationship * @return Shipment */ return $this->_objShipmentAsFrom; case '_ShipmentAsFromArray': /** * Gets the value for the private _objShipmentAsFromArray (Read-Only) * if set due to an ExpandAsArray on the shipment.from_address_id reverse relationship * @return Shipment[] */ return (array) $this->_objShipmentAsFromArray; case '_ShipmentAsTo': /** * Gets the value for the private _objShipmentAsTo (Read-Only) * if set due to an expansion on the shipment.to_address_id reverse relationship * @return Shipment */ return $this->_objShipmentAsTo; case '_ShipmentAsToArray': /** * Gets the value for the private _objShipmentAsToArray (Read-Only) * if set due to an ExpandAsArray on the shipment.to_address_id reverse relationship * @return Shipment[] */ return (array) $this->_objShipmentAsToArray; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } }
protected function CheckPrerequisites() { // Check that the 'Default Company' admin setting is set and valid if (!Company::Load(QApplication::$TracmorSettings->CompanyId)) { $this->lstToContact->Warning = $this->lstToAddress->Warning = 'Default Shipping/Receiving Company not set'; $this->lblNewToContact->Visible = false; $this->lblNewToAddress->Visible = false; } }
/** * Static Helper Method to Create using PK arguments * You must pass in the PK arguments on an object to load, or leave it blank to create a new one. * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo * static helper methods. Finally, specify a CreateType to define whether or not we are only allowed to * edit, or if we are also allowed to create a new one, etc. * * @param mixed $objParentObject QForm or QPanel which will be using this CompanyMetaControl * @param integer $intCompanyId primary key value * @param QMetaControlCreateType $intCreateType rules governing Company object creation - defaults to CreateOrEdit * @return CompanyMetaControl */ public static function Create($objParentObject, $intCompanyId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) { // Attempt to Load from PK Arguments if (strlen($intCompanyId)) { $objCompany = Company::Load($intCompanyId); // Company was found -- return it! if ($objCompany) { return new CompanyMetaControl($objParentObject, $objCompany); } else { if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound) { throw new QCallerException('Could not find a Company object with PK arguments: ' . $intCompanyId); } } // If EditOnly is specified, throw an exception } else { if ($intCreateType == QMetaControlCreateType::EditOnly) { throw new QCallerException('No PK arguments specified'); } } // If we are here, then we need to create a new record return new CompanyMetaControl($objParentObject, new Company()); }