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

Impossible to create event template through api

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.3
    • Fix Version/s: 4.7
    • Component/s: CiviCRM API
    • Labels:
      None
    • Documentation Required?:
      Developer Doc
    • Funding Source:
      Needs Funding

      Description

      Currently it is not possible to create an event template throught the API. Title and start date are defined as required fields for the api, which aren't available for an event template.
      Removing the required code, fixes the code.
      Best fix probably is to conditionally check required fields.
      So actually change

      function _civicrm_api3_event_create_spec(&$params)

      { $params['start_date']['api.required'] = 1; $params['title']['api.required'] = 1; $params['is_active']['api.default'] = 1; $params['financial_type_id']['api.aliases'] = array('contribution_type_id'); }

      in to

      function _civicrm_api3_event_create_spec(&$params) {
      if ( $params['is_template'] == 1)

      { $params['start_date']['api.required'] = 1; $params['title']['api.required'] = 1; }

      $params['is_active']['api.default'] = 1;
      $params['financial_type_id']['api.aliases'] = array('contribution_type_id');
      }

      in api/v3/Event.php

        Attachments

          Activity

            People

            • Assignee:
              colemanw Coleman Watts
              Reporter:
              mallezie Tim Mallezie
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: