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

--- Comment #15 from Jesse Weaver <[email protected]> ---
(In reply to Jonathan Druart from comment #11)
> Jesse, yes it should be the way to go but..
> I have already tried something and was stuck. I have a wip branch but I
> don't remember what was wrong.
> 
> Looking at the diff it seems that I have tried to add a
> DeleteBorrowerAttributes subroutines and the code looks quite complicated:
> 
> +sub DeleteBorrowerAttributes {
> +    my $borrowernumber = shift;
> +    my $no_branch_limit = @_ ? shift : 0;
> +    my $branch_limit = $no_branch_limit
> +        ? 0
> +        : C4::Context->userenv ? C4::Context->userenv->{"branch"} : 0;
> +
> +    my $dbh = C4::Context->dbh;
> +    my $query = q{
> +        DELETE FROM borrower_attributes
> +        };
> +    $query .= q{
> +        LEFT JOIN borrower_attribute_types_branches ON bat_code = code
> +        WHERE b_branchcode = ? OR b_branchcode IS NULL
> +    } if $branch_limit;
> +    $query .= q{
> +        WHERE borrowernumber = ?
> +    };
> +
> +    $dbh->do( $query, undef, $branch_limit ? $branch_limit : (),
> $borrowernumber );
> +}

That honestly looks exactly like what I would have done. Why send the hidden
attributes in memberentrygen.tt, though, if DeleteBorrowerAttributes is
branch-limited?

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