Esempio n. 1
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if ($id) {
         $this->_contributionIds = array($id);
         $this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
         $this->_single = TRUE;
         $this->assign('totalSelectedContributions', 1);
     } else {
         parent::preProcess();
     }
     // check that all the contribution ids have pending status
     $query = "\nSELECT count(*)\nFROM   civicrm_contribution\nWHERE  contribution_status_id != 1\nAND    {$this->_componentClause}";
     $count = CRM_Core_DAO::singleValueQuery($query);
     if ($count != 0) {
         CRM_Core_Error::statusBounce("Please select only online contributions with Completed status.");
     }
     // we have all the contribution ids, so now we get the contact ids
     parent::setContactIDs();
     $this->assign('single', $this->_single);
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
     $urlParams = 'force=1';
     if (CRM_Utils_Rule::qfKey($qfKey)) {
         $urlParams .= "&qfKey={$qfKey}";
     }
     $url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
     $breadCrumb = array(array('url' => $url, 'title' => ts('Search Results')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     CRM_Utils_System::setTitle(ts('Print Contribution Receipts'));
 }
Esempio n. 2
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     /*
      * initialize the task and row fields
      */
     parent::preProcess();
 }
Esempio n. 3
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, false);
     if ($id) {
         $this->_contributionIds = array($id);
         $this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
         $this->_single = true;
         $this->assign('totalSelectedContributions', 1);
     } else {
         parent::preProcess();
     }
     // check that all the contribution ids have pending status
     $query = "\nSELECT count(*)\nFROM   civicrm_contribution\nWHERE  contribution_status_id != 2\nAND    {$this->_componentClause}";
     $count = CRM_Core_DAO::singleValueQuery($query, CRM_Core_DAO::$_nullArray);
     if ($count != 0) {
         CRM_Core_Error::statusBounce(ts('Please select only online contributions with Pending status.'));
     }
     // ensure that all contributions are generated online by pay later
     $query = "\nSELECT DISTINCT( source ) as source\nFROM   civicrm_contribution\nWHERE  {$this->_componentClause}";
     $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     while ($dao->fetch()) {
         if (strpos($dao->source, ts('Online Contribution')) === false && strpos($dao->source, ts('Online Event Registration')) === false) {
             CRM_Core_Error::statusBounce("<strong>Update Pending Contribution Status</strong> can only be used for pending online contributions (made using the 'Pay Later' option). The Source for these contributions starts with 'Online ...'. Please de-select any offline contributions and try again.");
         }
     }
     // we have all the contribution ids, so now we get the contact ids
     parent::setContactIDs();
     $this->assign('single', $this->_single);
 }
Esempio n. 4
0
 /**
  * Build all the data structures needed to build the form.
  */
 public function preProcess()
 {
     //check for delete
     if (!CRM_Core_Permission::checkActionPermission('CiviContribute', CRM_Core_Action::DELETE)) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page.'));
     }
     parent::preProcess();
 }
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     CRM_Contact_Form_Task_EmailCommon::preProcessFromAddress($this);
     parent::preProcess();
     // we have all the contribution ids, so now we get the contact ids
     parent::setContactIDs();
     $this->assign('single', $this->_single);
 }
Esempio n. 6
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, false);
     if ($cid) {
         CRM_Contact_Form_Task_EmailCommon::preProcessSingle($this, $cid);
     } else {
         parent::preProcess();
         // we have all the contribution ids, so now we get the contact ids
         parent::setContactIDs();
     }
     $this->assign('single', $this->_single);
 }
Esempio n. 7
0
 /**
  * Build all the data structures needed to build the form.
  */
 public function preProcess()
 {
     // initialize the task and row fields
     parent::preProcess();
     //get the contact read only fields to display.
     $readOnlyFields = array_merge(array('sort_name' => ts('Name')), CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'contact_autocomplete_options', TRUE, NULL, FALSE, 'name', TRUE));
     //get the read only field data.
     $returnProperties = array_fill_keys(array_keys($readOnlyFields), 1);
     $contactDetails = CRM_Contact_BAO_Contact_Utils::contactDetails($this->_contributionIds, 'CiviContribute', $returnProperties);
     $this->assign('contactDetails', $contactDetails);
     $this->assign('readOnlyFields', $readOnlyFields);
 }
Esempio n. 8
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     parent::preProcess();
     $rows = array();
     // display name and contribution details of all selected contacts
     $contribIDs = implode(',', $this->_contributionIds);
     $query = "\n    SELECT co.total_amount as amount,\n           co.receive_date as receive_date,\n           co.source       as source,\n           ct.display_name as display_name\n      FROM civicrm_contribution co\nINNER JOIN civicrm_contact ct ON ( co.contact_id = ct.id )\n     WHERE co.id IN ( {$contribIDs} )";
     $dao = CRM_Core_DAO::executeQuery($query, CRM_Core_DAO::$_nullArray);
     while ($dao->fetch()) {
         $rows[] = array('display_name' => $dao->display_name, 'amount' => $dao->amount, 'source' => $dao->source, 'receive_date' => $dao->receive_date);
     }
     $this->assign('rows', $rows);
 }
Esempio n. 9
0
 function preProcess()
 {
     parent::preProcess();
     CRM_Utils_System::setTitle(ts('Rebook', array('domain' => 'de.systopia.donrec')));
     $session = CRM_Core_Session::singleton();
     $userContext = $session->readUserContext();
     $admin = CRM_Core_Permission::check('edit contributions');
     if (!$admin) {
         CRM_Core_Error::fatal(ts('You do not have the permissions required to access this page.', array('domain' => 'de.systopia.donrec')));
         CRM_Utils_System::redirect($userContext);
     }
     // check if the contributions are all from the same contact
     CRM_Donrec_Form_Task_Rebook::checkSameContact($this->_contributionIds, $userContext);
 }
Esempio n. 10
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if ($id) {
         $this->_contributionIds = array($id);
         $this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
         $this->_single = TRUE;
         $this->assign('totalSelectedContributions', 1);
         // set the redirection after actions
         $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
         $url = CRM_Utils_System::url('civicrm/contact/view/contribution', "action=view&reset=1&id={$id}&cid={$contactId}&context=contribution&selectedChild=contribute");
         CRM_Core_Session::singleton()->pushUserContext($url);
     } else {
         parent::preProcess();
     }
     // check that all the contribution ids have status Completed, Pending, Refunded.
     $this->_contributionStatusId = CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name');
     $status = array('Completed', 'Pending', 'Refunded');
     $statusId = array();
     foreach ($this->_contributionStatusId as $key => $value) {
         if (in_array($value, $status)) {
             $statusId[] = $key;
         }
     }
     $Id = implode(",", $statusId);
     $query = "SELECT count(*) FROM civicrm_contribution WHERE contribution_status_id NOT IN ({$Id}) AND {$this->_componentClause}";
     $count = CRM_Core_DAO::singleValueQuery($query);
     if ($count != 0) {
         CRM_Core_Error::statusBounce(ts('Please select only contributions with Completed, Pending, Refunded status.'));
     }
     // we have all the contribution ids, so now we get the contact ids
     parent::setContactIDs();
     $this->assign('single', $this->_single);
     $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this);
     $urlParams = 'force=1';
     if (CRM_Utils_Rule::qfKey($qfKey)) {
         $urlParams .= "&qfKey={$qfKey}";
     }
     $url = CRM_Utils_System::url('civicrm/contribute/search', $urlParams);
     $breadCrumb = array(array('url' => $url, 'title' => ts('Search Results')));
     CRM_Utils_System::appendBreadCrumb($breadCrumb);
     $this->_selectedOutput = CRM_Utils_Request::retrieve('select', 'String', $this);
     $this->assign('selectedOutput', $this->_selectedOutput);
     if ($this->_selectedOutput == 'email') {
         CRM_Utils_System::setTitle(ts('Email Invoice'));
     } else {
         CRM_Utils_System::setTitle(ts('Print Contribution Invoice'));
     }
 }
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     parent::preProcess();
     require_once 'CRM/Civigiftaid/Utils/Contribution.php';
     list($total, $toRemove, $notInBatch, $alreadySubmited) = CRM_Civigiftaid_Utils_Contribution::_validationRemoveContributionFromBatch($this->_contributionIds);
     $this->assign('selectedContributions', $total);
     $this->assign('totalToRemoveContributions', count($toRemove));
     $this->assign('notInBatchContributions', count($notInBatch));
     $this->assign('alreadySubmitedContributions', count($alreadySubmited));
     $contributionsToRemoveRows = CRM_Civigiftaid_Utils_Contribution::getContributionDetails($toRemove);
     $this->assign('contributionsToRemoveRows', $contributionsToRemoveRows);
     $contributionsAlreadySubmitedRows = CRM_Civigiftaid_Utils_Contribution::getContributionDetails($alreadySubmited);
     $this->assign('contributionsAlreadySubmitedRows', $contributionsAlreadySubmitedRows);
     $contributionsNotInBatchRows = CRM_Civigiftaid_Utils_Contribution::getContributionDetails($notInBatch);
     $this->assign('contributionsNotInBatchRows', $contributionsNotInBatchRows);
 }
