Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.0.7
-
Fix Version/s: 4.2.0
-
Component/s: Drupal Integration Modules
-
Labels:
Description
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 to access separate civicrm database
I looked at the file at ../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;
}
}
?>
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...