/** 
  * Generate html code to visualize the given match. The visualization may also provide interactive form elements.
  * 
  * @val $match    match data as previously generated by this plugin instance
  * @val $btx      the bank transaction the match refers to
  * @return html code snippet
  */
 function visualize_match(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     $html = "<p>" . ts("Because :") . "<ul>";
     $evidence = $match->getEvidence();
     foreach ($evidence as $ev) {
         $html .= '<li>' . $ev . '</li>';
     }
     $html .= '</ul></p>';
     return $html;
 }
 /** 
  * Generate html code to visualize the given match. The visualization may also provide interactive form elements.
  * 
  * @val $match    match data as previously generated by this plugin instance
  * @val $btx      the bank transaction the match refers to
  * @return html code snippet
  */
 function visualize_match(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     $config = $this->_plugin_config;
     $smarty_vars = array();
     // load the recurring contribution
     $rcontribution_id = $match->getParameter('recurring_contribution_id');
     $rcontribution = civicrm_api3('ContributionRecur', 'getsingle', array('id' => $rcontribution_id));
     // load the recurring contribution
     $contact_id = $match->getParameter('contact_id');
     $contact = civicrm_api3('Contact', 'getsingle', array('id' => $contact_id));
     // get due date:
     $last_contribution = NULL;
     $due_date = self::getExpectedDate($rcontribution, $btx, $config->recurring_mode, $last_contribution);
     // assign to smarty and compile HTML
     $smarty_vars['recurring_contribution'] = $rcontribution;
     $smarty_vars['last_contribution'] = $last_contribution;
     $smarty_vars['contact'] = $contact;
     $smarty_vars['due_date'] = $due_date ? date('Ymdhis', $due_date) : '';
     $smarty_vars['expected_date'] = $match->getParameter('expected_date');
     $smarty_vars['expected_amount'] = $match->getParameter('expected_amount');
     $smarty_vars['penalties'] = $match->getEvidence();
     $smarty = CRM_Banking_Helpers_Smarty::singleton();
     $smarty->pushScope($smarty_vars);
     $html_snippet = $smarty->fetch('CRM/Banking/PluginImpl/Matcher/RecurringContribution.suggestion.tpl');
     $smarty->popScope();
     return $html_snippet;
 }
 /** 
  * Generate html code to visualize the given match. The visualization may also provide interactive form elements.
  * 
  * @val $match    match data as previously generated by this plugin instance
  * @val $btx      the bank transaction the match refers to
  * @return html code snippet
  */
 function visualize_match(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     $config = $this->_plugin_config;
     $smarty_vars = array();
     // load the contribution
     $contribution_id = $match->getParameter('contribution_id');
     $mandate_id = $match->getParameter('mandate_id');
     $mandate_reference = $match->getParameter('mandate_reference');
     $cancellation_mode = $match->getParameter('cancellation_mode');
     $cancellation_mode = !empty($cancellation_mode);
     $smarty_vars['contribution_id'] = $contribution_id;
     $smarty_vars['mandate_id'] = $mandate_id;
     $smarty_vars['mandate_reference'] = $mandate_reference;
     $smarty_vars['cancellation_mode'] = $cancellation_mode;
     $result = civicrm_api('Contribution', 'get', array('version' => 3, 'id' => $contribution_id));
     if (isset($result['id'])) {
         // gather information
         $contribution = $result['values'][$result['id']];
         $contact_id = $contribution['contact_id'];
         $contact_link = CRM_Utils_System::url("civicrm/contact/view", "reset=1&cid={$contact_id}");
         $smarty_vars['contribution'] = $contribution;
         $smarty_vars['contact_id'] = $contact_id;
         $smarty_vars['contact_html'] = "<a href=\"{$contact_link}\" target=\"_blank\">{$contribution['display_name']} [{$contact_id}]</a>";
         $smarty_vars['mandate_link'] = CRM_Utils_System::url("civicrm/sepa/xmandate", "mid={$mandate_id}");
         $smarty_vars['contribution_link'] = CRM_Utils_System::url("civicrm/contact/view/contribution", "reset=1&id={$contribution_id}&cid={$contact_id}&action=view");
         $smarty_vars['create_activity'] = $config->cancellation_create_activity;
         // add warnings, if any
         $smarty_vars['warnings'] = $match->getEvidence();
         // add cancellation extra parameters
         if ($cancellation_mode) {
             $smarty_vars['cancellation_cancel_reason'] = $config->cancellation_cancel_reason;
             if ($config->cancellation_cancel_reason) {
                 $smarty_vars['cancel_reason'] = $match->getParameter('cancel_reason');
                 $smarty_vars['cancel_reason_edit'] = $config->cancellation_cancel_reason_edit;
             }
             $smarty_vars['cancellation_cancel_fee'] = $config->cancellation_cancel_fee;
             if ($config->cancellation_cancel_fee) {
                 $smarty_vars['cancel_fee'] = $match->getParameter('cancel_fee');
                 $smarty_vars['cancel_fee_edit'] = $config->cancellation_cancel_fee_edit;
             }
         }
     } else {
         // CONTRIBUTION NOT FOUND!
         $smarty_vars['error'] = ts("Internal error! Cannot find contribution #") . $match->getParameter('contribution_id');
     }
     $smarty = CRM_Banking_Helpers_Smarty::singleton();
     $smarty->pushScope($smarty_vars);
     $html_snippet = $smarty->fetch('CRM/Banking/PluginImpl/Matcher/SepaMandate.suggestion.tpl');
     $smarty->popScope();
     return $html_snippet;
 }
 /** 
  * Generate html code to visualize the given match. The visualization may also provide interactive form elements.
  * 
  * @val $match    match data as previously generated by this plugin instance
  * @val $btx      the bank transaction the match refers to
  * @return html code snippet
  */
 function visualize_match(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     $config = $this->_plugin_config;
     $smarty_vars = array();
     // load the data
     $contribution_id = $match->getParameter('contribution_id');
     $smarty_vars['contribution_id'] = $contribution_id;
     $contribution = civicrm_api('Contribution', 'getsingle', array('id' => $contribution_id, 'version' => 3));
     if (empty($contribution['is_error'])) {
         $smarty_vars['contribution'] = $contribution;
         $contact = civicrm_api('Contact', 'getsingle', array('id' => $contribution['contact_id'], 'version' => 3));
         if (empty($contact['is_error'])) {
             $smarty_vars['contact'] = $contact;
         } else {
             $smarty_vars['error'] = $contact['error_message'];
         }
     } else {
         $smarty_vars['error'] = $contribution['error_message'];
     }
     $smarty_vars['reasons'] = $match->getEvidence();
     // add cancellation extra parameters
     if ($config->mode == 'cancellation') {
         $smarty_vars['cancellation_cancel_reason'] = $config->cancellation_cancel_reason;
         if ($config->cancellation_cancel_reason) {
             $smarty_vars['cancel_reason'] = $match->getParameter('cancel_reason');
             $smarty_vars['cancel_reason_edit'] = $config->cancellation_cancel_reason_edit;
         }
         $smarty_vars['cancellation_cancel_fee'] = $config->cancellation_cancel_fee;
         if ($config->cancellation_cancel_fee) {
             $smarty_vars['cancel_fee'] = $match->getParameter('cancel_fee');
             $smarty_vars['cancel_fee_edit'] = $config->cancellation_cancel_fee_edit;
         }
     }
     // assign to smarty and compile HTML
     $smarty = CRM_Banking_Helpers_Smarty::singleton();
     $smarty->pushScope($smarty_vars);
     $html_snippet = $smarty->fetch('CRM/Banking/PluginImpl/Matcher/ExistingContribution.suggestion.tpl');
     $smarty->popScope();
     return $html_snippet;
 }
示例#5
0
 function visualize_match(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     $s = '<ul>' . ts("Because :");
     $evidence = $match->getEvidence();
     foreach ($evidence as $ev) {
         $s .= '<li>' . $ev . '</li>';
     }
     $s .= '</ul>';
     return $s;
 }