Bugzilla – Attachment 168459 Details for
Bug 37246
Suggestions filter by fund displays inactive budgets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37246: Use the same dropdown for filtering and editing/adding budgets
Bug-37246-Use-the-same-dropdown-for-filtering-and-.patch (text/plain), 7.07 KB, created by
Nick Clemens (kidclamp)
on 2024-07-03 14:10:33 UTC
(
hide
)
Description:
Bug 37246: Use the same dropdown for filtering and editing/adding budgets
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-07-03 14:10:33 UTC
Size:
7.07 KB
patch
obsolete
>From a221f75430a75fa5368faeb98878530080bf8c57 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 3 Jul 2024 14:07:15 +0000 >Subject: [PATCH] Bug 37246: Use the same dropdown for filtering and > editing/adding budgets > >This patch removes a second fetch of budgets form the db, and clones the dropdown in the template >as we will only ever be displaying one of them at a time. > >The JS is moved to fire for both operations. > >To test: > 1 - Create an active and inactive budget in acquisitions > 2 - Add funs to both > 3 - Visit - Acquisitions -> Suggestions > 4 - Click 'Acquisition information' under filters on the left > 5 - Note all funds are showing > 6 - Apply patch > 7 - Reload > 8 - Note you only see active budgets > 9 - Check the box to show inactive, verify they show >10 - Filter by an inactive budget >11 - Confirm selection remains >12 - Add a suggestion and verify budget dropdown works >13 - Edit the suggestion and verify budget dropdown works >--- > .../prog/en/modules/suggestion/suggestion.tt | 44 ++++++++++--------- > suggestion/suggestion.pl | 15 ------- > 2 files changed, 24 insertions(+), 35 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >index 5d9e0bf8f45..481d9ae046a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt >@@ -605,7 +605,7 @@ > [% END %] > </select> > <label for="showallfunds" style="float:none;width:auto;"> Show inactive:</label> >- <input type="checkbox" id="showallfunds" /> >+ <input type="checkbox" class="showallfunds" /> > </li> > <li> > <label for="quantity">Copies:</label> >@@ -1219,22 +1219,25 @@ > <fieldset class="brief acquisition_information"> > <ol> > <li> >- <label for="budgetid"> Book fund:</label> >+ <label for="budgetid">Fund:</label> > <select name="budgetid" id="budgetid"> >- <option value="__ANY__">Any</option> > [% IF budgetid == '__NONE__' %] > <option value="__NONE__" selected="selected">None</option> > [% ELSE %] > <option value="__NONE__">None</option> > [% END %] >- [% FOREACH budgetsloo IN budgetsloop %] >- [% IF ( budgetsloo.selected ) %] >- <option value="[% budgetsloo.budget_id | html %]" selected="selected">[% budgetsloo.budget_name | html %]</option> >+ [% FOREACH budget IN sugg_budgets %] >+ [% IF ( budget.selected ) %] >+ <option value="[% budget.b_id | html %]" selected="selected">[% budget.b_txt | html %] [% IF ( !budget.b_active ) %](inactive)[% END %]</option> >+ [% ELSIF ( budget.b_active ) %] >+ <option value="[% budget.b_id | html %]">[% budget.b_txt | html %]</option> > [% ELSE %] >- <option value="[% budgetsloo.budget_id | html %]">[% budgetsloo.budget_name | html %]</option> >+ <option value="[% budget.b_id | html %]" class="b_inactive">[% budget.b_txt | html %] (inactive)</option> > [% END %] > [% END %] > </select> >+ <label for="showallfunds" style="float:none;width:auto;"> Show inactive:</label> >+ <input type="checkbox" class="showallfunds" /> > </li> > </ol> > </fieldset> <!-- /#acquisition_information --> >@@ -1325,6 +1328,20 @@ > }); > return 0; > } >+ >+ //keep a copy of all budgets before removing the inactives >+ var budgetId = $("#budgetid"); >+ var disabledBudgetsCopy = budgetId.html(); >+ $('.b_inactive').remove(); >+ >+ $('.showallfunds').click(function() { >+ if ($(this).is(":checked")) { >+ budgetId.html(disabledBudgetsCopy); //Puts back all the funds >+ } >+ else { >+ $('.b_inactive').remove(); >+ } >+ }); > </script> > > [% IF ( op == 'show' || op == 'else' ) %] >@@ -1483,19 +1500,6 @@ > $('#notify').prop('checked', false).prop('disabled', true); > }); > >- //keep a copy of all budgets before removing the inactives >- var budgetId = $("form#add_edit #budgetid"); >- var disabledBudgetsCopy = budgetId.html(); >- $('.b_inactive').remove(); >- >- $('#showallfunds').click(function() { >- if ($(this).is(":checked")) { >- budgetId.html(disabledBudgetsCopy); //Puts back all the funds >- } >- else { >- $('.b_inactive').remove(); >- } >- }); > > }); > </script> >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index 4ee69957f03..3c68cf1384c 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -470,21 +470,6 @@ $template->param( returnsuggestedby => $returnsuggestedby ); > my $patron_reason_loop = GetAuthorisedValues("OPAC_SUG"); > $template->param(patron_reason_loop=>$patron_reason_loop); > >-# Budgets for filtering >-my $budgets = GetBudgets; >-my @budgets_loop; >-foreach my $budget ( @{$budgets} ) { >- next unless (CanUserUseBudget($borrowernumber, $budget, $userflags)); >- >- ## Please see file perltidy.ERR >- $budget->{'selected'} = 1 >- if ($$suggestion_ref{'budgetid'} >- && $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'}); >- >- push @budgets_loop, $budget; >-} >-$template->param( budgetsloop => \@budgets_loop); >- > # Budgets for suggestion add or edition > my $sugg_budget_loop = []; > my $sugg_budgets = GetBudgetHierarchy(); >-- >2.39.2
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 37246
:
168459
|
168464
|
168556
|
168557