Bug 23111 - Setting a custom framework as the default for cataloguing is not possible
Summary: Setting a custom framework as the default for cataloguing is not possible
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
: 20842 34703 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-06-12 23:12 UTC by Hayley Pelham
Modified: 2024-01-18 21:13 UTC (History)
14 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This patch adds the ability to set a custom framework as the default to be applied when importing records or editing records with no framework mapped.
Version(s) released in:
Circulation function:


Attachments
Bug 23111: Set custom bibliographic framework as default (9.90 KB, patch)
2019-06-13 00:09 UTC, Hayley Pelham
Details | Diff | Splinter Review
Bug 23111: (follow-up) Fix for QA test tool failure (705 bytes, patch)
2019-06-14 04:08 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 23111: (follow-up) Fix for QA test tool failure (894 bytes, patch)
2019-06-14 04:10 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 23111: Set custom bibliographic framework as default (11.51 KB, patch)
2019-06-27 01:12 UTC, Hayley Pelham
Details | Diff | Splinter Review
Bug 23111: Set custom bibliographic framework as default (11.51 KB, patch)
2019-06-27 01:12 UTC, Hayley Pelham
Details | Diff | Splinter Review
Bug 23111: Set custom bibliographic framework as default (11.74 KB, patch)
2019-07-26 03:01 UTC, Alex Buckley
Details | Diff | Splinter Review
Bug 23111: (follow-up) Made Biblio::Framework use statements plural (1.16 KB, patch)
2019-08-13 23:19 UTC, Hayley Pelham
Details | Diff | Splinter Review
Bug 23111: Set a custom framework as the default (13.13 KB, patch)
2020-04-08 21:11 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: (follow-up) Schema changes (1.61 KB, patch)
2020-04-08 21:11 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Schema changes (1.72 KB, patch)
2020-04-30 21:48 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Making is_default a boolean flag (816 bytes, patch)
2020-04-30 21:48 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Set a custom framework as the default (13.02 KB, patch)
2020-04-30 22:17 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 23111: Schema changes (1.78 KB, patch)
2020-04-30 22:17 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 23111: Making is_default a boolean flag (877 bytes, patch)
2020-04-30 22:17 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 23111: (QA follow-up) Add AFTER to update database statement (1.25 KB, patch)
2020-07-05 16:56 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 23111: (follow-up) Add a column to show default framework (3.09 KB, patch)
2020-10-24 01:57 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: (follow-up) set default framework on advanced editor (3.69 KB, patch)
2020-10-25 03:36 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Set a custom framework as the default (13.33 KB, patch)
2022-08-08 03:54 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Schema changes (1.60 KB, patch)
2022-08-08 03:54 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Making is_default a boolean flag (879 bytes, patch)
2022-08-08 03:55 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: (follow-up) Add a column to show default framework (3.31 KB, patch)
2022-08-08 03:55 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: (follow-up) set default framework on advanced editor (2.76 KB, patch)
2022-08-08 03:55 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Set a custom framework as the default (13.30 KB, patch)
2022-10-10 09:11 UTC, David Nind
Details | Diff | Splinter Review
Bug 23111: Schema changes (1.65 KB, patch)
2022-10-10 09:11 UTC, David Nind
Details | Diff | Splinter Review
Bug 23111: Making is_default a boolean flag (926 bytes, patch)
2022-10-10 09:11 UTC, David Nind
Details | Diff | Splinter Review
Bug 23111: (follow-up) Add a column to show default framework (3.33 KB, patch)
2022-10-10 09:11 UTC, David Nind
Details | Diff | Splinter Review
Bug 23111: (follow-up) set default framework on advanced editor (2.79 KB, patch)
2022-10-10 09:11 UTC, David Nind
Details | Diff | Splinter Review
Bug 23111: Set a custom framework as the default (13.46 KB, patch)
2023-10-24 02:43 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Schema changes (1.73 KB, patch)
2023-10-24 02:43 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Making is_default a boolean flag (928 bytes, patch)
2023-10-24 02:44 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: (follow-up) Add a column to show default framework (3.32 KB, patch)
2023-10-24 02:44 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: (follow-up) set default framework on advanced editor (2.80 KB, patch)
2023-10-24 02:44 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Allow switch to Default framework and use selected default when adding New record (4.99 KB, patch)
2023-10-24 02:44 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 23111: Use selected default framework if UseACQFrameworkForBiblioRecords set to Don't Use (1.35 KB, patch)
2023-10-24 02:44 UTC, Aleisha Amohia
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Hayley Pelham 2019-06-12 23:12:14 UTC
Currently, it is not possible to select a custom framework as the default, in situations where editing a record with no framework mapped, or importing a staged MARC file with no mapping.
Comment 1 Hayley Pelham 2019-06-13 00:09:27 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2019-06-13 12:12:52 UTC
This looks to be working great--and it's a great improvement. The QA tool is giving one warning though:

 FAIL   Koha/BiblioFramework.pm
   OK     critic
   OK     forbidden patterns
   OK     git manipulation
   FAIL   pod
                *** ERROR:
                Apparent command =cut not preceded by blank line

                 in file Koha/BiblioFramework.pm


Also: Could we get the framework name to show in the system preference instead of just the code? I don't think it's a dealbreaker but it would be more user-friendly.
Comment 3 Alex Buckley 2019-06-14 04:08:20 UTC Comment hidden (obsolete)
Comment 4 Alex Buckley 2019-06-14 04:10:09 UTC Comment hidden (obsolete)
Comment 5 Hayley Pelham 2019-06-27 01:12:06 UTC Comment hidden (obsolete)
Comment 6 Hayley Pelham 2019-06-27 01:12:47 UTC Comment hidden (obsolete)
Comment 7 Hayley Pelham 2019-06-27 01:14:43 UTC
(In reply to Owen Leonard from comment #2)

> Also: Could we get the framework name to show in the system preference
> instead of just the code? I don't think it's a dealbreaker but it would be
> more user-friendly.

The latest version of the patch fixes the QA tool warning and replaces the choice in the syspref with frameworktext instead of frameworkcode.

Thanks for testing!
Comment 8 Alex Buckley 2019-07-26 03:01:14 UTC Comment hidden (obsolete)
Comment 9 Alex Buckley 2019-07-26 03:01:52 UTC
I've rebased this commit against master and have re-attached it.
Comment 10 Tomás Cohen Arazi (tcohen) 2019-07-31 14:57:25 UTC
I'm sorry but this seems to me like a over-complicated approach: why don't we add a 'default' column with a boolean value to the biblio_framework table?
Paired with a Koha::BiblioFramework->set_default method that unsets the previous default when called. And that's it? You will need Koha::BiblioFrameworks::get_default as well if you want to avoid crafting the query.

in addbiblio.pl you use Koha::BiblioFramework (singular class) and you shouldn't. WE only include the plurals, which in turn include the singular.
Comment 11 Hayley Pelham 2019-08-13 23:19:58 UTC
Created attachment 92184 [details] [review]
Bug 23111: (follow-up) Made Biblio::Framework use statements plural

Follow-up based on comment #10 to use Koha::BiblioFrameworks in
addbiblio.pl and cataloguing.pref.
Comment 12 Hayley Pelham 2019-08-13 23:35:04 UTC
(In reply to Tomás Cohen Arazi from comment #10)
> I'm sorry but this seems to me like a over-complicated approach: why don't
> we add a 'default' column with a boolean value to the biblio_framework table?
> Paired with a Koha::BiblioFramework->set_default method that unsets the
> previous default when called. And that's it? You will need
> Koha::BiblioFrameworks::get_default as well if you want to avoid crafting
> the query.
> 
> in addbiblio.pl you use Koha::BiblioFramework (singular class) and you
> shouldn't. WE only include the plurals, which in turn include the singular.

Hi Tomás,

Have included a follow-up patch to change the use statements to plural classes.

We're looking into your suggestions now.

How do you see the interface for this implemented? 
i.e. How should the librarians in your opinion set a framework to be the default?
Comment 13 Katrin Fischer 2019-08-15 20:35:20 UTC
(In reply to Tomás Cohen Arazi from comment #10)
> I'm sorry but this seems to me like a over-complicated approach: why don't
> we add a 'default' column with a boolean value to the biblio_framework table?

Where would you put the configuration option then? On http://localhost:8081/cgi-bin/koha/admin/biblio_framework.pl?op=add_form&frameworkcode=ACQ?

NOTE: It looks like there is no way to Edit the default framework entry, so resetting from another framework to Default could be a problem.
Comment 14 Aleisha Amohia 2020-04-01 03:53:19 UTC
These patches still apply cleanly. Setting to In Discussion as I think that's more appropriate. Tomás can you please answer Comment #13 when you get a chance?
Comment 15 Katrin Fischer 2020-04-05 01:51:55 UTC
*** Bug 20842 has been marked as a duplicate of this bug. ***
Comment 16 Tomás Cohen Arazi (tcohen) 2020-04-05 04:43:20 UTC
(In reply to Hayley Mapley from comment #12)
> (In reply to Tomás Cohen Arazi from comment #10)
> > I'm sorry but this seems to me like a over-complicated approach: why don't
> > we add a 'default' column with a boolean value to the biblio_framework table?
> > Paired with a Koha::BiblioFramework->set_default method that unsets the
> > previous default when called. And that's it? You will need
> > Koha::BiblioFrameworks::get_default as well if you want to avoid crafting
> > the query.
> > 
> > in addbiblio.pl you use Koha::BiblioFramework (singular class) and you
> > shouldn't. WE only include the plurals, which in turn include the singular.
> 
> Hi Tomás,
> 
> Have included a follow-up patch to change the use statements to plural
> classes.
> 
> We're looking into your suggestions now.
> 
> How do you see the interface for this implemented? 
> i.e. How should the librarians in your opinion set a framework to be the
> default?

A checkbox on the framework edit page. And a confirmation modal.
Comment 17 Aleisha Amohia 2020-04-08 21:11:33 UTC
Created attachment 102602 [details] [review]
Bug 23111: Set a custom framework as the default

when importing records or editing records with no framework mapped.

To test:
1) Go to edit a biblio with no framework mapped
2) Click the Settings dropdown, notice that the 'Default' framework is
selected
3) Go to the Cataloguing home page. Click the main 'New from Z39.50/SRU'
button and notice the selected framework in the URL is 'Default'
4) Go to Tools -> Stage MARC records for import. Stage a bibliographic
record. Go to Staged MARC management for your newly imported batch.
Notice that the frameworks dropdown (above the 'Import this batch into
the catalog' button) has the 'Default' framework selected
5) Apply this patch and update the database. Apply the schema changes
patch or update your schema files. Restart memcached and plack.
6) Go to Administration -> MARC bibliographic frameworks. Edit one of
your custom frameworks. Set it as default by checking the checkbox and
saving.
7) Edit a different custom framework and set this one as the default
now. Confirm that the previous framework has been unset (the checkbox is
no longer checked) as the default.
8) Repeat steps 1-4 and confirm that the selected framework is your
newly set default framework, instead of the provided 'Default'
framework.
9) Go back to Administration -> MARC bibliographic frameworks. Edit your
default framework and unset it as default (uncheck the checkbox). Save.
10) Repeat steps 1-4 and confirm that the selected framework is the
provided 'Default' framework again, so we can have no default custom
framework if chosen.
11) Confirm the tests pass: t/db_dependent/Koha/BiblioFrameworks.t

