Bug 24108

Summary: Configure if biblionumber or control number is used for saved files from detail page or advanced cataloguing editor
Product: Koha Reporter: Cori Lynn Arnold <carnold>
Component: CatalogingAssignee: Cori Lynn Arnold <carnold>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: caroline.cyr-la-rose, david, fridolin.somers, katrin.fischer, m.de.rooy
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Medium patch
Text to go in the release notes:
This enhancement lets you choose how a record is named when saving it as a MARC or MARCXML file using the advanced cataloguing editor or the download option from the staff interface detail page. Using the new system system preference "DefaultSaveRecordFileID" choose: - the bibliographic record number (the default): the file is saved as bib-{biblionumber}.{format}, or - the control number (001 field): the file is saved as as record-{controlnumber}.{format}.
Version(s) released in:
21.05.00
Attachments: Bug 24108: Advanced Editor: Save .mrc save with a configurable value
Bug 24108: Advanced Editor: Save .mrc save with a configurable value
Changed indentation.
Bug 24108: Advanced Editor: Save .mrc save with a configurable value
Bug 24108: Advanced Editor: Save .mrc save with a configurable value
Bug 24108: Advanced Editor - Save .mrc save with a configurable value
Bug 24108: Advanced Editor: Save .mrc save with a configurable value
Bug 24108: (follow-up) Fix capitalization of sys pref description
Bug 24108: Alternativ phrasing of the system preference decription
Bug 24108: (follow-up) Alternative phrasing of the system preference decription
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug 24108: (follow-up) Fix typo with .xml extension
Bug 24108: (QA follow-up) Adjust wording and use perl for update file
Bug 24108: Make export file names consistent
Bug 24108: Make export file names consistent
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug 24108: (follow-up) Fix typo with .xml extension
Bug 24108: (QA follow-up) Adjust wording and use perl for update file
Bug 24108: Make export file names consistent
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug 24108: (follow-up) Fix typo with .xml extension
Bug 24108: (QA follow-up) Adjust wording and use perl for update file
Bug 24108: Make export file names consistent
Bug 24108: (QA follow-up) Add missing comma in sysprefs.sql
Bug 24108: (QA follow-up) Add staff detail page to syspref description
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files
Bug 24108: (follow-up) Fix typo with .xml extension
Bug 24108: (QA follow-up) Adjust wording and use perl for update file
Bug 24108: Make export file names consistent
Bug 24108: (QA follow-up) Add missing comma in sysprefs.sql
Bug 24108: (QA follow-up) Add staff detail page to syspref description
Bug 24108: Remove extra spaces

Description Cori Lynn Arnold 2019-11-25 20:42:47 UTC
When saving a file as .mrc in the Advanced Editor, please add an identifier to the name of the file. Either:

*Koha Number
*Control Number (our preference, but we understand not everyone uses this)

Bonus if it is configurable (default can be Koha Number)

Currently the file is saved as "record.mrc" which does no one any good at all.
Comment 1 Cori Lynn Arnold 2019-12-04 11:04:05 UTC
Created attachment 95989 [details] [review]
Bug 24108: Advanced Editor: Save .mrc save with a configurable value

Creates a new systempref "SaveRecordbyControlNumber" which is initially
set to 0 (off/no). By default saving .mrc (and .xml) will be saved by the
biblionumber.

To test:

    Apply the patches.
    1. Open a record in the advanced editor
    2. Save the record using the drop down box selecting "Save as MARC
    (.mrc) file.
    3. Note that the file saved is the same as the biblionumber at the top
    of the Advanced Editor interface.
    <Repeat steps 1-3 for the .xml save option>

    4. Update the database:
    update systempreferences set value = '1' where variable =
    'SaveRecordbyControlNumber';

    5. Restart Koha

    6. Verify that there is not a 001 field in the record (delete it if
            there is)

    Repeat steps 1, 2, & 3 for both .mrc and .xml options (the file should still be saved as the
            biblionumber if there is no control field)

    7. Add a 001 field to the record such as "001  abc00012345"

    Repeat steps 1, 2 for both .mrc and .xml Verify that the files saved
    are named abc00012345.mrc and abc00012345.xml
Comment 2 Cori Lynn Arnold 2019-12-04 11:04:42 UTC
To test:

    Apply the patches.
    1. Open a record in the advanced editor
    2. Save the record using the drop down box selecting "Save as MARC
    (.mrc) file.
    3. Note that the file saved is the same as the biblionumber at the top
    of the Advanced Editor interface.
    <Repeat steps 1-3 for the .xml save option>

    4. Update the database:
    update systempreferences set value = '1' where variable =
    'SaveRecordbyControlNumber';

    5. Restart Koha

    6. Verify that there is not a 001 field in the record (delete it if
            there is)

    Repeat steps 1, 2, & 3 for both .mrc and .xml options (the file should still be saved as the
            biblionumber if there is no control field)

    7. Add a 001 field to the record such as "001  abc00012345"

    Repeat steps 1, 2 for both .mrc and .xml Verify that the files saved
    are named abc00012345.mrc and abc00012345.xml
Comment 3 Cori Lynn Arnold 2019-12-11 12:56:06 UTC
Adding me as assignee
Comment 4 Cori Lynn Arnold 2020-03-19 14:55:27 UTC
Created attachment 101026 [details] [review]
Bug 24108: Advanced Editor: Save .mrc save with a configurable value

Creates a new systempref "SaveRecordbyControlNumber" which is initially
set to 0 (off/no). By default saving .mrc (and .xml) will be saved by the
biblionumber.

To test:

    Apply the patches.
    1. Open a record in the advanced editor
    2. Save the record using the drop down box selecting "Save as MARC
    (.mrc) file.
    3. Note that the file saved is the same as the biblionumber at the top
    of the Advanced Editor interface.
    <Repeat steps 1-3 for the .xml save option>

    4. Update the database:
    update systempreferences set value = '1' where variable =
    'SaveRecordbyControlNumber';

    5. Restart Koha

    6. Verify that there is not a 001 field in the record (delete it if
            there is)

    Repeat steps 1, 2, & 3 for both .mrc and .xml options (the file should still be saved as the
            biblionumber if there is no control field)

    7. Add a 001 field to the record such as "001  abc00012345"

    Repeat steps 1, 2 for both .mrc and .xml Verify that the files saved
    are named abc00012345.mrc and abc00012345.xml
Comment 5 Cori Lynn Arnold 2020-03-19 15:07:39 UTC
Created attachment 101027 [details] [review]
Changed indentation.

See tests above.
Comment 6 Cori Lynn Arnold 2020-03-19 15:10:07 UTC
Comment on attachment 101027 [details] [review]
Changed indentation.

GAH, why is this so hard??
Comment 7 Cori Lynn Arnold 2020-03-19 15:29:54 UTC
Created attachment 101032 [details] [review]
Bug 24108: Advanced Editor: Save .mrc save with a configurable value

Creates a new systempref "SaveRecordbyControlNumber" which is initially
set to 0 (off/no). By default saving .mrc (and .xml) will be saved by the
biblionumber.

To test:

    Apply the patches.
    1. Open a record in the advanced editor
    2. Save the record using the drop down box selecting "Save as MARC
    (.mrc) file.
    3. Note that the file saved is the same as the biblionumber at the top
    of the Advanced Editor interface.
    <Repeat steps 1-3 for the .xml save option>

    4. Update the database:
    update systempreferences set value = '1' where variable =
    'SaveRecordbyControlNumber';

    5. Restart Koha

    6. Verify that there is not a 001 field in the record (delete it if
            there is)

    Repeat steps 1, 2, & 3 for both .mrc and .xml options (the file should still be saved as the
            biblionumber if there is no control field)

    7. Add a 001 field to the record such as "001  abc00012345"

    Repeat steps 1, 2 for both .mrc and .xml Verify that the files saved
    are named abc00012345.mrc and abc00012345.xml
Comment 8 Cori Lynn Arnold 2020-03-19 19:40:14 UTC
Created attachment 101056 [details] [review]
Bug 24108: Advanced Editor: Save .mrc save with a configurable value

Creates a new systempref "SaveRecordbyControlNumber" which is initially
set to 0 (off/no). By default saving .mrc (and .xml) will be saved by the
biblionumber.

To test:

    Apply the patches.
    1. Open a record in the advanced editor
    2. Save the record using the drop down box selecting "Save as MARC
    (.mrc) file.
    3. Note that the file saved is the same as the biblionumber at the top
    of the Advanced Editor interface.
    <Repeat steps 1-3 for the .xml save option>

    4. Update the preference:
        Search for "SaveRecordbyControlNumber" in system preferences. Change to "Save by ControlNumber"

    5. Restart Koha

    6. Verify that there is not a 001 field in the record (delete it if
            there is)

    Repeat steps 1, 2, & 3 for both .mrc and .xml options (the file should still be saved as the
            biblionumber if there is no control field)

    7. Add a 001 field to the record such as "001  abc00012345"

    Repeat steps 1, 2 for both .mrc and .xml Verify that the files saved
    are named abc00012345.mrc and abc00012345.xml
Comment 9 David Nind 2020-03-20 10:47:50 UTC
Created attachment 101069 [details] [review]
Bug 24108: Advanced Editor - Save .mrc save with a configurable value

Creates a new system preference "SaveRecordbyControlNumber" which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber.
 
Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
    there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 Katrin Fischer 2020-03-22 15:34:13 UTC
Created attachment 101381 [details] [review]
Bug 24108: Advanced Editor: Save .mrc save with a configurable value

Creates a new systempref "SaveRecordbyControlNumber" which is initially
set to 0 (off/no). By default saving .mrc (and .xml) will be saved by the
biblionumber.

To test:

    Apply the patches.
    1. Open a record in the advanced editor
    2. Save the record using the drop down box selecting "Save as MARC
    (.mrc) file.
    3. Note that the file saved is the same as the biblionumber at the top
    of the Advanced Editor interface.
    <Repeat steps 1-3 for the .xml save option>

    4. Update the preference:
        Search for "SaveRecordbyControlNumber" in system preferences. Change to "Save by ControlNumber"

    5. Restart Koha

    6. Verify that there is not a 001 field in the record (delete it if
            there is)

    Repeat steps 1, 2, & 3 for both .mrc and .xml options (the file should still be saved as the
            biblionumber if there is no control field)

    7. Add a 001 field to the record such as "001  abc00012345"

    Repeat steps 1, 2 for both .mrc and .xml Verify that the files saved
    are named abc00012345.mrc and abc00012345.xml

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2020-03-22 15:34:16 UTC
Created attachment 101382 [details] [review]
Bug 24108: (follow-up) Fix capitalization of sys pref description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Katrin Fischer 2020-03-22 15:34:21 UTC
Created attachment 101383 [details] [review]
Bug 24108: Alternativ phrasing of the system preference decription

Suggestion:
When exporting a record in the advanced editor (Rancor), use the
[biblionumber|control number] in the file name. Default is by biblionumer.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 13 Katrin Fischer 2020-03-22 15:35:07 UTC
Created attachment 101384 [details] [review]
Bug 24108: (follow-up) Alternative phrasing of the system preference decription

Suggestion:
When exporting a record in the advanced editor (Rancor), use the
[biblionumber|control number] in the file name. Default is by biblionumer.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2020-03-22 15:38:09 UTC
Hi Cori,

i added 2 follow-ups:
- A fix for the capitalization in your pref description (this would be a QA blocker)
- A suggestion for rephrasing it - I think it might be easier to understand (hopefully).

There is still a blocker for me. If 001/biblionumer (for a new record) is missing, we now get .mrc or .xml as file name. Before there was record.mrc record.xml. I think we should keep this behaviour - a fallback for missing values.
Comment 15 Cori Lynn Arnold 2020-12-01 18:21:45 UTC
Created attachment 114081 [details] [review]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Creates a new system preference "SaveRecordbyControlNumber" which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber. If the record does not yet have a biblionumber,
the record will be saved as record.mrc or record.xml

Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
     there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!
