silverstripe / silverstripe-dms

Adds a Document Management System to Silverstripe
BSD 3-Clause "New" or "Revised" License
40 stars 52 forks source link

Document sets GridField added to page is called 'Document Sets' with a space in it #196

Closed wakes closed 6 years ago

wakes commented 7 years ago

Hi,

DMSSiteTreeExtension adds a GridField showing document sets to a page, however the field is given a name 'Document Sets' with a space in it not e.g. 'DocumentSets'.

https://github.com/silverstripe/silverstripe-dms/blob/2.0.4/code/extensions/DMSSiteTreeExtension.php#L29

This breaks e.g. GridFieldOrderableRows extension and possibly other things as when data is posted back to CMS to do reordering the postVar is 'Document_Sets' which doesn't match up with field name of 'Document Sets' and so failure ensues.

https://github.com/symbiote/silverstripe-gridfieldextensions/blob/1.4.5/code/GridFieldOrderableRows.php#L287

You could say it's a problem with GridFieldOrderableRows not handling a space in the field name, but I think fixing the issue with having a space in the field name may be a better approach as may break other things?

Cheers, Steve

robbieaverill commented 7 years ago

Sounds good. Would you like to make a pull request?

wakes commented 7 years ago

@robbieaverill ah, forgot to say "this may break other bits of the dms so will need a good regression test" :-) sadly I just now have DMS in System Testing so bit loath to make big changes, need to fork etc. Will try and do out of hours if possible.

robbieaverill commented 7 years ago

I suspect that what is required here will be taking the space out of $fields->addFieldToTab('Root.Document Sets', ...) and adding something like $fields->findOrMakeTab('Root.DocumentSets')->setTitle(_t('DocumentSet.DOCUMENT_SET', 'Document Sets')); - untested, but if this is the change that needs to be made I don't imagine it will cause any problems elsewhere.

robbieaverill commented 6 years ago

Released in 2.1.0, thanks for reporting @wakes and thanks for fixing @raissanorth!