+=head2 DeleteBorrowerAttribute
+
+ DeleteBorrowerAttribute($borrowernumber, $attribute);
+
+Delete a borrower attribute for the patron identified by C<$borrowernumber> and the attribute code of C<$attribute>
+
+=cut
+sub DeleteBorrowerAttribute {
+ my ( $borrowernumber, $attribute ) = @_;
+
+ my $dbh = C4::Context->dbh;
+ my $sth = $dbh->prepare(qq{
+ DELETE FROM borrower_attributes
+ WHERE borrowernumber = ?
+ AND code = ?
+ } );
+ $sth->execute( $borrowernumber, $attribute->{code} );
+}
+
+=head2 UpdateBorrowerAttribute
+
+ UpdateBorrowerAttribute($borrowernumber, $attribute );
+
+Update a borrower attribute C<$attribute> for the patron identified by C<$borrowernumber>,
+
+=cut
+sub UpdateBorrowerAttribute {
+ my ( $borrowernumber, $attribute ) = @_;
+
+ DeleteBorrowerAttribute $borrowernumber, $attribute;
+
+ my $dbh = C4::Context->dbh;
+ my $query = "INSERT INTO borrower_attributes SET attribute = ?, code = ?, borrowernumber = ?";
+ my @params = ( $attribute->{attribute}, $attribute->{code}, $borrowernumber );
+ if ( defined $attribute->{password} ) {
+ $query .= ", password = ?";
+ push @params, $attribute->{password};
+ }
+ my $sth = $dbh->prepare( $query );
+
+ $sth->execute( @params );
+}
+
+