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

Add support for admin-only fee / price field value options

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.2.8
    • Fix Version/s: 4.7.27
    • Component/s: CiviEvent
    • Labels:
    • Versioning Impact:
      Major (incompatible API change)
    • Documentation Required?:
      User and Admin Doc
    • Funding Source:
      Contributed Code

      Description

      This is an idea for the sprint.

      When registering a person for a 'fee' event, a fee level must be chosen even if the person is not paying and no contribution is being entered. This is often inappropriate in certain use cases, such as assigning individuals with event roles 'staff' or 'volunteers' to an event. While there is no harm in selecting a fee level and then Not entering a contribution, the pyschological effects to new users is mass confusion. I'd like to discuss ways to avoid this.

      Idea: offer a "no fee" option when back office event participant reg.

      Example:
      July Conference Fee Levels:
      $200 ticket (public)
      $250 ticket plus dinner (public)
      $100 scholarship half-off (non-public)
      $0 keynote speakers get in free (non-public)
      $0 staff (non-public)

      Implementation:

      Overview: provide a visibility selector for price field value options, where the visibility is either Public or Admin, . Only display options with visibility of Admin on backoffice operations for events. Do not implement visibility

      0. Create a github development environment with an installed local site including CiviCRM.

      1. Change the database
      Replicate the visibility_id field from xml/schema/Price/Field.xml into xml/schema/Price/FieldValue.xml (place after is_active, and change <add> value to 4.4).

      cd to the civicrm/bin directory and follow instructions at http://wiki.civicrm.org/confluence/display/CRMDOC43/Installing+CiviCRM+from+subversion+%28SVN%29+repository in section 'Keeping your SVN install up to date'
      edit the values in bin/setup.conf for your database
      setup.sh // this rebuilds the DAO layer and replaces the civicrm db contents

      2. Change the Complex Price Set Configuration
      Add the new Visibility field to the New/Edit Price Option form as per attached image 'complex config price option.png'.
      Add the new Visibility field to the View Price Option page as per attached image 'view price field option value.png'.
      Note: following feedback from Dave Greenberg, please place the visibility field above the 'Active?' field, rather that at the bottom as in the attached images.
      Add a form validation rule that checks the price set to verify there is a publicly visible price field with a publicly visible price field option. If not true the form displays the following message: "At least one publicly visible field with one publicly visible option must exist if online registration is enabled."
      Add a form validation rule on Edit Price Option page that checks if the option has been editted from Publicly available to Admin, then check if the Price Set is being used by an Event AND no other options for this field are public AND no other fields are public visible (ie are both public and if they are of Select or Radio type have at least public option). Message should be: "This price field option cannot be admin only since that would leave no publicly visible fees on a public event."
      To explain the validation more fully using pseudocode:
      if ( (option has changed from public to admin) AND (price set of this price field option value is currently in use for an event) ) then
      $allowChange = FALSE;
      foreach ( $thisPriceSet->pricefields as $pricefield ) {
      if ($pricefield.visibility == public) {
      if ($pricefield has options) {
      foreach ( $pricefield->options as $option ) {
      if ($option.visibility == public)

      { $allowChange = TRUE; break; }

      }
      } else

      { $allowChange = TRUE; break; }

      }
      }
      if ( ! $allowChange )

      { set error message, etc; }

      }

      3. Change the Quick Price Set Configuration
      Add the new Public column to the Events > Manage Events, Configure > Fees form. The checkbox values should be set to true for options with visibility_id of public, and false for visibility_id of admin (I would guess that this will require translation of 1 and 2 to true and false). For rows that do not have option values yet specified, the checkbox should default to checked (True). The values in this column should be stored into the civicrm_price_field_value table on Save and Save and Done, and not on Cancel. Obviously, if there is no fee or amount provided, then a row should not be stored, and so its visibility_id will not be stored.
      Add a form validation rule that checks for and if not true displays the following message: "At least one public fee must exist if online registration is enabled."

      4. Filter the options displayed on Test and Live Event Signup pages so that only Price field option values with visibility of Public are displayed.
      For reference on how to do this, examine how fields are selected for display only when their visibility_id is public, and reimplement for option values for a single field.

      5. Upgrade script
      To come.

      6. Create a webtest for the functionality that does the following:
      a) Creates an event titled 'July Conference' with pay later option selected and no payment processor selected.
      b) Uses the quick configuration interface to create two fee options:
      $200 ticket (public)
      $0 staff (non-public)
      c) Tests that the live event registration page displays the first fee option.
      d) Tests that the live event registration page does NOT display the second fee option.
      e) Tests that the backoffice event registration page displays the first fee option.
      f) Tests that the backoffice event registration page displays the second fee option.
      g) Goes back to the Manage Events page, Fees tab for the event, and changes the $200 ticket to non-public, and attempts to save.
      h) Test that the appropriate error message is displayed.
      i) Changes the existing quick configuration into a complex price set. In the complex price set form, add a third option:
      $100 scholarship half-off (non-public). Saves.
      j) Tests that the live event registration does not show the $100 option.
      k) Tests that the backoffice event registration does show the $100 option.
      l) Goes into

        Attachments

        1. 2013-05-28_22-17-30.png
          174 kB
          Joe Murray
        2. complex config price option.png
          135 kB
          Joe Murray
        3. view price field option value.png
          95 kB
          Joe Murray

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              stoob Stoob
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: