#Delete all orders included in that basket, and all items received.
foreach my $myorder (@orders){
DelOrder($myorder->{biblionumber},$myorder->{ordernumber});
- warn "suppression de ".$myorder->{biblionumber}.' '.$myorder->{ordernumber};
}
# if $delbiblio = 1, delete the records if possible
if ((defined $delbiblio)and ($delbiblio ==1)){
+ my @cannotdelbiblios ;
foreach my $myorder (@orders){
my $biblionumber = $myorder->{'biblionumber'};
my $countbiblio = CountBiblioInOrders($biblionumber);
my $ordernumber = $myorder->{'ordernumber'};
- my @subscriptions = GetSubscriptionsId ($biblionumber);
+ my $subscriptions = scalar GetSubscriptionsId ($biblionumber);
my $itemcount = GetItemsCount($biblionumber);
- DelBiblio($myorder->{biblionumber}) if ($countbiblio == 0 && $itemcount == 0 && !(@subscriptions));
- warn "suppression de la notice ".$myorder->{biblionumber}};
+ my $error;
+ if ($countbiblio == 0 && $itemcount == 0 && $subscriptions == 0) {
+ $error = DelBiblio($myorder->{biblionumber}) }
+ else {
+ push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}),
+ title=> $myorder->{'title'},
+ author=> $myorder->{'author'},
+ countbiblio=> $countbiblio,
+ itemcount=>$itemcount,
+ subscriptions=>$subscriptions};
+ }
+ if ($error) {
+ push @cannotdelbiblios, {biblionumber=> ($myorder->{biblionumber}),
+ title=> $myorder->{'title'},
+ author=> $myorder->{'author'},
+ othererror=> $error};
+ }
+ }
+ $template->param( cannotdelbiblios => \@cannotdelbiblios );
}
-
# delete the basket
DelBasket($basketno,);
$template->param( delete_confirmed => 1 );
$template->param( delete_confirm => 1 );
if ( C4::Context->preference("IndependentBranches") ) {
my $userenv = C4::Context->userenv;
- unless ( $userenv->{flags} == 1 ) {
+ unless ( C4::Context->IsSuperLibrarian() ) {
my $validtest = ( $basket->{creationdate} eq '' )
|| ( $userenv->{branch} eq $basket->{branch} )
|| ( $userenv->{branch} eq '' )
address3 => $bookseller->{'address3'},
address4 => $bookseller->{'address4'},
);
-} elsif ($op eq 'attachbasket' && $template->{'VARS'}->{'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',
# get librarian branch...
if ( C4::Context->preference("IndependentBranches") ) {
my $userenv = C4::Context->userenv;
- unless ( $userenv->{flags} == 1 ) {
+ unless ( C4::Context->IsSuperLibrarian() ) {
my $validtest = ( $basket->{creationdate} eq '' )
|| ( $userenv->{branch} eq $basket->{branch} )
|| ( $userenv->{branch} eq '' )
$basketgroup = $bg;
}
}
- my %emptygroup = ( id => undef,
- name => "No group");
- if ( ! $basket->{basketgroupid} ) {
- $emptygroup{default} = 1;
- $emptygroup{nogroup} = 1;
- }
- unshift( @$basketgroups, \%emptygroup );
}
# if the basket is closed, calculate estimated delivery date