Ejemplo n.º 1
0
 /**
  * Gets the total amount POSTED to each Fund for this batch.  Returns as an array of float values, indexed by the StewardshipFundId
  * @return float[]
  */
 public function GetPostedTotalsByStewardshipFundId()
 {
     $strQuery = 'SELECT SUM(amount) AS amount_sum, stewardship_fund_id ' . 'FROM stewardship_post_amount, stewardship_post ' . 'WHERE stewardship_post_id  = stewardship_post.id ' . 'AND stewardship_batch_id=%s ' . 'GROUP BY stewardship_fund_id';
     $strQuery = sprintf($strQuery, $this->intId);
     $objResult = StewardshipBatch::GetDatabase()->Query($strQuery);
     $fltArrayToReturn = array();
     while ($objRow = $objResult->GetNextRow()) {
         $fltArrayToReturn[$objRow->GetColumn('stewardship_fund_id')] = $objRow->GetColumn('amount_sum');
     }
     return $fltArrayToReturn;
 }
Ejemplo n.º 2
0
    /**
     * Deletes all associated StewardshipStacks
     * @return void
     */
    public function DeleteAllStewardshipStacks()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateStewardshipStack on this unsaved StewardshipBatch.');
        }
        // Get the Database Object for this Class
        $objDatabase = StewardshipBatch::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (StewardshipStack::LoadArrayByStewardshipBatchId($this->intId) as $objStewardshipStack) {
                $objStewardshipStack->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`stewardship_stack`
				WHERE
					`stewardship_batch_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }