Lines 20-27
Link Here
|
20 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
20 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
|
21 |
|
22 |
use Modern::Perl; |
22 |
use Modern::Perl; |
23 |
|
|
|
24 |
use CGI; |
23 |
use CGI; |
|
|
24 |
use Try::Tiny qw(catch try); |
25 |
|
25 |
use C4::Output qw( output_html_with_http_headers ); |
26 |
use C4::Output qw( output_html_with_http_headers ); |
26 |
use C4::Auth qw( get_template_and_user haspermission ); |
27 |
use C4::Auth qw( get_template_and_user haspermission ); |
27 |
use C4::Biblio qw( |
28 |
use C4::Biblio qw( |
Lines 47-52
use C4::Charset qw( SetMarcUnicodeFlag );
Link Here
|
47 |
use Koha::BiblioFrameworks; |
48 |
use Koha::BiblioFrameworks; |
48 |
use Koha::DateUtils qw( dt_from_string ); |
49 |
use Koha::DateUtils qw( dt_from_string ); |
49 |
|
50 |
|
|
|
51 |
use Koha::Acquisition::Orders; |
50 |
use Koha::Biblios; |
52 |
use Koha::Biblios; |
51 |
use Koha::ItemTypes; |
53 |
use Koha::ItemTypes; |
52 |
use Koha::Libraries; |
54 |
use Koha::Libraries; |
Lines 762-775
if ( $op eq "addbiblio" ) {
Link Here
|
762 |
} |
764 |
} |
763 |
} |
765 |
} |
764 |
elsif ( $op eq "delete" ) { |
766 |
elsif ( $op eq "delete" ) { |
765 |
|
767 |
|
766 |
my $error = &DelBiblio($biblionumber); |
768 |
# Cancel attached order lines first before deleting biblio ! |
|
|
769 |
my $error; |
770 |
try { |
771 |
my @result = Koha::Acquisition::Orders->search( { biblionumber => $biblionumber } )->cancel; |
772 |
my $warns = @{ $result[1] }; |
773 |
if ( $result[0] && $warns ) { # warnings about order lines not removed |
774 |
warn sprintf( "%d order lines were deleted, but %d lines gave a warning\n", $result[0], $warns ); |
775 |
} |
776 |
$error = &DelBiblio($biblionumber); |
777 |
} catch { |
778 |
$error = ref($_) ? 'Exception raised - ' . $_->error : $_; |
779 |
}; |
780 |
|
767 |
if ($error) { |
781 |
if ($error) { |
|
|
782 |
#FIXME This should be handled in template alert |
768 |
warn "ERROR when DELETING BIBLIO $biblionumber : $error"; |
783 |
warn "ERROR when DELETING BIBLIO $biblionumber : $error"; |
769 |
print "Content-Type: text/html\n\n<html><body><h1>ERROR when DELETING BIBLIO $biblionumber : $error</h1></body></html>"; |
784 |
print "Content-Type: text/html\n\n<html><body><h1>ERROR when DELETING BIBLIO $biblionumber : $error</h1></body></html>"; |
770 |
exit; |
785 |
exit; |
771 |
} |
786 |
} |
772 |
|
787 |
|
773 |
print $input->redirect('/cgi-bin/koha/catalogue/search.pl' . ($searchid ? "?searchid=$searchid" : "")); |
788 |
print $input->redirect('/cgi-bin/koha/catalogue/search.pl' . ($searchid ? "?searchid=$searchid" : "")); |
774 |
exit; |
789 |
exit; |
775 |
|
790 |
|
776 |
- |
|
|