Bugzilla – Attachment 172901 Details for
Bug 35717
Link suggestions to orders by adding ordernumber to suggestions table
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35717: JS fixes
Bug-35717-JS-fixes.patch (text/plain), 4.12 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-10-17 15:14:12 UTC
(
hide
)
Description:
Bug 35717: JS fixes
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-10-17 15:14:12 UTC
Size:
4.12 KB
patch
obsolete
>From 567cfeba28b1e39a8b878ac051eecbf1d827a04a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 17 Oct 2024 11:35:22 -0300 >Subject: [PATCH] Bug 35717: JS fixes > >Bug 37018 added validation to queries and `{"in":...}` is no longer >valid. `{"-in":...}` is so this patch tweaks that. > >The previous patch fixes actual linking orders to suggestions. But not >having orders linked highlighted the code explode because an empty array >evaluates to `true` in Javascript. This patch fixes that too. > >The links generated by this patchset also get their components correctly >escaped. >--- > .../prog/en/modules/acqui/orderreceive.tt | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >index 903430c5704..f972fa24dd6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt >@@ -555,7 +555,7 @@ > $(document).ready(function(){ > // keep a copy for re-rendering > var $funds_tree = $('#bookfund').html(); >- var base_query = { "me.order_id": {"in": [[% multiple_orders | html %]]}}; >+ var base_query = { "me.order_id": {"-in": [[% multiple_orders | html %]]}}; > var pending_orders_url = "/api/v1/acquisitions/orders?only_active=1"; > var options = { > "ajax": { >@@ -697,7 +697,7 @@ > params['ordernumber'] = row.order_id; > params['booksellerid'] = row.basket.vendor_id; > >- if(row.suggestions && row.suggestions[0].reason) { >+ if(row.suggestions?.length && row.suggestions[0].reason) { > > params["suggestionid"] = row.suggestions[0].suggestion_id; > const options = Array.from(document.querySelectorAll('#reason option')); >@@ -1042,7 +1042,7 @@ > "data": function(row, type, val, meta) { > if(row.invoice) { > if(CAN_user_acquisition) { >- return '<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid='+row.invoice_id+'" title="Invoice detail page">'+row.invoice.invoice_number+"</a>"; >+ return '<a href="/cgi-bin/koha/acqui/invoice.pl?invoiceid='+encodeURIComponent(row.invoice_id)+'" title="Invoice detail page">'+escape_str(row.invoice.invoice_number)+"</a>"; > } > return row.invoice.invoice_number; > } >@@ -1138,17 +1138,17 @@ > o.parent().hide(); > } > }); >- if(row.suggestions) { >+ if(row.suggestions?.length) { > $("#suggestion_fieldset").show(); > if(row.suggestions[0].suggester) { > $("#biblio_suggestion_suggester").parent().show(); > $("#biblio_suggestion_suggester") > .html( >- [row.suggestions[0].suggester.surname, row.suggestions[0].suggester.firstname] >+ [escape_str(row.suggestions[0].suggester.surname), escape_str(row.suggestions[0].suggester.firstname)] > .filter(function(name){ > return name > }) >- .join(', ')+' (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='+row.suggestions[0].suggestion_id+'&op=show">'+SUGGESTION.format(row.suggestions[0].suggestion_id)+'</a>)' >+ .join(', ')+' (<a href="/cgi-bin/koha/suggestion/suggestion.pl?suggestionid='+encodeURIComponent(row.suggestions[0].suggestion_id)+'&op=show">'+SUGGESTION.format(row.suggestions[0].suggestion_id)+'</a>)' > ); > } else { > $("#biblio_suggestion_suggester").parent().hide(); >-- >2.47.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35717
:
160576
|
160577
|
160578
|
160579
|
160580
|
160581
|
160582
|
160583
|
164834
|
164835
|
164836
|
164837
|
164838
|
164839
|
164840
|
172871
|
172872
|
172873
|
172874
|
172875
|
172876
|
172877
|
172878
|
172899
|
172900
| 172901