From d8ed149e5fa808c73080ab228b7dae3b28fa5341 Mon Sep 17 00:00:00 2001 From: tipaul Date: Fri, 6 Jun 2003 14:50:35 +0000 Subject: [PATCH] 1st draft for budget reordering DOES NOT WORK. But it's time for week end for me, so bugfix will wait until tuesday :-) --- admin/aqbookfund.pl | 57 +++++++++---------- admin/aqbudget.pl | 56 +++++++++--------- .../default/en/parameters/admin-home.tmpl | 26 +++++---- .../default/en/parameters/aqbookfund.tmpl | 15 ++++- .../default/en/parameters/aqbudget.tmpl | 4 +- .../default/fr/parameters/admin-home.tmpl | 6 +- 6 files changed, 83 insertions(+), 81 deletions(-) diff --git a/admin/aqbookfund.pl b/admin/aqbookfund.pl index 10f70b3d38..a577800ac1 100755 --- a/admin/aqbookfund.pl +++ b/admin/aqbookfund.pl @@ -161,43 +161,40 @@ if ($op eq 'add_form') { my $query = "delete from aqbookfund where bookfundid='$bookfundid'"; 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(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 => \@loop_data); + 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} = \@budget_loop; + push @loop_data,\%row_data; + } + $template->param(bookfund => \@loop_data); } #---- END $OP eq DEFAULT output_html_with_http_headers $input, $cookie, $template->output; diff --git a/admin/aqbudget.pl b/admin/aqbudget.pl index 820b43e17a..4b6ee7374d 100755 --- a/admin/aqbudget.pl +++ b/admin/aqbudget.pl @@ -53,7 +53,7 @@ sub StringSearch { $searchstring=~ s/\'/\\\'/g; my @data=split(' ',$searchstring); my $count=@data; - my $query="Select bookfundid,startdate,enddate,budgetamount from aqbudget where (bookfundid like \"$data[0]%\") order by bookfundid"; + 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; my @results; @@ -72,6 +72,7 @@ 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 $op = $input->param('op'); $searchfield=~ s/\,//g; @@ -100,66 +101,59 @@ if ($op eq 'add_form') { #---- if primkey exists, it's a modify action, so read values to modify... my $dataaqbudget; my $dataaqbookfund; - if ($bookfundid) { + if ($aqbudgetid) { my $dbh = C4::Context->dbh; - my $query="select bookfundid,startdate,enddate,budgetamount from aqbudget where bookfundid='$bookfundid'"; + 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); $sth->execute; $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) { + if ($aqbudgetid) { $header = "Modify budget"; } else { $header = "Add budget"; } $template->param(header => $header); - if ($bookfundid) { + if ($aqbudgetid) { $template->param(modify => 1); - $template->param(bookfundid => $bookfundid); - $template->param(bookfundname => $dataaqbookfund->{bookfundname}); + $template->param(bookfundid => $dataaqbudget->{bookfundid}); + $template->param(bookfundname => $dataaqbudget->{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'}); + $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 ################################## # called by add_form, used to insert/modify data in DB } 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 $query = "replace aqbudget (aqbudgetid,bookfundid,startdate,enddate,budgetamount) values (?,?,?,?,?)"; my $sth=$dbh->prepare($query); - $sth->execute; + $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 ################## DELETE_CONFIRM ################################## # called by default form, used to confirm deletion of data in DB } 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'"); + 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'})); $template->param(budgetamount => $data->{'budgetamount'}); @@ -168,11 +162,13 @@ if ($op eq 'add_form') { # called by delete_confirm, used to effectively confirm deletion of data in DB } 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 $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 ################################## } else { # DEFAULT diff --git a/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl b/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl index c043b68726..395afd94fb 100644 --- a/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/parameters/admin-home.tmpl @@ -12,13 +12,9 @@ Item types Define item types. - - Budget - The monies allocated to your book funds. - Book funds - Book fund administration. + Book fund and budget administration. Authorised values @@ -78,12 +74,20 @@ Tools - - - - - - +
Export
MARC biblio exportExporting in MARC format.
+ + + + + + + + + +
Export
MARC biblio exportExporting in MARC format.
Import
Upload MARC records in Breeding FarmThe breeding farm is a table where imported MARC records are stored.
+ A MARC record is stored in the breeding farm as long as you have no item. When you type the ISBN or title of a biblio, it's searched for in the breeding farm. + If it is found, the biblio is added to Koha active table and removed from the breeding farm.
+
diff --git a/koha-tmpl/intranet-tmpl/default/en/parameters/aqbookfund.tmpl b/koha-tmpl/intranet-tmpl/default/en/parameters/aqbookfund.tmpl index 99a48395df..de9567d805 100644 --- a/koha-tmpl/intranet-tmpl/default/en/parameters/aqbookfund.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/parameters/aqbookfund.tmpl @@ -10,18 +10,27 @@ Book fund Name - Budget Edit Delete - "> + - ">/images/filefind.png" width=32 hspace=0 vspace=0 border=0 title="budget"> ?op=add_form&bookfundid= ">/images/fileopen.png" width=32 hspace=0 vspace=0 border=0> ?op=delete_confirm&bookfundid=">/images/edittrash.png" width=32 hspace=0 vspace=0 border=0> + + +   + + - : + + ">/images/fileopen.png" width=32 hspace=0 vspace=0 border=0> + ">/images/edittrash.png" width=32 hspace=0 vspace=0 border=0> + + +
diff --git a/koha-tmpl/intranet-tmpl/default/en/parameters/aqbudget.tmpl b/koha-tmpl/intranet-tmpl/default/en/parameters/aqbudget.tmpl index 23d4a56448..28c77e26bb 100644 --- a/koha-tmpl/intranet-tmpl/default/en/parameters/aqbudget.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/parameters/aqbudget.tmpl @@ -97,7 +97,7 @@ Start date ()  End date () Budget amount">
@@ -122,7 +122,7 @@ Data recorded -
+ Start date diff --git a/koha-tmpl/intranet-tmpl/default/fr/parameters/admin-home.tmpl b/koha-tmpl/intranet-tmpl/default/fr/parameters/admin-home.tmpl index 2dede9e058..25d828b77e 100644 --- a/koha-tmpl/intranet-tmpl/default/fr/parameters/admin-home.tmpl +++ b/koha-tmpl/intranet-tmpl/default/fr/parameters/admin-home.tmpl @@ -12,13 +12,9 @@ Types d'exemplaires Les supports physiques d'un exemplaire - - Budget - Les budgets alloués à un fonds. - Fonds - Les différents fonds + Les différents fonds et leurs budgets Valeurs autorisées -- 2.39.5