http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=9902

--- Comment #9 from Chris Cormack <ch...@bigballofwax.co.nz> ---
Interestingly in 3.8.x we did

 if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.holdingbranch'
|| $tagslib->{$tag}->{$subfield}->{kohafield} eq 'items.homebranch' )
                    && $defaultvalues
                    && $defaultvalues->{'branchcode'} ) {
                    my $temp;
                    if ($itemrecord) {
                        $temp = $itemrecord->field($subfield);
                    }
                    unless ($temp) {
                        $defaultvalue = $defaultvalues->{branchcode} if
$defaultvalues;
                    }
                }  

Bug 9116 removed these, and inadvertently caused this regression

                 if (   ( $tagslib->{$tag}->{$subfield}->{kohafield} eq
'items.holdingbranch' || $tagslib->{$tag
                     && $defaultvalues
                     && $defaultvalues->{'branchcode'} ) {
-                    my $temp;
-                    if ($itemrecord) {
-                        $temp = $itemrecord->field($subfield);
-                    }
-                    unless ($temp) {
-                        $defaultvalue = $defaultvalues->{branchcode} if
$defaultvalues;
+                    if ( $itemrecord and $defaultvalues and not
$itemrecord->field($subfield) ) {
+                        $defaultvalue = $defaultvalues->{branchcode};
                     }
                 }


You'll notice the new behaviour is not the same as the old one, basically the
change in bug 9116 is fine for editing any item, but means that default values
are never used on new items, causing the problem that Nicole discovered and
Kyle fixed.

We have a couple of choices, revert bug 9116 (probably hard to do now) as it
was just a code cleaning fix that broke functionality, or use Kyle's patch.

I think probably best to use Kyles patch. This does prove a good illustration
of why code cleaning is good in theory, hard to get right in practice. 
http://blog.bigballofwax.co.nz/2012/07/31/yes-you-should-rewrite-it-no-not-like-that/

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to