|
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 765-779
if ( $op eq "cud-addbiblio" ) {
Link Here
|
| 765 |
); |
767 |
); |
| 766 |
} |
768 |
} |
| 767 |
} |
769 |
} |
| 768 |
elsif ( $op eq "cud-delete" ) { |
|
|
| 769 |
|
770 |
|
| 770 |
my $error = &DelBiblio($biblionumber); |
771 |
elsif ( $op eq "cud-delete" ) { |
|
|
772 |
|
| 773 |
# Cancel attached order lines first before deleting biblio ! |
| 774 |
my $error; |
| 775 |
try { |
| 776 |
my @result = Koha::Acquisition::Orders->search( { biblionumber => $biblionumber } )->cancel; |
| 777 |
my $warns = @{ $result[1] }; |
| 778 |
if ( $result[0] && $warns ) { # warnings about order lines not removed |
| 779 |
warn sprintf( "%d order lines were deleted, but %d lines gave a warning\n", $result[0], $warns ); |
| 780 |
} |
| 781 |
$error = &DelBiblio($biblionumber); |
| 782 |
} catch { |
| 783 |
$error = ref($_) ? 'Exception raised - ' . $_->error : $_; |
| 784 |
}; |
| 785 |
|
| 771 |
if ($error) { |
786 |
if ($error) { |
|
|
787 |
#FIXME This should be handled in template alert |
| 772 |
warn "ERROR when DELETING BIBLIO $biblionumber : $error"; |
788 |
warn "ERROR when DELETING BIBLIO $biblionumber : $error"; |
| 773 |
print "Content-Type: text/html\n\n<html><body><h1>ERROR when DELETING BIBLIO $biblionumber : $error</h1></body></html>"; |
789 |
print "Content-Type: text/html\n\n<html><body><h1>ERROR when DELETING BIBLIO $biblionumber : $error</h1></body></html>"; |
| 774 |
exit; |
790 |
exit; |
| 775 |
} |
791 |
} |
| 776 |
|
792 |
|
| 777 |
print $input->redirect('/cgi-bin/koha/catalogue/search.pl' . ($searchid ? "?searchid=$searchid" : "")); |
793 |
print $input->redirect('/cgi-bin/koha/catalogue/search.pl' . ($searchid ? "?searchid=$searchid" : "")); |
| 778 |
exit; |
794 |
exit; |
| 779 |
|
795 |
|
| 780 |
- |
|
|