diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 9d3e94b304..d2010d06a4 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -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 = ?"; diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 0ba7180ea0..e6ceccc9ea 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -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, }; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl index 2cdc1ff581..e2895c6a72 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl @@ -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() } }); + + $('#showallbudgets').click(function() { + if ( $('#budget_id .b_inactive').is(":visible") ) + { + $('#budget_id .b_inactive').hide(); + } + else { + $('#budget_id .b_inactive').show(); + } + }); }); //]]> @@ -302,10 +313,14 @@ $(document).ready(function() - + + + + +