Summary: | EDI transfer_items uses a relationship where it's looking for a field | ||
---|---|---|---|
Product: | Koha | Reporter: | Martin Renvoize (ashimema) <martin.renvoize> |
Component: | Acquisitions | Assignee: | Martin Renvoize (ashimema) <martin.renvoize> |
Status: | Pushed to oldoldoldstable --- | QA Contact: | Testopia <testopia> |
Severity: | major | ||
Priority: | P5 - low | CC: | fridolin.somers, jon.turner, jonathan.druart, kyle, victor, wainuiwitikapark |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
21.11.00,21.05.05,20.11.11,20.05.17,19.11.23
|
|
Circulation function: | |||
Attachments: |
Bug 28960: Explicitly call get_column
Bug 28960: Explicitly call get_column |
Description
Martin Renvoize (ashimema)
2021-09-07 11:12:40 UTC
Created attachment 124572 [details] [review] Bug 28960: Explicitly call get_column This patch adds get_column to ensure we are returning a string value of a field rather than accidentally triggering a relationship accessor. Created attachment 124578 [details] [review] Bug 28960: Explicitly call get_column This patch adds get_column to ensure we are returning a string value of a field rather than accidentally triggering a relationship accessor. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Isn't the correct fix to call $item->home_branch->branchcode? From Koha::Item sub home_branch { my ($self) = @_; $self->{_home_branch} ||= Koha::Libraries->find( $self->homebranch() ); return $self->{_home_branch}; } (In reply to Jonathan Druart from comment #3) > Isn't the correct fix to call $item->home_branch->branchcode? > > From Koha::Item > > sub home_branch { > my ($self) = @_; > > $self->{_home_branch} ||= Koha::Libraries->find( $self->homebranch() ); > > return $self->{_home_branch}; > } There are two things with that. 1) $item is a DBIx::Class::Result and not a Koha::Item in EDI (Yes, we should certainly convert to Koha Objects here at some point) 2) if all we need is the code, why call through another DB hitting accessor rather than use the field in the first set directly? I hadn't realized we weren't manipulating a Koha::Object. And my remark was silly anyway as $item->branchcode is working if $item is a Koha::Item. Sorry for the noise. :).. it's certainly on my list to switch over to objects.. but before that I need to blitz some tests.. why is EDI so darn hard! Pushed to master for 21.11, thanks to everybody involved! Pushed to 21.05.x for 21.05.x Pushed to 20.11.x for 20.11.11 Backported: Pushed to 20.05.x branch for 20.05.17 Backported to 19.11.x for 19.11.23 |