koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha updater/updatedatabase koha-tmpl/intranet-...


From: Pierrick LE GALL
Subject: [Koha-cvs] koha updater/updatedatabase koha-tmpl/intranet-...
Date: Thu, 13 Apr 2006 08:36:42 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         
Changes by:     Pierrick LE GALL <address@hidden>       06/04/13 08:36:42

Modified files:
        updater        : updatedatabase 
        koha-tmpl/intranet-tmpl/prog/en/admin: aqbudget.tmpl 
                                               aqbookfund.tmpl 
        admin          : aqbudget.pl aqbookfund.pl 
        C4             : Date.pm 

Log message:
        new: function C4::Date::get_date_format_string_for_DHTMLcalendar based 
on
        the system preference prefered date format.
        
        improvement: book fund list and budget list screen redesigned. Filters 
on
        each field. Columns are not sortable yet. Using DHTML Calendar to fill 
date
        fields instead of manual filling. Pagination system. From the book fund
        list, you can reach the budget list, filtered on a book fund, or not. A
        budget can be added only from book fund list screen.
        
        bug fixed: branchcode was missing in table aqbudget.
        
        bug fixed: when setting a branchcode to a book fund, all associated 
budgets
        move to this branchcode.
        
        modification: when adding/modifying budget/fund, MySQL specific 
"REPLACE..."
        statements replaced by standard SQL compliant statement.
        
        bug fixed: when adding/modifying a budget, if the book fund is 
associated to
        a branch, the branch selection is disabled and set to the book fund 
branch.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/updater/updatedatabase.diff?tr1=1.132&tr2=1.133&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbudget.tmpl.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbookfund.tmpl.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/admin/aqbudget.pl.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/admin/aqbookfund.pl.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Date.pm.diff?tr1=1.13&tr2=1.14&r1=text&r2=text

Patches:
Index: koha/C4/Date.pm
diff -u koha/C4/Date.pm:1.13 koha/C4/Date.pm:1.14
--- koha/C4/Date.pm:1.13        Tue Apr  8 11:30:55 2003
+++ koha/C4/Date.pm     Thu Apr 13 08:36:42 2006
@@ -18,6 +18,7 @@
              &display_date_format
              &format_date
              &format_date_in_iso
+             get_date_format_string_for_DHTMLcalendar
 );
 
 
@@ -50,6 +51,25 @@
        }
 }
 
+sub get_date_format_string_for_DHTMLcalendar {
+    my $dateformat = get_date_format();
+
+    if ($dateformat eq 'us') {
+        return '%m/%d/%Y';
+    }
+    elsif ($dateformat eq 'metric') {
+        return '%d/%m/%Y';
+    }
+    elsif ($dateformat eq "iso") {
+        return '%Y-%m-%d';
+    }
+    else {
+        return
+            'Invalid date format: '.$dateformat.'.'
+            .' Please change in system preferences';
+    }
+}
+
 
 sub format_date
 {
Index: koha/admin/aqbookfund.pl
diff -u koha/admin/aqbookfund.pl:1.25 koha/admin/aqbookfund.pl:1.26
--- koha/admin/aqbookfund.pl:1.25       Fri Feb 24 11:15:01 2006
+++ koha/admin/aqbookfund.pl    Thu Apr 13 08:36:42 2006
@@ -39,6 +39,9 @@
 
 use strict;
 use CGI;
+use HTML::Template;
+use List::Util qw/min/;
+
 use C4::Auth;
 use C4::Koha;
 use C4::Context;
@@ -47,60 +50,33 @@
 use C4::Interface::CGI::Output;
 use C4::Search;
 use C4::Date;
-use HTML::Template;
-
-sub StringSearch  {
-       my ($env,$searchstring,$branches)address@hidden;
-       my $dbh = C4::Context->dbh;
-       $searchstring=~ s/\'/\\\'/g;
-       my @data=split(' ',$searchstring);
-       my address@hidden;
-       my $strsth= "select bookfundid,bookfundname,bookfundgroup,branchcode 
from aqbookfund where bookfundname like ? ";
-       if ($branches){
-               $strsth.= "AND (aqbookfund.branchcode is null " ;
-               foreach my $branchcode (keys %$branches){
-                       $strsth .= "or aqbookfund.branchcode = 
'".$branchcode."' "; 
-               }
-               $strsth .= ") ";
-       }
-       $strsth.= "order by aqbookfund.bookfundid";
-#      warn "chaine de recherche : ".$strsth;
-       
-       my $sth=$dbh->prepare($strsth);
-       $sth->execute("%$data[0]%");
-       my @results;
-       while (my $data=$sth->fetchrow_hashref){
-               push(@results,$data);
-       }
-       #  $sth->execute;
-       $sth->finish;
-       return (scalar(@results),address@hidden);
-}
 
 my $dbh = C4::Context->dbh;
 my $input = new CGI;
-my $searchfield=$input->param('searchfield') || '';
-my $offset=$input->param('offset');
 my $script_name="/cgi-bin/koha/admin/aqbookfund.pl";
 my $bookfundid=$input->param('bookfundid');
-my $pagesize=20;
+my $pagesize = 10;
 my $op = $input->param('op') || '';
-$searchfield=~ s/\,//g;
 
 my ($template, $borrowernumber, $cookie)
-    = get_template_and_user({template_name => "admin/aqbookfund.tmpl",
-                            query => $input,
-                            type => "intranet",
-                            authnotrequired => 0,
-                            flagsrequired => {parameters => 1, management => 
1},
-                            debug => 1,
-                            });
+    = get_template_and_user(
+        {template_name => "admin/aqbookfund.tmpl",
+         query => $input,
+         type => "intranet",
+         authnotrequired => 0,
+         flagsrequired => {parameters => 1, management => 1},
+         debug => 1,
+     }
+    );
 
 if ($op) {
-$template->param(script_name => $script_name,
-               $op              => 1); # we show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
+    $template->param(
+        script_name => $script_name,
+        $op => 1,
+    ); # we show only the TMPL_VAR names $op
+}
+else {
+    $template->param(script_name => $script_name,
                else              => 1); # we show only the TMPL_VAR names $op
 }
 $template->param(action => $script_name);
@@ -110,40 +86,25 @@
 # my %select_branches;
 
 my $branches = getbranches;
-my @branchloop;
-foreach my $thisbranch (sort keys %$branches) {
-#      my $selected = 1 if $thisbranch eq $branch;
-       my %row =(value => $thisbranch,
-#                              selected => $selected,
-                               branchname => 
$branches->{$thisbranch}->{'branchname'},
-                       );
-       push @branchloop, \%row;
-#      $select_branches{$thisbranch} = 
$branches->{$thisbranch}->{'branchname'};
-}
-
-# my $homebranch=C4::Context->userenv->{branch};
-# for (my $i=0;$i<$count2;$i++){
-#      push @select_branch, $branches[$i]->{'branchcode'};#
-#      $select_branches{$branches[$i]->{'branchcode'}} = 
$branches[$i]->{'branchname'};
-# }
-# 
-# my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
-#                      -values   => address@hidden,
-#                      -labels   => \%select_branches,
-#                      -size     => 1,
-#                      -multiple => 0 );
-$template->param(branchloop => address@hidden);
 
 ################## ADD_FORM ##################################
 # called by default. Used to create form to add or  modify a record
 if ($op eq 'add_form') {
        #---- if primkey exists, it's a modify action, so read values to 
modify...
-       my $data;
+       my $dataaqbookfund;
        my $header;
        if ($bookfundid) {
-               my $sth=$dbh->prepare("select 
bookfundid,bookfundname,bookfundgroup from aqbookfund where bookfundid=?");
+                my $query = '
+SELECT bookfundid,
+       bookfundname,
+       bookfundgroup,
+       branchcode
+  FROM aqbookfund
+  WHERE bookfundid = ?
+';
+               my $sth=$dbh->prepare($query);
                $sth->execute($bookfundid);
-               $data=$sth->fetchrow_hashref;
+               $dataaqbookfund = $sth->fetchrow_hashref;
                $sth->finish;
            }
        if ($bookfundid) {
@@ -161,22 +122,91 @@
        }
        $template->param(add_or_modify => $add_or_modify);
        $template->param(bookfundid =>$bookfundid);
-       $template->param(bookfundname =>$data->{'bookfundname'});
+       $template->param(bookfundname =>$dataaqbookfund->{'bookfundname'});
+
+        my @branchloop;
+        foreach my $branchcode (sort keys %{$branches}) {
+            my $row = {
+                branchcode => $branchcode,
+                branchname => $branches->{$branchcode}->{branchname},
+            };
+
+            if (defined $bookfundid
+                and defined $dataaqbookfund->{branchcode}
+                and $dataaqbookfund->{branchcode} eq $branchcode) {
+                $row->{selected} = 1;
+            }
+
+            push @branchloop, $row;
+        }
+
+        $template->param(branches => address@hidden);
+
+} # END $OP eq ADD_FORM
 
-                                                                               
                        # END $OP eq ADD_FORM
 ################## ADD_VALIDATE ##################################
 # called by add_form, used to insert/modify data in DB
-} elsif ($op eq 'add_validate') {
-       my $bookfundid=uc($input->param('bookfundid'));
-       my $sth=$dbh->prepare("delete from aqbookfund where bookfundid =?");
+elsif ($op eq 'add_validate') {
+       my $bookfundid = uc $input->param('bookfundid');
+
+        my ($query, $sth);
+
+        $query = '
+SELECT COUNT(*) AS counter
+  FROM aqbookfund
+  WHERE bookfundid = ?
+';
+        $sth=$dbh->prepare($query);
        $sth->execute($bookfundid);
+        my $data = $sth->fetchrow_hashref;
        $sth->finish;
-       $sth=$dbh->prepare("replace aqbookfund 
(bookfundid,bookfundname,branchcode) values (?,?,?)");
-       
$sth->execute($input->param('bookfundid'),$input->param('bookfundname'),$input->param('branchcode'));
-       $sth->finish;
-       print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; 
URL=aqbookfund.pl\"></html>";
-       exit;
-                       
+        my $bookfund_already_exists = $data->{counter} > 0 ? 1 : 0;
+
+        if ($bookfund_already_exists) {
+            $query = '
+UPDATE aqbookfund
+  SET bookfundname = ?,
+      branchcode = ?
+  WHERE bookfundid = ?
+';
+            $sth=$dbh->prepare($query);
+            $sth->execute(
+                $input->param('bookfundname'),
+                $input->param('branchcode') || undef,
+                $bookfundid,
+            );
+            $sth->finish;
+
+            # budgets depending on a bookfund must have the same branchcode
+            # if the bookfund branchcode is set
+            if (defined $input->param('branchcode')) {
+                $query = '
+UPDATE aqbudget
+  SET branchcode = ?
+';
+                $sth=$dbh->prepare($query);
+                $sth->execute($input->param('branchcode'));
+                $sth->finish;
+            }
+        }
+        else {
+            $query = '
+INSERT
+  INTO aqbookfund
+  (bookfundid, bookfundname, branchcode)
+  VALUES
+  (?, ?, ?)
+';
+            $sth=$dbh->prepare($query);
+            $sth->execute(
+                $bookfundid,
+                $input->param('bookfundname'),
+                $input->param('branchcode') || undef,
+            );
+            $sth->finish;
+        }
+
+        $input->redirect('aqbookfund.pl');
                                                                                
# END $OP eq ADD_VALIDATE
 ################## DELETE_CONFIRM ##################################
 # called by default form, used to confirm deletion of data in DB
@@ -201,50 +231,140 @@
                                                                                
                        # END $OP eq DELETE_CONFIRMED
 ################## DEFAULT ##################################
 } else { # DEFAULT
-       $template->param(scriptname => $script_name);
-       if  ($searchfield ne '') {
-               $template->param(search => 1);
-               $template->param(searchfield => $searchfield);
-       }
-       my $env;
-       my ($count,$results)=StringSearch($env,$searchfield,$branches);
-       my $toggle="white";
-       my @loop_data =();
-       my $dbh = C4::Context->dbh;
-       for (my $i=$offset; $i < 
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
-               my %row_data;
-               $row_data{bookfundid} =$results->[$i]{'bookfundid'};
-               $row_data{bookfundname} = $results->[$i]{'bookfundname'};
-#              warn "".$results->[$i]{'bookfundid'}." 
".$results->[$i]{'bookfundname'}." ".$results->[$i]{'branchcode'};
-               $row_data{branchname} = 
$branches->{$results->[$i]{'branchcode'}}->{branchname};
-               my $strsth2="Select aqbudgetid,startdate,enddate,budgetamount 
from aqbudget where aqbudget.bookfundid = ?";
-#              my $strsth2="Select 
aqbudgetid,startdate,enddate,budgetamount,branchcode from aqbudget where 
aqbudget.bookfundid = ?";
-#              if ($homebranch){
-#                      $strsth2 .= " AND ((aqbudget.branchcode is null) OR 
(aqbudget.branchcode='') OR (aqbudget.branchcode= 
".$dbh->quote($homebranch).")) " ;
-#              } else {
-#                      $strsth2 .= " AND (aqbudget.branchcode='') " if 
((C4::Context->userenv) && (C4::Context->userenv->{flags}>1));
-#              }
-               $strsth2 .= " order by aqbudgetid";
-#              warn "".$strsth2;
-               my $sth2 = $dbh->prepare($strsth2);
-               $sth2->execute($row_data{bookfundid});
-               my @budget_loop;
-#              while (my 
($aqbudgetid,$startdate,$enddate,$budgetamount,$branchcode) = $sth2->fetchrow) {
-               while (my ($aqbudgetid,$startdate,$enddate,$budgetamount) = 
$sth2->fetchrow) {
-                       my %budgetrow_data;
-                       $budgetrow_data{aqbudgetid} = $aqbudgetid;
-                       $budgetrow_data{startdate} = format_date($startdate);
-                       $budgetrow_data{enddate} = format_date($enddate);
-                       $budgetrow_data{budgetamount} = $budgetamount;
-#                      $budgetrow_data{branchcode} = $branchcode;
-                       push @budget_loop,\%budgetrow_data;
-               }
-               if ($sth2->rows){
-                       $row_data{budget} = address@hidden;
-                       push @loop_data,\%row_data;
-               }
-       }
-       $template->param(bookfund => address@hidden);
+    my ($query, $sth);
+
+    $template->param(scriptname => $script_name);
+
+    # filters
+    my @branchloop;
+    foreach my $branchcode (sort keys %{$branches}) {
+        my $row = {
+            code => $branchcode,
+            name => $branches->{$branchcode}->{branchname},
+        };
+
+        if (defined $input->param('filter_branchcode')
+            and $input->param('filter_branchcode') eq $branchcode) {
+            $row->{selected} = 1;
+        }
+
+        push @branchloop, $row;
+    }
+
+    my @bookfundids_loop;
+    $query = '
+SELECT bookfundid
+  FROM aqbookfund
+';
+    $sth = $dbh->prepare($query);
+    $sth->execute();
+    while (my $row = $sth->fetchrow_hashref) {
+        if (defined $input->param('filter_bookfundid')
+            and $input->param('filter_bookfundid') eq $row->{bookfundid}) {
+            $row->{selected} = 1;
+        }
+
+        push @bookfundids_loop, $row;
+    }
+    $sth->finish;
+
+    $template->param(
+        filter_bookfundids => address@hidden,
+        filter_branches => address@hidden,
+        filter_bookfundname => $input->param('filter_bookfundname') || undef,
+    );
+
+    # searching the bookfunds corresponding to our filtering rules
+    my @bindings;
+
+    $query = '
+SELECT bookfundid,
+       bookfundname,
+       bookfundgroup,
+       branchcode
+  FROM aqbookfund
+  WHERE 1 = 1';
+    if ($input->param('filter')) {
+        if ($input->param('filter_bookfundid')) {
+            $query.= '
+    AND bookfundid = ?
+';
+            push @bindings, $input->param('filter_bookfundid');
+        }
+        if ($input->param('filter_bookfundname')) {
+            $query.= '
+    AND bookfundname like ?
+';
+            push @bindings, '%'.$input->param('filter_bookfundname').'%';
+        }
+        if ($input->param('filter_branchcode')) {
+            $query.= '
+    AND branchcode = ?
+';
+            push @bindings, $input->param('filter_branchcode');
+        }
+    }
+    $query.= '
+  ORDER BY bookfundid
+';
+
+    $sth = $dbh->prepare($query);
+    $sth->execute(@bindings);
+    my @results;
+    while (my $row = $sth->fetchrow_hashref) {
+        push @results, $row;
+    }
+
+    # does the book funds have budgets?
+    $query = '
+SELECT bookfundid,
+       COUNT(*) AS counter
+  FROM aqbudget
+  GROUP BY bookfundid
+';
+    $sth = $dbh->prepare($query);
+    $sth->execute();
+    my %nb_budgets_of;
+    while (my $row = $sth->fetchrow_hashref) {
+        $nb_budgets_of{ $row->{bookfundid} } = $row->{counter};
+    }
+
+    # pagination informations
+    my $page = $input->param('page') || 1;
+    my @loop;
+
+    my $first = ($page - 1) * $pagesize;
+
+    # if we are on the last page, the number of the last word to display
+    # must not exceed the length of the results array
+    my $last = min(
+        $first + $pagesize - 1,
+        scalar(@results) - 1,
+    );
+
+    my $toggle = 0;
+    foreach my $result (@results[$first .. $last]) {
+        push(
+            @loop,
+            {
+                %{$result},
+                toggle => $toggle++%2,
+                branchname =>
+                    $branches->{ $result->{branchcode} }->{branchname},
+                has_budgets => defined $nb_budgets_of{ $result->{bookfundid} },
+            }
+        );
+    }
+
+    $template->param(
+        bookfund => address@hidden,
+        pagination_bar => pagination_bar(
+            $script_name,
+            getnbpages(scalar @results, $pagesize),
+            $page,
+            'page'
+        )
+    );
 } #---- END $OP eq DEFAULT
 
 output_html_with_http_headers $input, $cookie, $template->output;
Index: koha/admin/aqbudget.pl
diff -u koha/admin/aqbudget.pl:1.19 koha/admin/aqbudget.pl:1.20
--- koha/admin/aqbudget.pl:1.19 Fri Feb 24 11:15:01 2006
+++ koha/admin/aqbudget.pl      Thu Apr 13 08:36:42 2006
@@ -39,6 +39,9 @@
 
 use strict;
 use CGI;
+use HTML::Template;
+use List::Util qw/min/;
+
 use C4::Date;
 use C4::Auth;
 use C4::Acquisition;
@@ -46,55 +49,32 @@
 use C4::Output;
 use C4::Interface::CGI::Output;
 use C4::Search;
-use HTML::Template;
-
-sub StringSearch  {
-       my ($env,$searchstring,$type)address@hidden;
-       my $dbh = C4::Context->dbh;
-       $searchstring=~ s/\'/\\\'/g;
-       my @data=split(' ',$searchstring);
-       my address@hidden;
-       my $sth=$dbh->prepare("Select 
aqbudgetid,bookfundid,startdate,enddate,budgetamount,branchcode from aqbudget 
where (bookfundid like ?) order by bookfundid,aqbudgetid");
-       $sth->execute("$data[0]%");
-       my @results;
-       my $cnt=0;
-       while (my $data=$sth->fetchrow_hashref){
-       push(@results,$data);
-       $cnt ++;
-       }
-       #  $sth->execute;
-       $sth->finish;
-       return ($cnt,address@hidden);
-}
+use C4::Koha;
 
 my $input = new CGI;
-my $searchfield=$input->param('searchfield');
-my $offset=$input->param('offset');
 my $script_name="/cgi-bin/koha/admin/aqbudget.pl";
 my $bookfundid=$input->param('bookfundid');
 my $aqbudgetid=$input->param('aqbudgetid');
-my $pagesize=20;
+my $pagesize = 20;
 my $op = $input->param('op');
-$searchfield=~ s/\,//g;
 
 my ($template, $borrowernumber, $cookie)
-    = get_template_and_user({template_name => "admin/aqbudget.tmpl",
-                            query => $input,
-                            type => "intranet",
-                            authnotrequired => 0,
-                            flagsrequired => {parameters => 1},
-                            debug => 1,
-                            });
-
-if ($op) {
-$template->param(script_name => $script_name,
-                                               $op              => 1); # we 
show only the TMPL_VAR names $op
-} else {
-$template->param(script_name => $script_name,
-                                               else              => 1); # we 
show only the TMPL_VAR names $op
-}
+    = get_template_and_user(
+        {template_name => "admin/aqbudget.tmpl",
+         query => $input,
+         type => "intranet",
+         authnotrequired => 0,
+         flagsrequired => {parameters => 1},
+         debug => 1,
+     }
+    );
 
-$template->param(action => $script_name);
+$template->param(
+    action => $script_name,
+    DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+    script_name => $script_name,
+    $op || 'else' => 1,
+);
 
 my $dbh = C4::Context->dbh;
 my $sthtemp = $dbh->prepare("Select flags, branchcode from borrowers where 
borrowernumber = ?");
@@ -104,83 +84,147 @@
 ################## ADD_FORM ##################################
 # called by default. Used to create form to add or  modify a record
 if ($op eq 'add_form') {
-       #---- if primkey exists, it's a modify action, so read values to 
modify...
-       my $dataaqbudget;
-       my $dataaqbookfund;
-       if ($aqbudgetid) {
-               my $dbh = C4::Context->dbh;
-#              my $sth=$dbh->prepare("select 
aqbudgetid,bookfundname,aqbookfund.bookfundid,aqbookfund.branchcode as 
bfbranch,startdate,enddate,budgetamount,aqbudget.branchcode from 
aqbudget,aqbookfund where aqbudgetid=? and 
aqbudget.bookfundid=aqbookfund.bookfundid");
-               my $sth=$dbh->prepare("select 
aqbudgetid,bookfundname,aqbookfund.bookfundid,aqbookfund.branchcode as 
bfbranch,startdate,enddate,budgetamount from aqbudget,aqbookfund where 
aqbudgetid=? and aqbudget.bookfundid=aqbookfund.bookfundid");
-               $sth->execute($aqbudgetid);
-               $dataaqbudget=$sth->fetchrow_hashref;
-               $sth->finish;
-       }
-       if ($bookfundid) {
-               my $dbh = C4::Context->dbh;
-               my $sth=$dbh->prepare("select aqbookfund.branchcode, 
branches.branchname from aqbookfund LEFT JOIN branches ON 
aqbookfund.branchcode=branches.branchcode where bookfundid=?");
-               $sth->execute($bookfundid);
-               $dataaqbookfund=$sth->fetchrow_hashref;
-               $sth->finish;
-       }
-       my $header;
-       if ($aqbudgetid) {
-               $header = "Modify budget";
-       } else {
-               $header = "Add budget";
-       }
-       $template->param(header => $header);
-       if ($aqbudgetid) {
-           $template->param(modify => 1);
-           $template->param(bookfundid => $dataaqbudget->{'bookfundid'});
-           $template->param(bookfundname => $dataaqbudget->{'bookfundname'});
-       } else {
-           $template->param(bookfundid => $bookfundid,
-                                                               adding => 1);
-       }
-#      my @select_branch;
-#      my %select_branches;
-#      if ($dataaqbookfund->{branchcode}){
-#              push @select_branch,$dataaqbookfund->{'branchcode'};
-#              
$select_branches{$dataaqbookfund->{'branchcode'}}=$dataaqbookfund->{'branchname'};
-#      }else {
-#              my @branches;
-#              my ($count2,@branches)=branches();
-#              push @select_branch,"";
-#              $select_branches{""}="";
-#              for (my $i=0;$i<$count2;$i++){
-#                      push @select_branch, $branches[$i]->{'branchcode'};#
-#                      $select_branches{$branches[$i]->{'branchcode'}} = 
$branches[$i]->{'branchname'};
-#              }
-#      }
-#      my $CGIbranch=CGI::scrolling_list( -name     => 'branchcode',
-#                              -values   => address@hidden,
-#                              -labels   => \%select_branches,
-#                              -default  => 
($dataaqbookfund->{branchcode}?$dataaqbookfund->{branchcode}:$dataaqbudget->{branchcode}),
-#                              -size     => 1,
-#                              -multiple => 0 );
-#      $template->param(CGIbranch => $CGIbranch);
-
-       $template->param(dateformat => display_date_format(),
-                                                       aqbudgetid => 
$dataaqbudget->{'aqbudgetid'},
-                                                       startdate => 
format_date($dataaqbudget->{'startdate'}),
-                                                       enddate => 
format_date($dataaqbudget->{'enddate'}),
-                                                       budgetamount => 
$dataaqbudget->{'budgetamount'}
-       );
+    my ($query, $dataaqbudget, $dataaqbookfund, $sth);
+    my $dbh = C4::Context->dbh;
+
+    #---- if primkey exists, it's a modify action, so read values to modify...
+    if ($aqbudgetid) {
+        $query = '
+SELECT aqbudgetid,
+       bookfundname,
+       aqbookfund.bookfundid,
+       startdate,
+       enddate,
+       budgetamount,
+       aqbudget.branchcode
+  FROM aqbudget
+    INNER JOIN aqbookfund ON aqbudget.bookfundid = aqbookfund.bookfundid
+  WHERE aqbudgetid = ?
+';
+        $sth=$dbh->prepare($query);
+        $sth->execute($aqbudgetid);
+        $dataaqbudget=$sth->fetchrow_hashref;
+        $sth->finish;
+    }
+
+    $query = '
+SELECT aqbookfund.branchcode,
+       branches.branchname,
+       aqbookfund.bookfundname
+  FROM aqbookfund
+    LEFT JOIN branches ON aqbookfund.branchcode = branches.branchcode
+  WHERE bookfundid = ?
+';
+    $sth=$dbh->prepare($query);
+    $sth->execute(
+        defined $aqbudgetid ? $dataaqbudget->{bookfundid} : $bookfundid,
+    );
+    $dataaqbookfund=$sth->fetchrow_hashref;
+    $sth->finish;
+
+    if (defined $aqbudgetid) {
+        $template->param(
+            bookfundid => $dataaqbudget->{'bookfundid'},
+            bookfundname => $dataaqbudget->{'bookfundname'}
+        );
+    }
+    else {
+        $template->param(
+            bookfundid => $bookfundid,
+            bookfundname => $dataaqbookfund->{bookfundname},
+        );
+    }
+
+    # Available branches
+    my @branches = ();
+
+    $query = '
+SELECT branchcode,
+       branchname
+  FROM branches
+  ORDER BY branchname
+';
+    $sth=$dbh->prepare($query);
+    $sth->execute();
+    while (my $row = $sth->fetchrow_hashref) {
+        my $branch = $row;
+
+        if (defined $dataaqbookfund->{branchcode}) {
+            $branch->{selected} =
+                $dataaqbookfund->{branchcode} eq $row->{branchcode} ? 1 : 0;
+        }
+        elsif (defined $aqbudgetid) {
+            $branch->{selected} =
+                $dataaqbudget->{branchcode} eq $row->{branchcode} ? 1 : 0;
+        }
+
+        push @branches, $branch;
+    }
+    $sth->finish;
+
+    $template->param(
+        dateformat => display_date_format(),
+        aqbudgetid => $dataaqbudget->{'aqbudgetid'},
+        startdate => format_date($dataaqbudget->{'startdate'}),
+        enddate => format_date($dataaqbudget->{'enddate'}),
+        budgetamount => $dataaqbudget->{'budgetamount'},
+        branches => address@hidden,
+    );
+
+    if (defined $dataaqbookfund->{branchcode}) {
+        $template->param(
+            disable_branchselection => 1,
+            branch => $dataaqbookfund->{branchcode},
+        );
+    }
                                                                                
                        # END $OP eq ADD_FORM
 ################## ADD_VALIDATE ##################################
 # called by add_form, used to insert/modify data in DB
 } elsif ($op eq 'add_validate') {
-       my $dbh = C4::Context->dbh;
-       my $sth=$dbh->prepare("replace aqbudget 
(aqbudgetid,bookfundid,startdate,enddate,budgetamount,branchcode) values 
(?,?,?,?,?,?)");
-       $sth->execute($input->param('aqbudgetid'),$input->param('bookfundid'),
-                                               
format_date_in_iso($input->param('startdate')),
-                                               
format_date_in_iso($input->param('enddate')),
-                                               $input->param('budgetamount'),
-                                               $input->param('branchcode')
-                                               );
-       $sth->finish;
-        print $input->redirect("aqbookfund.pl");
-        exit;
+    my ($query, $sth);
+
+    if (defined $aqbudgetid) {
+        $query = '
+UPDATE aqbudget
+  SET bookfundid = ?,
+      startdate = ?,
+      enddate = ?,
+      budgetamount = ?,
+      branchcode = ?
+  WHERE aqbudgetid = ?
+';
+        $sth=$dbh->prepare($query);
+        $sth->execute(
+            $input->param('bookfundid'),
+            format_date_in_iso($input->param('startdate')),
+            format_date_in_iso($input->param('enddate')),
+            $input->param('budgetamount'),
+            $input->param('branch') || undef,
+            $aqbudgetid,
+        );
+        $sth->finish;
+    }
+    else {
+        $query = '
+INSERT
+  INTO aqbudget
+  (bookfundid, startdate, enddate, budgetamount, branchcode)
+  VALUES
+  (?, ?, ?, ?, ?)
+';
+        $sth=$dbh->prepare($query);
+        $sth->execute(
+            $input->param('bookfundid'),
+            format_date_in_iso($input->param('startdate')),
+            format_date_in_iso($input->param('enddate')),
+            $input->param('budgetamount'),
+            $input->param('branch') || undef,
+        );
+        $sth->finish;
+    }
+
+    $input->redirect("aqbudget.pl");
+
 # END $OP eq ADD_VALIDATE
 ################## DELETE_CONFIRM ##################################
 # called by default form, used to confirm deletion of data in DB
@@ -209,53 +253,177 @@
                                                                                
                        # END $OP eq DELETE_CONFIRMED
 ################## DEFAULT ##################################
 } else { # DEFAULT
-       if  ($searchfield ne '') {
-               $template->param(search => 1);
-               $template->param(searchfield => $searchfield);
-       }
-       my $env;
-       my ($count,$results)=StringSearch($env,$searchfield,'web');
-       my $toggle="white";
-       my @loop_data =();
-       for (my $i=$offset; $i < 
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
-               #find out stats
-       #       my 
($od,$issue,$fines)=categdata2($env,$results->[$i]{'borrowernumber'});
-       #       $fines=$fines+0;
-               my $dataaqbookfund;
-               my $dbh = C4::Context->dbh;
-               my $sth=$dbh->prepare("select bookfundid,bookfundname from 
aqbookfund where bookfundid=?");
-               $sth->execute($results->[$i]{'bookfundid'});
-               $dataaqbookfund=$sth->fetchrow_hashref;
-               $sth->finish;
-               my @toggle = ();
-               my @bookfundid = ();
-               my @bookfundname = ();
-               my @startdate = ();
-               my @enddate = ();
-               my @budgetamount = ();
-               push(@toggle,$toggle);
-               push(@bookfundid,$results->[$i]{'bookfundid'});
-               push(@bookfundname,$dataaqbookfund->{'bookfundname'});
-               push(@startdate,format_date($results->[$i]{'startdate'}));
-               push(@enddate,format_date($results->[$i]{'enddate'}));
-               push(@budgetamount,$results->[$i]{'budgetamount'});
-               if ($toggle eq 'white'){
-                       $toggle="#ffffcc";
-               } else {
-                       $toggle="white";
-               }
-               while (@toggle and @bookfundid and @bookfundname and @startdate 
and @enddate and @budgetamount) { 
-          my %row_data;
-          $row_data{toggle} = shift @toggle;
-          $row_data{bookfundid} = shift @bookfundid;
-          $row_data{bookfundname} = shift @bookfundname;
-          $row_data{startdate} = shift @startdate;
-          $row_data{enddate} = shift @enddate;
-          $row_data{budgetamount} = shift @budgetamount;
-          push(@loop_data, \%row_data);
-       }
-       }
-       $template->param(budget => address@hidden);
+    my ($query, $sth);
+
+    # create a look-up table for bookfund names from bookfund ids,
+    # instead of having on query per budget
+    my %bookfundname_of = ();
+    $query = '
+SELECT bookfundid, bookfundname
+  FROM aqbookfund
+';
+    $sth=$dbh->prepare($query);
+    $sth->execute;
+    while (my $row = $sth->fetchrow_hashref) {
+        $bookfundname_of{ $row->{bookfundid} } = $row->{bookfundname};
+    }
+    $sth->finish;
+
+    # filters
+    my $branches = getbranches();
+    my @branchloop;
+    foreach my $branchcode (sort keys %{$branches}) {
+        my $row = {
+            code => $branchcode,
+            name => $branches->{$branchcode}->{branchname},
+        };
+
+        if (defined $input->param('filter_branchcode')
+            and $input->param('filter_branchcode') eq $branchcode) {
+            $row->{selected} = 1;
+        }
+
+        push @branchloop, $row;
+    }
+
+    my @bookfundids_loop;
+    $query = '
+SELECT bookfundid
+  FROM aqbookfund
+';
+    $sth = $dbh->prepare($query);
+    $sth->execute();
+    while (my $row = $sth->fetchrow_hashref) {
+        if (defined $input->param('filter_bookfundid')
+            and $input->param('filter_bookfundid') eq $row->{bookfundid}) {
+            $row->{selected} = 1;
+        }
+
+        push @bookfundids_loop, $row;
+    }
+    $sth->finish;
+
+    $template->param(
+        filter_bookfundids => address@hidden,
+        filter_branches => address@hidden,
+        filter_amount => $input->param('filter_amount') || undef,
+        filter_startdate => $input->param('filter_startdate') || undef,
+        filter_enddate => $input->param('filter_enddate') || undef,
+    );
+
+    my %sign_label_of = (
+        '=' => 'equal',
+        '>=' => 'superior',
+        '<=' => 'inferior',
+    );
+
+    foreach my $field (qw/startdate enddate amount/) {
+        my $param = 'filter_'.$field.'_sign';
+
+        foreach my $sign (keys %sign_label_of) {
+            if ($input->param($param) eq $sign) {
+                $template->param(
+                    $param.'_'.$sign_label_of{$sign}.'_selected' => 1,
+                );
+            }
+        }
+    }
+
+    # Search all available budgets
+    $query = '
+SELECT aqbudgetid,
+       bookfundid,
+       startdate,
+       enddate,
+       budgetamount,
+       branchcode
+  FROM aqbudget
+  WHERE 1 = 1';
+
+    my @bindings;
+
+    if ($input->param('filter_bookfundid')) {
+        $query.= '
+    AND bookfundid = ?
+';
+        push @bindings, $input->param('filter_bookfundid');
+    }
+    if ($input->param('filter_branchcode')) {
+        $query.= '
+    AND branchcode = ?
+';
+        push @bindings, $input->param('filter_branchcode');
+    }
+    if ($input->param('filter_startdate')) {
+        $query.= '
+    AND startdate '.$input->param('filter_startdate_sign').' ?
+';
+        push @bindings, format_date_in_iso($input->param('filter_startdate'));
+    }
+    if ($input->param('filter_enddate')) {
+        $query.= '
+    AND enddate '.$input->param('filter_enddate_sign').' ?
+';
+        push @bindings, format_date_in_iso($input->param('filter_enddate'));
+    }
+    if ($input->param('filter_amount')) {
+        $query.= '
+    AND budgetamount '.$input->param('filter_amount_sign').' ?
+';
+        # the amount must be a quantity, with 2 digits after the decimal
+        # separator
+        $input->param('filter_amount') =~ m{(\d* (?:\.\d{,2})? )}xms;
+        my ($amount) = $1;
+        push @bindings, $amount;
+    }
+
+    $query.= '
+  ORDER BY bookfundid, aqbudgetid
+';
+    $sth = $dbh->prepare($query);
+    $sth->execute(@bindings);
+    my @results;
+    while (my $row = $sth->fetchrow_hashref){
+        push @results, $row;
+    }
+    $sth->finish;
+
+    # filter budgets depending on the pagination
+    my $page = $input->param('page') || 1;
+    my $first = ($page - 1) * $pagesize;
+
+    # if we are on the last page, the number of the last word to display
+    # must not exceed the length of the results array
+    my $last = min(
+        $first + $pagesize - 1,
+        scalar @results - 1,
+    );
+
+    my $toggle = 0;
+    my @loop;
+    foreach my $result (@results[$first .. $last]) {
+        push(
+            @loop,
+            {
+                %{$result},
+                toggle => $toggle++%2,
+                bookfundname => $bookfundname_of{ $result->{'bookfundid'} },
+                branchname => $branches->{ $result->{branchcode} 
}->{branchname},
+                startdate => format_date($result->{startdate}),
+                enddate => format_date($result->{enddate}),
+            }
+        );
+    }
+
+    $template->param(
+        budget => address@hidden,
+        pagination_bar => pagination_bar(
+            $script_name,
+            getnbpages(scalar @results, $pagesize),
+            $page,
+            'page'
+        )
+    );
 } #---- END $OP eq DEFAULT
 
 output_html_with_http_headers $input, $cookie, $template->output;
Index: koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbookfund.tmpl
diff -u koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbookfund.tmpl:1.1 
koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbookfund.tmpl:1.2
--- koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbookfund.tmpl:1.1      Fri Feb 
24 11:18:17 2006
+++ koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbookfund.tmpl  Thu Apr 13 
08:36:42 2006
@@ -1,59 +1,98 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- System Administration: 
<!-- TMPL_IF name="else" -->Book Funds<!-- /TMPL_IF -->
-
-
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+Koha -- System Administration: Book Funds
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
 <!-- TMPL_INCLUDE NAME="menu-admin.inc" -->
 
-<!-- TMPL_IF name="add_form" --><!-- TMPL_VAR name="header" --><!-- /TMPL_IF 
-->
-<!-- TMPL_IF name="add_validate" -->Data Recorded<!-- /TMPL_IF -->
-<!-- TMPL_IF name="delete_confirm" -->Confirm Deletion of Fund '<!-- TMPL_VAR 
name="bookfundname" -->'<!-- /TMPL_IF -->
-<!-- TMPL_IF name="delete_confirmed" -->Data Deleted<!-- /TMPL_IF -->
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
 <!-- TMPL_IF name="else" -->
 <h1>Book Fund Administration</h1>
-<!-- TMPL_IF NAME="bookfund" --><form action="<!-- TMPL_VAR name=scriptname 
-->" method="post">
-<input type="text" name="searchfield" value="" /> <input type="submit" 
name="search" value="Search" /></form>
-<!-- TMPL_IF name="search" -->
-       You Searched for <span class="ex"><!-- TMPL_VAR name="searchfield" 
--></span>
-<!-- /TMPL_IF -->
-
+  <!-- TMPL_IF NAME="bookfund" -->
 <table>
-<tr>
-       <th>Book Fund</th>
-       <th>Name</th>
-       <th>Edit</th>
-       <th>Delete</th>
-       </tr>
-<!-- TMPL_LOOP name="bookfund" -->
-       <tr>
-               <td><a href="<!-- TMPL_VAR name="action" 
-->?op=add_form&amp;bookfundid=<!-- TMPL_VAR name="bookfundid" --> "><!-- 
TMPL_VAR name="bookfundid" --></a></td>
-               <td><!-- TMPL_VAR name="bookfundname" --></td>
-               <td><form action="<!-- TMPL_VAR name="action" -->" 
method="get"><input type="hidden" name="op" value="add_form" /><input 
type="hidden" name="bookfundid" value="<!-- TMPL_VAR name="bookfundid" -->" 
/><input type="submit" value="Edit" /></form></td>
-               <td><form action="<!-- TMPL_VAR name="action" -->" 
method="get"><input type="hidden" name="op" value="delete_confirm" /><input 
type="hidden" name="bookfundid" value="<!-- TMPL_VAR name="bookfundid" -->" 
/><input type="submit" class="delete" value="Delete" /></form></td>
-       </tr>
-               <tr>
-               <td>&nbsp;</td>
-               <td>Budget</td>
-               <td><form action="aqbudget.pl" method="get"><input 
type="hidden" name="op" value="add_form" /><input type="hidden" 
name="bookfundid" value="<!-- TMPL_VAR name="bookfundid" -->" /><input 
type="submit" value="Add Budget" /></form></td>
-               <td></td>
-       </tr>
-       <!-- TMPL_LOOP name="budget" -->
-               <tr>
-                       <td>&nbsp;</td>
-                       <td>
-                               <!-- TMPL_VAR name="startdate" --> - <!-- 
TMPL_VAR name="enddate" --> : <!-- TMPL_VAR name="budgetamount" -->
-                       </td>
-                       <td><form action="/cgi-bin/koha/admin/aqbudget.pl" 
method="get"><input type="hidden" name="op" value="add_form" /><input 
type="hidden" name="aqbudgetid" value="<!-- TMPL_VAR name="aqbudgetid" -->" 
/><input type="submit" value="Edit" /></form></td>
-                       <td><form action="/cgi-bin/koha/admin/aqbudget.pl" 
method="get"><input type="hidden" name="op" value="delete_confirm" /><input 
type="hidden" name="aqbudgetid" value="<!-- TMPL_VAR name="aqbudgetid" -->" 
/><input type="submit" class="delete" value="Delete" /></form></td>
-
-               </tr>
-       <!-- /TMPL_LOOP -->
-<!-- /TMPL_LOOP -->
-</table><!-- /TMPL_IF -->
-<form action="<!-- TMPL_VAR name=scriptname -->" method="post">
-       <p><input type="hidden" name="op" value="add_form" /></p>
-<input type="submit" value="Add bookfund" /></form>
-<!-- /TMPL_IF -->
+  <tr>
+    <th>Code</th>
+    <th>Name</th>
+    <th>Branch</th>
+    <th>Actions</th>
+  </tr>
+
+<form action="<!-- TMPL_VAR name="scriptname" -->" method="post">
+  <tr class="filter">
+    <td>
+      <select name="filter_bookfundid">
+        <option value="">----</option>
+    <!-- TMPL_LOOP name="filter_bookfundids" -->
+      <!-- TMPL_IF NAME="selected" -->
+        <option value="<!-- TMPL_VAR name="bookfundid" -->" 
selected="selected"><!-- TMPL_VAR name="bookfundid" --></option>
+      <!-- TMPL_ELSE -->
+        <option value="<!-- TMPL_VAR name="bookfundid" -->"><!-- TMPL_VAR 
name="bookfundid" --></option>
+      <!-- /TMPL_IF -->
+    <!-- /TMPL_LOOP -->
+      </select>
+    </td>
+    <td>
+      <input type="text" name="filter_bookfundname" value="<!-- TMPL_VAR 
name="filter_bookfundname" -->" />
+    </td>
+    <td>
+      <select name="filter_branchcode">
+        <option value="">----</option>
+    <!-- TMPL_LOOP name="filter_branches" -->
+      <!-- TMPL_IF NAME="selected" -->
+        <option value="<!-- TMPL_VAR name="code" -->" selected="selected"><!-- 
TMPL_VAR name="name" --></option>
+      <!-- TMPL_ELSE -->
+        <option value="<!-- TMPL_VAR name="code" -->"><!-- TMPL_VAR 
name="name" --></option>
+      <!-- /TMPL_IF -->
+    <!-- /TMPL_LOOP -->
+      </select>
+    </td>
+    <td>
+      <input type="submit" name="filter" value="Filter" />
+    </td>
+  </tr>
+</form>
+
+<form action="aqbudget.pl" method="post">
+    <!-- TMPL_LOOP name="bookfund" -->
+      <!-- TMPL_IF NAME="toggle" -->
+  <tr class="highlight">
+      <!-- TMPL_ELSE -->
+  <tr>
+      <!-- /TMPL_IF -->
+    <td>
+      <!-- TMPL_VAR name="bookfundid" -->
+    </td>
+    <td>
+      <!-- TMPL_VAR name="bookfundname" -->
+    </td>
+    <td>
+      <!-- TMPL_IF NAME="branchname" -->
+      <!-- TMPL_VAR name="branchname" -->
+      <!-- TMPL_ELSE -->
+      None
+      <!-- /TMPL_IF -->
+    </td>
+    <td>
+      <a href="<!-- TMPL_VAR name="scriptname" 
-->?op=add_form&amp;bookfundid=<!-- TMPL_VAR name="bookfundid" -->">Edit</a>
+      <a href="<!-- TMPL_VAR name="scriptname" 
-->?op=delete_confirm&amp;bookfundid=<!-- TMPL_VAR name="bookfundid" 
-->">Delete</a>
+      <a href="aqbudget.pl?op=add_form&amp;bookfundid=<!-- TMPL_VAR 
name="bookfundid" -->">Add budget</a>
+      <!-- TMPL_IF NAME="has_budgets" -->
+      <a href="aqbudget.pl?filter_bookfundid=<!-- TMPL_VAR name="bookfundid" 
-->">Show budgets</a>
+      <!-- /TMPL_IF -->
+    </td>
+  </tr>
+
+    <!-- /TMPL_LOOP --> <!-- bookfund -->
+</table>
+
+<div class="paginationBar"><!-- TMPL_VAR NAME="pagination_bar" --></div>
+  <!-- /TMPL_IF --> <!-- bookfund -->
+
+<p>
+  <a href="<!-- TMPL_VAR name=scriptname -->?op=add_form">Add bookfund</a>
+  <a href="aqbudget.pl">Show all budgets</a>
+</p>
+
+</form>
+<!-- /TMPL_IF --> <!-- else -->
 
 <!-- TMPL_IF name="add_form" -->
 <script>
@@ -108,45 +147,112 @@
                        alert(alertString2);
                }
        }
-       </SCRIPT>
-<form action="<!-- TMPL_VAR name="action" -->" name="Aform" method="post">
-<input type="hidden" name="op" value="add_validate" />
-<input type="hidden" name="checked" value="0" />
+       </script>
 
-<table>
-<caption><!-- TMPL_VAR name="header" --></caption>
-<!-- TMPL_IF name="add_or_modify" -->
-<tr><th>Book fund</th><td><input type="hidden" name="bookfundid" value="<!-- 
TMPL_VAR name="bookfundid" -->" /><!-- TMPL_VAR name="bookfundid" --></td></tr>
-<!-- TMPL_ELSE -->
-<tr><th>Book fund</th><td><input type="text" name="bookfundid" size="5" 
maxlength="5" onblur="toUC(this)" /></td></tr>
-<!-- /TMPL_IF -->
-<tr><th>Name</th><td><input type="text" name="bookfundname" size="40" 
maxlength="80" value="<!-- TMPL_VAR name="bookfundname" escape="HTML" -->" 
/></td></tr>
-</table>
+<form action="<!-- TMPL_VAR name="action" -->" name="Aform" method="post">
+  <input type="hidden" name="op" value="add_validate" />
+  <input type="hidden" name="checked" value="0" />
 
-<p><input type="button" value="<!-- TMPL_VAR name="header" -->" 
onclick="Check(this.form); return false;" /> <input type="submit" 
value="Cancel" onclick="location.href='<!-- TMPL_VAR name="action" -->'; return 
false;" /></p>
+  <table>
+    <caption><!-- TMPL_VAR name="header" --></caption>
+    
+  <!-- TMPL_IF name="add_or_modify" -->
+    <tr>
+      <th>Book fund</th>
+      <td>
+        <input type="hidden" name="bookfundid" value="<!-- TMPL_VAR 
name="bookfundid" -->" />
+        <!-- TMPL_VAR name="bookfundid" -->
+      </td>
+    </tr>
+  <!-- TMPL_ELSE -->
+    <tr>
+      <th>Book fund</th>
+      <td>
+        <input type="text" name="bookfundid" size="5" maxlength="5" 
onblur="toUC(this)" />
+      </td>
+    </tr>
+  <!-- /TMPL_IF --> <!-- add_or_modify -->
+    
+    <tr>
+      <th>Name</th>
+      <td>
+        <input type="text"
+               name="bookfundname"
+               size="40"
+          maxlength="80"
+              value="<!-- TMPL_VAR name="bookfundname" escape="HTML" -->"
+        />
+      </td>
+    </tr>
+
+    <tr>
+      <th>Branch</th>
+      <td>
+        <select name="branchcode">
+          <option value="">None</option>
+  <!-- TMPL_LOOP NAME="branches" -->
+    <!-- TMPL_IF NAME="selected" -->
+          <option value="<!-- TMPL_VAR NAME="branchcode" -->" 
selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
+    <!-- TMPL_ELSE -->
+          <option value="<!-- TMPL_VAR NAME="branchcode" -->"><!-- TMPL_VAR 
NAME="branchname" --></option>
+    <!-- /TMPL_IF -->
+  <!-- /TMPL_LOOP -->
+      </td>
+    </tr>
+    
+  </table>
+
+  <p>
+    <input type="button" value="Submit" onclick="Check(this.form); return 
false;" />
+    <input type="reset" value="Reset" />
+  </p>
 </form>
-<!-- /TMPL_IF -->
+<!-- /TMPL_IF --> <!-- add_form -->
 
 <!-- TMPL_IF name="add_validate" -->
 <h3>Data Recorded</h3>
-<form action="<!-- TMPL_VAR name="action" -->" method="post">
-<input type="submit" value="OK" />
-</form></td></tr></table>
+
+<p>
+  <a href="<!-- TMPL_VAR name="action" -->">Return to fund list</a>
+</p>
 <!-- /TMPL_IF -->
 
 <!-- TMPL_IF name="delete_confirm" -->
 <h3>Confirm Deletion of Fund <em><!-- TMPL_VAR name="bookfundid" --></em></h3>
 <table>
-<tr><th>Book fund</th><td><!-- TMPL_VAR name="bookfundid" --></td></tr>
-<tr><th>Name</th><td><!-- TMPL_VAR name="bookfundname" 
--></td></tr><tr><th>Group</th><td><!-- TMPL_VAR name="bookfundgroup" 
--></td></tr>
-</table><form action="<!-- TMPL_VAR name="action" -->" method="post"><input 
type="hidden" name="op" value="delete_confirmed" /><input type="hidden" 
name="bookfundid" value="<!-- TMPL_VAR name="bookfundid" -->" /><input 
type="submit" value="Delete this Fund" /></form> <form action="<!-- TMPL_VAR 
name="action" -->" method="post"><input type="submit" value="Do not Delete" 
/></form>
-<!-- /TMPL_IF -->
+  <tr>
+    <th>Book fund</th>
+    <td><!-- TMPL_VAR name="bookfundid" --></td>
+  </tr>
+  <tr>
+    <th>Name</th>
+    <td><!-- TMPL_VAR name="bookfundname" --></td>
+  </tr>
+  <tr>
+    <th>Group</th>
+    <td><!-- TMPL_VAR name="bookfundgroup" --></td>
+  </tr>
+</table>
+
+<form action="<!-- TMPL_VAR name="action" -->" method="post">
+  <input type="hidden" name="op" value="delete_confirmed" />
+  <input type="hidden" name="bookfundid" value="<!-- TMPL_VAR 
name="bookfundid" -->" />
+
+  <div id="action">
+    <input type="submit" value="Delete this Fund" />
+  </div>
+</form>
+
+<form action="<!-- TMPL_VAR name="action" -->" method="post">
+  <input type="submit" value="Do not Delete" />
+</form>
+<!-- /TMPL_IF --> <!-- delete_confirm -->
 
 <!-- TMPL_IF name="delete_confirmed" -->
 <h3>Data Deleted</h3>
 <form action="<!-- TMPL_VAR name="action" -->" method="post">
-<input type="submit" value="OK" /></form>
-<!-- /TMPL_IF -->
-
+  <input type="submit" value="OK" />
+</form>
+<!-- /TMPL_IF --> <!-- delete_confirmed -->
 
 <!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->
Index: koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbudget.tmpl
diff -u koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbudget.tmpl:1.1 
koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbudget.tmpl:1.2
--- koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbudget.tmpl:1.1        Fri Feb 
24 11:18:17 2006
+++ koha/koha-tmpl/intranet-tmpl/prog/en/admin/aqbudget.tmpl    Thu Apr 13 
08:36:42 2006
@@ -1,36 +1,179 @@
-<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->Koha -- System Administration: 
<!-- TMPL_IF name="else" -->Budget admin<!-- /TMPL_IF -->
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" -->
+Koha -- System Administration: Budgets
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+
+<!-- Additions to enable Calendar system -->
+<link rel="stylesheet" type="text/css" href="<!-- TMPL_VAR name="themelang" 
-->/includes/calendar/calendar-system.css">
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" 
-->/includes/calendar/calendar.js"></script>
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" 
-->/includes/calendar/calendar-en.js"></script>
+<script type="text/javascript" src="<!-- TMPL_VAR name="themelang" 
-->/includes/calendar/calendar-setup.js"></script>
+<!-- End of additions -->
 
 <!-- TMPL_INCLUDE NAME="menus.inc" -->
 <!-- TMPL_INCLUDE NAME="menu-admin.inc" -->
 
-<!-- TMPL_IF name="add_form" --><!-- TMPL_VAR NAME="header" --><!-- /TMPL_IF 
-->
-<!-- TMPL_IF name="add_validate" -->Budget Data Recorded<!-- /TMPL_IF -->
-<!-- TMPL_IF name="delete_confirm" -->Delete Book Fund '<!-- TMPL_VAR 
NAME="bookfundid" -->'<!-- /TMPL_IF -->
-<!-- TMPL_IF name="delete_confirmed" -->Book fund deleted<!-- /TMPL_IF -->
-<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<ul id="_informations">
+<!-- TMPL_IF NAME="add_validate" -->
+  <li>Budget Data Recorded, return to <a href="<!-- TMPL_VAR 
name="script_name" -->">budget list</a></li>
+<!-- /TMPL_IF --> <!-- add_validate -->
+
+<!-- TMPL_IF name="delete_confirmed" -->
+  <li>Budget deleted, return to <a href="<!-- TMPL_VAR name="script_name" 
-->">budget list</a></li>
+<!-- /TMPL_IF --> <!-- delete_confirmed -->
+</ul>
 
 <!-- TMPL_IF name="else" -->
-<h1>Budget admin</h1><form action="/cgi-bin/koha/admin/aqbudget.pl" 
method="post">
-       <input type="text" name="searchfield" value="" /> <input type="submit" 
name="search" value="Search" /></form>
-       <!-- TMPL_IF name="search" -->
-       You Searched for <!-- TMPL_VAR NAME="searchfield" --></span>
-       <!-- /TMPL_IF -->
+<h1>Budget admin</h1>
+
 <table>
-       <tr><th>Book fund</th><th>Start date</th><th>End date</th><th>Budget 
amount</th><th colspan="2">&nbsp;</th></tr>
-       <!-- TMPL_LOOP name="budget" -->
-               <tr>
-                       <td><!-- TMPL_VAR NAME="bookfundid" --> (<!-- TMPL_VAR 
NAME="bookfundname" -->)</td>
-                       <td><!-- TMPL_VAR NAME="startdate" --></td>
-                       <td><!-- TMPL_VAR NAME="enddate" --></td>
-                       <td><!-- TMPL_VAR NAME="budgetamount" --></td>
-                       <td><a 
href="/cgi-bin/koha/admin/aqbudget.pl?op=add_form&amp;bookfundid=<!-- TMPL_VAR 
NAME="bookfundid" -->">Edit</a></td>
-                       <td><a 
href="/cgi-bin/koha/admin/aqbudget.pl?op=delete_confirm&amp;bookfundid=<!-- 
TMPL_VAR NAME="bookfundid" -->">Delete</a></td>
-               </tr>
-       <!-- /TMPL_LOOP -->
-       </table>
-       <form action="/cgi-bin/koha/admin/aqbudget.pl" method="post">
-       <p><input type="hidden" name="op" value="add_form" /><input 
type="submit" value="Add Budget" /></p></form>
-<!-- /TMPL_IF -->
+  <tr>
+    <th>Book fund</th>
+    <th>Branch</th>
+    <th>Start date</th>
+    <th>End date</th>
+    <th>Budget amount</th>
+    <th>Actions</th>
+  </tr>
+
+<form action="/cgi-bin/koha/admin/aqbudget.pl" method="post">
+  <tr class="filter">
+    <td>
+      <select name="filter_bookfundid">
+        <option value="">----</option>
+    <!-- TMPL_LOOP name="filter_bookfundids" -->
+      <!-- TMPL_IF NAME="selected" -->
+        <option value="<!-- TMPL_VAR name="bookfundid" -->" 
selected="selected"><!-- TMPL_VAR name="bookfundid" --></option>
+      <!-- TMPL_ELSE -->
+        <option value="<!-- TMPL_VAR name="bookfundid" -->"><!-- TMPL_VAR 
name="bookfundid" --></option>
+      <!-- /TMPL_IF -->
+    <!-- /TMPL_LOOP -->
+      </select>
+    </td>
+    <td>
+      <select name="filter_branchcode">
+        <option value="">----</option>
+    <!-- TMPL_LOOP name="filter_branches" -->
+      <!-- TMPL_IF NAME="selected" -->
+        <option value="<!-- TMPL_VAR name="code" -->" selected="selected"><!-- 
TMPL_VAR name="name" --></option>
+      <!-- TMPL_ELSE -->
+        <option value="<!-- TMPL_VAR name="code" -->"><!-- TMPL_VAR 
name="name" --></option>
+      <!-- /TMPL_IF -->
+    <!-- /TMPL_LOOP -->
+      </select>
+    </td>
+    <td>
+      <select name="filter_startdate_sign">
+    <!-- TMPL_IF NAME="filter_startdate_sign_equal_selected" -->
+        <option value="=" selected="selected">=</option>
+    <!-- TMPL_ELSE -->
+        <option value="=">=</option>
+    <!-- /TMPL_IF -->
+
+    <!-- TMPL_IF NAME="filter_startdate_sign_superior_selected" -->
+        <option value="&gt;=" selected="selected">&gt;=</option>
+    <!-- TMPL_ELSE -->
+        <option value="&gt;=">&gt;=</option>
+    <!-- /TMPL_IF -->
+
+    <!-- TMPL_IF NAME="filter_startdate_sign_inferior_selected" -->
+        <option value="&lt;=" selected="selected">&lt;=</option>
+    <!-- TMPL_ELSE -->
+        <option value="&lt;=">&lt;=</option>
+    <!-- /TMPL_IF -->
+      </select>
+      <input type="text" size="10" id="filter_startdate" 
name="filter_startdate" value="<!-- TMPL_VAR Name="filter_startdate" -->" />
+      <img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" 
id="filter_startdate_button" />
+      <script language="JavaScript" type="text/javascript">
+        Calendar.setup(
+          {
+            inputField : "filter_startdate",
+            ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+            button : "filter_startdate_button"
+          }
+        );
+      </script>
+    </td>
+    <td>
+      <select name="filter_enddate_sign">
+    <!-- TMPL_IF NAME="filter_enddate_sign_equal_selected" -->
+        <option value="=" selected="selected">=</option>
+    <!-- TMPL_ELSE -->
+        <option value="=">=</option>
+    <!-- /TMPL_IF -->
+
+    <!-- TMPL_IF NAME="filter_enddate_sign_superior_selected" -->
+        <option value="&gt;=" selected="selected">&gt;=</option>
+    <!-- TMPL_ELSE -->
+        <option value="&gt;=">&gt;=</option>
+    <!-- /TMPL_IF -->
+
+    <!-- TMPL_IF NAME="filter_enddate_sign_inferior_selected" -->
+        <option value="&lt;=" selected="selected">&lt;=</option>
+    <!-- TMPL_ELSE -->
+        <option value="&lt;=">&lt;=</option>
+    <!-- /TMPL_IF -->
+      </select>
+      <input type="text" size="8" maxlength="10" id="filter_enddate" 
name="filter_enddate" value="<!-- TMPL_VAR Name="filter_enddate" -->" />
+      <img src="<!-- TMPL_VAR Name="themelang" -->/includes/calendar/cal.gif" 
id="filter_enddate_button" />
+      <script language="JavaScript" type="text/javascript">
+        Calendar.setup(
+          {
+            inputField : "filter_enddate",
+            ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+            button : "filter_enddate_button"
+          }
+        );
+      </script>
+    </td>
+    <td>
+      <select name="filter_amount_sign">
+    <!-- TMPL_IF NAME="filter_amount_sign_equal_selected" -->
+        <option value="=" selected="selected">=</option>
+    <!-- TMPL_ELSE -->
+        <option value="=">=</option>
+    <!-- /TMPL_IF -->
+
+    <!-- TMPL_IF NAME="filter_amount_sign_superior_selected" -->
+        <option value="&gt;=" selected="selected">&gt;=</option>
+    <!-- TMPL_ELSE -->
+        <option value="&gt;=">&gt;=</option>
+    <!-- /TMPL_IF -->
+
+    <!-- TMPL_IF NAME="filter_amount_sign_inferior_selected" -->
+        <option value="&lt;=" selected="selected">&lt;=</option>
+    <!-- TMPL_ELSE -->
+        <option value="&lt;=">&lt;=</option>
+    <!-- /TMPL_IF -->
+      </select>
+      <input type="text" name="filter_amount" value="<!-- TMPL_VAR 
NAME="filter_amount" -->" size="8"/>
+    </td>
+    <td>
+      <input type="submit" name="filter" value="Filter" />
+    </td>
+  </tr>
+</form>
+  
+  <!-- TMPL_LOOP name="budget" -->
+    <!-- TMPL_IF NAME="toggle" -->
+  <tr class="highlight">
+    <!-- TMPL_ELSE -->
+  <tr>
+    <!-- /TMPL_IF -->
+    <td><!-- TMPL_VAR NAME="bookfundid" --></td>
+    <td><!-- TMPL_VAR NAME="branchname" --></td>
+    <td><!-- TMPL_VAR NAME="startdate" --></td>
+    <td><!-- TMPL_VAR NAME="enddate" --></td>
+    <td><!-- TMPL_VAR NAME="budgetamount" --></td>
+    <td>
+      <a href="/cgi-bin/koha/admin/aqbudget.pl?op=add_form&amp;aqbudgetid=<!-- 
TMPL_VAR NAME="aqbudgetid" -->">Edit</a>
+      <a 
href="/cgi-bin/koha/admin/aqbudget.pl?op=delete_confirm&amp;aqbudgetid=<!-- 
TMPL_VAR NAME="aqbudgetid" -->">Delete</a>
+    </td>
+  </tr>
+  <!-- /TMPL_LOOP --> <!-- budget -->
+</table>
+
+<div class="paginationBar"><!-- TMPL_VAR NAME="pagination_bar" --></div>
+<!-- /TMPL_IF --> <!-- else -->
 
 <!-- TMPL_IF name="add_form" -->
 <script language="JavaScript" type="text/javascript">
@@ -85,52 +228,136 @@
                        alert(alertString2);
                }
        }
-       </script>
+</script>
 
 <form action="/cgi-bin/koha/admin/aqbudget.pl" name="Aform" method="post">
-<input type="hidden" name="op" value="add_validate" />
-<input type="hidden" name="checked" value="0" />
-<h1><!-- TMPL_VAR NAME="header" --></h1>
-
-<table>
-<!-- TMPL_IF name="modify" -->
-<tr><th>Book fund</th><td><input type="hidden" name="bookfundid" value="<!-- 
TMPL_VAR NAME="bookfundid" -->" /><!-- TMPL_VAR NAME="bookfundid" --></td></tr>
-<tr><th>Book fund name</th><td><!-- TMPL_VAR NAME="bookfundname" --></td></tr>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="adding" -->
-<tr><th><label for="bookfundid">Bookfund</label></th><td><input type="hidden" 
name="bookfundid" id="bookfundid" size="5" maxlength="5" value="<!-- TMPL_VAR 
NAME="bookfundid" -->" /><!-- TMPL_VAR NAME="bookfundid" --></td></tr>
-<!-- /TMPL_IF -->
-
-<tr><th><label for="startdate">Start date (<!-- TMPL_VAR NAME="dateformat" 
-->)</label></th><td><input type="text" id="startdate" name="startdate" 
value="<!-- TMPL_VAR NAME="startdate" -->" />&nbsp;</td></tr>
-<tr><th><label for="enddate">End date (<!-- TMPL_VAR NAME="dateformat" 
-->)</label></th><td><input type="text" id="enddate" name="enddate" value="<!-- 
TMPL_VAR NAME="enddate" -->" /></td></tr>
-<tr><th><label for="budgetamount">Budget amount</label></th><td><input 
type="text" name="budgetamount" id="budgetamount" value="<!-- TMPL_VAR 
NAME="budgetamount" -->" /></td></tr>
-</table>
-<input type="hidden" name="aqbudgetid" value="<!-- TMPL_VAR NAME="aqbudgetid" 
-->" /><input type="button" value="<!-- TMPL_VAR NAME="header" -->" 
onclick="Check(this.form)" /> <input type="button" value="Cancel" 
onclick="location.href='/cgi-bin/koha/admin/aqbudget.pl'; return false;" 
/></form>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="add_validate" -->
-<h3>Budget Data Recorded</h3><table><tr><td>
-<form action="<!-- TMPL_VAR NAME="action" -->" method="post">
-<input type="submit" value="Continue" />
-</form></td></tr></table>
-<!-- /TMPL_IF -->
+  <fieldset>
+    <legend>Add budget</legend>
+    <input type="hidden" name="op" value="add_validate" />
+    <input type="hidden" name="checked" value="0" />
+
+    <table>
+      <tr>
+        <th>Book fund</th>
+        <td>
+          <input type="hidden" name="bookfundid" value="<!-- TMPL_VAR 
NAME="bookfundid" -->" />
+          <!-- TMPL_VAR NAME="bookfundname" -->
+        </td>
+      </tr>
+
+      <tr>
+        <th>
+          <label for="startdate">Start date (<!-- TMPL_VAR NAME="dateformat" 
-->)</label>
+        </th>
+        <td>
+          <input type="text" size="8" maxlength="10" id="startdate" 
name="startdate" value="<!-- TMPL_VAR Name="startdate" -->" />
+          <img src="<!-- TMPL_VAR Name="themelang" 
-->/includes/calendar/cal.gif" id="startdate_button" />
+          <script language="JavaScript" type="text/javascript">
+            Calendar.setup(
+              {
+                inputField : "startdate",
+                ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+                button : "startdate_button"
+              }
+            );
+          </script>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <label for="enddate">End date (<!-- TMPL_VAR NAME="dateformat" 
-->)</label>
+        </th>
+        <td>
+          <input type="text" size="8" maxlength="10" id="enddate" 
name="enddate" value="<!-- TMPL_VAR Name="enddate" -->" />
+          <img src="<!-- TMPL_VAR Name="themelang" 
-->/includes/calendar/cal.gif" id="enddate_button" />
+          <script language="JavaScript" type="text/javascript">
+            Calendar.setup(
+              {
+                inputField : "enddate",
+                ifFormat : "<!-- TMPL_VAR NAME="DHTMLcalendar_dateformat" -->",
+                button : "enddate_button"
+              }
+            );
+          </script>
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <label for="budgetamount">Budget amount</label>
+        </th>
+        <td>
+          <input type="text" name="budgetamount" id="budgetamount" value="<!-- 
TMPL_VAR NAME="budgetamount" -->" size="8" />
+        </td>
+      </tr>
+      <tr>
+        <th>
+          <label for="branch">Branch</label>
+        </th>
+        <td>
+  <!-- TMPL_IF NAME="disable_branchselection" -->
+          <!-- Pierrick's note: I've found that a disabled select was not -->
+          <!-- giving its value to Perl :-/ So I use a hidden field trick -->
+          <input type="hidden" name="branch" value="<!-- TMPL_VAR 
NAME="branch" -->" />
+          <select name="branch" disabled="disabled">
+  <!-- TMPL_ELSE -->
+          <select name="branch">
+  <!-- /TMPL_IF -->
+
+            <option value="">----</option>
+  <!-- TMPL_LOOP NAME="branches" -->
+    <!-- TMPL_IF NAME="selected" -->
+            <option value="<!-- TMPL_VAR NAME="branchcode" -->" 
selected="selected"><!-- TMPL_VAR NAME="branchname" --></option>
+    <!-- TMPL_ELSE -->
+            <option value="<!-- TMPL_VAR NAME="branchcode" -->"><!-- TMPL_VAR 
NAME="branchname" --></option>
+    <!-- /TMPL_IF -->
+  <!-- /TMPL_LOOP -->
+          </select>
+        </td>
+      </tr>
+    </table>
+
+  <!-- TMPL_IF NAME="aqbudgetid" -->
+    <input type="hidden" name="aqbudgetid" value="<!-- TMPL_VAR 
NAME="aqbudgetid" -->" />
+  <!-- /TMPL_IF -->
+
+    <p id="action">
+      <input type="button" value="Submit" onclick="Check(this.form)" />
+      <input type="submit" value="Cancel" 
onclick="location.href='/cgi-bin/koha/admin/aqbudget.pl'; return false;" />
+    </p>
+  </fieldset>
+</form>
+<!-- /TMPL_IF --> <!-- add_form -->
 
 <!-- TMPL_IF name="delete_confirm" -->
-<h3>Delete Book Budget?</h3>
-<table>
-<tr><th>Start date</th><td><!-- TMPL_VAR NAME="startdate" --></td></tr>
-<tr><th>End date</th><td><!-- TMPL_VAR NAME="enddate" --></td></tr>
-<tr><th>Budget Amount</th><td><!-- TMPL_VAR NAME="budgetamount" --></td></tr>
-</table>
-
-<form action="<!-- TMPL_VAR NAME="action" -->" method="post"><input 
type="hidden" name="op" value="delete_confirmed" /><input type="hidden" 
name="aqbudgetid" value="<!-- TMPL_VAR NAME="aqbudgetid" -->" /><input 
type="submit" value="Delete this Book Fund" /></form> <form action="<!-- 
TMPL_VAR NAME="action" -->" method="post"><input type="submit" value="Do Not 
Delete" /></form>
-<!-- /TMPL_IF -->
-
-<!-- TMPL_IF name="delete_confirmed" -->
-<h3>Budget deleted</h3>
 <form action="<!-- TMPL_VAR NAME="action" -->" method="post">
-<input type="submit" value="Continue" />
+  <fieldset>
+    <legend>Delete Book Budget?</legend>
+
+    <table>
+      <tr>
+        <th>Start date</th>
+        <td><!-- TMPL_VAR NAME="startdate" --></td>
+      </tr>
+      
+      <tr>
+        <th>End date</th>
+        <td><!-- TMPL_VAR NAME="enddate" --></td>
+      </tr>
+      
+      <tr>
+        <th>Budget Amount</th>
+        <td><!-- TMPL_VAR NAME="budgetamount" --></td>
+      </tr>
+    </table>
+
+    <input type="hidden" name="op" value="delete_confirmed" />
+    <input type="hidden" name="aqbudgetid" value="<!-- TMPL_VAR 
NAME="aqbudgetid" -->" />
+
+    <p id="action">
+      <input type="submit" value="Delete this budget" />
+      <input type="submit" value="Do Not Delete" />
+    </p>
+  </fieldset>
 </form>
 <!-- /TMPL_IF -->
 
Index: koha/updater/updatedatabase
diff -u koha/updater/updatedatabase:1.132 koha/updater/updatedatabase:1.133
--- koha/updater/updatedatabase:1.132   Thu Apr  6 12:37:05 2006
+++ koha/updater/updatedatabase Thu Apr 13 08:36:42 2006
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: updatedatabase,v 1.132 2006/04/06 12:37:05 hdl Exp $
+# $Id: updatedatabase,v 1.133 2006/04/13 08:36:42 plg Exp $
 
 # Database Updater
 # This script checks for required updates to the database.
@@ -141,6 +141,7 @@
        subscription => { 'letter' => 'char(20) NULL', 'distributedto' => 'text 
NULL'},
        itemtypes => { 'imageurl' => 'char(200) NULL'},
        aqbookfund => { 'branchcode' => 'varchar(4) NULL'},
+       aqbudget => { 'branchcode' => 'varchar(4) NULL'},
 #    tablename        => { 'field' => 'fieldtype' },
 );
 
@@ -1285,6 +1286,27 @@
 exit;
 
 # $Log: updatedatabase,v $
+# Revision 1.133  2006/04/13 08:36:42  plg
+# new: function C4::Date::get_date_format_string_for_DHTMLcalendar based on
+# the system preference prefered date format.
+#
+# improvement: book fund list and budget list screen redesigned. Filters on
+# each field. Columns are not sortable yet. Using DHTML Calendar to fill date
+# fields instead of manual filling. Pagination system. From the book fund
+# list, you can reach the budget list, filtered on a book fund, or not. A
+# budget can be added only from book fund list screen.
+#
+# bug fixed: branchcode was missing in table aqbudget.
+#
+# bug fixed: when setting a branchcode to a book fund, all associated budgets
+# move to this branchcode.
+#
+# modification: when adding/modifying budget/fund, MySQL specific "REPLACE..."
+# statements replaced by standard SQL compliant statement.
+#
+# bug fixed: when adding/modifying a budget, if the book fund is associated to
+# a branch, the branch selection is disabled and set to the book fund branch.
+#
 # Revision 1.132  2006/04/06 12:37:05  hdl
 # Bugfixing : aqbookfund needed a field.
 #




reply via email to

[Prev in Thread] Current Thread [Next in Thread]