/**
* Creates a new option group with the passed in values.
- * @TODO: Should update the group if it already exists intelligently, so multi-lingual is
- * not messed up. Currently deletes the old group
*
* @param string $groupName
* The name of the option group - make sure there is no conflict.
* the option group ID
*/
public static function createAssoc($groupName, &$values, &$defaultID, $groupTitle = NULL) {
- self::deleteAssoc($groupName);
if (!empty($values)) {
$group = new CRM_Core_DAO_OptionGroup();
$group->name = $groupName;
+ $group->find(TRUE);
$group->title = empty($groupTitle) ? $groupName : $groupTitle;
$group->is_reserved = 1;
$group->is_active = 1;
foreach ($values as $v) {
$value = new CRM_Core_DAO_OptionValue();
$value->option_group_id = $group->id;
- $value->label = $v['label'];
$value->value = $v['value'];
+ $value->find(TRUE);
+ $value->label = $v['label'];
$value->name = $v['name'] ?? NULL;
$value->description = $v['description'] ?? NULL;
$value->weight = $v['weight'] ?? NULL;
* @param $values
* @param bool $flip
* @param string $field
+ *
+ * @deprecated
*/
public static function getAssoc($groupName, &$values, $flip = FALSE, $field = 'name') {
+ CRM_Core_Error::deprecatedFunctionWarning('unused function');
$query = "
SELECT v.id as amount_id, v.value, v.label, v.name, v.description, v.weight
FROM civicrm_option_group g,
/**
* @param string $groupName
* @param string $operator
+ *
+ * @deprecated
*/
public static function deleteAssoc($groupName, $operator = "=") {
+ CRM_Core_Error::deprecatedFunctionWarning('unused function');
$query = "
DELETE g, v
FROM civicrm_option_group g,