Comment 16 Cori Lynn Arnold 2020-12-01 18:49:26 UTC
Created attachment 114082 [details] [review]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Fix typo with .xml extension
Comment 17 Cori Lynn Arnold 2020-12-01 20:15:22 UTC
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Updates based on QA feedback:
1. If the biblionumber is not set (not yet in the system) default to save to "record.mrc" and "record.xml", emulating the old behavior.
2. Lowercase "control number" and "biblionumber" in description.
3. Better system preference description.

Creates a new system preference "SaveRecordbyControlNumber" which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber. If the record does not yet have a biblionumber,
the record will be saved as record.mrc or record.xml

Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
     there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!
Comment 18 David Nind 2020-12-07 20:38:18 UTC
Created attachment 114243 [details] [review]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Creates a new system preference "SaveRecordbyControlNumber" which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber. If the record does not yet have a biblionumber,
the record will be saved as record.mrc or record.xml

Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
     there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!

Signed-off-by: David Nind <david@davidnind.com>
Comment 19 David Nind 2020-12-07 20:38:22 UTC
Created attachment 114244 [details] [review]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Fix typo with .xml extension

Signed-off-by: David Nind <david@davidnind.com>
Comment 20 David Nind 2020-12-07 20:40:26 UTC
I've signed off, but I think the system preference description needs some changes.

My suggestion for the system preference description:

When saving a record to a MARC or MARCXML file in the advanced cataloging editor, use the [bibliographic record number|control number] in the file name. The default is to use the bibliographic record number. 

