Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.0.4
-
Fix Version/s: 3.4.5
-
Component/s: Core CiviCRM
-
Labels:None
Description
to reproduce :
add at least one pdf format (without making any of it the default one) and add an associated model
List some contact (one is enough), select it, action -> print pdf and a notice will appear :
"""
Notice : Undefined index: id dans CRM_Contact_Form_Task_PDFLetterCommon::setDefaultValues() (ligne 153 dans /var/www/drupal/sites/all/modules/civicrm/CRM/Contact/Form/Task/PDFLetterCommon.php).
"""
In fact the default format recovered by this function :
"""
$defaultFormat = CRM_Core_BAO_PdfFormat::getDefaultValues();
"""
doesn't provide the 'id' information and the notice is due to :
"""
$defaultFormat['format_id'] = $defaultFormat['id'];
"""
the following test is sufficient to avoid notices and warnings (see attached patch):
"""
if (isset($defaultFormat['id'])){
$defaultFormat['format_id'] = $defaultFormat['id'];
}
"""
But ensuring that getDefaultValues returns normalized datas seems a better choice.
Hoping this helps