Add warning when no conditions and/or actions are available

psynaptic - October 20, 2008 - 20:33
Project:UC Discounts
Version:5.x-1.x-dev
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

There seems to be a repeating issue where people are finding the conditions and/or actions select widget empty. This can be caused by not having any of the included modules installed so no conditions or actions are available.

We need to add a warning message when no conditions or actions are available so users don't get confused.

#1

joachim - October 21, 2008 - 15:02

Simplest thing is to implement hook_store_status.
A warning when users actually are on the page with the empty bits, or when users are at the start of the process of adding a discount would be good too -- since there's no point creating a discount if you have less than 1 condition and 1 action available.

#2

psynaptic - October 21, 2008 - 15:49

I would say the most visible place for a warning would be on the discounts admin page itself. We could have a message on the install page too since that would save the admin navigating back to the modules page.

#3

joachim - October 22, 2008 - 18:57

/admin/store/discounts ?

Yup, since that's where you start trying to add discounts.
Still, it's not too hard to also do a status notice.

So we need to code:
- a sanity-checking function for the core discounts module. This checks there is at least one action and one condition available; returns TRUE or FALSE.
- something that calls this on the discounts admin page. Ideally, this should block the 'add discount' link too, since it's of no use.
- an implementation of hook_store_status which calls this too.

#4

psynaptic - October 22, 2008 - 16:11
Title:Conditions and/or actions select widget is empty» Add warning when no conditions and/or actions are available

#5

joachim - October 24, 2008 - 23:28
Status:active» fixed

Turns out there's already functions that get a list of actions and conditions: they're used to populate those lists that are showing up empty.
Implemented the hook, and checking on our admin page too with a message that sends the user to check status.
Here's a patch of what I've committed.

AttachmentSize
uc_discounts_status_messages.patch 1.65 KB

#6

psynaptic - October 26, 2008 - 13:15

Just tested this and it works perfectly. Thanks!

#7

Anonymous (not verified) - November 9, 2008 - 13:22
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.