| Summary: | When placing a hold in OPAC page explodes into error 500 | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Katrin Fischer <katrin.fischer> |
| Component: | OPAC | Assignee: | Jonathan Druart <jonathan.druart> |
| Status: | CLOSED FIXED | QA Contact: | Katrin Fischer <katrin.fischer> |
| Severity: | critical | ||
| Priority: | P5 - low | CC: | domm, januszop, jonathan.druart, lucas, michaela.sieber |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Crowdfunding goal: | 0 |
| Patch complexity: | --- | Documentation contact: | |
| Documentation submission: | Text to go in the release notes: | ||
| Version(s) released in: |
23.05.00,22.11.04
|
Circulation function: | |
| Bug Depends on: | 31306 | ||
| Bug Blocks: | |||
| Attachments: |
Bug 32674: Fix placing a hold at the OPAC for serials
Bug 32674: Fix placing a hold at the OPAC for serials Bug 32674: Fix placing a hold at the OPAC for serials Bug 32674: Fix placing a hold at the OPAC for serials |
||
|
Description
Katrin Fischer
2023-01-18 16:16:16 UTC
*** This bug has been marked as a duplicate of bug 32269 *** opac-detail.pl has 'me.biblionumber' => $biblionumber. To maybe find out more of what's going on:
* Try emptying out OpacHiddenItems to see if it makes a difference
* Try toggling hidelostitems
* Get to the SQL query (hope I got these right):
Change Koha/Database.pm:
sub _new_schema {
+ $ENV{DBIC_TRACE} = 1;
restart plack
tail -f the log
hit the page/create the error
remove the DBIC_TRACE
restart plack
Just a general DBIC-note: This problem is caused when joining tables and both tables have a column with the same name. As DBIC allows chaining of result-set/search calls, a given piece of code may work in one case, but not when later own the base query is amended and eg a second table is joined. Therefore it's (IMO) best pratice to always use the `me.` alias in DBIC searches, just to future-proof your code. There are more info on bug 33081, it's happening for serials. *** Bug 33081 has been marked as a duplicate of this bug. *** Created attachment 147479 [details] [review] Bug 32674: Fix placing a hold at the OPAC for serials Placing a hold at the OPAC explodes with a 500 when the record is a serial DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'biblionumber' in where clause is ambiguous at /usr/share/koha/lib/Koha/Objects.pm line 394 Test plan: Create a serial from a given biblio Place a hold on this record at the OPAC Jonathan, thank you for identifying the duplicate.
I wonder also if the first argument to search_ordered call should not be a anon. hash, like:
my $items = Koha::Items->search_ordered(
{
-or =>
[
'me.biblionumber' => $biblioNumber,
'me.itemnumber' => {
-in => [
.....
],
},
since it is than passed to search? This would have been in my patch which I did not manage to send yesterday.
(In reply to Janusz Kaczmarek from comment #8) > Jonathan, thank you for identifying the duplicate. > > I wonder also if the first argument to search_ordered call should not be a > anon. hash, like: > > > my $items = Koha::Items->search_ordered( > { > -or => > [ > 'me.biblionumber' => $biblioNumber, > 'me.itemnumber' => { > -in => [ > ..... > ], > }, > > since it is than passed to search? This would have been in my patch which I > did not manage to send yesterday. They are identical constructs, it won't change anything. Created attachment 147481 [details] [review] Bug 32674: Fix placing a hold at the OPAC for serials Placing a hold at the OPAC explodes with a 500 when the record is a serial DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'biblionumber' in where clause is ambiguous at /usr/share/koha/lib/Koha/Objects.pm line 394 Test plan: Create a serial from a given biblio Place a hold on this record at the OPAC Signed-off-by: Janusz Kaczmarek <januszop@gmail.com> > Signed-off-by: Janusz Kaczmarek <januszop@gmail.com>
Did you forget to change the status? :)
Created attachment 147759 [details] [review] Bug 32674: Fix placing a hold at the OPAC for serials Placing a hold at the OPAC explodes with a 500 when the record is a serial DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'biblionumber' in where clause is ambiguous at /usr/share/koha/lib/Koha/Objects.pm line 394 Test plan: * Create a subscription for an existing bibliographic record * Place a hold on this record at the OPAC Signed-off-by: Janusz Kaczmarek <januszop@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Created attachment 147760 [details] [review] Bug 32674: Fix placing a hold at the OPAC for serials Placing a hold at the OPAC explodes with a 500 when the record is a serial DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Column 'biblionumber' in where clause is ambiguous at /usr/share/koha/lib/Koha/Objects.pm line 394 Test plan: * Create a serial subscription for an existing bibliographic record * Place a hold on this record at the OPAC Signed-off-by: Janusz Kaczmarek <januszop@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Pushed to master for 23.05. Nice work everyone, thanks! Nice work, thanks everyone! Pushed to 22.11.x for the next release. Missing dependencies for 22.05.x |