Bugzilla – Attachment 3697 Details for
Bug 6069
Multiple level budget list on suggestions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch
0001-BZ6069-Multiple-level-budget-list-on-suggestions.patch (text/plain), 9.12 KB, created by
Paul Poulain
on 2011-04-05 14:25:43 UTC
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Paul Poulain
Created:
2011-04-05 14:25:43 UTC
Size:
9.12 KB
patch
obsolete
>From ec665f09fdf788e7f26d13fc0281328fd7910346 Mon Sep 17 00:00:00 2001 >From: Paul Poulain <paul.poulain@biblibre.com> >Date: Tue, 5 Apr 2011 16:25:21 +0200 >Subject: [PATCH] BZ6069: Multiple level budget list on suggestions > >Librarians dealing with a suggestion have (and must have) access to all >budgets. >For a large library/network, it means the list can be huge and impossible to >deal with. >A possible solution would be to have multiple level lists : one for the top >level, then one for the 2nd level, that appears when the 1st level is choosen, >then one for the 3rd level (if applicable) when the 2nd level is choosen. >--- > C4/Budgets.pm | 55 +++++++++++++++++++ > .../prog/en/modules/suggestion/suggestion.tmpl | 58 ++++++++++++++++++++ > suggestion/suggestion.pl | 11 ++++ > 3 files changed, 124 insertions(+), 0 deletions(-) > >diff --git a/C4/Budgets.pm b/C4/Budgets.pm >index d2010d0..7f01c88 100644 >--- a/C4/Budgets.pm >+++ b/C4/Budgets.pm >@@ -46,6 +46,10 @@ BEGIN { > > &GetBudgetPeriod > &GetBudgetPeriods >+ &GetBudgetFirstChild >+ &GetBudgetParent >+ &GetBudgetSecondChild >+ > &ModBudgetPeriod > &AddBudgetPeriod > &DelBudgetPeriod >@@ -464,6 +468,57 @@ sub GetBudgetPeriod { > } > > # ------------------------------------------------------------------- >+sub GetBudgetFirstChild { >+ my $dbh = C4::Context->dbh; >+ my $query = "SELECT * >+ FROM `aqbudgets` >+ WHERE budget_parent_id >+ IN ( >+ SELECT budget_id FROM `aqbudgets` >+ JOIN `aqbudgetperiods` ON aqbudgets.budget_period_id = aqbudgetperiods.budget_period_id >+ WHERE ((`budget_parent_id` IS NULL)AND (`budget_period_active` LIKE 1))) >+ ORDER BY `aqbudgets`.`budget_parent_id`, budget_name ASC"; >+ my $sth= $dbh->prepare($query); >+ $sth->execute(); >+ my $data = $sth->fetchall_arrayref({}); >+ return $data; >+} >+# ------------------------------------------------------------------- >+sub GetBudgetParent { >+ my $dbh = C4::Context->dbh; >+ my $query = "SELECT * >+ FROM `aqbudgets` >+ JOIN `aqbudgetperiods` ON aqbudgets.budget_period_id = aqbudgetperiods.budget_period_id >+ WHERE ((`budget_parent_id` IS NULL)AND (`budget_period_active` LIKE 1)) >+ ORDER BY `aqbudgets`.`budget_id`, budget_name ASC"; >+ my $sth= $dbh->prepare($query); >+ $sth->execute(); >+ my $data = $sth->fetchall_arrayref({}); >+ return $data; >+} >+# ------------------------------------------------------------------- >+sub GetBudgetSecondChild { >+ my $dbh = C4::Context->dbh; >+ my $query = "SELECT * >+ FROM `aqbudgets` >+ WHERE budget_parent_id >+ IN ( >+ SELECT budget_id >+ FROM `aqbudgets` >+ WHERE budget_parent_id >+ IN ( >+ SELECT budget_id >+ FROM `aqbudgets` >+ JOIN `aqbudgetperiods` ON aqbudgets.budget_period_id = aqbudgetperiods.budget_period_id >+ WHERE ((`budget_parent_id` IS NULL)AND (`budget_period_active` LIKE 1)))) >+ ORDER BY `aqbudgets`.`budget_parent_id` , budget_name ASC"; >+ my $sth= $dbh->prepare($query); >+ $sth->execute(); >+ my $data = $sth->fetchall_arrayref({}); >+ return $data; >+} >+# ------------------------------------------------------------------- >+ > sub DelBudgetPeriod{ > my ($budget_period_id) = @_; > my $dbh = C4::Context->dbh; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl >index 3d7817e..d085062 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tmpl >@@ -87,6 +87,56 @@ $(document).ready(function() { calcNewsuggTotal(); }); > </script> > <!--/TMPL_IF--> > <script type="text/javascript" src="<!-- TMPL_VAR NAME='themelang' -->/js/acq.js"></script> >+<script type="text/javascript"> >+// <![CDATA[ >+ $(document).ready(function() { >+ $('#sub_budgetid').hide(); >+ $('#su_sub_budgetid').hide(); >+ $("#budgetid").val("").attr('selected', 'selected'); >+ >+ $('#budgetid').change(function() { >+ var budget= $('#budgetid').val(); >+ >+ if (budget ==""){ >+ $('#sub_budgetid').hide(); >+ $('#su_sub_budgetid').hide(); >+ $('#sub_budgetid option:visible').hide(); >+ $('#su_sub_budgetid option:visible').hide(); >+ $("#sub_budgetid").val("").attr('selected', 'selected'); >+ $("#su_sub_budgetid").val("").attr('selected', 'selected'); >+ } >+ else { >+ $('#sub_budgetid').show(); >+ $('#sub_budgetid option:visible').hide(); >+ $('.'+budget).show(); >+ $('#a').show(); >+ $("#sub_budgetid").val("").attr('selected', 'selected'); >+ $('#su_sub_budgetid option:visible').hide(); >+ $('#su_sub_budgetid').hide(); >+ } >+ }); >+ >+ $('#sub_budgetid').change(function() { >+ var subbudget= $('#sub_budgetid').val(); >+ >+ if (subbudget ==""){ >+ $('#su_sub_budgetid').hide(); >+ $("#su_sub_budgetid").val("").attr('selected', 'selected'); >+ $("#sub_budgetid").val("").attr('selected', 'selected'); >+ >+ } >+ else { >+ $('#su_sub_budgetid').show(); >+ $('#su_sub_budgetid option:visible').hide(); >+ $('.'+subbudget).show(); >+ $('#b').show(); >+ $("#su_sub_budgetid").val("").attr('selected', 'selected'); >+ } >+ }); >+ }); >+// ]]> >+</script> >+ > </head> > <body> > <!-- TMPL_INCLUDE name="header.inc" --> >@@ -169,6 +219,14 @@ $(document).ready(function() { calcNewsuggTotal(); }); > <option value="">Any</option><!-- TMPL_LOOP name="budgetsloop" --> > <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="budget_id" -->" selected="selected"><!-- TMPL_VAR name="budget_name" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="budget_id" -->"><!-- TMPL_VAR name="budget_name" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP --> > </select> >+ <select name="sub_budgetid" id="sub_budgetid" > >+ <option value="" id="a">Any</option><!-- TMPL_LOOP name="sub_budgetsloop" --> >+ <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="budget_id" -->" selected="selected" class="<!-- TMPL_VAR name="budget_parent_id" -->" style ="display : none;"><!-- TMPL_VAR name="budget_name" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="budget_id" -->" class="<!-- TMPL_VAR name="budget_parent_id" -->" style ="display : none;" ><!-- TMPL_VAR name="budget_name" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP --> >+ </select> >+ <select name="su_sub_budgetid" id="su_sub_budgetid"> >+ <option value="" id="b">Any</option><!-- TMPL_LOOP name="su_sub_budgetsloop" --> >+ <!-- TMPL_IF NAME="selected" --><option value="<!-- TMPL_VAR name="budget_id" -->" selected="selected" class="<!-- TMPL_VAR name="budget_parent_id" -->" style ="display : none;"><!-- TMPL_VAR name="budget_name" --></option><!-- TMPL_ELSE --><option value="<!-- TMPL_VAR name="budget_id" -->" class="<!-- TMPL_VAR name="budget_parent_id" -->" style ="display : none;"><!-- TMPL_VAR name="budget_name" --></option><!-- /TMPL_IF --><!-- /TMPL_LOOP --> >+ </select> > </li><li><label for="quantity">Copies:</label> > <input type="text" size="10" id="quantity" name="quantity" value="<!-- TMPL_VAR name="quantity" -->" onchange="calcNewsuggTotal();" /> > </li><li><label for="currency">Currency:</label> >diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl >index aa8fad0..388a90b 100755 >--- a/suggestion/suggestion.pl >+++ b/suggestion/suggestion.pl >@@ -84,6 +84,10 @@ my $tabcode = $input->param('tabcode'); > my $suggestion_ref = $input->Vars; > > delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field ); >+ >+$suggestion_ref->{'budgetid'} = $suggestion_ref->{'su_sub_budgetid'}||$suggestion_ref->{'sub_budgetid'}||$suggestion_ref->{'budgetid'}; >+delete $$suggestion_ref{$_} foreach qw( suggestedbyme op displayby tabcode edit_field sub_budgetid su_sub_budgetid); >+ > foreach (keys %$suggestion_ref){ > delete $$suggestion_ref{$_} if (!$$suggestion_ref{$_} && ($op eq 'else' || $op eq 'change')); > } >@@ -294,8 +298,15 @@ my $budgets = GetBudgets($searchbudgets); > foreach my $budget (@$budgets){ > $budget->{'selected'}=1 if ($$suggestion_ref{'budgetid'} && $budget->{'budget_id'} eq $$suggestion_ref{'budgetid'}) > }; >+my $bud = GetBudgetParent(); >+my $subbud = GetBudgetFirstChild(); >+my $susubbud = GetBudgetSecondChild(); > > $template->param( budgetsloop => $budgets); >+$template->param( budgetsloop => $bud ); >+$template->param( sub_budgetsloop => $subbud ); >+$template->param( su_sub_budgetsloop => $susubbud ); >+ > $template->param( "statusselected_$$suggestion_ref{'STATUS'}" =>1); > > # get currencies and rates >-- >1.7.1 >
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 6069
:
3697
|
4797
|
4858
|
4859