Main Koha release repository
https://koha-community.org
Jonathan Druart
a881984413
This patch fixes an issue when editing items. * The issue Cannot blank a subfield when editing an item. If you have an item with itemcallnumber=42, then edit it, blank it and save. The itemcallnumber is still 42 * Why? (line numbers from https://gitlab.com/joubu/Koha/-/tree/bug_23463) additem (and other item's edition forms) receives a list of tags, subfields and values, generates a MARC::Record::XML then calls ModItemFromMarc: 717 my $itemtosave=MARC::Record::new_from_xml($xml, 'UTF-8'); 727 my $newitem = ModItemFromMarc($itemtosave, $biblionumber, $itemnumber); And ModItemFromMarc: 282 my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' ); 283 $item->{cn_source} = delete $item->{'items.cn_source'}; # Because of C4::Biblio::_disambiguate 284 $item_object->set($item); ModItemFromMarc never knows that the field has been blank. Prior to bug 23463 we had a map of default values, and ModItemFromMarc was doing: 426 my $item = TransformMarcToKoha( $localitemmarc, $frameworkcode, 'items' ); 427 my $default_values = _build_default_values_for_mod_marc(); 428 foreach my $item_field ( keys %$default_values ) { 429 $item->{$item_field} = $default_values->{$item_field} 430 unless exists $item->{$item_field}; 431 } I do not want to reinsert that list of default values. Here I wrote a generic method in Koha::Object to set the value passed in parameter, or "blank" if not passed. It's nulled if can be set to null in DB, or the default value is retrieved from the schema info. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> |
||
---|---|---|
acqui | ||
admin | ||
api/v1 | ||
authorities | ||
basket | ||
C4 | ||
catalogue | ||
cataloguing | ||
circ | ||
clubs | ||
course_reserves | ||
debian | ||
docs | ||
errors | ||
etc | ||
ill | ||
installer | ||
Koha | ||
koha-tmpl | ||
labels | ||
members | ||
misc | ||
offline_circ | ||
opac | ||
patron_lists | ||
patroncards | ||
plugins | ||
pos | ||
reports | ||
reserve | ||
reviews | ||
rotating_collections | ||
serials | ||
services | ||
skel | ||
suggestion | ||
svc | ||
t | ||
tags | ||
tmp/modified_authorities | ||
tools | ||
virtualshelves | ||
xt | ||
.editorconfig | ||
.eslintrc.json | ||
.gitignore | ||
.htaccess | ||
.mailmap | ||
.scss-lint.yml | ||
about.pl | ||
changelanguage.pl | ||
cpanfile | ||
fix-perl-path.PL | ||
gulpfile.js | ||
help.pl | ||
INSTALL | ||
Koha.pm | ||
koha_perl_deps.pl | ||
kohaversion.pl | ||
LICENSE | ||
mainpage.pl | ||
Makefile.PL | ||
MANIFEST.SKIP | ||
package.json | ||
README | ||
README.md | ||
README.robots | ||
rewrite-config.PL | ||
yarn.lock |
Koha is a free software integrated library system (ILS).
Koha is distributed under the GNU GPL version 3 or later.
Note: This is a synced mirror of the official Koha repo.
Note: Koha does not accept pull requests from git hosting sites.
Note: This project has its own bug tracker, to report a bug or submit a patch visit http://bugs.koha-community.org.
For guidelines on submitting patches for Koha please visit https://wiki.koha-community.org/wiki/SubmitingAPatch
The developers handbook can be found at https://wiki.koha-community.org/wiki/Developer_handbook