Product downloads controller reviewed
Traumflug last edited by Traumflug
Over the last couple of days I reviewed the product downloads controller in order to give it a more reliable shape. This includes a number of changes to the
ProductDownloadclass, none of which should affect behavior for other uses.
It’s this thing, part of the product editor:
Changed and new features:
- Deleting the file deletes the file only, not the entire product download record. As one would expect when clicking ‘Delete this file’.
- Removing the file associated to the product still removes both, file and record.
- Deleting one record no longer creates yet another, empty record.
- Switching product type away from ‘Virtual Product’ also deletes file and product download record. Keep the environment clean, folks!
- There is now a new switch for deactivating a download. Previously the other switch tried to handle this as well … and more often than not produced a mess.
- If there’s something wrong with the downloadable file (missing file, missing name), a product download gets deactivated automatically. To make sure your customers see only working downloads.
- Catched all cases of product download records being deleted without the related file being deleted as well. No more stale file in the downloads folder of your server. Well, hopefully
If you want to give it a try, code is currently on the productdownloads branch for evaluation. If there are no objections coming up, I’ll move it to
1.0.xin a few days.
P.S.: ‘record’ = database entry into the
That’s an important change. Thank you!
I’ll test it today/tomorrow and let you know our feedback. I’m sure it’s a great change and we definitely welcome it, but let’s see what effect it has on stability and compatibility.
alwayspaws last edited by
@Traumflug That was a huge undertaking. No wonder we keep you around
Note to self: all changes at once: https://github.com/thirtybees/thirtybees/compare/cd3819f5bce6e54eedbb07c280256b41e6dc54ae…58b2479643c86049a9464ca0adc6e52c82723b7e
I’ll have a final look today and will let you know. Looking good so far.
What is missing for the second precision? Just the frontend widget? I believe tb needs a datetime option instead of just date. This time I actually wouldn’t mind if we added a new feature. I needed to use the datetime option several times in my modules, so instead ended up adding it to the module via a template override.
Traumflug last edited by
What is missing for the second precision? Just the frontend widget?
As far as I could see, it’s the formatting requested for the datepicker in the GUI and also some PHP code assuming this format. PHP code for second-precision exists in a comment already.