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 Drupal Modules (Moderator: Donald Lobo) »
  • Drupal 7 Views 3 Civi4.0.7 Custom Data Image Problem (missing handler/broken)
Pages: [1]

Author Topic: Drupal 7 Views 3 Civi4.0.7 Custom Data Image Problem (missing handler/broken)  (Read 1604 times)

seamonkey

  • I’m new here
  • *
  • Posts: 8
  • Karma: 1
  • CiviCRM version: 4.0.7
  • CMS version: Drupal 7.9
  • MySQL version: 5.1.58-1ubuntu1
  • PHP version: 5.2
Drupal 7 Views 3 Civi4.0.7 Custom Data Image Problem (missing handler/broken)
November 20, 2011, 11:00:01 pm
Hi,

Very new to D7 and Civi so bear with me as I try to explain the issue.

On creating a basic stock View I'm calling "Sponsors" I have added a custom data set for uploading a logo file that would be displayed in a block on the website. I verified in phpmyadmin that the table and file exists. However, when adding the FIELD Sponsor_Logo, the next screen states,

"The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item."

I verified that I updated my settings.php for core Drupal as you can see below (note table value_sponsor_logo_1)



$databases['default']['default']['prefix']= array(
  'civicrm_acl'                              => '`civicrm`.',
  'civicrm_acl_cache'                        => '`civicrm`.',
  'civicrm_acl_contact_cache'                => '`civicrm`.',
  'civicrm_acl_entity_role'                  => '`civicrm`.',
  'civicrm_action_log'                       => '`civicrm`.',
  'civicrm_action_mapping'                   => '`civicrm`.',
  'civicrm_action_schedule'                  => '`civicrm`.',
  'civicrm_activity'                         => '`civicrm`.',
  'civicrm_activity_assignment'              => '`civicrm`.',
  'civicrm_activity_target'                  => '`civicrm`.',
  'civicrm_address'                          => '`civicrm`.',
  'civicrm_address_format'                   => '`civicrm`.',
  'civicrm_batch'                            => '`civicrm`.',
  'civicrm_cache'                            => '`civicrm`.',
  'civicrm_campaign'                         => '`civicrm`.',
  'civicrm_campaign_group'                   => '`civicrm`.',
  'civicrm_case'                             => '`civicrm`.',
  'civicrm_case_activity'                    => '`civicrm`.',
  'civicrm_case_contact'                     => '`civicrm`.',
  'civicrm_component'                        => '`civicrm`.',
  'civicrm_contact'                          => '`civicrm`.',
  'civicrm_contact_type'                     => '`civicrm`.',
  'civicrm_contribution'                     => '`civicrm`.',
  'civicrm_contribution_page'                => '`civicrm`.',
  'civicrm_contribution_product'             => '`civicrm`.',
  'civicrm_contribution_recur'               => '`civicrm`.',
  'civicrm_contribution_soft'                => '`civicrm`.',
  'civicrm_contribution_type'                => '`civicrm`.',
  'civicrm_contribution_widget'              => '`civicrm`.',
  'civicrm_country'                          => '`civicrm`.',
  'civicrm_county'                           => '`civicrm`.',
  'civicrm_currency'                         => '`civicrm`.',
  'civicrm_custom_field'                     => '`civicrm`.',
  'civicrm_custom_group'                     => '`civicrm`.',
  'civicrm_dashboard'                        => '`civicrm`.',
  'civicrm_dashboard_contact'                => '`civicrm`.',
  'civicrm_dedupe_exception'                 => '`civicrm`.',
  'civicrm_dedupe_rule'                      => '`civicrm`.',
  'civicrm_dedupe_rule_group'                => '`civicrm`.',
  'civicrm_discount'                         => '`civicrm`.',
  'civicrm_domain'                           => '`civicrm`.',
  'civicrm_email'                            => '`civicrm`.',
  'civicrm_entity_batch'                     => '`civicrm`.',
  'civicrm_entity_file'                      => '`civicrm`.',
  'civicrm_entity_financial_trxn'            => '`civicrm`.',
  'civicrm_entity_tag'                       => '`civicrm`.',
  'civicrm_event'                            => '`civicrm`.',
  'civicrm_file'                             => '`civicrm`.',
  'civicrm_financial_account'                => '`civicrm`.',
  'civicrm_financial_trxn'                   => '`civicrm`.',
  'civicrm_grant'                            => '`civicrm`.',
  'civicrm_group'                            => '`civicrm`.',
  'civicrm_group_contact'                    => '`civicrm`.',
  'civicrm_group_contact_cache'              => '`civicrm`.',
  'civicrm_group_nesting'                    => '`civicrm`.',
  'civicrm_group_organization'               => '`civicrm`.',
  'civicrm_im'                               => '`civicrm`.',
  'civicrm_line_item'                        => '`civicrm`.',
  'civicrm_loc_block'                        => '`civicrm`.',
  'civicrm_location_type'                    => '`civicrm`.',
  'civicrm_log'                              => '`civicrm`.',
  'civicrm_mail_settings'                    => '`civicrm`.',
  'civicrm_mailing'                          => '`civicrm`.',
  'civicrm_mailing_bounce_pattern'           => '`civicrm`.',
  'civicrm_mailing_bounce_type'              => '`civicrm`.',
  'civicrm_mailing_component'                => '`civicrm`.',
  'civicrm_mailing_event_bounce'             => '`civicrm`.',
  'civicrm_mailing_event_confirm'            => '`civicrm`.',
  'civicrm_mailing_event_delivered'          => '`civicrm`.',
  'civicrm_mailing_event_forward'            => '`civicrm`.',
  'civicrm_mailing_event_opened'             => '`civicrm`.',
  'civicrm_mailing_event_queue'              => '`civicrm`.',
  'civicrm_mailing_event_reply'              => '`civicrm`.',
  'civicrm_mailing_event_subscribe'          => '`civicrm`.',
  'civicrm_mailing_event_trackable_url_open' => '`civicrm`.',
  'civicrm_mailing_event_unsubscribe'        => '`civicrm`.',
  'civicrm_mailing_group'                    => '`civicrm`.',
  'civicrm_mailing_job'                      => '`civicrm`.',
  'civicrm_mailing_recipients'               => '`civicrm`.',
  'civicrm_mailing_spool'                    => '`civicrm`.',
  'civicrm_mailing_trackable_url'            => '`civicrm`.',
  'civicrm_mapping'                          => '`civicrm`.',
  'civicrm_mapping_field'                    => '`civicrm`.',
  'civicrm_membership'                       => '`civicrm`.',
  'civicrm_membership_block'                 => '`civicrm`.',
  'civicrm_membership_log'                   => '`civicrm`.',
  'civicrm_membership_payment'               => '`civicrm`.',
  'civicrm_membership_status'                => '`civicrm`.',
  'civicrm_membership_type'                  => '`civicrm`.',
  'civicrm_menu'                             => '`civicrm`.',
  'civicrm_navigation'                       => '`civicrm`.',
  'civicrm_note'                             => '`civicrm`.',
  'civicrm_openid'                           => '`civicrm`.',
  'civicrm_option_group'                     => '`civicrm`.',
  'civicrm_option_value'                     => '`civicrm`.',
  'civicrm_participant'                      => '`civicrm`.',
  'civicrm_participant_payment'              => '`civicrm`.',
  'civicrm_participant_status_type'          => '`civicrm`.',
  'civicrm_payment_processor'                => '`civicrm`.',
  'civicrm_payment_processor_type'           => '`civicrm`.',
  'civicrm_pcp'                              => '`civicrm`.',
  'civicrm_pcp_block'                        => '`civicrm`.',
  'civicrm_persistent'                       => '`civicrm`.',
  'civicrm_phone'                            => '`civicrm`.',
  'civicrm_pledge'                           => '`civicrm`.',
  'civicrm_pledge_block'                     => '`civicrm`.',
  'civicrm_pledge_payment'                   => '`civicrm`.',
  'civicrm_preferences'                      => '`civicrm`.',
  'civicrm_preferences_date'                 => '`civicrm`.',
  'civicrm_premiums'                         => '`civicrm`.',
  'civicrm_premiums_product'                 => '`civicrm`.',
  'civicrm_prevnext_cache'                   => '`civicrm`.',
  'civicrm_price_field'                      => '`civicrm`.',
  'civicrm_price_field_value'                => '`civicrm`.',
  'civicrm_price_set'                        => '`civicrm`.',
  'civicrm_price_set_entity'                 => '`civicrm`.',
  'civicrm_product'                          => '`civicrm`.',
  'civicrm_project'                          => '`civicrm`.',
  'civicrm_relationship'                     => '`civicrm`.',
  'civicrm_relationship_type'                => '`civicrm`.',
  'civicrm_report_instance'                  => '`civicrm`.',
  'civicrm_saved_search'                     => '`civicrm`.',
  'civicrm_state_province'                   => '`civicrm`.',
  'civicrm_subscription_history'             => '`civicrm`.',
  'civicrm_survey'                           => '`civicrm`.',
  'civicrm_tag'                              => '`civicrm`.',
  'civicrm_task'                             => '`civicrm`.',
  'civicrm_task_status'                      => '`civicrm`.',
  'civicrm_tell_friend'                      => '`civicrm`.',
  'civicrm_timezone'                         => '`civicrm`.',
  'civicrm_uf_field'                         => '`civicrm`.',
  'civicrm_uf_group'                         => '`civicrm`.',
  'civicrm_uf_join'                          => '`civicrm`.',
  'civicrm_uf_match'                         => '`civicrm`.',
  'civicrm_value_sponsor_logo_1'             => '`civicrm`.',
  'civicrm_website'                          => '`civicrm`.',
  'civicrm_worldregion'                      => '`civicrm`.',
);