Notes:
- An alternative could be to use 'record number', rather than 'bibliographic record number' to make a bit shorter if desired.
- The system preference for enabling the advanced cataloguing editor doesn't use Rancor, so I would removed that and use the same terminology used in  EnableAdvancedCatalogingEditor.
- The drop down list for choosing the option should just be the text in lower case, and not include the "Save by...".
- See the terminology list (don't use biblio, use bibliographic record): https://wiki.koha-community.org/wiki/Terminology
Comment 21 Nick Clemens 2021-01-11 15:23:15 UTC
Created attachment 115033 [details] [review]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Creates a new system preference "SaveRecordbyControlNumber" which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber. If the record does not yet have a biblionumber,
the record will be saved as record.mrc or record.xml

Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
     there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!

Signed-off-by: David Nind <david@davidnind.com>
Comment 22 Nick Clemens 2021-01-11 15:23:18 UTC
Created attachment 115034 [details] [review]
Bug 24108: (follow-up) Fix typo with .xml extension

Signed-off-by: David Nind <david@davidnind.com>
Comment 23 Nick Clemens 2021-01-11 15:23:21 UTC
Created attachment 115035 [details] [review]
Bug 24108: (QA follow-up) Adjust wording and use perl for update file
Comment 24 Nick Clemens 2021-01-11 15:23:25 UTC
Created attachment 115036 [details] [review]
Bug 24108: Make export file names consistent

This patch renames the systempreference to be a bit clearer and uses
explicit options rather than a yes/no

Additionally it standardizes the export from the advanced cataloging editor
with that from the details page

To test:
 1 - Apply patches
 2 - Update database and restart all the things
 3 - Open a record in the advanced editor and save it as marc and xml
 4 - Note the file name is 'bib-{biblionumber.{format}'
 5 - Edit the syspref 'DefaultSaveRecordFileID' to be control number
 6 - Repeate 3-4 on a record with and without a control number
 7 - If control number present fiule name should be 'record-{controlnumber}.{format}'
 8 - Otherwise it should be as above
 9 - Repeat tests from the details page of a record
10 - Repeat tests from the opac details page of a record
Comment 25 Nick Clemens 2021-01-11 15:25:22 UTC
I got a bit carried away here, I intended just to implement David's wording changes, but I think we should be consistent when saving either in the editor or on the details page - I also think the syspref could be a bit more explicit in the naming and options.

Please either sign-off, or feel free to obsolete my patches and throw back for another QA opinion
Comment 26 Nick Clemens 2021-01-11 15:36:40 UTC
Created attachment 115038 [details] [review]
Bug 24108: Make export file names consistent

This patch renames the systempreference to be a bit clearer and uses
explicit options rather than a yes/no

Additionally it standardizes the export from the advanced cataloging editor
with that from the details page

To test:
 1 - Apply patches
 2 - Update database and restart all the things
 3 - Open a record in the advanced editor and save it as marc and xml
 4 - Note the file name is 'bib-{biblionumber.{format}'
 5 - Edit the syspref 'DefaultSaveRecordFileID' to be control number
 6 - Repeate 3-4 on a record with and without a control number
 7 - If control number present fiule name should be 'record-{controlnumber}.{format}'
 8 - Otherwise it should be as above
 9 - Repeat tests from the details page of a record
10 - Repeat tests from the opac details page of a record
Comment 27 David Nind 2021-01-19 20:49:49 UTC
Created attachment 115356 [details] [review]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Creates a new system preference "SaveRecordbyControlNumber" which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber. If the record does not yet have a biblionumber,
the record will be saved as record.mrc or record.xml

Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
     there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!

Signed-off-by: David Nind <david@davidnind.com>
Comment 28 David Nind 2021-01-19 20:49:53 UTC
Created attachment 115357 [details] [review]
Bug 24108: (follow-up) Fix typo with .xml extension

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>
Comment 29 David Nind 2021-01-19 20:49:56 UTC
Created attachment 115358 [details] [review]
Bug 24108: (QA follow-up) Adjust wording and use perl for update file

Signed-off-by: David Nind <david@davidnind.com>
Comment 30 David Nind 2021-01-19 20:50:00 UTC
Created attachment 115359 [details] [review]
Bug 24108: Make export file names consistent

This patch renames the systempreference to be a bit clearer and uses
explicit options rather than a yes/no

Additionally it standardizes the export from the advanced cataloging editor
with that from the details page

To test:
 1 - Apply patches
 2 - Update database and restart all the things
 3 - Open a record in the advanced editor and save it as marc and xml
 4 - Note the file name is 'bib-{biblionumber.{format}'
 5 - Edit the syspref 'DefaultSaveRecordFileID' to be control number
 6 - Repeate 3-4 on a record with and without a control number
 7 - If control number present fiule name should be 'record-{controlnumber}.{format}'
 8 - Otherwise it should be as above
 9 - Repeat tests from the details page of a record
10 - Repeat tests from the opac details page of a record

Signed-off-by: David Nind <david@davidnind.com>
Comment 31 Katrin Fischer 2021-02-15 21:49:22 UTC
Created attachment 116898 [details] [review]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Creates a new system preference "SaveRecordbyControlNumber" which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber. If the record does not yet have a biblionumber,
the record will be saved as record.mrc or record.xml

Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
     there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 32 Katrin Fischer 2021-02-15 21:49:26 UTC
Created attachment 116899 [details] [review]
Bug 24108: (follow-up) Fix typo with .xml extension

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 33 Katrin Fischer 2021-02-15 21:49:31 UTC
Created attachment 116900 [details] [review]
Bug 24108: (QA follow-up) Adjust wording and use perl for update file

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 34 Katrin Fischer 2021-02-15 21:49:36 UTC
Created attachment 116901 [details] [review]
Bug 24108: Make export file names consistent

This patch renames the systempreference to be a bit clearer and uses
explicit options rather than a yes/no

Additionally it standardizes the export from the advanced cataloging editor
with that from the details page

To test:
 1 - Apply patches
 2 - Update database and restart all the things
 3 - Open a record in the advanced editor and save it as marc and xml
 4 - Note the file name is 'bib-{biblionumber.{format}'
 5 - Edit the syspref 'DefaultSaveRecordFileID' to be control number
 6 - Repeate 3-4 on a record with and without a control number
 7 - If control number present fiule name should be 'record-{controlnumber}.{format}'
 8 - Otherwise it should be as above
 9 - Repeat tests from the details page of a record
10 - Repeat tests from the opac details page of a record

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 35 Katrin Fischer 2021-02-15 21:49:40 UTC
Created attachment 116902 [details] [review]
Bug 24108: (QA follow-up) Add missing comma in sysprefs.sql

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 36 Katrin Fischer 2021-02-15 21:49:45 UTC
Created attachment 116903 [details] [review]
Bug 24108: (QA follow-up) Add staff detail page to syspref description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 37 Jonathan Druart 2021-02-16 11:18:11 UTC
Created attachment 116912 [details] [review]
Bug 24108: Advanced editor: configure if biblionumber or control number is used for saved files

Creates a new system preference "SaveRecordbyControlNumber" (renamed in
follow-up patch with "DefaultSaveRecordFileID") which is
initially set to 0 (off/no). By default saving .mrc (and .xml) will be
saved by the biblionumber. If the record does not yet have a biblionumber,
the record will be saved as record.mrc or record.xml

Test plan:
1)  Apply the patch, flush_memcached and restart_all
2)  Enable the "EnableAdvancedCatalogingEditor" system preference
4)  Save the record using the drop down box selecting "Save as MARC (.mrc)
    file.
