use strict;
use CGI;
+use C4::Branch; # GetBranches
use List::Util qw/min/;
-use C4::Date;
+use C4::Dates qw/format_date format_date_in_iso/;
use C4::Auth;
use C4::Acquisition;
use C4::Context;
-use C4::Interface::CGI::Output;
-use C4::Search;
-use C4::Koha;
use C4::Output;
+use C4::Koha;
my $input = new CGI;
my $script_name="/cgi-bin/koha/admin/aqbudget.pl";
-my $bookfundid=$input->param('bookfundid');
-my $aqbudgetid=$input->param('aqbudgetid');
+my $bookfundid = $input->param('bookfundid');
+my $aqbudgetid = $input->param('aqbudgetid');
+my $branchcodeid = $input->param('branchcode');
my $pagesize = 20;
my $op = $input->param('op');
$template->param(
action => $script_name,
- DHTMLcalendar_dateformat => get_date_format_string_for_DHTMLcalendar(),
+ DHTMLcalendar_dateformat => C4::Dates->DHTMLcalendar(),
script_name => $script_name,
$op || 'else' => 1,
);
budgetamount,
aqbudget.branchcode
FROM aqbudget
- INNER JOIN aqbookfund ON aqbudget.bookfundid = aqbookfund.bookfundid
+ INNER JOIN aqbookfund ON (aqbudget.bookfundid = aqbookfund.bookfundid AND
+ aqbudget.branchcode = aqbookfund.branchcode)
WHERE aqbudgetid = ?
';
$sth=$dbh->prepare($query);
aqbookfund.bookfundname
FROM aqbookfund
LEFT JOIN branches ON aqbookfund.branchcode = branches.branchcode
- WHERE bookfundid = ?
+ WHERE bookfundid = ? AND aqbookfund.branchcode=?
';
$sth=$dbh->prepare($query);
$sth->execute(
defined $aqbudgetid ? $dataaqbudget->{bookfundid} : $bookfundid,
+ $branchcodeid
);
$dataaqbookfund=$sth->fetchrow_hashref;
$sth->finish;
if (defined $aqbudgetid) {
$template->param(
bookfundid => $dataaqbudget->{'bookfundid'},
+ branchcode => $dataaqbudget->{'branchcode'},
bookfundname => $dataaqbudget->{'bookfundname'}
);
}
else {
$template->param(
bookfundid => $bookfundid,
+ branchcode => $dataaqbookfund->{'branchcode'},
bookfundname => $dataaqbookfund->{bookfundname},
);
}
$sth->finish;
$template->param(
- dateformat => display_date_format(),
+ dateformat => C4::Dates->new()->visual(),
aqbudgetid => $dataaqbudget->{'aqbudgetid'},
startdate => format_date($dataaqbudget->{'startdate'}),
- enddate => format_date($dataaqbudget->{'enddate'}),
+ enddate => format_date($dataaqbudget->{'enddate'}),
budgetamount => $dataaqbudget->{'budgetamount'},
branches => \@branches,
);
- if (defined $dataaqbookfund->{branchcode}) {
+ if ( $dataaqbookfund->{branchcode}) {
$template->param(
disable_branchselection => 1,
branch => $dataaqbookfund->{branchcode},
format_date_in_iso($input->param('startdate')),
format_date_in_iso($input->param('enddate')),
$input->param('budgetamount'),
- $input->param('branch') || undef,
+ $input->param('branch') || '',
$aqbudgetid,
);
$sth->finish;
format_date_in_iso($input->param('startdate')),
format_date_in_iso($input->param('enddate')),
$input->param('budgetamount'),
- $input->param('branch') || undef,
+ $input->param('branch') || '',
);
$sth->finish;
}
budgetamount,
branchcode
FROM aqbudget
- WHERE 1 = 1';
+ WHERE 1 = 1'; # What's the point?
my @bindings;
)
);
} #---- END $OP eq DEFAULT
-$template->param(intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet => C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
output_html_with_http_headers $input, $cookie, $template->output;