1st draft for budget reordering
DOES NOT WORK. But it's time for week end for me, so bugfix will wait until tuesday :-)
This commit is contained in:
parent
f2a2937c0c
commit
d8ed149e5f
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -12,13 +12,9 @@
|
|||
<td valign="top" width="25%"><a href=/cgi-bin/koha/admin/itemtypes.pl>Item types</a></td>
|
||||
<td>Define item types.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%"><a href=/cgi-bin/koha/admin/aqbudget.pl>Budget</a></td>
|
||||
<td>The monies allocated to your book funds.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%"><a href=/cgi-bin/koha/admin/aqbookfund.pl>Book funds</a></td>
|
||||
<td>Book fund administration.</td>
|
||||
<td>Book fund and budget administration.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%"><a href=/cgi-bin/koha/admin/authorised_values.pl>Authorised values</a></td>
|
||||
|
|
@ -78,12 +74,20 @@
|
|||
<th>Tools</th>
|
||||
</tr>
|
||||
</table>
|
||||
<table cellspacing=0 cellpadding=1 width=80%>
|
||||
<th colspan=2>Export</th>
|
||||
<tr>
|
||||
<td valign="top" width="25%"><a href=/cgi-bin/koha/export/marc.pl>MARC biblio export</a></td>
|
||||
<td>Exporting in MARC format.</td>
|
||||
</tr>
|
||||
<table cellspacing=5 cellpadding=1 width=80%>
|
||||
<th colspan=2>Export</th>
|
||||
<tr>
|
||||
<td valign="top" width="25%"><a href="/cgi-bin/koha/export/marc.pl">MARC biblio export</a></td>
|
||||
<td>Exporting in MARC format.</td>
|
||||
</tr>
|
||||
<th colspan=2>Import</th>
|
||||
<tr valign="top">
|
||||
<td width="20%"><a href="/cgi-bin/koha/import/breeding.pl">Upload MARC records</a> in Breeding Farm</td>
|
||||
<td>The breeding farm is a table where imported MARC records are stored.<br/>
|
||||
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. <br/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<TMPL_INCLUDE NAME="parameters-bottom.inc">
|
||||
|
|
|
|||
|
|
@ -10,18 +10,27 @@
|
|||
<tr valign=top bgcolor=#99cc33>
|
||||
<td background="<TMPL_VAR NAME='themelang'>/images/background-mem.gif"><b>Book fund</b></td>
|
||||
<td background="<TMPL_VAR NAME='themelang'>/images/background-mem.gif"><b>Name</b></td>
|
||||
<td background="<TMPL_VAR NAME='themelang'>/images/background-mem.gif"><b>Budget</b></td>
|
||||
<td background="<TMPL_VAR NAME='themelang'>/images/background-mem.gif"><b>Edit</b></td>
|
||||
<td background="<TMPL_VAR NAME='themelang'>/images/background-mem.gif"><b>Delete</b></td>
|
||||
</tr>
|
||||
<TMPL_LOOP name="bookfund">
|
||||
<tr valign=top bgcolor="<TMPL_VAR name="toggle">">
|
||||
<tr valign=top bgcolor="ffffcc">
|
||||
<td><TMPL_VAR name="bookfundid"></td>
|
||||
<td><TMPL_VAR name="bookfundname"></td>
|
||||
<td><a href="aqbudget.pl?bookfundid=<TMPL_VAR name="bookfundid"> "><img src="<TMPL_VAR NAME='interface'>/<TMPL_VAR name="theme">/images/filefind.png" width=32 hspace=0 vspace=0 border=0 title="budget"></a></td>
|
||||
<td><a href="<TMPL_VAR name="action">?op=add_form&bookfundid=<TMPL_VAR name="bookfundid"> "><img src="<TMPL_VAR NAME='interface'>/<TMPL_VAR name="theme">/images/fileopen.png" width=32 hspace=0 vspace=0 border=0></a></td>
|
||||
<td><a href="<TMPL_VAR name="action">?op=delete_confirm&bookfundid=<TMPL_VAR name="bookfundid">"><img src="<TMPL_VAR NAME='interface'>/<TMPL_VAR name="theme">/images/edittrash.png" width=32 hspace=0 vspace=0 border=0></a></td>
|
||||
</tr>
|
||||
<TMPL_LOOP name="budget">
|
||||
<tr valign=top>
|
||||
<td> </td>
|
||||
<td align="right">
|
||||
<TMPL_VAR name="startdate"> - <TMPL_VAR name="enddate"> : <b><TMPL_VAR name="budgetamount"></b>
|
||||
</td>
|
||||
<td><a href="/cgi-bin/koha/admin/aqbudget.pl?op=add_form&aqbudgetid=<TMPL_VAR name="aqbudgetid">"><img src="<TMPL_VAR NAME='interface'>/<TMPL_VAR name="theme">/images/fileopen.png" width=32 hspace=0 vspace=0 border=0></a></td>
|
||||
<td><a href="/cgi-bin/koha/admin/aqbudget.pl?op=delete_confirm&aqbudgetid=<TMPL_VAR name="aqbudgetid">"><img src="<TMPL_VAR NAME='interface'>/<TMPL_VAR name="theme">/images/edittrash.png" width=32 hspace=0 vspace=0 border=0></a></td>
|
||||
|
||||
</tr>
|
||||
</TMPL_LOOP>
|
||||
</TMPL_LOOP>
|
||||
</table>
|
||||
<form action='<TMPL_VAR name=scriptname>' method=post>
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@
|
|||
<tr><td>Start date (<TMPL_VAR NAME=dateformat>)</td><td><input type=text name=startdate size=11 value='<TMPL_VAR name="startdate">'> </td></tr>
|
||||
<tr><td>End date (<TMPL_VAR NAME=dateformat>)</td><td><input type=text name=enddate size=11 value='<TMPL_VAR name="enddate">'></td></tr>
|
||||
<tr><td>Budget amount</td><td><input type=text name=budgetamount value='<TMPL_VAR name="budgetamount">'></td></tr>
|
||||
<tr><td> </td><td><INPUT type=button value='OK' onClick='Check(this.form)'></td></tr>
|
||||
<tr><td> </td><td><input type="hidden" name="aqbudgetid" value="<TMPL_VAR name="aqbudgetid">"><INPUT type=button value='OK' onClick='Check(this.form)'></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<br clear=all>
|
||||
|
|
@ -122,7 +122,7 @@ Data recorded
|
|||
</td>
|
||||
</tr>
|
||||
|
||||
<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">'>
|
||||
<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">'>
|
||||
<tr>
|
||||
<td>Start date</td>
|
||||
<td><TMPL_VAR name="startdate"></td>
|
||||
|
|
|
|||
|
|
@ -12,13 +12,9 @@
|
|||
<td valign="top" width="25%"><a href=/cgi-bin/koha/admin/itemtypes.pl>Types d'exemplaires</a></td>
|
||||
<td>Les supports physiques d'un exemplaire</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%"><a href=/cgi-bin/koha/admin/aqbudget.pl>Budget</a></td>
|
||||
<td>Les budgets alloués à un fonds.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%"><a href=/cgi-bin/koha/admin/aqbookfund.pl>Fonds</a></td>
|
||||
<td>Les différents fonds</td>
|
||||
<td>Les différents fonds et leurs budgets</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top" width="25%"><a href=/cgi-bin/koha/admin/authorised_values.pl>Valeurs autorisées</a></td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue