Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8454

If no pdf default format is provided, a notice is popuped when you go to the generate pdf page

    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

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              tonthon tonthon
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 hour
                1h
                Remaining:
                Remaining Estimate - 1 hour
                1h
                Logged:
                Time Spent - Not Specified
                Not Specified