koha-cvs
[Top][All Lists]
Advanced

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

[Koha-cvs] CVS: koha/admin aqbookfund.pl,1.14,1.15 aqbudget.pl,1.13,1.14


From: Paul POULAIN
Subject: [Koha-cvs] CVS: koha/admin aqbookfund.pl,1.14,1.15 aqbudget.pl,1.13,1.14
Date: Fri, 06 Jun 2003 07:50:39 -0700

Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1:/tmp/cvs-serv27443/admin

Modified Files:
        aqbookfund.pl aqbudget.pl 
Log Message:
1st draft for budget reordering
DOES NOT WORK.
But it's time for week end for me, so bugfix will wait until tuesday :-)

Index: aqbookfund.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/aqbookfund.pl,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** aqbookfund.pl       13 Apr 2003 05:54:18 -0000      1.14
--- aqbookfund.pl       6 Jun 2003 14:50:36 -0000       1.15
***************
*** 162,202 ****
        my $sth=$dbh->prepare($query);
        $sth->execute;
        $sth->finish;
                                                                                
                        # 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,'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 @toggle = ();
!          my @bookfundid = ();
!          my @bookfundname = ();
!          push(@toggle,$toggle);
!          push(@bookfundid,$results->[$i]{'bookfundid'});
!          push(@bookfundname,$results->[$i]{'bookfundname'});
!          if ($toggle eq 'white'){
!                       $toggle="#ffffcc";
!               } else {
!                       $toggle="white";
!               }
!       while (@toggle and @bookfundid and @bookfundname) {
!          my %row_data;
!          $row_data{toggle} = shift @toggle;
!          $row_data{bookfundid} = shift @bookfundid;
!          $row_data{bookfundname} = shift @bookfundname;
!          push(@loop_data, \%row_data);
!        }
!        }
!        $template->param(bookfund => address@hidden);
  } #---- END $OP eq DEFAULT
  
--- 162,199 ----
        my $sth=$dbh->prepare($query);
        $sth->execute;
+       $dbh->do("delete from aqbudget where bookfundid='$bookfundid'");
        $sth->finish;
                                                                                
                        # 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,'web');
!       my $toggle="white";
!       my @loop_data =();
!       my $dbh = C4::Context->dbh;
!       my $sth2 = $dbh->prepare("Select 
aqbudgetid,startdate,enddate,budgetamount from aqbudget where bookfundid = ? 
order by bookfundid");
!       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'};
!               $sth2->execute($row_data{bookfundid});
!               my @budget_loop;
!               while (my ($aqbudgetid,$startdate,$enddate,$budgetamount) = 
$sth2->fetchrow) {
!                       my %budgetrow_data;
!                       $budgetrow_data{aqbudgetid} = $aqbudgetid;
!                       $budgetrow_data{startdate} = $startdate;
!                       $budgetrow_data{enddate} = $enddate;
!                       $budgetrow_data{budgetamount} = $budgetamount;
!                       push @budget_loop,\%budgetrow_data;
!               }
!               $row_data{budget} = address@hidden;
!               push @loop_data,\%row_data;
!       }
!       $template->param(bookfund => address@hidden);
  } #---- END $OP eq DEFAULT
  

Index: aqbudget.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/aqbudget.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** aqbudget.pl 5 Apr 2003 03:19:33 -0000       1.13
--- aqbudget.pl 6 Jun 2003 14:50:36 -0000       1.14
***************
*** 54,58 ****
        my @data=split(' ',$searchstring);
        my address@hidden;
!       my $query="Select bookfundid,startdate,enddate,budgetamount from 
aqbudget where (bookfundid like \"$data[0]%\") order by bookfundid";
        my $sth=$dbh->prepare($query);
        $sth->execute;
--- 54,58 ----
        my @data=split(' ',$searchstring);
        my address@hidden;
!       my $query="Select aqbudgetid,bookfundid,startdate,enddate,budgetamount 
from aqbudget where (bookfundid like \"$data[0]%\") order by 
bookfundid,aqbudgetid";
        my $sth=$dbh->prepare($query);
        $sth->execute;
***************
*** 73,76 ****
--- 73,77 ----
  my $script_name="/cgi-bin/koha/admin/aqbudget.pl";
  my $bookfundid=$input->param('bookfundid');
+ my $aqbudgetid=$input->param('aqbudgetid');
  my $pagesize=20;
  my $op = $input->param('op');
***************
*** 101,107 ****
        my $dataaqbudget;
        my $dataaqbookfund;
!       if ($bookfundid) {
                my $dbh = C4::Context->dbh;
!               my $query="select bookfundid,startdate,enddate,budgetamount 
from aqbudget where bookfundid='$bookfundid'";
  #             print $query;
                my $sth=$dbh->prepare($query);
--- 102,108 ----
        my $dataaqbudget;
        my $dataaqbookfund;
!       if ($aqbudgetid) {
                my $dbh = C4::Context->dbh;
!               my $query="select 
aqbudgetid,bookfundname,aqbookfund.bookfundid,startdate,enddate,budgetamount 
from aqbudget,aqbookfund where aqbudgetid='$aqbudgetid' and 
aqbudget.bookfundid=aqbookfund.bookfundid";
  #             print $query;
                my $sth=$dbh->prepare($query);
***************
*** 109,121 ****
                $dataaqbudget=$sth->fetchrow_hashref;
                $sth->finish;
-               my $query="select bookfundid,bookfundname from aqbookfund where 
bookfundid='$bookfundid'";
- #             print $query;
-               my $sth=$dbh->prepare($query);
-               $sth->execute;
-               $dataaqbookfund=$sth->fetchrow_hashref;
-               $sth->finish;
        }
        my $header;
!       if ($bookfundid) {
                $header = "Modify budget";
        } else {
--- 110,116 ----
                $dataaqbudget=$sth->fetchrow_hashref;
                $sth->finish;
        }
        my $header;
!       if ($aqbudgetid) {
                $header = "Modify budget";
        } else {
***************
*** 123,137 ****
        }
        $template->param(header => $header);
!       if ($bookfundid) {
            $template->param(modify => 1);
!           $template->param(bookfundid => $bookfundid);
!           $template->param(bookfundname => $dataaqbookfund->{bookfundname});
        } else {
            $template->param(adding => 1);
        }
!       $template->param(dateformat => display_date_format() );
!       $template->param(startdate => 
format_date($dataaqbudget->{'startdate'}));
!       $template->param(enddate => format_date($dataaqbudget->{'enddate'}));
!       $template->param(budgetamount => $dataaqbudget->{'budgetamount'});
                                                                                
                        # END $OP eq ADD_FORM
  ################## ADD_VALIDATE ##################################
--- 118,134 ----
        }
        $template->param(header => $header);
!       if ($aqbudgetid) {
            $template->param(modify => 1);
!           $template->param(bookfundid => $dataaqbudget->{bookfundid});
!           $template->param(bookfundname => $dataaqbudget->{bookfundname});
        } else {
            $template->param(adding => 1);
        }
!       $template->param(dateformat => display_date_format(),
!                                                       aqbudgetid => 
$dataaqbudget->{'aqbudgetid'},
!                                                       startdate => 
format_date($dataaqbudget->{'startdate'}),
!                                                       enddate => 
format_date($dataaqbudget->{'enddate'}),
!                                                       budgetamount => 
$dataaqbudget->{'budgetamount'}
!       );
                                                                                
                        # END $OP eq ADD_FORM
  ################## ADD_VALIDATE ##################################
***************
*** 139,149 ****
  } elsif ($op eq 'add_validate') {
        my $dbh = C4::Context->dbh;
!       my $query = "replace aqbudget 
(bookfundid,startdate,enddate,budgetamount) values (";
!       $query.= $dbh->quote($input->param('bookfundid')).",";
!       $query.= 
$dbh->quote(format_date_in_iso($input->param('startdate'))).",";
!       $query.= $dbh->quote(format_date_in_iso($input->param('enddate'))).",";
!       $query.= $dbh->quote($input->param('budgetamount')).")";
        my $sth=$dbh->prepare($query);
!       $sth->execute;
        $sth->finish;
                                                                                
                        # END $OP eq ADD_VALIDATE
--- 136,146 ----
  } elsif ($op eq 'add_validate') {
        my $dbh = C4::Context->dbh;
!       my $query = "replace aqbudget 
(aqbudgetid,bookfundid,startdate,enddate,budgetamount) values (?,?,?,?,?)";
        my $sth=$dbh->prepare($query);
!       $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')
!                                               );
        $sth->finish;
                                                                                
                        # END $OP eq ADD_VALIDATE
***************
*** 152,164 ****
  } elsif ($op eq 'delete_confirm') {
        my $dbh = C4::Context->dbh;
! #     my $sth=$dbh->prepare("select count(*) as total from categoryitem where 
itemtype='$itemtype'");
! #     $sth->execute;
! #     my $total = $sth->fetchrow_hashref;
! #     $sth->finish;
!       my $sth=$dbh->prepare("select bookfundid,startdate,enddate,budgetamount 
from aqbudget where bookfundid='$bookfundid'");
        $sth->execute;
        my $data=$sth->fetchrow_hashref;
        $sth->finish;
        $template->param(bookfundid => $bookfundid);
        $template->param(startdate => format_date($data->{'startdate'}));
        $template->param(enddate => format_date($data->{'enddate'}));
--- 149,158 ----
  } elsif ($op eq 'delete_confirm') {
        my $dbh = C4::Context->dbh;
!       my $sth=$dbh->prepare("select 
aqbudgetid,bookfundid,startdate,enddate,budgetamount from aqbudget where 
aqbudgetid='$aqbudgetid'");
        $sth->execute;
        my $data=$sth->fetchrow_hashref;
        $sth->finish;
        $template->param(bookfundid => $bookfundid);
+       $template->param(aqbudgetid => $data->{'aqbudgetid'});
        $template->param(startdate => format_date($data->{'startdate'}));
        $template->param(enddate => format_date($data->{'enddate'}));
***************
*** 169,177 ****
  } elsif ($op eq 'delete_confirmed') {
        my $dbh = C4::Context->dbh;
!       my $bookfundid=uc($input->param('bookfundid'));
!       my $query = "delete from aqbudget where bookfundid='$bookfundid'";
        my $sth=$dbh->prepare($query);
        $sth->execute;
        $sth->finish;
                                                                                
                        # END $OP eq DELETE_CONFIRMED
  ################## DEFAULT ##################################
--- 163,173 ----
  } elsif ($op eq 'delete_confirmed') {
        my $dbh = C4::Context->dbh;
!       my $aqbudgetid=uc($input->param('aqbudgetid'));
!       my $query = "delete from aqbudget where aqbudgetid='$aqbudgetid'";
        my $sth=$dbh->prepare($query);
        $sth->execute;
        $sth->finish;
+        print $input->redirect("aqbookfund.pl");
+        return;
                                                                                
                        # END $OP eq DELETE_CONFIRMED
  ################## DEFAULT ##################################




reply via email to

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