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

Emily Lamancusa <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |emily.lamancusa@montgomeryc
                   |                            |ountymd.gov
         QA Contact|[email protected] |emily.lamancusa@montgomeryc
                   |y.org                       |ountymd.gov
             Status|Signed Off                  |Failed QA

--- Comment #4 from Emily Lamancusa <[email protected]> ---
(In reply to Lucas Gass from comment #1)
> I don't see why an if/else is needed here. We can just pass the value
> $incremental to UpdateTotalIssues
> 
> -            my $ret;
> -            if ( $incremental && $totalissues > 0 ) {
> -                $ret = UpdateTotalIssues( $biblionumber, $totalissues );
> -            }
> -            else {
> -                $ret = UpdateTotalIssues( $biblionumber, 0, $totalissues );
> -            }
> 
> Instead this should work just as good:
> 
> +            my $ret = UpdateTotalIssues( $biblionumber, $incremental,
> $totalissues, 1 );

The if/else is necessary. In the if branch, $totalissues is being passed as the
$increase parameter (i.e. the amount to increment the existing value by). In
the else branch, $totalissues is being passed as the $value parameter (i.e. the
value to overwrite the existing value).

Providing a defined $value parameter causes UpdateTotalIssues to ignore the
$increment parameter, so if the --incremental flag is set, the third parameter
needs to be undef. Otherwise UpdateTotalIssues will overwrite the existing
value instead of incrementing it as desired.

That being said...if the --incremental flag is set, but $totalissues is 0 for a
particular biblio, the else clause will still trigger, and wipe out the
totalissues value for that biblio! So the if/else isn't correct to begin with -
those conditions need to be checked separately.

-- 
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