Aqbudget => 'budget_owner_id',
Aqbudgetborrower => 'borrowernumber',
ArticleRequest => 'borrowernumber',
- BorrowerAttribute => 'borrowernumber',
BorrowerDebarment => 'borrowernumber',
BorrowerFile => 'borrowernumber',
BorrowerModification => 'borrowernumber',
$self->surname( uc($self->surname) )
if C4::Context->preference("uppercasesurnames");
- $self->relationship(undef) # We do not want to store an empty string in this field
- if defined $self->relationship
- and $self->relationship eq "";
-
unless ( $self->in_storage ) { #AddMember
# Generate a valid userid/login if needed
# Unbless for safety, the patron will end up being deleted
$results->{merged}->{$patron_id}->{patron} = $patron->unblessed;
+ my $attributes = $patron->extended_attributes;
+ my $new_attributes = [
+ map { { code => $_->code, attribute => $_->attribute } }
+ $attributes->as_list
+ ];
+ $attributes->delete; # We need to delete before trying to merge them to prevent exception on unique and repeatable
+ for my $attribute ( @$new_attributes ) {
+ $self->add_extended_attribute($attribute);
+ }
+
while (my ($r, $field) = each(%$RESULTSET_PATRON_ID_MAPPING)) {
my $rs = $schema->resultset($r)->search({ $field => $patron_id });
$results->{merged}->{ $patron_id }->{updated}->{$r} = $rs->count();
return $can;
}
+=head3 can_log_into
+
+my $can_log_into = $patron->can_log_into( $library );
+
+Given a I<Koha::Library> object, it returns a boolean representing
+the fact the patron can log into a the library.
+
+=cut
+
+sub can_log_into {
+ my ( $self, $library ) = @_;
+
+ my $can = 0;
+
+ if ( C4::Context->preference('IndependentBranches') ) {
+ $can = 1
+ if $self->is_superlibrarian
+ or $self->branchcode eq $library->id;
+ }
+ else {
+ # no restrictions
+ $can = 1;
+ }
+
+ return $can;
+}
+
=head3 libraries_where_can_see_patrons
my $libraries = $patron-libraries_where_can_see_patrons;