Bug 25476 - Uploaded files can't be easily browsed via upload.pl
Summary: Uploaded files can't be easily browsed via upload.pl
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: David Cook
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-13 06:49 UTC by David Cook
Modified: 2021-05-24 14:43 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.06


Attachments
Bug 25476: Add ability to browse file uploads by category (3.78 KB, patch)
2020-05-14 04:17 UTC, David Cook
Details | Diff | Splinter Review
Bug 25476: Add ability to browse file uploads by category (3.83 KB, patch)
2021-01-19 22:57 UTC, Mazen Khallaf
Details | Diff | Splinter Review
Bug 25476: Add ability to browse file uploads by category (3.88 KB, patch)
2021-03-27 03:07 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 25476: Add ability to browse file uploads by category (3.99 KB, patch)
2021-04-09 06:35 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Cook 2020-05-13 06:49:06 UTC
/cgi-bin/koha/tools/upload.pl should allow you to browse files.

There is a search function, but you'd already need to know what you're searching for in order for it to work as desired.
Comment 1 David Cook 2020-05-14 04:17:05 UTC
Created attachment 104862 [details] [review]
Bug 25476: Add ability to browse file uploads by category

This patch adds the ability to search/browse files by category.
(Note it doesn't include temporary uploads since they don't have
 a "category" per se.)

Test Plan:
0) Apply patch
1) Go to /cgi-bin/koha/admin/authorised_values.pl
2) Create "UPLOAD" authorized value category
3) Create "test" authorized value in "UPLOAD" category
4) Go to /cgi-bin/koha/tools/upload.pl
5) Note "Search uploads by category" fieldset
6) Upload new file to "test" category
7) Click "Back"
8) Choose "test" category in "Search uploads by category"
9) Click "Search"
10) Note that your file upload is displayed in result list
Comment 2 Owen Leonard 2020-09-04 16:47:29 UTC
Can this be made to combine both category and term/hash searching in one form?
Comment 3 David Cook 2020-09-07 00:44:22 UTC
(In reply to Owen Leonard from comment #2)
> Can this be made to combine both category and term/hash searching in one
> form?

Probably although that would be low on my TODO list.
Comment 4 Mazen Khallaf 2021-01-19 22:57:57 UTC
Created attachment 115373 [details] [review]
Bug 25476: Add ability to browse file uploads by category

This patch adds the ability to search/browse files by category.
(Note it doesn't include temporary uploads since they don't have
 a "category" per se.)

Test Plan:
0) Apply patch
1) Go to /cgi-bin/koha/admin/authorised_values.pl
2) Create "UPLOAD" authorized value category
3) Create "test" authorized value in "UPLOAD" category
4) Go to /cgi-bin/koha/tools/upload.pl
5) Note "Search uploads by category" fieldset
6) Upload new file to "test" category
7) Click "Back"
8) Choose "test" category in "Search uploads by category"
9) Click "Search"
10) Note that your file upload is displayed in result list

Signed-off-by: Mazen Khallaf <mazen.i.khallaf@gamil.com>
Comment 5 Victor Grousset/tuxayo 2021-03-27 03:07:46 UTC
Created attachment 118882 [details] [review]
Bug 25476: Add ability to browse file uploads by category

This patch adds the ability to search/browse files by category.
(Note it doesn't include temporary uploads since they don't have
 a "category" per se.)

Test Plan:
0) Apply patch
1) Go to /cgi-bin/koha/admin/authorised_values.pl
2) Create "UPLOAD" authorized value category
3) Create "test" authorized value in "UPLOAD" category
4) Go to /cgi-bin/koha/tools/upload.pl
5) Note "Search uploads by category" fieldset
6) Upload new file to "test" category
7) Click "Back"
8) Choose "test" category in "Search uploads by category"
9) Click "Search"
10) Note that your file upload is displayed in result list

Signed-off-by: Mazen Khallaf <mazen.i.khallaf@gamil.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 6 Victor Grousset/tuxayo 2021-03-27 03:10:11 UTC
Works, QA tools ok, code looks good but just one question about plugin stuff:

Why is [% PROCESS plugin_pars %] needed?
And what does $plugin? ( public => 1 ): (), do?
Comment 7 David Cook 2021-03-29 02:46:07 UTC
(In reply to Victor Grousset/tuxayo from comment #6)
> Works, QA tools ok, code looks good but just one question about plugin stuff:
> 
> Why is [% PROCESS plugin_pars %] needed?

Honestly, I did that because the other blocks had it. It looks like it's needed so that if you're working with plugins, Koha will know you're still working with plugins when you do a form submit.

> And what does $plugin? ( public => 1 ): (), do?

This looks like it may have been changed in newer versions of Koha to something like: $plugin? (): ( include_private => 1 ),

I am not sure. It's been too long since I wrote this. 

Might be worth marking as Failed QA, and I probably won't work on fixing it, as I have too many other things on at the moment.
Comment 8 Victor Grousset/tuxayo 2021-03-29 16:27:06 UTC
> Might be worth marking as Failed QA

Asked for help in koha-devel, to not have this fall into oblivion ^^
Maybe there is nothing to fix.
Comment 9 Marcel de Rooy 2021-04-09 06:09:54 UTC
Having a look right now
Comment 10 Marcel de Rooy 2021-04-09 06:19:19 UTC
First impression: The search fields category and term could better have been combined on one search form instead of now two.
Comment 11 Marcel de Rooy 2021-04-09 06:33:53 UTC
Victor asked:

QUOTE
[% PROCESS plugin_pars %]
[...]
$plugin? ( public => 1 ): ()

Does this look familiar to anyone?
END_QUOTE

Yes, it looks familiar ;) I wrote this code once. The plugin variable refers to the use of upload in the cataloguing editor as a plugin for field 856 in MARC21.
When you upload files there, it would be useless to add file uploads that are not public, since your OPAC users would not be able to use them.

The process directive adds the block defined earlier. The plugin flag adds the extra condition public = 1 to your search. You dont want to add private uploads in field 856.

Hope that helps.
Comment 12 Marcel de Rooy 2021-04-09 06:35:52 UTC
Created attachment 119343 [details] [review]
Bug 25476: Add ability to browse file uploads by category

This patch adds the ability to search/browse files by category.
(Note it doesn't include temporary uploads since they don't have
 a "category" per se.)

Test Plan:
0) Apply patch
1) Go to /cgi-bin/koha/admin/authorised_values.pl
2) Create "UPLOAD" authorized value category
3) Create "test" authorized value in "UPLOAD" category
4) Go to /cgi-bin/koha/tools/upload.pl
5) Note "Search uploads by category" fieldset
6) Upload new file to "test" category
7) Click "Back"
8) Choose "test" category in "Search uploads by category"
9) Click "Search"
10) Note that your file upload is displayed in result list

Signed-off-by: Mazen Khallaf <mazen.i.khallaf@gamil.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 13 Marcel de Rooy 2021-04-09 06:36:52 UTC
Passed QA with reference to comment10
Comment 14 Jonathan Druart 2021-04-09 14:40:51 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 15 Fridolin Somers 2021-04-29 09:09:36 UTC
Small and very useful enhancement, I choose to backport.

Pushed to 20.11.x for 20.11.06
Comment 16 Andrew Fuerste-Henry 2021-05-24 14:43:51 UTC
Not backported to 20.05.