Bugzilla – Attachment 26957 Details for
Bug 7180
Order from staged file improvements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7180: Adapt neworderempty code (js function moved).
Bug-7180-Adapt-neworderempty-code-js-function-move.patch (text/plain), 8.17 KB, created by
Jonathan Druart
on 2014-04-10 07:46:47 UTC
(
hide
)
Description:
Bug 7180: Adapt neworderempty code (js function moved).
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-04-10 07:46:47 UTC
Size:
8.17 KB
patch
obsolete
>From 6f04e28bb448d4cfdd5ebdae53c1c4b411c94877 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 10 Sep 2013 10:31:11 +0200 >Subject: [PATCH] Bug 7180: Adapt neworderempty code (js function moved). > >The js function fetchSortDropbox has been deleted in previous patch. >The new function is getAuthValueDropbox. > >Test plan: >- link some av to some funds >- open an existing order and verify value are correctly filled in the > sort1 and sort2 values >- create a new order and verify behavior is the same as before > >Note: This patch generates 2 ajax queries (max) if the budget is linked >to 2 av categories for sort1 and sort2. This could be improved using a >template plugin for values display on load. > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > acqui/neworderempty.pl | 35 ++---------- > .../prog/en/modules/acqui/neworderempty.tt | 59 ++++++++------------ > 2 files changed, 28 insertions(+), 66 deletions(-) > >diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl >index 9fdf032..3947431 100755 >--- a/acqui/neworderempty.pl >+++ b/acqui/neworderempty.pl >@@ -262,6 +262,8 @@ foreach my $r (@{$budgets}) { > push @{$budget_loop}, { > b_id => $r->{budget_id}, > b_txt => $r->{budget_name}, >+ b_sort1_authcat => $r->{'sort1_authcat'}, >+ b_sort2_authcat => $r->{'sort2_authcat'}, > b_active => $r->{budget_period_active}, > b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0, > }; >@@ -276,37 +278,8 @@ if ($close) { > > } > >-my $CGIsort1; >-if ($budget) { # its a mod .. >- if ( defined $budget->{'sort1_authcat'} ) { # with custom Asort* planning values >- $CGIsort1 = GetAuthvalueDropbox( $budget->{'sort1_authcat'}, $data->{'sort1'} ); >- } >-} elsif(@{$budgets}){ >- $CGIsort1 = GetAuthvalueDropbox( @$budgets[0]->{'sort1_authcat'}, '' ); >-} >- >-# if CGIsort is successfully fetched, the use it >-# else - failback to plain input-field >-if ($CGIsort1) { >- $template->param( CGIsort1 => $CGIsort1 ); >-} else { >- $template->param( sort1 => $data->{'sort1'} ); >-} >- >-my $CGIsort2; >-if ($budget) { >- if ( defined $budget->{'sort2_authcat'} ) { >- $CGIsort2 = GetAuthvalueDropbox( $budget->{'sort2_authcat'}, $data->{'sort2'} ); >- } >-} elsif(@{$budgets}) { >- $CGIsort2 = GetAuthvalueDropbox( @$budgets[0]->{sort2_authcat}, '' ); >-} >- >-if ($CGIsort2) { >- $template->param( CGIsort2 => $CGIsort2 ); >-} else { >- $template->param( sort2 => $data->{'sort2'} ); >-} >+$template->param( sort1 => $data->{'sort1'} ); >+$template->param( sort2 => $data->{'sort2'} ); > > if (C4::Context->preference('AcqCreateItem') eq 'ordering' && !$ordernumber) { > # Check if ACQ framework exists >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 596aa07..0992dd1 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -141,6 +141,24 @@ $(document).ready(function() > $('#budget_id .b_inactive').remove(); > } > }); >+ >+ $("#budget_id").change(function(){ >+ var destination_sort1 = $(this).parents('fieldset.rows').find('input[name="sort1"]'); >+ var sort1_authcat = $(this).find("option:selected").attr('data-sort1-authcat'); >+ var sort1 = $(destination_sort1).val() || ""; >+ if ( destination_sort1.length < 1 ) { >+ destination_sort1 = $(this).parents('fieldset.rows').find('select[name="sort1"]'); >+ } >+ var destination_sort2 = $(this).parents('fieldset.rows').find('input[name="sort2"]'); >+ var sort2_authcat = $(this).find("option:selected").attr('data-sort2-authcat'); >+ var sort2 = $(destination_sort2).val() || ""; >+ if ( destination_sort2.length < 1 ) { >+ destination_sort2 = $(this).parents('fieldset.rows').find('select[name="sort2"]'); >+ } >+ getAuthValueDropbox( 'sort1', sort1_authcat, destination_sort1, sort1 ); >+ getAuthValueDropbox( 'sort2', sort2_authcat, destination_sort2, sort2 ); >+ }); >+ $("#budget_id").change(); > }); > //]]> > </script> >@@ -414,14 +432,14 @@ $(document).ready(function() > <input type="hidden" name="budget_id" id="budget_id" value="[% budget_id %]" />[% Budget_name %] > [% ELSE %] > <label class="required" for="budget_id">Fund: </label> >- <select id="budget_id" onchange="fetchSortDropbox(this.form)" size="1" name="budget_id"> >+ <select id="budget_id" size="1" name="budget_id"> > <option value="">Select a fund</option> > [% FOREACH budget_loo IN budget_loop %] > [% IF ( budget_loo.b_sel ) %] >- <option value="[% budget_loo.b_id %]" selected="selected">[% budget_loo.b_txt %]</option> >+ <option value="[% budget_loo.b_id %]" selected="selected" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option> > [% ELSE %] >- [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]">[% budget_loo.b_txt %]</option> >- [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive">[% budget_loo.b_txt %] (inactive)</option> >+ [% IF ( budget_loo.b_active ) %]<option value="[% budget_loo.b_id %]" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %]</option> >+ [% ELSE %]<option value="[% budget_loo.b_id %]" class="b_inactive" data-sort1-authcat="[% budget_loo.b_sort1_authcat %]" data-sort2-authcat="[% budget_loo.b_sort2_authcat %]">[% budget_loo.b_txt %] (inactive)</option> > [% END %] > [% END %] > [% END %] >@@ -540,39 +558,10 @@ $(document).ready(function() > </li> > <li><div class="hint">The 2 following fields are available for your own usage. They can be useful for statistical purposes</div> > <label for="sort1">Statistic 1: </label> >- <span id="sort1_zone"> >- [% IF CGIsort1 %] >- <select id="sort1" size="1" name="sort1"> >- [% FOREACH sort_opt IN CGIsort1 %] >- [% IF sort_opt.default %] >- <option value="[% sort_opt.value %]" selected="selected">[% sort_opt.label %]</option> >- [% ELSE %] >- <option value="[% sort_opt.value %]">[% sort_opt.label %]</option> >- [% END %] >- [% END %] >- </select> >- [% ELSE %] >- <input type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" /> >- [% END %] >- </span> >- </li> >+ <input id="sort1" type="text" id="sort1" size="20" name="sort1" value="[% sort1 %]" /> > <li> > <label for="sort2">Statistic 2: </label> >- <span id="sort2_zone"> >- [% IF CGIsort2 %] >- <select id="sort2" size="1" name="sort2"> >- [% FOREACH sort_opt IN CGIsort2 %] >- [% IF sort_opt.default %] >- <option value="[% sort_opt.value %]" selected="selected">[% sort_opt.label %]</option> >- [% ELSE %] >- <option value="[% sort_opt.value %]">[% sort_opt.label %]</option> >- [% END %] >- [% END %] >- </select> >- [% ELSE %] >- <input type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" /> >- [% END %] >- </span> >+ <input id="sort2" type="text" id="sort2" size="20" name="sort2" value="[% sort2 %]" /> > </li> > </ol> > </fieldset> >-- >1.7.10.4
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 7180
:
6234
|
13019
|
15023
|
15048
|
15617
|
15677
|
15934
|
15935
|
16014
|
16505
|
16511
|
16544
|
16566
|
16613
|
19066
|
19067
|
19068
|
19316
|
19587
|
19588
|
19589
|
19590
|
19641
|
19645
|
20900
|
20901
|
20902
|
20903
|
20904
|
20926
|
20933
|
20934
|
20935
|
20978
|
20979
|
21004
|
21014
|
21017
|
21117
|
21462
|
21463
|
21464
|
21465
|
21466
|
21467
|
21468
|
21469
|
21470
|
21471
|
21472
|
21473
|
21474
|
21514
|
22546
|
22547
|
22548
|
22549
|
22550
|
22551
|
22552
|
22553
|
22554
|
22555
|
22556
|
22557
|
22558
|
22559
|
24052
|
24053
|
24054
|
24055
|
24056
|
24057
|
24058
|
24059
|
24060
|
24061
|
24062
|
24063
|
24064
|
24065
|
24636
|
24637
|
24638
|
24639
|
24640
|
24641
|
24642
|
24643
|
24644
|
24645
|
24646
|
24647
|
24648
|
24649
|
24708
|
24709
|
24710
|
24711
|
24712
|
24713
|
24714
|
24715
|
24716
|
24717
|
24718
|
24719
|
24720
|
24721
|
25908
|
26950
|
26951
|
26952
|
26953
|
26954
|
26955
|
26956
|
26957
|
26958
|
26959
|
26960
|
26961
|
26962
|
26963
|
26964
|
27128
|
27131
|
27136
|
27160
|
27325
|
27408
|
27409
|
27410
|
27411
|
27412
|
27413
|
27414
|
27415
|
27416
|
27417
|
27418
|
27419
|
27420
|
27421
|
27422
|
27423
|
27424
|
27451
|
27520
|
27561
|
27562
|
27563
|
27564
|
27565
|
27566
|
27567
|
27568
|
27569
|
27570
|
27571
|
27572
|
27573
|
27574
|
27575
|
27576
|
27577
|
27578
|
27829
|
27830
|
27831
|
27832
|
27833
|
27834
|
27835
|
27836
|
27837
|
27838
|
27839
|
27840
|
27841
|
27842
|
27843
|
27844
|
27845
|
27846
|
27847
|
27848
|
27849
|
27850
|
27851
|
27852
|
27853
|
27854
|
27855
|
27856
|
27857
|
27858
|
27859
|
27860
|
27861
|
27862
|
27863
|
27864
|
27865
|
27866