Esempio n. 12
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     /*
      * initialize the task and row fields
      */
     parent::preProcess();
     //get the contact read only fields to display.
     require_once 'CRM/Core/BAO/Preferences.php';
     $readOnlyFields = array_merge(array('sort_name' => ts('Name')), CRM_Core_BAO_Preferences::valueOptions('contact_autocomplete_options', true, null, false, 'name', true));
     //get the read only field data.
     $returnProperties = array_fill_keys(array_keys($readOnlyFields), 1);
     require_once 'CRM/Contact/BAO/Contact/Utils.php';
     $contactDetails = CRM_Contact_BAO_Contact_Utils::contactDetails($this->_contributionIds, 'CiviContribute', $returnProperties);
     $this->assign('contactDetails', $contactDetails);
     $this->assign('readOnlyFields', $readOnlyFields);
 }
Esempio n. 13
0
 /**
  * Build all the data structures needed to build the form.
  */
 public function preProcess()
 {
     // initialize the task and row fields
     parent::preProcess();
     $session = CRM_Core_Session::singleton();
     $this->_userContext = $session->readUserContext();
     CRM_Utils_System::setTitle(ts('Batch Update Contributions Via Profile'));
     $validate = FALSE;
     //validations
     if (count($this->_contributionIds) > $this->_maxContributions) {
         CRM_Core_Session::setStatus(ts("The maximum number of contributions you can select for Batch update is %1. You have selected %2. Please select fewer contributions from your search results and try again.", array(1 => $this->_maxContributions, 2 => count($this->_contributionIds))), ts('Batch Update Error'), 'error');
         $validate = TRUE;
     }
     // than redirect
     if ($validate) {
         CRM_Utils_System::redirect($this->_userContext);
     }
 }
Esempio n. 14
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     parent::preProcess();
     require_once 'GiftAid/Utils/Contribution.php';
     list($total, $added, $alreadyAdded, $notValid) = GiftAid_Utils_Contribution::_validateContributionToBatch($this->_contributionIds);
     $this->assign('selectedContributions', $total);
     $this->assign('totalAddedContributions', count($added));
     $this->assign('alreadyAddedContributions', count($alreadyAdded));
     $this->assign('notValidContributions', count($notValid));
     // get details of contribution that will be added to this batch.
     $contributionsAddedRows = array();
     $contributionsAddedRows = GiftAid_Utils_Contribution::getContributionDetails($added);
     $this->assign('contributionsAddedRows', $contributionsAddedRows);
     // get details of contribution thatare already added to this batch.
     $contributionsAlreadyAddedRows = array();
     $contributionsAlreadyAddedRows = GiftAid_Utils_Contribution::getContributionDetails($alreadyAdded);
     $this->assign('contributionsAlreadyAddedRows', $contributionsAlreadyAddedRows);
 }
