Roomify / bat_drupal

Booking and Availability Management Tools for Drupal 7 and Drupal 8
33 stars 7 forks source link

Unable to delete unit bundle #11

Closed simmonspaul closed 8 years ago

simmonspaul commented 8 years ago

[Be aware that I hacked code as per #10 to enable BAT Calendar Reference module - I do not think that it would impact the behaviour seen below]

I have been trying to configure the BAT tool to my use case and hence have been mucking about, adding an event type, unit type bundles, types, units, etc... as you might expect.

Eventually I came to try and delete a unit bundle and got the following error. "This unit bundle has associated units. Please delete all units before attempting to delete this unit bundle."

My issue is there is no way to access these units in order to delete them and then the unit bundle.

I would have expected to go unit management and see an entry there that had a corresponding unit and then go in and delete it. However there was no corresponding entry. [I have gone nuclear in order to try and delete the unit bundles and actual have deleted everything that I have added. Scorched Earth but only the unit bundles remain as I can not delete them because of this error.


Configuration menu behavior might contribute to the issue of not being able to manage the nodes.

There are currently 5 options 1 Type Bundles 2 Unit Bundles 3 Types 4 Units 5 Full Calendar

For 1 and 2, we have the option to add and or import. If we click on the heading itself we can see what is already created and manage it, including the fields therein. For 3 and 4, we can add. If we can click on the heading itself, it also takes us to add. There is not a way of managing what has already been created from configuration for these.

I understand that 4 is probably best managed via the Unit Management menu item (although it might be nice to manage them as a comprehensive list here).

qcutter commented 8 years ago

I had the same issue and ended up deleting the row from the database in this table: bat_units. For some reason it didn't get deleted when i removed from the UI. When I looked sure enough, it was still in the database. After removing that I was able to remove my unit type as normal. Hope this helps

qcutter commented 8 years ago

Also found that the items in bat_event_state, were still in the databases as well so, something is up with the delete process from UI.

simmonspaul commented 8 years ago

Copy that and agreed. Thanks. (ie. I also can find and delete from the database itself as a workaround to the UI)

acrollet commented 8 years ago

Hi @simmonspaul @qcutter ,

I would be interested to hear your use cases for creating Unit bundles - we anticipated that most use cases could be handled with Types and associated units, and in fact are planning on hiding the Unit bundle administration page - Unit bundles (at this time) only exist so that Units may be fieldable.

thanks, Adrian

simmonspaul commented 8 years ago

Hi Adrian - no use case for unit bundles from my perspective. thx

I was just thinking this through further on how to make BAT as flexible as possible. Currently, We have Type Bundles that have a one-to-many relationship to Types... We then have Types that have a one-to-many relationship to Units... (When you book an event the event_unit_reference field is a combination to Type and Unit.)

I think it would be preferable if the relationship between Type and Units is many-to-many. You could create Units through Types as now. You would also have the ability to manage Units themselves to add additional (existing) Types relationships as required.

This supports a use case case of Type Bundle = Hotel Booking Types = Standard Room, Deluxe Room, Beach View, Parking Lot View Units = 101, 102, 103, 201, 202, 203 { Standard Room = 101, 102, 201, 203} { Deluxe Room - 103, 202 } { Beach View = 102, 202 } { Parking Lot View = 101, 103, 201, 203 } (When you were to book an event, you would do it through a separate Type and Unit field. The Unit field would be filtered by the Type selected. Indeed if the Type field allowed multi select then the result would only return those units that satisfied both criteria. eg Standard Room with Beach View = 102)

Again, there might be another way of satisfying this scenario in Bat as it is currently designed, but this seems most flexible.