コード例 #1
0
ファイル: AddressGen.class.php プロジェクト: heshuai64/einv2
 /**
  * Gets all associated ReceiptsAsTo as an array of Receipt objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return Receipt[]
  */
 public function GetReceiptAsToArray($objOptionalClauses = null)
 {
     if (is_null($this->intAddressId)) {
         return array();
     }
     try {
         return Receipt::LoadArrayByToAddressId($this->intAddressId, $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }
コード例 #2
0
    /**
     * Deletes all associated ReceiptsAsTo
     * @return void
     */
    public function DeleteAllReceiptsAsTo()
    {
        if (is_null($this->intAddressId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateReceiptAsTo on this unsaved Address.');
        }
        // Get the Database Object for this Class
        $objDatabase = Address::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (Receipt::LoadArrayByToAddressId($this->intAddressId) as $objReceipt) {
                $objReceipt->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`receipt`
				WHERE
					`to_address_id` = ' . $objDatabase->SqlVariable($this->intAddressId) . '
			');
    }