Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCHR-3654: Make it Impossible to Uncheck Work pattern As Default #2604

Merged
merged 5 commits into from
May 11, 2018

Conversation

tunbola
Copy link
Contributor

@tunbola tunbola commented May 9, 2018

Overview

Currently, It is possible to unselect a work pattern as default, leaving a CiviHR site without a default work pattern which breaks many things. This PR fixes the issue and makes sure that the default work pattern can not be unselected to make it non default, rather default work pattern change should happen from edit/create screen of a new work pattern (This is the current behaviour).

Before

  • It is possible to unselect a work pattern as default.

defaultworkpatternbefore

After

  • It is not possible to unselect the default work pattern and make it non-default

defaultworkpattern

Note

This PR also contains changes from #2605 which is about making it impossible to set a disabled work pattern as default.

$isToBeUncheckedAsDefault = isset($params['is_default']) && !$params['is_default'];
if($isToBeUncheckedAsDefault && $isDefaultWorkPattern) {
throw new CRM_HRLeaveAndAbsences_Exception_InvalidWorkPatternException(
'It is not possible to have no default Work Pattern'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this also implies Default Work Pattern required.? Guess it will be more simplified if it means same thing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes a default Work pattern is required. A default work pattern is actually shipped with the default CiviHR installation

Copy link
Contributor

@ajesamson ajesamson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@tunbola tunbola merged commit 69d565b into staging May 11, 2018
@tunbola tunbola deleted the PCHR-3654-not-uncheck-default-work-pattern branch May 11, 2018 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants