Bugzilla – Attachment 174372 Details for
Bug 34355
Automated MARC record ordering process
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34355: (QA follow-up) Migrate vendor dropdown to a kohaSelect
Bug-34355-QA-follow-up-Migrate-vendor-dropdown-to-.patch (text/plain), 9.79 KB, created by
Matt Blenkinsop
on 2024-11-11 15:24:28 UTC
(
hide
)
Description:
Bug 34355: (QA follow-up) Migrate vendor dropdown to a kohaSelect
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2024-11-11 15:24:28 UTC
Size:
9.79 KB
patch
obsolete
>From eea6886221dc3a21414d0788cb15b2d1e4abdd61 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Mon, 21 Oct 2024 09:52:03 +0000 >Subject: [PATCH] Bug 34355: (QA follow-up) Migrate vendor dropdown to a > kohaSelect > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > admin/marc_order_accounts.pl | 15 +--- > .../en/modules/admin/marc_order_accounts.tt | 75 +++++++++++++++---- > 2 files changed, 63 insertions(+), 27 deletions(-) > >diff --git a/admin/marc_order_accounts.pl b/admin/marc_order_accounts.pl >index ce5899900bf..c95efe312dd 100755 >--- a/admin/marc_order_accounts.pl >+++ b/admin/marc_order_accounts.pl >@@ -55,18 +55,8 @@ $op ||= 'display'; > > if ( $op eq 'acct_form' ) { > $template->param( acct_form => 1 ); >- my @vendors = Koha::Acquisition::Booksellers->search( >- undef, >- { >- columns => [ 'name', 'id' ], >- order_by => { -asc => 'name' } >- } >- )->as_list; > my $budgets = GetBudgets(); >- $template->param( >- vendors => \@vendors, >- budgets => $budgets >- ); >+ $template->param( budgets => $budgets ); > my @matchers = C4::Matcher::GetMatcherList(); > $template->param( available_matchers => \@matchers ); > >@@ -127,7 +117,8 @@ sub show_account { > if ($acct_id) { > my $acct = Koha::MarcOrderAccounts->find($acct_id); > if ($acct) { >- $template->param( account => $acct ); >+ my $vendor = Koha::Acquisition::Booksellers->find( $acct->vendor_id ); >+ $template->param( vendor => $vendor, account => $acct ); > } > } > return; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_order_accounts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_order_accounts.tt >index eda9b144475..11e9aef075e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_order_accounts.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_order_accounts.tt >@@ -34,8 +34,9 @@ MARC Order Accounts > > <div class="main container-fluid"> > <div class="row"> >- <div class="col-sm-10 col-sm-push-2"> >+ <div class="col-md-10 order-md-2 order-sm-1"> > <main> >+ [% INCLUDE 'messages.inc' %] > [% IF display %] > <div id="toolbar" class="btn-toolbar"> > <a class="btn btn-default" id="newmarcorderacct" href="/cgi-bin/koha/admin/marc_order_accounts.pl?op=acct_form"> >@@ -95,19 +96,15 @@ MARC Order Accounts > <ol> > <li> > <label for="vendor_id">Vendor: </label> >- <select name="vendor_id" id="vendor_id"> >- [% FOREACH vendor IN vendors %] >- [% IF account.vendor_id == vendor.id %] >- <option value="[% vendor.id | html %]" selected="selected">[% vendor.name | html %]</option> >- [% ELSE %] >- <option value="[% vendor.id | html %]">[% vendor.name | html %]</option> >- [% END %] >+ <select class="select2" name="vendor_id" id="vendor_id"> >+ [% IF (vendor) %] >+ <option value="[% account.vendor_id | html %]" selected="selected">Current vendor ([% vendor.name | html %])</option> > [% END %] > </select> > </li> > <li> > <label for="budget_id">Budget: </label> >- <select name="budget_id" id="budget_id"> >+ <select class="select2" name="budget_id" id="budget_id"> > [% FOREACH budget IN budgets %] > [% IF account.budget_id == budget.budget_id %] > <option value="[% budget.budget_id | html %]" selected="selected">[% budget.budget_name | html %]</option> >@@ -144,7 +141,7 @@ MARC Order Accounts > <ol> > <li> > <label for='record_type'>Record type:</label> >- <select name='record_type' id='record_type'> >+ <select class="select2" name='record_type' id='record_type'> > [% IF ( account.record_type == 'biblio' ) %] > <option value="biblio" selected="selected"> > [% ELSE %] >@@ -161,7 +158,7 @@ MARC Order Accounts > </li> > <li> > <label for="encoding">Character encoding: </label> >- <select name="encoding" id="encoding"> >+ <select class="select2" name="encoding" id="encoding"> > [% IF ( account.encoding == 'UTF-8' ) %] > <option value="UTF-8" selected="selected"> > [% ELSE %] >@@ -207,7 +204,7 @@ MARC Order Accounts > <ol> > <li> > <label for="matcher">Record matching rule:</label> >- <select name="matcher" id="matcher"> >+ <select class="select2" name="matcher" id="matcher"> > [% FOREACH available_matcher IN available_matchers %] > [% IF available_matcher.matcher_id == account.matcher_id %] > <option value="[% available_matcher.matcher_id | html %]" selected="selected">[% available_matcher.code | html %] ([% available_matcher.description | html %])</option> >@@ -219,7 +216,7 @@ MARC Order Accounts > </li> > <li> > <label for="overlay_action">Action if matching record found: </label> >- <select name="overlay_action" id="overlay_action"> >+ <select class="select2" name="overlay_action" id="overlay_action"> > [% IF ( account.overlay_action == 'replace' ) %] > <option value="replace" selected="selected"> > [% ELSE %] >@@ -242,7 +239,7 @@ MARC Order Accounts > </li> > <li> > <label for="nomatch_action">Action if no match is found: </label> >- <select name="nomatch_action" id="nomatch_action"> >+ <select class="select2" name="nomatch_action" id="nomatch_action"> > [% IF ( account.nomatch_action == 'create_new' ) %] > <option value="create_new" selected="selected"> > [% ELSE %] >@@ -282,7 +279,7 @@ MARC Order Accounts > <ol> > <li> > <label for="item_action">How to process items: </label> >- <select name="item_action" id="item_action"> >+ <select class="select2" name="item_action" id="item_action"> > [% IF ( account.item_action == 'always_add' ) %] > <option value="always_add" selected="selected"> > [% ELSE %] >@@ -361,5 +358,53 @@ MARC Order Accounts > > [% MACRO jsinclude BLOCK %] > [% Asset.js("js/admin-menu.js") | $raw %] >+ [% INCLUDE 'select2.inc' %] >+<script> >+ >+$(document).ready(function() { >+ >+ function display_vendor(vendor) { >+ var $text; >+ $text = $('<span>'+vendor.text+'</span>'); >+ >+ return $text; >+ }; >+ >+ $("#vendor_id").kohaSelect({ >+ width: '10%', >+ allowClear: false, >+ ajax: { >+ url: '/api/v1/acquisitions/vendors', >+ delay: 300, // wait 300 milliseconds before triggering the request >+ cache: true, >+ dataType: 'json', >+ data: function (params) { >+ var search_term = (params.term === undefined) ? '' : params.term; >+ var query = { >+ "q": JSON.stringify({"name":{"-like":'%'+search_term+'%'}}), >+ "_order_by": "name", >+ "_page": params.page >+ }; >+ >+ return query; >+ }, >+ processResults: function (data) { >+ var results = []; >+ data.results.forEach( function ( vendor ) { >+ results.push( >+ { >+ "id": vendor.id, >+ "text": vendor.name.escapeHtml() >+ } >+ ); >+ }); >+ return { "results": results, "pagination": { "more": data.pagination.more } }; >+ } >+ }, >+ templateResult: display_vendor, >+ templateSelection: display_vendor >+ }); >+}); >+</script> > [% END %] > [% INCLUDE 'intranet-bottom.inc' %] >\ No newline at end of file >-- >2.39.3 (Apple Git-146)
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 34355
:
154705
|
154706
|
154707
|
154708
|
154709
|
154710
|
157092
|
157093
|
157094
|
157095
|
157096
|
157097
|
157098
|
157099
|
157100
|
160858
|
160859
|
160860
|
160861
|
160862
|
160863
|
160864
|
160865
|
160866
|
160867
|
160868
|
160869
|
160870
|
160871
|
160872
|
160873
|
160874
|
160875
|
169896
|
169897
|
169898
|
169899
|
169900
|
169901
|
169902
|
169903
|
169904
|
170395
|
170401
|
170402
|
170403
|
170404
|
170405
|
170406
|
170407
|
170408
|
170409
|
173054
|
173055
|
173056
|
173057
|
173058
|
173059
|
173060
|
173061
|
173062
|
173063
|
173064
|
173065
|
173066
|
173709
|
173805
|
173806
|
173809
|
173824
|
173825
|
173993
|
173994
|
173995
|
173996
|
173997
|
173998
|
173999
|
174000
|
174001
|
174002
|
174003
|
174004
|
174005
|
174006
|
174007
|
174008
|
174009
|
174010
|
174362
|
174363
|
174364
|
174365
|
174366
|
174367
|
174368
|
174369
|
174370
|
174371
| 174372 |
174373
|
174374
|
174375
|
174376
|
174377
|
174378
|
174379
|
174380
|
174382
|
174383