/** * returns the list of fields that can be exported. * * @param bool $prefix * * @return array */ static function &export($prefix = FALSE) { if (!self::$_export) { self::$_export = array(); $fields = self::fields(); foreach ($fields as $name => $field) { if (!empty($field['export'])) { if ($prefix) { self::$_export['price_set'] =& $fields[$name]; } else { self::$_export[$name] =& $fields[$name]; } } } } return self::$_export; }
/** * returns the list of fields that can be exported * * @access public * return array * @static */ static function &export($prefix = false) { if (!self::$_export) { self::$_export = array(); $fields = self::fields(); foreach ($fields as $name => $field) { if (CRM_Utils_Array::value('export', $field)) { if ($prefix) { self::$_export['price_set'] =& $fields[$name]; } else { self::$_export[$name] =& $fields[$name]; } } } } return self::$_export; }
/** * Link the price set with the specified table and id. * * @param string $entityTable * @param int $entityId * @param int $priceSetId * * @return bool */ public static function addTo($entityTable, $entityId, $priceSetId) { // verify that the price set exists $dao = new CRM_Upgrade_Snapshot_V4p2_Price_DAO_Set(); $dao->id = $priceSetId; if (!$dao->find()) { return FALSE; } unset($dao); $dao = new CRM_Upgrade_Snapshot_V4p2_Price_DAO_SetEntity(); // find if this already exists $dao->entity_id = $entityId; $dao->entity_table = $entityTable; $dao->find(TRUE); // add or update price_set_id $dao->price_set_id = $priceSetId; return $dao->save(); }