I’ll try to explain, but I’m not sure what’s going on here… hopefully it’ll become clearer to me as I type it out!
I accidentally added an Edition ID instead of a Book ID to an Edition’s :book> :id that I was editing, in a raw edit. I didn’t notice I’d done it until I’d done two of them, then refreshed the original Book and the entries that had been there appeared to vanish.
The odd thing is that no errors were reported when I did it. The site will happily let me use an Edition ID as if it were a Book ID, and even show a page for the Edition-disguised-as-Book.
To illustrate; 413864 is actually a Book, 300502 is actually an Edition:
I’ve now fixed the Editions so they’re in the right book, so that’s not the problem. I shouldn’t be allowed to save or create an Edition using a Book ID that’s being used as an ID for an Edition.
Good catch. You’re right — the system was treating entity IDs as interchangeable across types within a catalog. A Book ID and an Edition ID both live in the same ID space, so the URL would happily render any entity regardless of whether the type in the URL matched the actual type of the record.
I’ve added a fix so the entity page now validates that the type in the URL matches the entity’s actual type. If someone visits /book/300502/ but 300502 is actually an edition, they’ll get a 404 instead of a confusing mashup page.
On the raw edit side — you’re also right that the system should ideally prevent saving an Edition ID in a :book > :id field. That’s a separate validation issue I’ll look into.
Is the Raw Edit form better for some edits? I originally had it just for testing and development purposed, and thought at some point it would go away.
Thanks for that. I worry I might not be able to fix it if I do it again now there’s no way to edit. I guess I’ll have to not do it again
I do use the raw edit form a lot. Because I’ve had a lot of similar Editions, and several publishers for titles of many of those Editions, it’s been handy to have several tabs in Notepad++ with a raw template for each publisher in each so when I need to add a new publisher or new title’s new Edition I just start from the relevant template, tweak it for the new title or new publisher, and then paste into the raw edit of a newly created Edition. In fairness, there were fewer developed functions when I started this way. Also, I’m now coming to the end of the submissions with loads of printings across multiple publishers, so perhaps the Copy to new submission function will work as well now.
I think it’s handy to keep it around, just in case though. If no-one is using it months from now, it’s probably safe to quietly retire it, but it’s been really useful so far.