Ejemplo n.º 1
0
 public function __toStringWithLink()
 {
     // Shipment
     if ($this->TransactionTypeId == 6) {
         $objShipment = Shipment::LoadByTransactionId($this->TransactionId);
         if ($objShipment) {
             $strToReturn = sprintf('<a href="../shipping/shipment_edit.php?intShipmentId=%s">Ship</a>', $objShipment->ShipmentId);
         } else {
             $strToReturn = '';
         }
     } elseif ($this->TransactionTypeId == 7) {
         $objReceipt = Receipt::LoadByTransactionId($this->TransactionId);
         if ($objReceipt) {
             $strToReturn = sprintf('<a href="../receiving/receipt_edit.php?intReceiptId=%s">Receipt</a>', $objReceipt->ReceiptId);
         } else {
             $strToReturn = '';
         }
     } else {
         $strToReturn = sprintf('<a href="../common/transaction_edit.php?intTransactionId=%s">%s</a>', $this->TransactionId, $this->TransactionType->__toString());
     }
     return $strToReturn;
 }
Ejemplo n.º 2
0
 /**
  * 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 'TransactionId':
             // Gets the value for intTransactionId (Read-Only PK)
             // @return integer
             return $this->intTransactionId;
         case 'EntityQtypeId':
             // Gets the value for intEntityQtypeId (Not Null)
             // @return integer
             return $this->intEntityQtypeId;
         case 'TransactionTypeId':
             // Gets the value for intTransactionTypeId (Not Null)
             // @return integer
             return $this->intTransactionTypeId;
         case 'Note':
             // Gets the value for strNote
             // @return string
             return $this->strNote;
         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 'TransactionType':
             // Gets the value for the TransactionType object referenced by intTransactionTypeId (Not Null)
             // @return TransactionType
             try {
                 if (!$this->objTransactionType && !is_null($this->intTransactionTypeId)) {
                     $this->objTransactionType = TransactionType::Load($this->intTransactionTypeId);
                 }
                 return $this->objTransactionType;
             } 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 'Receipt':
             // Gets the value for the Receipt object that uniquely references this Transaction
             // by objReceipt (Unique)
             // @return Receipt
             try {
                 if ($this->objReceipt === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objReceipt) {
                     $this->objReceipt = Receipt::LoadByTransactionId($this->intTransactionId);
                 }
                 return $this->objReceipt;
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
         case 'Shipment':
             // Gets the value for the Shipment object that uniquely references this Transaction
             // by objShipment (Unique)
             // @return Shipment
             try {
                 if ($this->objShipment === false) {
                     // We've attempted early binding -- and the reverse reference object does not exist
                     return null;
                 }
                 if (!$this->objShipment) {
                     $this->objShipment = Shipment::LoadByTransactionId($this->intTransactionId);
                 }
                 return $this->objShipment;
             } 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 '_AssetTransaction':
             // Gets the value for the private _objAssetTransaction (Read-Only)
             // if set due to an expansion on the asset_transaction.transaction_id reverse relationship
             // @return AssetTransaction
             return $this->_objAssetTransaction;
         case '_AssetTransactionArray':
             // Gets the value for the private _objAssetTransactionArray (Read-Only)
             // if set due to an ExpandAsArray on the asset_transaction.transaction_id reverse relationship
             // @return AssetTransaction[]
             return (array) $this->_objAssetTransactionArray;
         case '_InventoryTransaction':
             // Gets the value for the private _objInventoryTransaction (Read-Only)
             // if set due to an expansion on the inventory_transaction.transaction_id reverse relationship
             // @return InventoryTransaction
             return $this->_objInventoryTransaction;
         case '_InventoryTransactionArray':
             // Gets the value for the private _objInventoryTransactionArray (Read-Only)
             // if set due to an ExpandAsArray on the inventory_transaction.transaction_id reverse relationship
             // @return InventoryTransaction[]
             return (array) $this->_objInventoryTransactionArray;
         case '__Restored':
             return $this->__blnRestored;
         default:
             try {
                 return parent::__get($strName);
             } catch (QCallerException $objExc) {
                 $objExc->IncrementOffset();
                 throw $objExc;
             }
     }
 }
Ejemplo n.º 3
0
 public function __toStringVerbWithLink()
 {
     if ($this->TransactionTypeId == 6) {
         $objShipment = Shipment::LoadByTransactionId($this->TransactionId);
         if ($objShipment) {
             if ($objShipment->ShippedFlag) {
                 $verb = 'shipped';
             } else {
                 $verb = 'scheduled shipment';
             }
             $strToReturn = sprintf('<a href="../shipping/shipment_edit.php?intShipmentId=%s">%s</a>', $objShipment->ShipmentId, $verb);
         } else {
             $strToReturn = '';
         }
     } elseif ($this->TransactionTypeId == 7) {
         $objReceipt = Receipt::LoadByTransactionId($this->TransactionId);
         if ($objReceipt) {
             if ($objReceipt->ReceivedFlag) {
                 $verb = 'received';
             } else {
                 $verb = 'scheduled receipt';
             }
             $strToReturn = sprintf('<a href="../receiving/receipt_edit.php?intReceiptId=%s">%s</a>', $objReceipt->ReceiptId, $verb);
         } else {
             $strToReturn = '';
         }
     } else {
         $verb = strtolower($this->TransactionType->__toString());
         if (str_word_count($verb) > 1) {
             $verb = explode(" ", $verb);
             $verb = $verb[0] . 'ed ' . $verb[1];
         } else {
             $verb = $verb . 'd';
         }
         $strToReturn = sprintf('<a href="../common/transaction_edit.php?intTransactionId=%s">%s</a>', $this->TransactionId, $verb);
     }
     return $strToReturn;
     return '';
 }
Ejemplo n.º 4
0
 public function __toStringData()
 {
     switch ($this->Transaction->TransactionTypeId) {
         case 1:
             return sprintf('from %s to %s', $this->__toStringSourceLocation(), $this->__toStringDestinationLocation());
             break;
         case 2:
             if ($this->Transaction->ModifiedByObject instanceof UserAccount) {
                 $user = $this->Transaction->ModifiedByObject->__toStringFullName();
             } else {
                 $user = $this->Transaction->CreatedByObject->__toStringFullName();
             }
             return sprintf('from %s to %s', $user, $this->__toStringDestinationLocation());
             break;
         case 3:
             if ($this->AssetTransactionCheckout) {
                 if ($this->AssetTransactionCheckout->ToContactId) {
                     $strToReturn = $this->AssetTransactionCheckout->ToContact->__toStringWithLink();
                 } else {
                     $strToReturn = $this->AssetTransactionCheckout->ToUser->__toStringFullName();
                 }
             } else {
                 $strToReturn = $this->Transaction->CreatedByObject->__toStringFullName();
             }
             return sprintf('from %s to %s', $this->__toStringSourceLocation(), $strToReturn);
             break;
         case 6:
             $this->Transaction->Shipment = Shipment::LoadByTransactionId($this->TransactionId);
             return sprintf('from %s to %s', $this->__toStringSourceLocation(), $this->Transaction->ToStringCompanyWithLink());
             break;
         case 7:
             $this->Transaction->Receipt = Receipt::LoadByTransactionId($this->TransactionId);
             if ($this->Transaction->Receipt->ReceivedFlag) {
                 return sprintf('from %s to %s', $this->Transaction->ToStringCompanyWithLink(), $this->__toStringDestinationLocation());
             } else {
                 return sprintf('from %s', $this->Transaction->ToStringCompanyWithLink());
             }
             break;
         default:
             return '';
             break;
     }
 }