From 3898662932f910f32ded8c16004dbf284f98482b Mon Sep 17 00:00:00 2001 From: Christophe Croullebois Date: Tue, 26 Oct 2010 10:24:22 +0200 Subject: [PATCH] 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". --- C4/Budgets.pm | 15 ++++--- acqui/neworderempty.pl | 1 + .../prog/en/modules/acqui/neworderempty.tmpl | 40 ++++++++++++++++++- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/C4/Budgets.pm b/C4/Budgets.pm index 0882756..2d86d07 100644 --- a/C4/Budgets.pm +++ b/C4/Budgets.pm @@ -487,14 +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)|; + + # show only period X if requested my @where_strings; # Pick out the active ones push @where_strings, 'aqbudgetperiods.budget_period_active=1'; diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index 0ba7180..e6ceccc 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 76f5a3f..60d0c30 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tmpl @@ -64,7 +64,39 @@ ff.submit(); } - +$(document).ready(function() + { + //We apply the fonction only for modify option + + $('#quantity').blur(function() + { + // if user decreases the quantity + if($(this).val() < ) + { + alert("You have deleted item(s) in the order, don't forget to delete it(them) in the catalog"); + return true; + } + else + { + // if user increases the quantity + alert("You can't add a new item, please create a new order line"); + // and we replace the original value + $(this).val() + return false; + } + }); + + + $('#showallbudgets').click(function() { + if ( $('#budget_id .b_inactive').is(":visible") ) + { + $('#budget_id .b_inactive').hide(); + } + else { + $('#budget_id .b_inactive').show(); + } + }); + }); //]]> @@ -273,11 +305,13 @@ ff.submit(); - + + + - +  Show all :
  • -- 1.7.1