Guest User

Untitled

a guest
Aug 14th, 2012
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.00 KB | None | 0 0
  1. Index: CRM/Report/Form.php
  2. ===================================================================
  3. --- CRM/Report/Form.php (revision 41947)
  4. +++ CRM/Report/Form.php (working copy)
  5. @@ -891,6 +891,11 @@
  6. array('' => ts('- select group -')) + CRM_Core_PseudoConstant::staticGroup()
  7. );
  8. $this->assign('group', TRUE);
  9. + if(is_array($this->_contactTables) && count($this->_contactTables > 1)){
  10. + $this->addElement('select', 'btn_group_contact', ts('Contact to Add'),
  11. + array('' => ts('- choose contact -')) + $this->_contactTables
  12. + );
  13. + }
  14. }
  15.  
  16. $label = ts('Add these Contacts to Group');
  17. @@ -3109,11 +3114,15 @@
  18. }
  19.  
  20. function add2group($groupID) {
  21. - if (is_numeric($groupID) && isset($this->_aliases['civicrm_contact'])) {
  22. - $select = "SELECT DISTINCT {$this->_aliases['civicrm_contact']}.id AS addtogroup_contact_id, ";
  23. - $select = str_ireplace('SELECT SQL_CALC_FOUND_ROWS ', $select, $this->_select);
  24. + if (is_numeric($groupID) && isset($this->_aliases['honor_civicrm_contact'])) {
  25. + require_once 'CRM/Contact/BAO/GroupContact.php';
  26.  
  27. - $sql = "{$select} {$this->_from} {$this->_where} {$this->_groupBy} {$this->_having} {$this->_orderBy}";
  28. + $contact = $this->_submitValues['btn_group_contact'];
  29. + $select = "SELECT DISTINCT {$this->_aliases[$contact]}.id AS addtogroup_contact_id";
  30. + // $select = str_ireplace('SELECT SQL_CALC_FOUND_ROWS ', $select, $this->_select);
  31. +
  32. + $sql = "{$select} {$this->_from} {$this->_where} AND {$this->_aliases[$contact]}.id IS NOT NULL {$this->_groupBy} {$this->_having} {$this->_orderBy}";
  33. +
  34. $dao = CRM_Core_DAO::executeQuery($sql);
  35.  
  36. $contact_ids = array();
  37. Index: templates/CRM/Report/Form/Actions.tpl
  38. ===================================================================
  39. --- templates/CRM/Report/Form/Actions.tpl (revision 41947)
  40. +++ templates/CRM/Report/Form/Actions.tpl (working copy)
  41. @@ -48,13 +48,19 @@
  42. </table>
  43. </td>
  44. <td>
  45. - <table class="form-layout-compressed" align="right">
  46. + <table class="form-layout-compressed" align="right">
  47. {if $chartSupported}
  48. <tr>
  49. <td>{$form.charts.html|crmReplace:class:big}</td>
  50. <td align="right">{$form.$chart.html}</td>
  51. </tr>
  52. {/if}
  53. + {if $form.btn_group_contact}
  54. + <tr>
  55. + <td>{$form.btn_group_contact.html|crmReplace:class:big}</td>
  56. + <td align="right">{$form.$btn_group_contact.html}</td>
  57. + </tr>
  58. + {/if}
  59. {if $form.groups}
  60. <tr>
  61. <td>{$form.groups.html|crmReplace:class:big}</td>
Advertisement
Add Comment
Please, Sign In to add comment