Sponsored-by: Catalyst IT
Comment 18 Aleisha Amohia 2020-04-08 21:11:37 UTC
Created attachment 102603 [details] [review]
Bug 23111: (follow-up) Schema changes
Comment 19 Owen Leonard 2020-04-11 19:26:27 UTC
I'm getting his error when doing a search in cataloging (/cgi-bin/koha/cataloguing/addbooks.pl?q=blue):

DBIx::Class::ResultSource::_resolve_join(): No such relationship marc_subfield_structures on AuthorisedValueCategory at /kohadevbox/koha/Koha/Objects.pm line 130
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
Comment 20 Aleisha Amohia 2020-04-15 03:49:57 UTC
(In reply to Owen Leonard from comment #19)
> I'm getting his error when doing a search in cataloging
> (/cgi-bin/koha/cataloguing/addbooks.pl?q=blue):
> 
> DBIx::Class::ResultSource::_resolve_join(): No such relationship
> marc_subfield_structures on AuthorisedValueCategory at
> /kohadevbox/koha/Koha/Objects.pm line 130
>  at /usr/share/perl5/DBIx/Class/Exception.pm line 77

Sorry Owen I don't get this error. Perhaps some data problem? 

Setting back to Needs Signoff to see if someone else can confirm.
Comment 21 Bernardo Gonzalez Kriegel 2020-04-30 19:06:08 UTC
Hi, 
no problem searching, test pass, works.

qa-tools complains
 FAIL   installer/data/mysql/kohastructure.sql
   OK     boolean_vs_tinyint
   OK     charset_collate
   OK     git manipulation
   FAIL   tinyint_has_boolean_flag
                The new column biblio_framework.is_default is using TINYINT(1) as type but is not defined as boolean in the schema file (Koha/Schema/Result/BiblioFramework.pm), see the SQL12 coding guideline

Why not use an smallint/int type?
Seems like a false positive to me.
Comment 22 Aleisha Amohia 2020-04-30 21:11:14 UTC
(In reply to Bernardo Gonzalez Kriegel from comment #21)
> Hi, 
> no problem searching, test pass, works.
> 
> qa-tools complains
>  FAIL   installer/data/mysql/kohastructure.sql
>    OK     boolean_vs_tinyint
>    OK     charset_collate
>    OK     git manipulation
>    FAIL   tinyint_has_boolean_flag
>                 The new column biblio_framework.is_default is using
> TINYINT(1) as type but is not defined as boolean in the schema file
> (Koha/Schema/Result/BiblioFramework.pm), see the SQL12 coding guideline
> 
> Why not use an smallint/int type?
> Seems like a false positive to me.

See the coding guidelines on the Koha Community wiki about booleans: https://wiki.koha-community.org/wiki/Coding_Guidelines#SQL12:_Booleans

I realise I have done this wrong so will fix it up anyway, but guidelines say to use tinyint.
Comment 23 Katrin Fischer 2020-04-30 21:15:36 UTC
Bug 12194 might be helpful here - I think it's a 'right' positive.
Comment 24 Aleisha Amohia 2020-04-30 21:48:36 UTC
Created attachment 104058 [details] [review]
Bug 23111: Schema changes

If not testing on a sandbox, do not apply this patch. Instead, apply
first patch, update dbix files, then apply final patch and test.
Comment 25 Aleisha Amohia 2020-04-30 21:48:41 UTC
Created attachment 104059 [details] [review]
Bug 23111: Making is_default a boolean flag
Comment 26 Bernardo Gonzalez Kriegel 2020-04-30 22:17:18 UTC
Created attachment 104060 [details] [review]
Bug 23111: Set a custom framework as the default

when importing records or editing records with no framework mapped.

To test:
1) Go to edit a biblio with no framework mapped
2) Click the Settings dropdown, notice that the 'Default' framework is
selected
3) Go to the Cataloguing home page. Click the main 'New from Z39.50/SRU'
button and notice the selected framework in the URL is 'Default'
4) Go to Tools -> Stage MARC records for import. Stage a bibliographic
record. Go to Staged MARC management for your newly imported batch.
Notice that the frameworks dropdown (above the 'Import this batch into
the catalog' button) has the 'Default' framework selected
5) Apply this patch and update the database. Apply the schema changes
patch or update your schema files. Restart memcached and plack.
6) Go to Administration -> MARC bibliographic frameworks. Edit one of
your custom frameworks. Set it as default by checking the checkbox and
saving.
7) Edit a different custom framework and set this one as the default
now. Confirm that the previous framework has been unset (the checkbox is
no longer checked) as the default.
8) Repeat steps 1-4 and confirm that the selected framework is your
newly set default framework, instead of the provided 'Default'
framework.
9) Go back to Administration -> MARC bibliographic frameworks. Edit your
default framework and unset it as default (uncheck the checkbox). Save.
10) Repeat steps 1-4 and confirm that the selected framework is the
provided 'Default' framework again, so we can have no default custom
framework if chosen.
11) Confirm the tests pass: t/db_dependent/Koha/BiblioFrameworks.t

Sponsored-by: Catalyst IT
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment 27 Bernardo Gonzalez Kriegel 2020-04-30 22:17:24 UTC
Created attachment 104061 [details] [review]
Bug 23111: Schema changes

If not testing on a sandbox, do not apply this patch. Instead, apply
first patch, update dbix files, then apply final patch and test.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment 28 Bernardo Gonzalez Kriegel 2020-04-30 22:17:29 UTC
Created attachment 104062 [details] [review]
Bug 23111: Making is_default a boolean flag

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment 29 Bernardo Gonzalez Kriegel 2020-04-30 22:23:22 UTC
(In reply to Aleisha Amohia from comment #22)
> See the coding guidelines on the Koha Community wiki about booleans:
> https://wiki.koha-community.org/wiki/Coding_Guidelines#SQL12:_Booleans
> 
> I realise I have done this wrong so will fix it up anyway, but guidelines
> say to use tinyint.

(In reply to Katrin Fischer from comment #23)
> Bug 12194 might be helpful here - I think it's a 'right' positive.

I read the coding guidelines, but didn't know if it was intended to be Boolean, so a type change would fix the problem.

If that was the intention, it needed to be declared, and was a 'right' positive  :)

Tested and signed
Comment 30 Katrin Fischer 2020-07-05 16:55:15 UTC
Hi Aleisha,

1) At the moment you can't tell from the administration page, which is the current default framework. Could you add a column or note there to show the current default? (/cgi-bin/koha/admin/biblio_framework.pl). I think this would be really helpful.

I wonder if a hint would be helpful "unset to make default default" (better phrased) as this might not be intuitive (no edit option for the default framework).

2) It looks like the advanced editor still defaults to default - should this be changed as well?
Comment 31 Katrin Fischer 2020-07-05 16:56:22 UTC
Created attachment 106560 [details] [review]
Bug 23111: (QA follow-up) Add AFTER to update database statement
Comment 32 Aleisha Amohia 2020-10-24 01:57:10 UTC
Created attachment 112354 [details] [review]
Bug 23111: (follow-up) Add a column to show default framework
Comment 33 Aleisha Amohia 2020-10-24 01:57:56 UTC
(In reply to Katrin Fischer from comment #30)

> 2) It looks like the advanced editor still defaults to default - should this
> be changed as well?

I have implemented everything except this point, I'm not sure the best way to go about it!
Comment 34 Aleisha Amohia 2020-10-25 03:36:58 UTC
Created attachment 112468 [details] [review]
Bug 23111: (follow-up) set default framework on advanced editor

This patch ensures the advanced editor considers the default biblio
framework.

Also fixing bug in atomic update
Comment 35 David Cook 2020-10-25 23:58:42 UTC
(In reply to Aleisha Amohia from comment #33)
> (In reply to Katrin Fischer from comment #30)
> 
> > 2) It looks like the advanced editor still defaults to default - should this
> > be changed as well?
> 
> I have implemented everything except this point, I'm not sure the best way
> to go about it!

I feel like the advanced editor is its own beast >_>.
Comment 36 Holly 2022-04-21 15:11:23 UTC
Is the test from comment 26 still valid?
Comment 37 Aleisha Amohia 2022-08-08 03:54:52 UTC
Created attachment 138766 [details] [review]
Bug 23111: Set a custom framework as the default

when importing records or editing records with no framework mapped.

To test:
1) Go to edit a biblio with no framework mapped
2) Click the Settings dropdown, notice that the 'Default' framework is
selected
3) Go to the Cataloguing home page. Click the main 'New from Z39.50/SRU'
button and notice the selected framework in the URL is 'Default'
4) Go to Tools -> Stage MARC records for import. Stage a bibliographic
record. Go to Staged MARC management for your newly imported batch.
Notice that the frameworks dropdown (above the 'Import this batch into
the catalog' button) has the 'Default' framework selected
5) Apply this patch and update the database. Apply the schema changes
patch or update your schema files. Restart memcached and plack.
6) Go to Administration -> MARC bibliographic frameworks. Edit one of
your custom frameworks. Set it as default by checking the checkbox and
saving.
7) Edit a different custom framework and set this one as the default
now. Confirm that the previous framework has been unset (the checkbox is
no longer checked) as the default.
8) Repeat steps 1-4 and confirm that the selected framework is your
newly set default framework, instead of the provided 'Default'
framework.
9) Go back to Administration -> MARC bibliographic frameworks. Edit your
default framework and unset it as default (uncheck the checkbox). Save.
10) Repeat steps 1-4 and confirm that the selected framework is the
provided 'Default' framework again, so we can have no default custom
framework if chosen.
11) Confirm the tests pass: t/db_dependent/Koha/BiblioFrameworks.t

