https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38248

--- Comment #11 from Jonathan Druart <[email protected]> ---
(In reply to David Cook from comment #10)
> (In reply to Jonathan Druart from comment #9)
> > rows.return_claims won't be set if the pref is not set.
> 
> row.return_claims not being set is the whole problem resolved by this patch

Look at the code:

248     [% IF Koha.Preference('ClaimReturnedLostValue') %]
249         embed.push('return_claims');
250     [% END %]


497                         const hasReturnClaims = row.return_claims &&
row.return_claims.filter(rc => !rc.resolution).length > 0 ? true : false

This means that if the pref is not set, row.return_claims won't be set (the key
will not exist).
If the pref is set, row.return_claims will be an array (eventually empty).

A correct logic would be surround the 'hasReturnClaims' code with test on
ClaimReturnedLostValue.

if ( row.lost_status ) { 
    let lost_lib = av_lost.get(row.lost_status.toString()) || _("Unavailable
(lost or missing");
    [% IF Koha.Preference('ClaimReturnedLostValue') %]
        const hasReturnClaims = row.return_claims.filter(rc =>
!rc.resolution).length > 0 ? true : false
        nodes += '<span class="lost">%s</span>'.format(escape_str(lost_lib));
        if(hasReturnClaims) {
            nodes += '<span class="claimed_returned">' + _("(Claimed
returned)") + '</span>';
        }
    [% END %]
}

*BUT*

(In reply to Katrin Fischer from comment #8)
> (In reply to Jonathan Druart from comment #7)
> > I am wondering if the condition is correct. What would make sense IMO is to
> > test for ClaimReturnedLostValue
> > 
> > We should have row.return_claims set if the pref is set
> > 
> > 248     [% IF Koha.Preference('ClaimReturnedLostValue') %]
> > 249         embed.push('return_claims');
> > 250     [% END %]
> 
> We now have claimed returns items with LOST values other than the
> ClaimReturendLostValue. (See bug 27919) So this is why this needed to be
> adjusted.

Then following the above, there is a flaw in the logic.

If this is correct we should always embed return_claims, and remove the IF
l.248

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://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