Comment 7 for bug 1102612

Revision history for this message
Phil Frost (bitglue) wrote :

I see your change, and that error message is a little better. But, that's not what the bug is about. You are right, if I have a cash register assigned to the journal, I can go there and delete the cash control entries, and then I can delete the journal. But just changing the error message doesn't really address the issue, on several levels.

The error message in the proposed branch is: "You cannot remove an account that contains Cash Control items." What's a "cash control item?" I doubt I'd know, if I hadn't already figured it out by prodding around in the database. In fact, I'd find the old error message more useful, because at least it told me which table contained the thing that needed to be deleted. With the new error message, all I can do is wander around the interface looking for that "cash control" tab which is hidden three layers deep. A useful error message would tell me where to look.

But, what if there isn't a cash register associated with the journal? This is the case for the examples I gave, and is the case for most journals. Should I have to go create a cash register before I can delete a journal? Probably not.

The solution, I think, is to either not create cash control items for journals that are not associated with cash registers, or change this foreign key constraint to ON DELETE CASCADE. After all, what value is there in the cash control items if the journal does not exist? Or even better, implement both solutions.