Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2014-12-09-14-48-51
[civicrm-core.git] / api / v3 / Event.php
index 0566c134f015d23b63889f7b1b6bd2fb26113c55..3053bdd8a641d91f0030d9c04a27ae5c84770119 100644 (file)
@@ -79,6 +79,7 @@ function _civicrm_api3_event_create_spec(&$params) {
   $params['title']['api.required'] = 1;
   $params['is_active']['api.default'] = 1;
   $params['financial_type_id']['api.aliases'] = array('contribution_type_id');
+  $params['is_template']['api.default'] = 0;
 }
 
 /**
@@ -127,13 +128,6 @@ function civicrm_api3_event_get($params) {
   $eventDAO = new CRM_Event_BAO_Event();
   _civicrm_api3_dao_set_filter($eventDAO, $params, TRUE, 'Event');
 
-  if (!empty($params['is_template'])) {
-    $eventDAO->whereAdd( '( is_template = 1 )' );
-  }
-  elseif(empty($eventDAO->id)){
-    $eventDAO->whereAdd('( is_template IS NULL ) OR ( is_template = 0 )');
-  }
-
   if (!empty($params['isCurrent'])) {
     $eventDAO->whereAdd('(start_date >= CURDATE() || end_date >= CURDATE())');
   }
@@ -157,7 +151,6 @@ function civicrm_api3_event_get($params) {
       $event[$eventDAO->id]['price_set_id'] = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $eventDAO->id);
     }
   }
-  //end of the loop
 
   return civicrm_api3_create_success($event, $params, 'event', 'get', $eventDAO);
 }
@@ -206,7 +199,7 @@ function civicrm_api3_event_delete($params) {
 /*
 
 /**
- * Function to add 'is_full' & 'available_seats' to the return array. (this might be better in the BAO)
+ * add 'is_full' & 'available_seats' to the return array. (this might be better in the BAO)
  * Default BAO function returns a string if full rather than a Bool - which is more appropriate to a form
  *
  * @param array $event return array of the event
@@ -215,7 +208,7 @@ function civicrm_api3_event_delete($params) {
  */
 /**
  * @param $event
- * @param $event_id
+ * @param int $event_id
  */
 function _civicrm_api3_event_getisfull(&$event, $event_id) {
   $eventFullResult = CRM_Event_BAO_Participant::eventFull($event_id, 1);