Bug 17818

Summary: Duplicating a subfield yields an empty subfield tag [follow-up]
Product: Koha Reporter: Sophie MEYNIEUX <sophie.meynieux>
Component: CatalogingAssignee: Sophie MEYNIEUX <sophie.meynieux>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P3 CC: arouss1980, jonathan.druart, josef.moravec, julian.maurice, katrin.fischer, m.de.rooy
Version: 3.22   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17477
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17863
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17725
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=19503
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 17817 - Duplicating a subfield yields an empty subfield tag [follow-up]
Bug 17818 - Duplicating a subfield yields an empty subfield tag [follow-up]

Description Sophie MEYNIEUX 2016-12-28 13:26:30 UTC
Bug 17152 made the subfield cloning function delete the contents of the cloned subfield. But it makes the subfield tag empty too, and this is causing troubles for people re-opening the records for edition.

Bug 17477 fix this for textareas, but the problem is the same with dropdown box selection
Comment 1 Sophie MEYNIEUX 2016-12-28 14:15:52 UTC Comment hidden (obsolete)
Comment 2 Sophie MEYNIEUX 2016-12-28 14:18:12 UTC
Created attachment 58471 [details] [review]
Bug 17818 - Duplicating a subfield yields an empty subfield tag [follow-up]

The problem is the same as Bug 17477 but also for dropdown selection list

Steps to reproduce error:
- On the cataloging screen (basic screen), create a new record
- Go to a field with repetable subfields and associated with authorised values
- Select a value for the subfield
 583$x)
 - Clone the subfield
 - select another value for the new subfield
 - Save the record
 - Edit the record to modify => the clone subfield has desappeared.
If you look in DB in marcxml, the subfield is present but without code

 - Apply patch
 - Clean cache browser and reload page
 - Repeat steps above
 - Verify that works as expected
Comment 3 Sophie MEYNIEUX 2016-12-28 14:18:55 UTC
wrong bug number in first commit message, sorry
Comment 4 Katrin Fischer 2017-01-07 22:28:50 UTC
I have tried testing this, but I had a lot of problems.

My configuration:
I created a new field and subfield 991$a, linked to CCODE for testing.
The field and the subfield are marked as repeatable.

Problem 0: 
- Try to repeat the field without filling in a value
- It will not work, there is a JavaScript error message:
TypeError: divs[i].getAttribute(...) is null  cataloging.js:100:12

Problem 1:
- Select a value for the subfield
- Repeat the field
- The value is copied form the original field into the repeated field (should be empty)

Problem 2:
- Try to clear the value in the repeated field using the X in the pull down.
- It won't work.

Problem 3: 
- Try to open the pull down in the repeated field
- It won't work.

I am not sure what's going on there, but something appears seriously wrong and makes it impossible to test this.

I have restarted Plack, memcached and reloaded the page multiple times clearing the cache.
Comment 5 Katrin Fischer 2017-01-07 22:34:27 UTC
I filed a separate bug for the behaviour I saw - bug 17863. Would be nice if someone could retest.
Comment 6 Josef Moravec 2017-01-20 13:57:45 UTC
I can't reproduce it on current master... can someone confirm?
Comment 7 Katrin Fischer 2017-01-22 22:55:32 UTC
Hi Joseph, we fixed Bug 17817 - Repeat this Tag (cloning) not working after I tested this, it's possible that this fixed the problem.
Comment 8 Jonathan Druart 2017-01-26 12:42:24 UTC
I cannot recreate either. Marked as duplicate of bug 17817.

*** This bug has been marked as a duplicate of bug 17817 ***
Comment 9 Julian Maurice 2017-04-12 13:57:01 UTC
Reopened as it is still a bug on 3.22.19
Comment 10 Julian Maurice 2017-05-10 11:26:38 UTC
Pushed to 3.22.x for 3.22.21
Comment 11 Andreas Roussos 2017-10-18 06:06:48 UTC
This bug affects the latest 16.05 release (16.05.17) as well: when you clone a
repeatable dropdown subfield the cloned subfield's tag is empty. If you then save
the record and re-open it, the cloned subfield is not shown at all (even though
it is present in the DB's marcxml column as Sophie pointed out). The next time
you save the record, the subfield is gone for good :(

If you try to reproduce this bug, please note that it's only the cloning of
dropdown subfields that is broken in 16.05.17. Cloning of textarea subfields
works fine.
Comment 12 Jonathan Druart 2017-10-18 13:16:01 UTC
Andreas, please open a new bug report and link it to this one.
This one has been marked as pushed and should not be reopened.