CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Creating Price Field: "Name already exists in Database."
Pages: [1]

Author Topic: Creating Price Field: "Name already exists in Database."  (Read 1291 times)

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Creating Price Field: "Name already exists in Database."
February 03, 2009, 02:48:36 pm
I get this error attached to the "Field Label" field when I try to create different sets of "Sponsorship" levels in separate price sets for different events.

Does the name of a price field have to be unique across all price sets?  And WHY? 

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Creating Price Field: "Name already exists in Database."
February 03, 2009, 03:05:34 pm
can you file an issue. We'll fix this for 2.2. It should not allow the same label in the same price set. Same label across multiple price sets should be fine

a small patch for 2.1 / 2.2 is here: (line numbers are from 2.2)

Code: [Select]
svn diff CRM/Price/Form/Field.php
Index: CRM/Price/Form/Field.php
===================================================================
--- CRM/Price/Form/Field.php    (revision 19724)
+++ CRM/Price/Form/Field.php    (working copy)
@@ -143,8 +143,6 @@
         
         // label
         $this->add('text', 'label', ts('Field Label'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_PriceField', 'label'), true);
-        $this->addRule( 'label', ts('Name already exists in Database.'),
-                        'objectExists', array( 'CRM_Core_DAO_PriceField', $this->_fid, 'label' ) );
         
         // html_type
         $javascript = 'onchange="option_html_type(this.form)";';
lobo


« Last Edit: February 03, 2009, 03:07:07 pm by Donald Lobo »
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

lentilsoup

  • I post frequently
  • ***
  • Posts: 134
  • Karma: 6
Re: Creating Price Field: "Name already exists in Database."
February 03, 2009, 03:28:02 pm
Yes, that's fixed the problem.  Thank you!  I assume the check for duplicates within the price set will have to be re-added eventually?

And yes, I'll file a bug... going to try to find my way around the issue tracker.

EDIT: bug filed -- http://issues.civicrm.org/jira/browse/CRM-4074
« Last Edit: February 03, 2009, 03:33:49 pm by lentilsoup »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Creating Price Field: "Name already exists in Database."

This forum was archived on 2017-11-26.