Next, I cleared the site's cache.

I looked at the actual file handler files but I'm so new I can't really trace what might be missing or pointing incorrectly.

Any help would be appreciated!

seamonkey

  • I’m new here
  • *
  • Posts: 8
  • Karma: 1
  • CiviCRM version: 4.0.7
  • CMS version: Drupal 7.9
  • MySQL version: 5.1.58-1ubuntu1
  • PHP version: 5.2
Re: Drupal 7 Views 3 Civi4.0.7 Custom Data Image Problem (missing handler/broken)
November 21, 2011, 06:23:24 am
Hello,

I looked this morning inside all/modules/civicrm/drupal/modules/views at civicrm_handler_field_custom_file.inc and the civicrm version listed in the header says version 3.4 - and my civicrm is version 4.0.7.

I quickly scanned other .inc files such as (......field_custom.inc) and they list version 4 at the top.

Does anyone know if adding a custom file to a contact in civicrm, then creating a view to output results, is accessing this older version file that may not be plugging in correctly?

Original handler code:
<?php
/*
 +--------------------------------------------------------------------+
 | CiviCRM version 3.4                                                |
 +--------------------------------------------------------------------+
 | This file is a part of CiviCRM.                                    |
 |                                                                    |
 | CiviCRM is free software; you can copy, modify, and distribute it  |
 | under the terms of the GNU Affero General Public License           |
 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
 |                                                                    |
 | CiviCRM is distributed in the hope that it will be useful, but     |
 | WITHOUT ANY WARRANTY; without even the implied warranty of         |
 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
 | See the GNU Affero General Public License for more details.        |
 |                                                                    |
 | You should have received a copy of the GNU Affero General Public   |
 | License and the CiviCRM Licensing Exception along                  |
 | with this program; if not, contact CiviCRM LLC                     |
 | at info[AT]civicrm[DOT]org. If you have questions about the        |
 | GNU Affero General Public License or the licensing of CiviCRM,     |
 | see the CiviCRM license FAQ       |
 +--------------------------------------------------------------------+
*/
  /*
   / * Unchanged anonymous code contribution. No claim.
   *
   * civicrm_handler_field_custom_file.inc
   * Displays File field uri instead of id.
   *
   */
  /**
   * Field handler to provide acess control for the File field
   *
   * @ingroup civicrm_field_handlers
   */
class civicrm_handler_field_custom_file extends views_handler_field {
    function construct( ) {
        civicrm_initialize( );
        $this->additional_fields['entity_id'] = 'entity_id';
    }
   
    function render( $values ) {
        $value = $values->{$this->field_alias};
        if ( ! is_null( $value ) ) {
            $fileType = CRM_Core_DAO::getFieldValue( 'CRM_Core_DAO_File',
                                                     $value,
                                                     'mime_type' );
           
            if ( $fileType && in_array($fileType,  array( "image/jpeg", "image/pjpeg", "image/gif", "image/x-png", "image/png" ) ) ) {
                $uri = CRM_Core_DAO::getFieldValue( 'CRM_Core_DAO_File',
                                                    $value,
                                                    'uri' );
                $config = CRM_Core_Config::singleton( );
                return str_replace( 'persist/contribute', 'custom', $config->imageUploadURL) . $uri;
            } else {
                $entityField = $this->aliases['entity_id'];
                return  CRM_Utils_System::url( 'civicrm/file',
                                               "reset=1&id={$value}&eid={$values->$entityField}",
                                               true, null, true, true );
            }
        }
        return null;
    }
  }
?>

seamonkey

  • I’m new here
  • *
  • Posts: 8
  • Karma: 1
  • CiviCRM version: 4.0.7
  • CMS version: Drupal 7.9
  • MySQL version: 5.1.58-1ubuntu1
  • PHP version: 5.2
Re: Drupal 7 Views 3 Civi4.0.7 Custom Data Image Problem (missing handler/broken)
November 21, 2011, 07:06:33 pm
Looking into it further tonight, I checked the logs and get this error:

Notice: Undefined index: element_type_enable in views_handler_field->options_submit() (line 400 of /var/www/drupal-7.8/sites/all/modules/views/handlers/views_handler_field.inc).

I assume something is not being passed from civi (handler at fault?) to drupal/views module...

In a bit over my head at the moment.

DerekL

  • I post frequently
  • ***
  • Posts: 132
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.54
  • PHP version: 5.2.17
Re: Drupal 7 Views 3 Civi4.0.7 Custom Data Image Problem (missing handler/broken)
November 30, 2011, 11:19:35 pm
Yep. I somehow managed to get exactly where you are.

To recreate:

1. Create a civicrm custom data field of type "file".
2. Attempt to add this field to a view.

I'm got here because I need to be able to assign contacts an image, and then use imagecache to generate thumbnails with those images. As civi exposes only the contact URL, I have no way of applying any imagecache black magic...

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Drupal 7 Views 3 Civi4.0.7 Custom Data Image Problem (missing handler/broken)

This forum was archived on 2017-11-26.