Bug 10853 - Create CSV profiles with sql fields
Summary: Create CSV profiles with sql fields
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 5031 10854
  Show dependency treegraph
 
Reported: 2013-09-10 11:44 UTC by Jonathan Druart
Modified: 2014-12-07 20:03 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Medium patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 10853: Add DB field export_format.type ('marc' or 'sql'). (17.12 KB, patch)
2013-09-10 13:29 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 10853: Add DB field export_format.type ('marc' or 'sql'). (17.12 KB, patch)
2013-09-18 12:06 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 10853: Add DB field export_format.type ('marc' or 'sql'). (17.54 KB, patch)
2013-09-21 21:27 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 10853 - followup to correct tabs (7.26 KB, patch)
2013-09-21 21:28 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 10853: All existing routing to get a CSV should return a marc csv (4.43 KB, patch)
2013-09-23 13:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
[PASSED QA] Bug 10853: Add DB field export_format.type ('marc' or 'sql'). (17.83 KB, patch)
2013-09-23 20:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 10853 - followup to correct tabs (7.33 KB, patch)
2013-09-23 20:27 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 10853: All existing routing to get a CSV should return a marc csv (4.50 KB, patch)
2013-09-23 20:27 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2013-09-10 11:44:02 UTC
Currently CSV profiles can be created with marc fields only.
This feature will allow to create CSV profile for sql fields.
Comment 1 Jonathan Druart 2013-09-10 13:29:18 UTC Comment hidden (obsolete)
Comment 2 I'm just a bot 2013-09-18 10:45:37 UTC
Applying: Bug 10853: Add DB field export_format.type ('marc' or 'sql').
Using index info to reconstruct a base tree...
M	installer/data/mysql/kohastructure.sql
M	installer/data/mysql/updatedatabase.pl
Falling back to patching base and 3-way merge...
Auto-merging installer/data/mysql/updatedatabase.pl
CONFLICT (content): Merge conflict in installer/data/mysql/updatedatabase.pl
Auto-merging installer/data/mysql/kohastructure.sql
Patch failed at 0001 Bug 10853: Add DB field export_format.type ('marc' or 'sql').
The copy of the patch that failed is found in:
   /home/christopher/git/koha/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Comment 3 Jonathan Druart 2013-09-18 12:06:53 UTC Comment hidden (obsolete)
Comment 4 Bernardo Gonzalez Kriegel 2013-09-21 21:27:44 UTC Comment hidden (obsolete)
Comment 5 Bernardo Gonzalez Kriegel 2013-09-21 21:28:26 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2013-09-22 19:54:17 UTC
I see 2 problems with this:

1) The new SQL based CSV profiles show up in the OPAC download list, but they don't seem to work there. I think we probably need something to differentiate where the CSV profiles are offered - maybe similar to the 'module' of letters?

2) When editing a CSV profile, it redirects to the 'empty' form after saving. It would be better if it remained on the edited CSV profile, so the changes can be checked.

Continueing testing with the dependent bugs/patches to see which changes those include.
Comment 7 Katrin Fischer 2013-09-22 19:55:59 UTC
3) Biggest question of all - I think we need some kind of documentation which tables can be used where? The examples refer to fields related to issues and subscriptions, but so far we only had CSV profiles in context of downloading bibliographic information from OPAC and staff search results.
Comment 8 Katrin Fischer 2013-09-22 20:23:51 UTC
I think we need to solve 1) before we can start making wide use of this feature - showing non-functional CSV profiles in the OPAC could cause quite a lot of confusion. (It shows in the cart download option list)
Comment 9 Jonathan Druart 2013-09-23 13:07:46 UTC
(In reply to Katrin Fischer from comment #6)
> I see 2 problems with this:
> 
> 1) The new SQL based CSV profiles show up in the OPAC download list, but
> they don't seem to work there. I think we probably need something to
> differentiate where the CSV profiles are offered - maybe similar to the
> 'module' of letters?

Yes, good catch. I will fix that.

> 2) When editing a CSV profile, it redirects to the 'empty' form after
> saving. It would be better if it remained on the edited CSV profile, so the
> changes can be checked.

It is the current behavior.

(In reply to Katrin Fischer from comment #7)
> 3) Biggest question of all - I think we need some kind of documentation
> which tables can be used where? The examples refer to fields related to
> issues and subscriptions, but so far we only had CSV profiles in context of
> downloading bibliographic information from OPAC and staff search results.

I tried to do something quite reusable. This patch does not use the created sql csv profile. Bug 10854 allows to export a serial claim using a csv profile (instead of using the default one, which is not editable), so for this one fields from serials and subscription will be available.
I don't know how/where can I document that.
Comment 10 Jonathan Druart 2013-09-23 13:08:13 UTC Comment hidden (obsolete)
Comment 11 Katrin Fischer 2013-09-23 13:24:04 UTC
Ok, I think this can go in, when the OPAC display is fixed. 
I am not sure how to document, but maybe if we had a 'module' flag or some other way to show where the CSV is used, we could have a note appearing that lists the tables? Or we could add it to the help file for that page.
Comment 12 Katrin Fischer 2013-09-23 20:27:03 UTC
Created attachment 21380 [details] [review]
[PASSED QA] Bug 10853: Add DB field export_format.type ('marc' or 'sql').

This patch:
- adds a new column 'type' to the export_format table.
- renames the field name export_format.marcfields with
  export_format.content.
Feel free to propose another name.

Test plan:
- Check that existing profiles have the type "marc" selected by default
- Create a new profile with a type "sql"
- Save and verify the profile is correctly displayed when you select it.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment: Work as described. koha-qa reports Small tabs errors,
corrected in followup

Test:
1) go to Tools > CSVProfiles, Create profile, current
2) Apply patch, run updatedatabase
3) Go to Tools > CSVProfiles, new option present
old profile with type MARC
4) Create new profile MARC, save and show correct
5) Create new profile SQL, save and show correct

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
All tests and QA script pass with all 3 patches applied.
Works as described. Functionality for SQL profiles will be
added by another patch. For now it's possible to add/edit/delete
them.
Existing CSV profiles can still be exported correctly.
Comment 13 Katrin Fischer 2013-09-23 20:27:19 UTC
Created attachment 21381 [details] [review]
[PASSED QA] Bug 10853 - followup to correct tabs

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 14 Katrin Fischer 2013-09-23 20:27:27 UTC
Created attachment 21382 [details] [review]
[PASSED QA] Bug 10853: All existing routing to get a CSV should return a marc csv

Test plan:
Verify that existing csv lists list marc csv profiles and not sql csv
profiles.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Comment 15 Galen Charlton 2013-10-11 03:27:17 UTC
Pushed to master.  Thanks, Jonathan!