Bug 23727: Editing course reserve items is broken
authorKyle M Hall <kyle@bywatersolutions.com>
Fri, 14 Feb 2020 20:22:17 +0000 (15:22 -0500)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 17 Apr 2020 12:45:56 +0000 (13:45 +0100)
commit7d15ff34043aeb2a812a1139aba084cf4c1bc136
tree4fb8f795a5b363f1f5b232f99febeb0b5ea1f2c3
parent6229b51d663b868532102e60a4517ae2d4fb44cd
Bug 23727: Editing course reserve items is broken

Adding an item to course reserves and trying to edit any values in a second step does not work. Values are not saved and the table shows all values as "Unchanged".

This patch set adds two new sets of columns to the course_items table.

The first set determines if the specified column should be swapped or
not. The was previously 'implied' by the column being set to undef which
has been the root problem with that way of knowing if a column should
swap or not.

The second set of new columns are for storing the item field values
while the item is on course reserve. Previously, the column values
were swapped between the items table and the course_items table,
which leaves ambiguity as to what each value is. Now, the original
columns *always* store the value when the item is on course reserve,
and the new storage columns store the original item value while the
item is on reserve, and are NULL when an item is *not* on reserve.

Test Plan:
1) Apply this patch
2) Add and edit course items, not the new checkboxes for enabling fields
3) Everything should function as before

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/CourseReserves.pm
Koha/Course/Instructors.pm
Koha/Course/Item.pm
Koha/Course/Items.pm
Koha/Course/Reserves.pm
course_reserves/add_items.pl
course_reserves/batch_add_items.pl
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt
koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt
t/db_dependent/CourseReserves/CourseItems.t