public function execute($params, $btx, CRM_Banking_Matcher_Suggestion $match)
 {
     $contact_id = $match->getParameter('contact_id');
     if ($contact_id) {
         $baid = $btx->party_ba_id;
         $r = civicrm_api3('banking_account', 'create', array('id' => $baid, 'contact_id' => $contact_id));
     }
 }
 /** 
  * Generate html code to visualize the executed match.
  * 
  * @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_execution_info(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     if ($match->getId() === "manual") {
         $cids = $match->getParameter('contribution_ids');
         $text = "<p>" . ts("This transaction was manually matched to the following contributions:") . "<ul>";
         foreach ($cids as $contribution_id) {
             if ($contribution_id) {
                 $contribution_link = CRM_Utils_System::url("civicrm/contact/view/contribution", "action=view&reset=1&id={$contribution_id}&cid=2&context=home");
                 $text .= "<li><a href=\"{$contribution_link}\">" . ts("Contribution") . " #{$contribution_id}</a>";
             }
         }
         $text .= "</ul>";
         return $text;
     }
 }
 /** 
  * Generate html code to visualize the executed match.
  * 
  * @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_execution_info(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     // just assign to smarty and compile HTML
     $smarty_vars = array();
     $smarty_vars['contribution_id'] = $match->getParameter('contribution_id');
     $smarty_vars['contact_id'] = $match->getParameter('contact_id');
     // assign to smarty and compile HTML
     $smarty = CRM_Banking_Helpers_Smarty::singleton();
     $smarty->pushScope($smarty_vars);
     $html_snippet = $smarty->fetch('CRM/Banking/PluginImpl/Matcher/CreateContribution.execution.tpl');
     $smarty->popScope();
     return $html_snippet;
 }
 /** 
  * Generate html code to visualize the executed match.
  * 
  * @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_execution_info(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     // just assign to smarty and compile HTML
     $smarty_vars = array();
     $smarty_vars['contribution_id'] = $match->getParameter('contribution_id');
     $contact_id = $match->getParameter('contact_id');
     if (empty($contact_id)) {
         // this information has not been stored (old matcher version)
         $result = civicrm_api('Contribution', 'get', array('version' => 3, 'id' => $match->getParameter('contribution_id')));
         if (isset($result['id'])) {
             $contribution = $result['values'][$result['id']];
             $contact_id = $contribution['contact_id'];
             $smarty_vars['contact_id'] = $contact_id;
         } else {
             // TODO: error handling?
             $smarty_vars['contact_id'] = 0;
         }
     } else {
         $smarty_vars['contact_id'] = $contact_id;
     }
     $smarty_vars['cancellation_mode'] = $match->getParameter('cancellation_mode');
     $smarty_vars['cancel_fee'] = $match->getParameter('cancel_fee');
     $smarty_vars['cancel_reason'] = $match->getParameter('cancel_reason');
     $smarty = CRM_Banking_Helpers_Smarty::singleton();
     $smarty->pushScope($smarty_vars);
     $html_snippet = $smarty->fetch('CRM/Banking/PluginImpl/Matcher/SepaMandate.execution.tpl');
     $smarty->popScope();
     return $html_snippet;
 }
예제 #5
0
 /** 
  * Generate html code to visualize the executed match.
  * 
  * @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_execution_info(CRM_Banking_Matcher_Suggestion $match, $btx)
 {
     $batch_id = $match->getParameter('batch_id');
     $batch_link = CRM_Utils_System::url("civicrm/batchtransaction", "reset=1&bid={$batch_id}");
     return "<p>" . sprintf(ts("This transaction was associated with <a href=\"%s\">payment batch #%s</a>."), $batch_link, $batch_id) . "</p>";
 }