Bug 28608 - Creating a biblio record leads to item creation even if framework has no items field
Summary: Creating a biblio record leads to item creation even if framework has no item...
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Baptiste Wojtkowski (bwoj)
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-21 14:03 UTC by Fridolin Somers
Modified: 2024-09-18 12:09 UTC (History)
3 users (show)

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


Attachments
Bug 28608: Creating a biblio record must not lead to item creation when framework has no items field (3.55 KB, patch)
2021-06-21 14:14 UTC, Fridolin Somers
Details | Diff | Splinter Review
Issue #6 - list of bugs applied must be global (2.04 KB, patch)
2021-06-21 17:53 UTC, Hakam Almotlak
Details | Diff | Splinter Review
Bug 28608: Creating a biblio record must not lead to item creation when framework has no items field (3.59 KB, patch)
2021-06-21 17:59 UTC, Hakam Almotlak
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2021-06-21 14:03:26 UTC
Some framework for biblio records have no items field (952 in MARC21, 995 in UNIMARC). Records can not have items for example a serial article.

In this case creating a record should not lead to item creation.
Comment 1 Fridolin Somers 2021-06-21 14:14:09 UTC
Created attachment 122230 [details] [review]
Bug 28608: Creating a biblio record must not lead to item creation when framework has no items field

Some framework for biblio records have no items field (952 in MARC21, 995 in UNIMARC). Records can not have items for example a serial article.

In this case creating a record should not lead to item creation.

This patch adds a condition next to items edition permission to have
only one save button when framework has no items field.

1) Create a biblio framework without items field (952 in MARC21, 995 in UNIMARC)
2) Create a biblio record with this framework
3) Click on "Save"
=> Without patch you see items creation page (with no inputs in form)
=> With patch you see record details page
Comment 2 Fridolin Somers 2021-06-21 14:16:25 UTC
We may hide other things when framework has no items field.
Maybe we will create a method has_items() in Koha::BiblioFramework
Comment 3 Hakam Almotlak 2021-06-21 17:53:12 UTC Comment hidden (obsolete)
Comment 4 Hakam Almotlak 2021-06-21 17:59:38 UTC
Created attachment 122255 [details] [review]
Bug 28608: Creating a biblio record must not lead to item creation when framework has no items field

Some framework for biblio records have no items field (952 in MARC21, 995 in UNIMARC). Records can not have items for example a serial article.

In this case creating a record should not lead to item creation.

This patch adds a condition next to items edition permission to have
only one save button when framework has no items field.

1) Create a biblio framework without items field (952 in MARC21, 995 in UNIMARC)
2) Create a biblio record with this framework
3) Click on "Save"
=> Without patch you see items creation page (with no inputs in form)
=> With patch you see record details page

Signed-off-by: hakam <hakam@inlibro.com>
Comment 5 David Cook 2021-06-21 23:22:35 UTC
Interesting!
Comment 6 Marcel de Rooy 2021-09-10 07:32:18 UTC
Processing files before patches
Argument "" isn't numeric in numeric gt (>) at /usr/share/koha/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt line 896.
|========================>| 2 / 2 (100.00%)
Processing files after patches
Argument "" isn't numeric in numeric gt (>) at /usr/share/koha/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt line 896.
Comment 7 Marcel de Rooy 2021-09-10 07:34:36 UTC
(In reply to Marcel de Rooy from comment #6)
> Processing files before patches
> Argument "" isn't numeric in numeric gt (>) at
> /usr/share/koha/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/
> addbiblio.tt line 896.
> |========================>| 2 / 2 (100.00%)
> Processing files after patches
> Argument "" isn't numeric in numeric gt (>) at
> /usr/share/koha/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/
> addbiblio.tt line 896.

[% IF ( BIG_LOOP.size > 1 ) %]

?
Comment 8 Marcel de Rooy 2021-09-10 07:48:40 UTC
QAing. There might be something wrong here..
Comment 9 Marcel de Rooy 2021-09-10 07:49:37 UTC
=head2 GetMarcFromKohaField

    ( $field,$subfield ) = GetMarcFromKohaField( $kohafield );
    @fields = GetMarcFromKohaField( $kohafield );
    $field = GetMarcFromKohaField( $kohafield );

    Returns the MARC fields & subfields mapped to $kohafield.
    Since the Default framework is considered as authoritative for such
    mappings, the former frameworkcode parameter is obsoleted.

    In list context all mappings are returned; there can be multiple
    mappings. Note that in the above example you could miss a second
    mappings in the first call.
    In scalar context only the field tag of the first mapping is returned.

=cut
Comment 10 Marcel de Rooy 2021-09-10 07:53:46 UTC
+( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber" );

Your call here does not look at the specific itemnumber field in that framework since kohafields are looked up in the Default framework. This is already the case in a few Koha versions. I know since I was involved in that dev ;)

So your framework may not have an itemnumber field, but if the Default has, then you can still add an item.

You need to think of a solution in some other way?
Comment 11 Fridolin Somers 2024-08-06 14:14:40 UTC
Oups indeed.
Will have another look on it ;)