/** * Set variables up before form is built. */ public function preProcess() { // Check permission for Financial Type when ACL-FT is enabled if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus() && !CRM_Core_Permission::check('administer CiviCRM Financial Types')) { CRM_Core_Error::fatal(ts('You do not have permission to access this page.')); } parent::preProcess(); }
/** * Set variables up before form is built. * * @return void */ public function preProcess() { $context = CRM_Utils_Request::retrieve('context', 'String', $this); $this->set("context", $context); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); parent::preProcess(); $session = CRM_Core_Session::singleton(); if ($this->_id) { $permissions = array(CRM_Core_Action::UPDATE => array('permission' => array('edit own manual batches', 'edit all manual batches'), 'actionName' => 'edit'), CRM_Core_Action::DELETE => array('permission' => array('delete own manual batches', 'delete all manual batches'), 'actionName' => 'delete')); $createdID = CRM_Core_DAO::getFieldValue('CRM_Batch_DAO_Batch', $this->_id, 'created_id'); if (!empty($permissions[$this->_action])) { $this->checkPermissions($this->_action, $permissions[$this->_action]['permission'], $createdID, $session->get('userID'), $permissions[$this->_action]['actionName']); } } }
/** * Set variables up before form is built. * * @return void */ public function preProcess() { parent::preProcess(); if ($this->_id) { $params = array('id' => $this->_id); $financialAccount = CRM_Financial_BAO_FinancialAccount::retrieve($params, CRM_Core_DAO::$_nullArray); $financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type'); if ($financialAccount->financial_account_type_id == array_search('Asset', $financialAccountType) && strtolower($financialAccount->account_type_code) == 'ar' && !CRM_Financial_BAO_FinancialAccount::getARAccounts($this->_id, array_search('Asset', $financialAccountType))) { $this->_isARFlag = TRUE; if ($this->_action & CRM_Core_Action::DELETE) { $msg = ts("The selected financial account cannot be deleted because at least one Accounts Receivable type account is required (to ensure that accounting transactions are in balance)."); CRM_Core_Error::statusBounce($msg); } } } }
/** * Function to set variables up before form is built * * @return void * @access public */ public function preProcess() { parent::preProcess(); if ($this->_id) { $params = array('id' => $this->_id); $financialAccount = CRM_Financial_BAO_FinancialAccount::retrieve($params, CRM_Core_DAO::$_nullArray); $financialAccountType = CRM_Core_PseudoConstant::accountOptionValues('financial_account_type'); if ($financialAccount->financial_account_type_id == array_search('Asset', $financialAccountType) && strtolower($financialAccount->account_type_code) == 'ar' && !CRM_Financial_BAO_FinancialAccount::getARAccounts($this->_id, array_search('Asset', $financialAccountType))) { $this->_isARFlag = TRUE; if ($this->_action & CRM_Core_Action::DELETE) { CRM_Core_Session::setStatus(ts("The selected financial account cannot be deleted because at least one Accounts Receivable type account is required (to ensure that accounting transactions are in balance)."), '', 'error'); CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/admin/financial/financialAccount', "reset=1&action=browse")); } } } }
/** * build all the data structures needed to build the form * * @return void * @access public */ function preProcess() { parent::preProcess(); $this->_contributionIds = $this->getContributionsList(); $this->_rejectedcontributionIds = $this->getRejectedContributionsList(); require_once 'DirectDebit/Utils/Contribution.php'; //echo "total contribution ids=".count($this->_contributionIds); list($total, $added, $alreadyAdded, $notValid) = DirectDebit_Utils_Contribution::_validateContributionToBatch($this->_contributionIds); //echo "<br>total=".$total; //echo "<br>added=".count($added); //echo "<br>al added=".count($alreadyAdded); //echo "<br>not valid=".count($notValid); $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 = DirectDebit_Utils_Contribution::getContributionDetails($added); //$this->assign('contributionsAddedRows', $contributionsAddedRows ); while (list($key, $values) = @each($contributionsAddedRows)) { $contributionsAddedRowsByActivity[$values['activity_type_id']][] = $values; } $this->assign('FirstTimeCollectionActivityId', CIVICRM_DIRECT_DEBIT_FIRST_COLLECTION_ACTIVITY_ID); $this->assign('StandardPaymentActivityId', CIVICRM_DIRECT_DEBIT_STANDARD_PAYMENT_ACTIVITY_ID); $this->assign('FinalPaymentActivityId', CIVICRM_DIRECT_DEBIT_FINAL_PAYMENT_ACTIVITY_ID); //print_r ($contributionsAddedRowsByActivity);exit; $this->assign('contributionsAddedRowsByActivity', $contributionsAddedRowsByActivity); // get details of contribution thatare already added to this batch. //print_r($alreadyAdded); $contributionsAlreadyAddedRows = array(); $contributionsAlreadyAddedRows = DirectDebit_Utils_Contribution::getContributionDetails($alreadyAdded); $this->assign('contributionsAlreadyAddedRows', $contributionsAlreadyAddedRows); if (count($this->_rejectedcontributionIds) > 0) { $this->assign('contributionsRejectionsRows', count($this->_rejectedcontributionIds)); $contributionsRejectionRows = array(); $contributionsRejectionRows = DirectDebit_Utils_Contribution::getContributionDetails($this->_rejectedcontributionIds); while (list($key, $values) = @each($contributionsRejectionRows)) { $contributionsRejectionRowsByActivity[$values['activity_type_id']][] = $values; } $this->assign('contributionsRejectionRowsByActivity', $contributionsRejectionRowsByActivity); } else { $this->assign('contributionsRejectionsRows', 0); } }
/** * Pre process the form. */ public function preProcess() { parent::preProcess(); }