CRM-12167: Finish Implementing Visibility per Price Option
authorCamilo Rodriguez <camilo@compucorp.co.uk>
Fri, 25 Aug 2017 15:16:28 +0000 (15:16 +0000)
committerCamilo Rodriguez <camilo@compucorp.co.uk>
Mon, 25 Sep 2017 14:53:00 +0000 (14:53 +0000)
commita13c171d740f1db886724d6ed8c224476f210214
tree798629a89d384ae819194e3f0dcb79239ab26a2c
parentbde70650f8a8d5b211b40650e1eaadb78815c9a1
CRM-12167: Finish Implementing Visibility per Price Option

Added validations so that:
- A public price field has at least one public option
- An admin price field has all admin options

Implemented removal for Select and Checkbox field types. Also added condition
to remove Admin values only if logged user doen't have appropriate
permissions.

Implemented different permissions check to see if admin options should be
deleted or not if the price set is being used for a contribution page or an
event page.

Implemented functionality so that if a user chooses Admin visibility for the
price field, all options are forced to have Admin visibility as well.

Added default visibility as public on creation, in case it's not set, and
protected access to unexisting visibility_id array key.

Moved SQL to add new visibility field to PHP upgrader for v4.7.26.
15 files changed:
CRM/Event/Form/Registration/Register.php
CRM/Price/BAO/PriceField.php
CRM/Price/BAO/PriceSet.php
CRM/Price/Form/Field.php
CRM/Price/Form/Option.php
CRM/Upgrade/Incremental/php/FourSeven.php
CRM/Upgrade/Incremental/sql/4.7.23.mysql.tpl [changed mode: 0755->0644]
templates/CRM/Price/Form/Field.tpl
templates/CRM/Price/Form/Option.tpl
templates/CRM/Price/Form/OptionFields.tpl
templates/CRM/Price/Form/PriceSet.tpl
templates/CRM/Price/Page/Field.hlp
tests/phpunit/CRM/Price/BAO/PriceFieldValueTest.php
tests/phpunit/CRM/Price/Form/FieldTest.php
tests/phpunit/CRM/Price/Form/OptionTest.php