Esempio n. 15
0
 /**
  * Build all the data structures needed to build the form.
  *
  * @return void
  */
 public function preProcess()
 {
     $this->skipOnHold = $this->skipDeceased = FALSE;
     CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
     // store case id if present
     $this->_caseId = CRM_Utils_Request::retrieve('caseid', 'Positive', $this, FALSE);
     // retrieve contact ID if this is 'single' mode
     $cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE);
     $this->_activityId = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if ($cid) {
         CRM_Contact_Form_Task_PDFLetterCommon::preProcessSingle($this, $cid);
         $this->_single = TRUE;
         $this->_cid = $cid;
     } else {
         parent::preProcess();
     }
     $this->assign('single', $this->_single);
 }
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     //check for permission to edit contributions
     if (!CRM_Core_Permission::check('issue cdn tax receipts')) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page', array('domain' => 'org.civicrm.cdntaxreceipts')));
     }
     parent::preProcess();
     $receipts = array('original' => array('email' => 0, 'print' => 0), 'duplicate' => array('email' => 0, 'print' => 0));
     // count and categorize contributions
     foreach ($this->_contributionIds as $id) {
         if (cdntaxreceipts_eligibleForReceipt($id)) {
             list($issued_on, $receipt_id) = cdntaxreceipts_issued_on($id);
             $key = empty($issued_on) ? 'original' : 'duplicate';
             list($method, $email) = cdntaxreceipts_sendMethodForContribution($id);
             $receipts[$key][$method]++;
         }
     }
     $this->_receipts = $receipts;
 }
Esempio n. 17
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     // uncomment when adding support for single contrib delete
     //      $cid = CRM_Utils_Request::retrieve( 'cid', $this, false );
     //       if ( $cid ) {
     //           // not sure why this is needed :(
     //           // also add the cid params to the Menu array
     //           CRM_Utils_Menu::addParam( 'cid', $cid );
     //
     //           // create menus ..
     //           $startWeight = CRM_Utils_Menu::getMaxWeight('civicrm/contact/view');
     //           $startWeight++;
     //           CRM_Core_BAO_CustomGroup::addMenuTabs(CRM_Contact_BAO_Contact::getContactType($cid), 'civicrm/contact/view/cd', $startWeight);
     //           $this->_contactIds = array( $cid );
     //           $this->_single     = true;
     //           $this->assign( 'totalSelectedContacts', 1 );
     //       } else {
     parent::preProcess();
     //       }
 }
