|
Lines 22-27
Link Here
|
| 22 |
use Modern::Perl; |
22 |
use Modern::Perl; |
| 23 |
|
23 |
|
| 24 |
use CGI; |
24 |
use CGI; |
|
|
25 |
use Try::Tiny; |
| 26 |
|
| 25 |
use C4::Output qw( output_html_with_http_headers ); |
27 |
use C4::Output qw( output_html_with_http_headers ); |
| 26 |
use C4::Auth qw( get_template_and_user haspermission ); |
28 |
use C4::Auth qw( get_template_and_user haspermission ); |
| 27 |
use C4::Biblio qw( |
29 |
use C4::Biblio qw( |
|
Lines 674-698
if ( $op eq "addbiblio" ) {
Link Here
|
| 674 |
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate) |
676 |
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate) |
| 675 |
if ( !$duplicatebiblionumber or $confirm_not_duplicate ) { |
677 |
if ( !$duplicatebiblionumber or $confirm_not_duplicate ) { |
| 676 |
my $oldbibitemnum; |
678 |
my $oldbibitemnum; |
| 677 |
if ( $is_a_modif ) { |
679 |
my $error = try { |
| 678 |
my $member = Koha::Patrons->find($loggedinuser); |
680 |
if ($is_a_modif) { |
| 679 |
ModBiblio( |
681 |
warn "Attempting modify"; |
| 680 |
$record, |
682 |
my $member = Koha::Patrons->find($loggedinuser); |
| 681 |
$biblionumber, |
683 |
ModBiblio( |
| 682 |
$frameworkcode, |
684 |
$record, |
| 683 |
{ |
685 |
$biblionumber, |
| 684 |
overlay_context => { |
686 |
$frameworkcode, |
| 685 |
source => $z3950 ? 'z3950' : 'intranet', |
687 |
{ |
| 686 |
categorycode => $member->categorycode, |
688 |
overlay_context => { |
| 687 |
userid => $member->userid |
689 |
source => $z3950 ? 'z3950' : 'intranet', |
|
|
690 |
categorycode => $member->categorycode, |
| 691 |
userid => $member->userid |
| 692 |
} |
| 688 |
} |
693 |
} |
| 689 |
} |
694 |
); |
| 690 |
); |
695 |
} else { |
| 691 |
} |
696 |
warn "Attempting add"; |
| 692 |
else { |
697 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
| 693 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
698 |
} |
| 694 |
} |
699 |
|
| 695 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
700 |
return 0; |
|
|
701 |
} catch { |
| 702 |
warn "Caught exception"; |
| 703 |
my $exception = $_; |
| 704 |
if ( ref($error) eq 'Koha::Exceptions::Metadata::Invalid' ) { |
| 705 |
warn "Found invalid metadata"; |
| 706 |
$template->param( INVALID_METADATA => $exception ); |
| 707 |
} else { |
| 708 |
$exception->rethrow; |
| 709 |
} |
| 710 |
return 1; |
| 711 |
}; |
| 712 |
warn "Value of error: $error"; |
| 713 |
if (!$error && ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save"))){ |
| 696 |
if ($frameworkcode eq 'FA'){ |
714 |
if ($frameworkcode eq 'FA'){ |
| 697 |
print $input->redirect( |
715 |
print $input->redirect( |
| 698 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
716 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
|
Lines 713-719
if ( $op eq "addbiblio" ) {
Link Here
|
| 713 |
exit; |
731 |
exit; |
| 714 |
} |
732 |
} |
| 715 |
} |
733 |
} |
| 716 |
elsif(($is_a_modif || $redirect eq "view") && $redirect ne "just_save"){ |
734 |
elsif(!$error && (($is_a_modif || $redirect eq "view") && $redirect ne "just_save")){ |
| 717 |
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); |
735 |
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); |
| 718 |
my $views = { C4::Search::enabled_staff_search_views }; |
736 |
my $views = { C4::Search::enabled_staff_search_views }; |
| 719 |
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { |
737 |
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { |
|
Lines 728-734
if ( $op eq "addbiblio" ) {
Link Here
|
| 728 |
exit; |
746 |
exit; |
| 729 |
|
747 |
|
| 730 |
} |
748 |
} |
| 731 |
elsif ($redirect eq "just_save"){ |
749 |
elsif (!$error && ($redirect eq "just_save")){ |
| 732 |
my $tab = $input->param('current_tab'); |
750 |
my $tab = $input->param('current_tab'); |
| 733 |
print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab&searchid=$searchid"); |
751 |
print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab&searchid=$searchid"); |
| 734 |
} |
752 |
} |
| 735 |
- |
|
|