5)  Note that the file saved is the same as the biblionumber at the top of
    the Advanced Editor interface.
6)  Repeat steps 3-5 for the .xml save option
7)  Update the new system preference "SaveRecordbyControlNumber" and
    change to "Save by ControlNumber"
8)  Verify that there is not a 001 field in the record (delete it if
     there is)
9)  Repeat steps 3-5 for both .mrc and .xml options (the file should still
    be saved as the biblionumber if there is no control field)
10) Add a 001 field to the record such as "001  abc00012345"
11) Repeat step 4 for both .mrc and .xml and verify that the files
    saved are named abc00012345.mrc and abc00012345.xml
12) Sign off!

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch:
* Remove change to obsolete sysprefs.sql
* Fix author's patch
* Update commit message to tell the syspref has been renamed
Comment 38 Jonathan Druart 2021-02-16 11:18:14 UTC
Created attachment 116913 [details] [review]
Bug 24108: (follow-up) Fix typo with .xml extension

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

JD amended patch:
* Fix author's patch
Comment 39 Jonathan Druart 2021-02-16 11:18:18 UTC
Created attachment 116914 [details] [review]
Bug 24108: (QA follow-up) Adjust wording and use perl for update file

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 40 Jonathan Druart 2021-02-16 11:18:21 UTC
Created attachment 116915 [details] [review]
Bug 24108: Make export file names consistent

This patch renames the systempreference to be a bit clearer and uses
explicit options rather than a yes/no

Additionally it standardizes the export from the advanced cataloging editor
with that from the details page

To test:
 1 - Apply patches
 2 - Update database and restart all the things
 3 - Open a record in the advanced editor and save it as marc and xml
 4 - Note the file name is 'bib-{biblionumber.{format}'
 5 - Edit the syspref 'DefaultSaveRecordFileID' to be control number
 6 - Repeate 3-4 on a record with and without a control number
 7 - If control number present fiule name should be 'record-{controlnumber}.{format}'
 8 - Otherwise it should be as above
 9 - Repeat tests from the details page of a record
10 - Repeat tests from the opac details page of a record

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 41 Jonathan Druart 2021-02-16 11:18:25 UTC
Created attachment 116916 [details] [review]
Bug 24108: (QA follow-up) Add missing comma in sysprefs.sql

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 42 Jonathan Druart 2021-02-16 11:18:28 UTC
Created attachment 116917 [details] [review]
Bug 24108: (QA follow-up) Add staff detail page to syspref description

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 43 Jonathan Druart 2021-02-16 11:18:32 UTC
Created attachment 116918 [details] [review]
Bug 24108: Remove extra spaces
Comment 44 Jonathan Druart 2021-02-17 15:30:59 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 45 Fridolin Somers 2021-02-22 10:06:00 UTC
Enhancement not pushed to 20.11.x
Comment 46 Caroline Cyr La Rose 2021-02-24 22:24:04 UTC
I'm wondering if this new syspref should go in Cataloging > Exporting instead of Cataloging > Interface...

What do y'all think?
Comment 47 David Nind 2021-02-24 23:04:18 UTC
That makes more sense to me! 

The new system preference is more closely related to the exporting section, which covers BibtexExport* and RisExport*.

The interface section covers what is displayed on various pages and features that affect the display.

A new bug or a follow up?