Bug 5963 : Add the ability to filter budgets using the active column

(MT #4717) Add the capability to have a filter by active budget

the sub GetBudgetHierarchy return aqbudgetperiods.budget_period_active to have acces to a new filtering way,
 more the neworderempty.pl page have a check box "shox all".

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Bug 5963: Modify GetBudgetsHierarchy to returns all funds

GetBudgetHierarchy now returns all funds, not only those that are part
of an active budget.
Fixed a layout problem.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Christophe Croullebois 2011-04-04 11:44:06 +02:00 committed by Chris Cormack
parent 1f323c00a1
commit 6a7470341a
3 changed files with 24 additions and 10 deletions

View file

@ -487,17 +487,15 @@ sub ModBudgetPeriod {
# -------------------------------------------------------------------
sub GetBudgetHierarchy {
my ($budget_period_id, $branchcode, $owner) = @_;
my @bind_params;
my $dbh = C4::Context->dbh;
my $query = qq|
SELECT aqbudgets.*
my ( $budget_period_id, $branchcode, $owner ) = @_;
my @bind_params;
my $dbh = C4::Context->dbh;
my $query = qq|
SELECT aqbudgets.*, aqbudgetperiods.budget_period_active
FROM aqbudgets
LEFT JOIN aqbudgetperiods
ON aqbudgetperiods.budget_period_id=aqbudgets.budget_period_id |;
JOIN aqbudgetperiods USING (budget_period_id)|;
my @where_strings;
# Pick out the active ones
push @where_strings, 'aqbudgetperiods.budget_period_active=1';
# show only period X if requested
if ($budget_period_id) {
push @where_strings," aqbudgets.budget_period_id = ?";

View file

@ -263,6 +263,7 @@ foreach my $r (@{$budgets}) {
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,
};
}

View file

@ -68,6 +68,7 @@ if (ok) {
ff.submit();
}
$(document).ready(function()
{
//We apply the fonction only for modify option
@ -90,6 +91,16 @@ $(document).ready(function()
}
});
<!-- /TMPL_IF -->
$('#showallbudgets').click(function() {
if ( $('#budget_id .b_inactive').is(":visible") )
{
$('#budget_id .b_inactive').hide();
}
else {
$('#budget_id .b_inactive').show();
}
});
});
//]]>
</script>
@ -302,10 +313,14 @@ $(document).ready(function()
<!-- TMPL_IF NAME="b_sel" -->
<option value="<!-- TMPL_VAR NAME='b_id' -->" selected="selected"><!-- TMPL_VAR NAME="b_txt" --></option>
<!-- TMPL_ELSE -->
<option value="<!-- TMPL_VAR NAME='b_id' -->"><!-- TMPL_VAR NAME="b_txt" --></option>
<!-- TMPL_IF NAME="b_active" --><option value="<!-- TMPL_VAR NAME='b_id' -->"><!-- TMPL_VAR NAME="b_txt" --></option>
<!-- TMPL_ELSE --><option value="<!-- TMPL_VAR NAME='b_id' -->" class="b_inactive" style="display : none;"><!-- TMPL_VAR NAME="b_txt" --></option>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</select>
<label for="showallbudgets" style="float:none;width:auto;">&nbsp;Show all:</label>
<input type="checkbox" id="showallbudgets" />
<!--/TMPL_IF-->
</li>
<li>