CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • DB error with Custom fields in SYBUNT and LYBUNT
Pages: [1]

Author Topic: DB error with Custom fields in SYBUNT and LYBUNT  (Read 942 times)

Tchiot Galopin

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.1.44
  • PHP version: 5.3.3.7
DB error with Custom fields in SYBUNT and LYBUNT
March 31, 2011, 09:02:51 am
Hello,

I try to have specific information in my reports. There datas are managed with custom fields.
It's theorically easy to add cutom fields information in reports adding this line

class CRM_Report_Form_Contribute_*** extends CRM_Report_Form {
+    protected $_customGroupExtends = array( 'Contact','Contribution' );


But... it doesn't work only in the SYBUNT and LYBUNT report (I haven't verified with each reports, but I think so); I've a such error :

Unknown column 'value_division_***_civireport.district__code_55' in 'field list', 1054
(In this case my custom data is a geographic division)

Do you have an idea of the reason ? Should the column be civicrm_value_division_*** ?

Thanks, best regards
« Last Edit: March 31, 2011, 09:04:35 am by Tchiot Galopin »

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: DB error with Custom fields in SYBUNT and LYBUNT
March 31, 2011, 09:57:16 pm
Hi,

These reports ( Lybunt, Sybunt ) are overriding most of the functions from parent class itself.
So these reports are missing to include 'FROM' clause for custom data.

Try following patch.
Code: [Select]
Index: CRM/Report/Form/Contribute/Sybunt.php
===================================================================
--- CRM/Report/Form/Contribute/Sybunt.php (revision 33416)
+++ CRM/Report/Form/Contribute/Sybunt.php (working copy)
@@ -45,6 +45,8 @@
                                 );
        protected $_add2groupSupported = false;
 
+       protected $_customGroupExtends = array( 'Individual', 'Contact', 'Contribution' );
+
     function __construct( ) {
         $yearsInPast      = 8;
         $yearsInFuture    = 2;
@@ -306,6 +308,8 @@
         $this->where  ( );
         $this->groupBy( );
 
+        $this->customDataFrom( );
+
         $rows = $contactIds = array( );
         if( !CRM_Utils_Array::value( 'charts', $this->_params ) ) { 
             $this->limit( );

BTW Lybunt/ Sybunt reports do not list out each the contributions separately, instead these reports list out the contacts depend upon the contribution criteria.
So I don't think displaying contribution related custom data make sense
ie:  protected $_customGroupExtends = array( 'Individual', 'Contact', 'Contribution' );

Just contact related data will be fine
ie: protected $_customGroupExtends = array( 'Individual', 'Contact' );

Rajan

Tchiot Galopin

  • I’m new here
  • *
  • Posts: 13
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Drupal 7.12
  • MySQL version: 5.1.44
  • PHP version: 5.3.3.7
Re: DB error with Custom fields in SYBUNT and LYBUNT
April 01, 2011, 06:30:41 am
Perfect. Works very well.
(Be sure that Contribution custom fields could make sense in our case  ;) )
Thank you !

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviReport (Moderator: Dave Greenberg) »
  • DB error with Custom fields in SYBUNT and LYBUNT

This forum was archived on 2017-11-26.