Lines 81-97
sub build_object {
Link Here
|
81 |
|
81 |
|
82 |
load $class; |
82 |
load $class; |
83 |
my $source = $class->_type; |
83 |
my $source = $class->_type; |
84 |
my @pks = $self->schema->source( $class->_type )->primary_columns; |
|
|
85 |
|
84 |
|
86 |
my $hashref = $self->build({ source => $source, value => $value }); |
85 |
my $hashref = $self->build({ source => $source, value => $value }); |
87 |
my @ids; |
86 |
my $object; |
|
|
87 |
if ( $class eq 'Koha::Old::Patrons' ) { |
88 |
$object = $class->search({ borrowernumber => $hashref->{borrowernumber} })->next; |
89 |
} else { |
90 |
my @ids; |
91 |
my @pks = $self->schema->source( $class->_type )->primary_columns; |
92 |
foreach my $pk ( @pks ) { |
93 |
push @ids, $hashref->{ $pk }; |
94 |
} |
88 |
|
95 |
|
89 |
foreach my $pk ( @pks ) { |
96 |
$object = $class->find( @ids ); |
90 |
push @ids, $hashref->{ $pk }; |
|
|
91 |
} |
97 |
} |
92 |
|
98 |
|
93 |
my $object = $class->find( @ids ); |
|
|
94 |
|
95 |
return $object; |
99 |
return $object; |
96 |
} |
100 |
} |
97 |
|
101 |
|
98 |
- |
|
|