Sponsored-by: Catalyst IT
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment 38 Aleisha Amohia 2022-08-08 03:54:58 UTC
Created attachment 138767 [details] [review]
Bug 23111: Schema changes
Comment 39 Aleisha Amohia 2022-08-08 03:55:04 UTC
Created attachment 138768 [details] [review]
Bug 23111: Making is_default a boolean flag

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Comment 40 Aleisha Amohia 2022-08-08 03:55:11 UTC
Created attachment 138769 [details] [review]
Bug 23111: (follow-up) Add a column to show default framework
Comment 41 Aleisha Amohia 2022-08-08 03:55:18 UTC
Created attachment 138770 [details] [review]
Bug 23111: (follow-up) set default framework on advanced editor

This patch ensures the advanced editor considers the default biblio
framework.

Also fixing bug in atomic update
Comment 42 David Nind 2022-10-10 09:11:11 UTC
Created attachment 141565 [details] [review]
Bug 23111: Set a custom framework as the default

when importing records or editing records with no framework mapped.

To test:
1) Go to edit a biblio with no framework mapped
2) Click the Settings dropdown, notice that the 'Default' framework is
selected
3) Go to the Cataloguing home page. Click the main 'New from Z39.50/SRU'
button and notice the selected framework in the URL is 'Default'
4) Go to Tools -> Stage MARC records for import. Stage a bibliographic
record. Go to Staged MARC management for your newly imported batch.
Notice that the frameworks dropdown (above the 'Import this batch into
the catalog' button) has the 'Default' framework selected
5) Apply this patch and update the database. Apply the schema changes
patch or update your schema files. Restart memcached and plack.
6) Go to Administration -> MARC bibliographic frameworks. Edit one of
your custom frameworks. Set it as default by checking the checkbox and
saving.
7) Edit a different custom framework and set this one as the default
now. Confirm that the previous framework has been unset (the checkbox is
no longer checked) as the default.
8) Repeat steps 1-4 and confirm that the selected framework is your
newly set default framework, instead of the provided 'Default'
framework.
9) Go back to Administration -> MARC bibliographic frameworks. Edit your
default framework and unset it as default (uncheck the checkbox). Save.
10) Repeat steps 1-4 and confirm that the selected framework is the
provided 'Default' framework again, so we can have no default custom
framework if chosen.
11) Confirm the tests pass: t/db_dependent/Koha/BiblioFrameworks.t

Sponsored-by: Catalyst IT
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: David Nind <david@davidnind.com>
Comment 43 David Nind 2022-10-10 09:11:17 UTC
Created attachment 141566 [details] [review]
Bug 23111: Schema changes

Signed-off-by: David Nind <david@davidnind.com>
Comment 44 David Nind 2022-10-10 09:11:22 UTC
Created attachment 141567 [details] [review]
Bug 23111: Making is_default a boolean flag

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: David Nind <david@davidnind.com>
Comment 45 David Nind 2022-10-10 09:11:28 UTC
Created attachment 141568 [details] [review]
Bug 23111: (follow-up) Add a column to show default framework

Signed-off-by: David Nind <david@davidnind.com>
Comment 46 David Nind 2022-10-10 09:11:34 UTC
Created attachment 141569 [details] [review]
Bug 23111: (follow-up) set default framework on advanced editor

This patch ensures the advanced editor considers the default biblio
framework.

Also fixing bug in atomic update

Signed-off-by: David Nind <david@davidnind.com>
Comment 47 David Nind 2022-10-10 09:19:40 UTC
I've signed off as everything works as per the test plan.

I enable the advanced editor (EnableAdvancedCatalogingEditor system preference) and this worked as expected with this change.

I did note that in the staff interface when on the details page for an existing record, you have the option of New > New record - this defaults to the default framework even if another framework is set as the default.

There may be other areas where /cgi-bin/koha/cataloguing/addbiblio.pl is used... possibly these can be addressed in a follow-up bug when these are identified, for example in the acquisitions area.
Comment 48 Katrin Fischer 2022-10-16 11:33:06 UTC
Giving this another round of testing:

I have made the FA framework my default. This worked nicely.

1) Open a record that has been saved with ACQ framework. Try to switch to Default. The "Change framework" list will have the checkmark at "FA", but the display will be the default framework. Switching to other frameworks works, so it might have to do with the "" of default.

2) I feel we should fix that one David found and that I confirmed within this patch set. There are 2 'major' ways to create a new record (from cataloguing module and form detail page) and as this is one of them, I think it makes sense to have it part here:

I did note that in the staff interface when on the details page for an existing record, you have the option of New > New record - this defaults to the default framework even if another framework is set as the default.

