[Koha-patches] [PATCH] (BUG #4360) aqbudgets.pl: Adding the hierarchy of budgets in the tooltip

Alex Arnaud alex.arnaud at biblibre.com
Thu Apr 1 13:53:55 CEST 2010


---
 admin/aqbudgets.pl                                 |   13 +++++++++++++
 .../intranet-tmpl/prog/en/css/staff-global.css     |   18 +++++++++++++++++-
 .../prog/en/modules/admin/aqbudgets.tmpl           |   14 +++++++++++++-
 3 files changed, 43 insertions(+), 2 deletions(-)

diff --git a/admin/aqbudgets.pl b/admin/aqbudgets.pl
index 8d7bab7..8c6d2b4 100755
--- a/admin/aqbudgets.pl
+++ b/admin/aqbudgets.pl
@@ -298,8 +298,21 @@ if ($op eq 'add_form') {
         $budget->{"budget_owner_name"}     = $borrower->{'firstname'} . ' ' . $borrower->{'surname'};
         $budget->{"budget_borrowernumber"} = $borrower->{'borrowernumber'};
 
+        #Make a list of parents of the bugdet
+        my @budget_hierarchy;
+        push  @budget_hierarchy, { element_name => $budget->{"budget_name"}, element_id => $budget->{"budget_id"} };
+        my $parent_id = $budget->{"budget_parent_id"};
+        while ($parent_id) {
+            my $parent = GetBudget($parent_id);
+            push @budget_hierarchy, { element_name => $parent->{"budget_name"}, element_id => $parent->{"budget_id"} };
+            $parent_id = $parent->{"budget_parent_id"};
+        }
+        push  @budget_hierarchy, { element_name => $period->{"budget_period_description"} }; 
+        @budget_hierarchy = reverse(@budget_hierarchy);
+
         push( @loop, {  %{$budget},
                         branchname  => $branches->{ $budget->{branchcode} }->{branchname},
+                        budget_hierarchy => \@budget_hierarchy,
                     }
         );
     }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
index 190c9da..9b14fed 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -1864,4 +1864,20 @@ img.spinner {
 }
 #cataloguing_additem_itemlist div {
 	overflow : scroll;
-}
\ No newline at end of file
+}
+ul.budget_hierarchy {
+    margin-left: 0px;
+    padding-left: 0px;
+}
+ul.budget_hierarchy li {
+    display: inline;
+}
+ul.budget_hierarchy li:after {
+    content: " -> ";
+}
+ul.budget_hierarchy li:last-child:after {
+    content: "";
+}
+ul.budget_hierarchy li:first-child:after {
+    content: "";
+}
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl
index baf13ea..fdb7410 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl
@@ -198,7 +198,19 @@
     <!-- TMPL_IF NAME="remaining_neg" --> style="color: red;" <!-- /TMPL_IF -->   >
     <!-- TMPL_VAR NAME="budget_remaining" --> </td>
 
-    <td class="tooltipcontent"><!-- TMPL_IF NAME="budget_owner_id" --><strong>Owner: </strong><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="budget_owner_id" -->"><!-- TMPL_VAR NAME="budget_owner_name" --></a><!-- /TMPL_IF --><!-- TMPL_IF NAME="budget_branchcode" --><br /><strong>Library: </strong><!-- TMPL_VAR NAME="budget_branchcode" --><!-- /TMPL_IF --><!-- TMPL_IF NAME="budget_notes" --><br /><strong>Notes: </strong><!-- TMPL_VAR NAME="budget_notes" --><!-- /TMPL_IF --></td>
+    <td class="tooltipcontent"><!-- TMPL_IF NAME="budget_owner_id" --><strong>Owner: </strong><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=<!-- TMPL_VAR NAME="budget_owner_id" -->"><!-- TMPL_VAR NAME="budget_owner_name" --></a><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="budget_branchcode" --><br /><strong>Library: </strong><!-- TMPL_VAR NAME="budget_branchcode" --><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="budget_notes" --><br /><strong>Notes: </strong><!-- TMPL_VAR NAME="budget_notes" --><!-- /TMPL_IF -->
+        <!-- TMPL_IF NAME="budget_hierarchy" -->
+            <ul class="budget_hierarchy"><!-- TMPL_LOOP name="budget_hierarchy" -->
+                <!-- TMPL_IF NAME="element_id" -->
+                    <li><a href="?op=add_form&budget_id=<!-- TMPL_VAR NAME="element_id" -->&budget_period_id=<!-- TMPL_VAR NAME="budget_period_id" -->"><!-- TMPL_VAR NAME="element_name" --></a></li>
+                <!-- TMPL_ELSE -->
+                    <li><strong><!-- TMPL_VAR NAME="element_name" --> : </strong></li>
+                <!-- /TMPL_IF -->
+                <!-- /TMPL_LOOP -->
+            </ul>
+        <!-- /TMPL_IF --></td>
     <!-- TMPL_IF NAME="budget_lock"-->
         <td> <span style="color: gray;" > Edit Delete </span> </td>
     <!-- TMPL_ELSE -->
-- 
1.6.3.3




More information about the Koha-patches mailing list