From b4c9e58cbeda6b9ec2477e3e3916238400d97738 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 12 May 2025 09:54:38 -0300 Subject: [PATCH] Bug 32266: (follow-up) Handle null basket.authorizer gracefully This patch makes the JS code handle the situation of `aqbasket.authorisedby` being NULL. I was only able to reproduce this by manually touching the DB, but existing data might have this situation. To test: 1. Have a few late orders 2. Pick a basket id 3. Run: $ ktd --shell k$ koha-mysql kohadev > UPDATE aqbasket SET authorisedby=NULL WHERE basketno=2; (in this case 2 was my chosen basket). 4. Visit the late orders page => FAIL: The table doesn't render correclty, the browser inspector says something about authorizer being null 5. Apply this patch 6. Repeat 4 => SUCCESS: The table renders correctly, the 'Library' column has an empty string for the affected rows 7. Sign off :-D Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index b359f7067d9..ff5694fb899 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -398,11 +398,15 @@ } }, { - data: 'basket.authorizer.library_id', + data: "", // 'basket.authorizer.library_id' orderable: false, - searchable: false, + searchable: false, // FIXME: not searchable as there's no FK render: function(data, type, row, meta) { - return escape_str(row.basket.authorizer._strings.library_id.str); + if ( basket.authorizer != null ) { + return escape_str(row.basket.authorizer._strings.library_id.str); + } + + return ""; } }, { -- 2.49.0