# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA 02111-1307 USA
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
use warnings;
$booksellerid = $basket->{booksellerid} unless $booksellerid;
my ($bookseller) = GetBookSellerFromId($booksellerid);
my $op = $query->param('op');
+if (!defined $op) {
+ $op = q{};
+}
if ( $op eq 'delete_confirm' ) {
my $basketno = $query->param('basketno');
} elsif ($op eq 'attachbasket' && $template->{'param_map'}->{'CAN_user_acquisition_group_manage'} == 1) {
print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?basketno=' . $basket->{'basketno'} . '&op=attachbasket&booksellerid=' . $booksellerid);
# check if we have to "close" a basket before building page
+} elsif ($op eq 'export') {
+ print $query->header(
+ -type => 'text/csv',
+ -attachment => 'basket' . $basket->{'basketno'} . '.csv',
+ );
+ print GetBasketAsCSV($query->param('basketno'));
+ exit;
} elsif ($op eq 'close') {
my $confirm = $query->param('confirm');
if ($confirm) {
});
ModBasket( { basketno => $basketno,
basketgroupid => $basketgroupid } );
- print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid);
+ print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?booksellerid='.$booksellerid.'&closed=1');
} else {
- print $query->redirect('/cgi-bin/koha/acqui/basketgroup.pl?basketno='.$basketno.'&op=attachbasket&booksellerid=' . $booksellerid);
+ print $query->redirect('/cgi-bin/koha/acqui/booksellers.pl?supplierid=' . $booksellerid);
}
exit;
} else {
}
#if the basket is closed,and the user has the permission to edit basketgroups, display a list of basketgroups
my $basketgroups;
- my $member = GetMember($loggedinuser, "borrowernumber");
+ my $member = GetMember(borrowernumber => $loggedinuser);
if ($basket->{closedate} && haspermission({ flagsrequired => { acquisition => 'group_manage'} })) {
$basketgroups = GetBasketgroups($basket->{booksellerid});
for (my $i=0; $i < scalar(@$basketgroups); $i++) {
for ( my $i = 0 ; $i < $count ; $i++ ) {
my $rrp = $results[$i]->{'listprice'};
my $qty = $results[$i]->{'quantity'} || 0;
+ if (!defined $results[$i]->{quantityreceived}) {
+ $results[$i]->{quantityreceived} = 0;
+ }
my $budget = GetBudget( $results[$i]->{'budget_id'} );
$rrp = ConvertCurrency( $results[$i]->{'currency'}, $rrp );
my %line = %{ $results[$i] };
($i%2) and $line{toggle} = 1;
- $line{order_received} = ( $qty eq $results[$i]->{'quantityreceived'} );
+ $line{order_received} = ( $qty == $results[$i]->{'quantityreceived'} );
$line{basketno} = $basketno;
$line{i} = $i;
$line{budget_name} = $budget->{budget_name};
$line{line_total} = sprintf( "%.2f", $line_total );
$line{odd} = $i % 2;
if ($line{uncertainprice}) {
- $template->param( unclosable => 1 );
- for my $key (qw/ecost line_total rrp/) {
- $line{$key} .= '??';
- }
+ $template->param( uncertainprices => 1 );
+ $line{rrp} .= ' (Uncertain)';
}
if ($line{'title'}){
my $volume = $results[$i]->{'volume'};
my $total_est_gste = $total_rrp_gste - ($total_rrp_gste * $discount);
my $contract = &GetContract($basket->{contractnumber});
+ my @orders = GetOrders($basketno);
$template->param(
basketno => $basketno,
basketname => $basket->{'basketname'},
GST => $gist,
basketgroups => $basketgroups,
grouped => $basket->{basketgroupid},
+ unclosable => @orders ? 0 : 1,
);
}
+
output_html_with_http_headers $query, $cookie, $template->output;