[Koha-bugs] [Bug 7435] An inactive fund is selected a default in neworderempty.pl
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Jan 16 18:04:40 CET 2012
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7435
Fred P <fred.pierre at smfpl.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fred.pierre at smfpl.org
--- Comment #4 from Fred P <fred.pierre at smfpl.org> 2012-01-16 17:04:40 UTC ---
Displaying the inactive funds in red interferes with the display:none setting.
The problem can be solved by option-grouping the selection list. A secondary
problem also exists that the Show All checkbox can display the full list, but
not un-display it. The javascript is buggy and prevents re-hiding the inactive
items. Here is an effective patch:
-----------------------------------------------------------
File: neworderempty.pl
Near Line 263:
-----------------------------------------------------------
my $budget_loop = [];
my $inactive_budget_loop = [];
my $budgets =
GetBudgetHierarchy(q{},$borrower->{branchcode},$borrower->{borrowernumber});
foreach my $r (@{$budgets}) {
if (!defined $r->{budget_amount} || $r->{budget_amount} == 0) {
next;
}
if($r->{budget_period_active}){
push @{$budget_loop}, {
b_id => $r->{budget_id},
b_txt => $r->{budget_name},
b_active => $r->{budget_period_active},
b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
};
}else{
push @{$inactive_budget_loop}, {
b_id => $r->{budget_id},
b_txt => $r->{budget_name},
b_active => $r->{budget_period_active},
b_sel => ( $r->{budget_id} == $budget_id ) ? 1 : 0,
};
}
}
if ($close) {
$budget_id = $data->{'budget_id'};
$budget_name = $budget->{'budget_name'};
}
-----------------------------------------------------------
Near Line 392:
-----------------------------------------------------------
budget_loop => $budget_loop,
inactive_budget_loop => $inactive_budget_loop,
isbn => $data->{'isbn'},
-----------------------------------------------------------
THAT FIXES THE JAVASCRIPT for the Checkbox "Show All"
Next we create the Option Groups in the Select Drop-Down:
-----------------------------------------------------------
File: neworderempty.tt
Near Line 95:
-----------------------------------------------------------
$('#showallbudgets').click(function() {
if ( $('#inactive_funds .b_inactive').is(":visible") )
{
$('#inactive_funds').attr("disabled","disabled");
$('#inactive_funds .b_inactive').hide();
}
else {
$('#inactive_funds').attr("disabled","");
$('#inactive_funds .b_inactive').show();
}
});
-----------------------------------------------------------
Near Line 333:
-----------------------------------------------------------
<label for="budget_id">Fund: </label>
<select id="budget_id" onchange="fetchSortDropbox(this.form)"
size="1" name="budget_id">
<optgroup label="active funds">
[% IF !(budget_id) %]<option value='0' >Select Fund</option> [% END %]
[% FOREACH budget_loo IN budget_loop %]
[% IF ( budget_loo.b_sel ) %]
<option value="[% budget_loo.b_id %]"
selected="selected">[% 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" style="display : none; color:red;" >[% budget_loo.b_txt
%]</option>
[% END %]
[% END %]
[% END %]
</optgroup>
<optgroup label="inactive funds" id="inactive_funds" disabled="disabled">
[% FOREACH inactive_budget_loo IN inactive_budget_loop %]
[% IF ( inactive_budget_loo.b_sel ) %]
<option value="[% inactive_budget_loo.b_id %]"
selected="selected">[% inactive_budget_loo.b_txt %]</option>
[% ELSE %]
[% IF ( inactive_budget_loo.b_active ) %]<option
value="[% inactive_budget_loo.b_id %]">[% inactive_budget_loo.b_txt %]</option>
[% ELSE %]<option value="[% inactive_budget_loo.b_id %]"
class="b_inactive" style="display : none;" >[% inactive_budget_loo.b_txt
%]</option>
[% END %]
[% END %]
[% END %]
</optgroup>
</select>
----------------------------------------------------------------
On my system, Chrome displays only two lines of the drop-down,
both before and after the fix, so I use Firefox for testing this.
--
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.
More information about the Koha-bugs
mailing list