Merge branch '4.4' of https://github.com/civicrm/civicrm-core into 4.5
[civicrm-core.git] / bin / deprecated / UpdatePledgeRecord.php
index f3e106dceb13be57b48383eef1d3c637a112a931..eafc94cb9e9e65f50789c62612c48dd0a149bf99 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 /*
  * This file checks and updates the status of all pledge records for a
  * given domain using the updatePledgePaymentStatus.
- * 
+ *
  * UpdatePledgeRecord.php prior to running this script.
  */
 
 require_once '../civicrm.config.php';
 require_once 'CRM/Core/Config.php';
+
+/**
+ * Class CRM_UpdatePledgeRecord
+ */
 class CRM_UpdatePledgeRecord {
+  /**
+   *
+   */
   function __construct() {
     $config = CRM_Core_Config::singleton();
     // this does not return on failure
@@ -49,6 +56,11 @@ class CRM_UpdatePledgeRecord {
     CRM_Core_Error::debug_log_message('UpdatePledgeRecord.php');
   }
 
+  /**
+   * @param bool $sendReminders
+   *
+   * @throws Exception
+   */
   public function updatePledgeStatus($sendReminders = FALSE) {
 
     // *** Uncomment the next line if you want automated reminders to be sent
@@ -86,12 +98,12 @@ SELECT  pledge.contact_id              as contact_id,
         pledge.is_test                 as is_test,
         pledge.campaign_id             as campaign_id,
         SUM(payment.scheduled_amount)  as amount_due,
-        ( SELECT sum(civicrm_pledge_payment.actual_amount) 
-        FROM civicrm_pledge_payment 
+        ( SELECT sum(civicrm_pledge_payment.actual_amount)
+        FROM civicrm_pledge_payment
         WHERE civicrm_pledge_payment.status_id = 1
         AND  civicrm_pledge_payment.pledge_id = pledge.id
         ) as amount_paid
-        FROM      civicrm_pledge pledge, civicrm_pledge_payment payment 
+        FROM      civicrm_pledge pledge, civicrm_pledge_payment payment
         WHERE     pledge.id = payment.pledge_id
         AND     payment.status_id IN ( {$statusIds} ) AND pledge.status_id IN ( {$statusIds} )
         GROUP By  payment.id
@@ -241,8 +253,8 @@ SELECT  pledge.contact_id              as contact_id,
             $template->assign('amount', $details['amount']);
             $template->assign('create_date', $details['create_date']);
 
-            require_once 'CRM/Core/BAO/MessageTemplates.php';
-            list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplates::sendTemplate(
+            require_once 'CRM/Core/BAO/MessageTemplate.php';
+            list($mailSent, $subject, $message, $html) = CRM_Core_BAO_MessageTemplate::sendTemplate(
               array(
                 'groupName' => 'msg_tpl_workflow_pledge',
                 'valueName' => 'pledge_reminder',