3) When a new record is created with "order from new" in acq, and UseACQFrameworkForBiblioRecords  is set to Don't use, the record will be using "default". This is less blocker than 2, but if it's not an easy fix, we should file a bug for it.

We've just recently had a request for this on the German mailing list, would love to see this make it into 22.11 :)
Comment 49 Katrin Fischer 2023-09-04 11:43:03 UTC
*** Bug 34703 has been marked as a duplicate of this bug. ***
Comment 50 Aleisha Amohia 2023-10-24 02:43:53 UTC
Created attachment 157717 [details] [review]
Bug 23111: Set a custom framework as the default

when importing records or editing records with no framework mapped.

To test:
1) Go to edit a biblio with no framework mapped
2) Click the Settings dropdown, notice that the 'Default' framework is
selected
3) Go to the Cataloguing home page. Click the main 'New from Z39.50/SRU'
button and notice the selected framework in the URL is 'Default'
4) Go to Tools -> Stage MARC records for import. Stage a bibliographic
record. Go to Staged MARC management for your newly imported batch.
Notice that the frameworks dropdown (above the 'Import this batch into
the catalog' button) has the 'Default' framework selected
5) Apply this patch and update the database. Apply the schema changes
patch or update your schema files. Restart memcached and plack.
6) Go to Administration -> MARC bibliographic frameworks. Edit one of
your custom frameworks. Set it as default by checking the checkbox and
saving.
7) Edit a different custom framework and set this one as the default
now. Confirm that the previous framework has been unset (the checkbox is
no longer checked) as the default.
8) Repeat steps 1-4 and confirm that the selected framework is your
newly set default framework, instead of the provided 'Default'
framework.
9) Go back to Administration -> MARC bibliographic frameworks. Edit your
default framework and unset it as default (uncheck the checkbox). Save.
10) Repeat steps 1-4 and confirm that the selected framework is the
provided 'Default' framework again, so we can have no default custom
framework if chosen.
11) Confirm the tests pass: t/db_dependent/Koha/BiblioFrameworks.t

Sponsored-by: Catalyst IT
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: David Nind <david@davidnind.com>
Comment 51 Aleisha Amohia 2023-10-24 02:43:57 UTC
Created attachment 157718 [details] [review]
Bug 23111: Schema changes
Comment 52 Aleisha Amohia 2023-10-24 02:44:01 UTC
Created attachment 157719 [details] [review]
Bug 23111: Making is_default a boolean flag

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Signed-off-by: David Nind <david@davidnind.com>
Comment 53 Aleisha Amohia 2023-10-24 02:44:05 UTC
Created attachment 157720 [details] [review]
Bug 23111: (follow-up) Add a column to show default framework

Signed-off-by: David Nind <david@davidnind.com>
Comment 54 Aleisha Amohia 2023-10-24 02:44:09 UTC
Created attachment 157721 [details] [review]
Bug 23111: (follow-up) set default framework on advanced editor

This patch ensures the advanced editor considers the default biblio
framework.

Also fixing bug in atomic update

Signed-off-by: David Nind <david@davidnind.com>
Comment 55 Aleisha Amohia 2023-10-24 02:44:13 UTC
Created attachment 157722 [details] [review]
Bug 23111: Allow switch to Default framework and use selected default when adding New record

This ensures that the correct framework is checked when using the 'Change framework' dropdown in the editor.

This also ensures that the selected default framework is used when using the New record button in the Cataloguing home page or from a record detail page. You would also still be able to use the Default framework if chosen.

Sponsored-by: Catalyst IT
Comment 56 Aleisha Amohia 2023-10-24 02:44:17 UTC
Created attachment 157723 [details] [review]
Bug 23111: Use selected default framework if UseACQFrameworkForBiblioRecords set to Don't Use
Comment 57 David Nind 2023-10-24 09:42:16 UTC
Two issues I came across when testing (using KTD):

1. Cataloguing > New from Z39.50/SRU: framework in URL is Default, even if another framework (such as BKS) is set as the default:
   . 127.0.0.1:8081/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=&frameworkcode=Default

2. Page not found error for Cataloguing > New record, after unsetting the default framework (so that the Default framework is now the default):
   - URL is: http://127.0.0.1:8081/cgi-bin/koha/cataloguing/undefined
   - Error 404 page (An error has occurred)