[Koha-bugs] [Bug 15163] Patron attributes with branch limiits are not saved when invisible
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Feb 18 22:32:53 CET 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15163
--- Comment #15 from Jesse Weaver <jweaver at bywatersolutions.com> ---
(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.
More information about the Koha-bugs
mailing list