Esempio n. 18
0
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     /*
      * initialize the task and row fields
      */
     parent::preProcess();
     $session =& CRM_Core_Session::singleton();
     $this->_userContext = $session->readUserContext();
     CRM_Utils_System::setTitle(ts('Batch Profile Update for Contribution'));
     $validate = false;
     //validations
     if (count($this->_contributionIds) > $this->_maxContributions) {
         CRM_Core_Session::setStatus("The maximum number of contributions you can select for Batch Update is {$this->_maxContributions}. You have selected " . count($this->_contributionIds) . ". Please select fewer contributions from your search results and try again.");
         $validate = true;
     }
     if ($validate) {
         // than redirect
         CRM_Utils_System::redirect($this->_userContext);
     }
 }
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     $id = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE);
     if ($id) {
         $this->_contributionIds = array($id);
         $this->_componentClause = " civicrm_contribution.id IN ( {$id} ) ";
         $this->_single = TRUE;
         $this->assign('totalSelectedContributions', 1);
     } else {
         parent::preProcess();
     }
     // check that all the contribution ids have pending status
     $query = "\nSELECT count(*)\nFROM   civicrm_contribution\nWHERE  contribution_status_id != 2\nAND    {$this->_componentClause}";
     $count = CRM_Core_DAO::singleValueQuery($query, CRM_Core_DAO::$_nullArray);
     if ($count != 0) {
         CRM_Core_Error::statusBounce(ts('Please select only online contributions with Pending status.'));
     }
     // we have all the contribution ids, so now we get the contact ids
     parent::setContactIDs();
     $this->assign('single', $this->_single);
 }
 /**
  * build all the data structures needed to build the form
  *
  * @return void
  * @access public
  */
 function preProcess()
 {
     //check for permission to edit contributions
     if (!CRM_Core_Permission::check('issue cdn tax receipts')) {
         CRM_Core_Error::fatal(ts('You do not have permission to access this page', array('domain' => 'org.civicrm.cdntaxreceipts')));
     }
     parent::preProcess();
     $this->_contributions_status = array();
     $this->_issue_type = array('original', 'duplicate');
     $this->_receipts = array();
     $this->_years = array();
     $receipts = array('totals' => array('total_contrib' => 0, 'loading_errors' => 0, 'total_contacts' => 0, 'original' => 0, 'duplicate' => 0));
     $this->_contributions_status = cdntaxreceipts_contributions_get_status($this->_contributionIds);
     // Get the number of years selected
     foreach ($this->_contributions_status as $contrib_status) {
         $this->_years[$contrib_status['receive_year']] = $contrib_status['receive_year'];
     }
     foreach ($this->_years as $year) {
         foreach ($this->_issue_type as $issue_type) {
             $receipts[$issue_type][$year] = array('total_contrib' => 0, 'total_amount' => 0, 'email' => array('contribution_count' => 0, 'receipt_count' => 0), 'print' => array('contribution_count' => 0, 'receipt_count' => 0), 'total_contacts' => 0, 'total_eligible_amount' => 0, 'not_eligible' => 0, 'not_eligible_amount' => 0, 'contact_ids' => array());
         }
     }
     // Count and categorize contributions
     foreach ($this->_contributionIds as $id) {
         $status = isset($this->_contributions_status[$id]) ? $this->_contributions_status[$id] : NULL;
         if (is_array($status)) {
             $year = $status['receive_year'];
             $issue_type = empty($status['receipt_id']) ? 'original' : 'duplicate';
             $receipts[$issue_type][$year]['total_contrib']++;
             // Note: non-deductible amount has already had hook called in cdntaxreceipts_contributions_get_status
             $receipts[$issue_type][$year]['total_amount'] += $status['total_amount'];
             $receipts[$issue_type][$year]['not_eligible_amount'] += $status['non_deductible_amount'];
             if ($status['eligible']) {
                 list($method, $email) = cdntaxreceipts_sendMethodForContact($status['contact_id']);
                 $receipts[$issue_type][$year][$method]['contribution_count']++;
                 if (!isset($receipts[$issue_type][$year]['contact_ids'][$status['contact_id']])) {
                     $receipts[$issue_type][$year]['contact_ids'][$status['contact_id']] = array('issue_method' => $method, 'contributions' => array());
                     $receipts[$issue_type][$year][$method]['receipt_count']++;
                 }
                 // Here we store all the contribution details for each contact_id
                 $receipts[$issue_type][$year]['contact_ids'][$status['contact_id']]['contributions'][$id] = $status;
             } else {
                 $receipts[$issue_type][$year]['not_eligible']++;
                 // $receipts[$issue_type][$year]['not_eligible_amount'] += $status['total_amount'];
             }
             // Global totals
             $receipts['totals']['total_contrib']++;
             $receipts['totals'][$issue_type]++;
             if ($status['contact_id']) {
                 $receipts['totals']['total_contacts']++;
             }
         } else {
             $receipts['loading_errors']++;
         }
     }
     foreach ($this->_issue_type as $issue_type) {
         foreach ($this->_years as $year) {
             $receipts[$issue_type][$year]['total_contacts'] = count($receipts[$issue_type][$year]['contact_ids']);
         }
     }
     $this->_receipts = $receipts;
 }