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-719
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 $encode_error = try { |
678 |
my $member = Koha::Patrons->find($loggedinuser); |
680 |
if ($is_a_modif) { |
679 |
ModBiblio( |
681 |
my $member = Koha::Patrons->find($loggedinuser); |
680 |
$record, |
682 |
ModBiblio( |
681 |
$biblionumber, |
683 |
$record, |
682 |
$frameworkcode, |
684 |
$biblionumber, |
683 |
{ |
685 |
$frameworkcode, |
684 |
overlay_context => { |
686 |
{ |
685 |
source => $z3950 ? 'z3950' : 'intranet', |
687 |
overlay_context => { |
686 |
categorycode => $member->categorycode, |
688 |
source => $z3950 ? 'z3950' : 'intranet', |
687 |
userid => $member->userid |
689 |
categorycode => $member->categorycode, |
|
|
690 |
userid => $member->userid |
691 |
} |
688 |
} |
692 |
} |
689 |
} |
693 |
); |
690 |
); |
694 |
} else { |
691 |
} |
695 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
692 |
else { |
696 |
} |
693 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
697 |
return 0; |
694 |
} |
698 |
} catch { |
695 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
699 |
my $exception = $_; |
696 |
if ($frameworkcode eq 'FA'){ |
700 |
if ( ref($exception) eq 'Koha::Exceptions::Metadata::Invalid' ) { |
697 |
print $input->redirect( |
701 |
$template->param( INVALID_METADATA => $exception ); |
698 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
702 |
} else { |
699 |
.'biblionumber='.$biblionumber |
703 |
$exception->rethrow; |
700 |
.'&frameworkcode='.$frameworkcode |
704 |
} |
701 |
.'&circborrowernumber='.$fa_circborrowernumber |
705 |
return 1; |
702 |
.'&branch='.$fa_branch |
706 |
}; |
703 |
.'&barcode='.uri_escape_utf8($fa_barcode) |
707 |
if (!$encode_error && ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save"))){ |
704 |
.'&stickyduedate='.$fa_stickyduedate |
708 |
if ($frameworkcode eq 'FA'){ |
705 |
.'&duedatespec='.$fa_duedatespec |
709 |
print $input->redirect( |
706 |
); |
710 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
707 |
exit; |
711 |
.'biblionumber='.$biblionumber |
708 |
} |
712 |
.'&frameworkcode='.$frameworkcode |
709 |
else { |
713 |
.'&circborrowernumber='.$fa_circborrowernumber |
710 |
print $input->redirect( |
714 |
.'&branch='.$fa_branch |
711 |
"/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&searchid=$searchid" |
715 |
.'&barcode='.uri_escape_utf8($fa_barcode) |
712 |
); |
716 |
.'&stickyduedate='.$fa_stickyduedate |
713 |
exit; |
717 |
.'&duedatespec='.$fa_duedatespec |
714 |
} |
718 |
); |
|
|
719 |
exit; |
720 |
} |
721 |
else { |
722 |
print $input->redirect( |
723 |
"/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&searchid=$searchid" |
724 |
); |
725 |
exit; |
726 |
} |
715 |
} |
727 |
} |
716 |
elsif(($is_a_modif || $redirect eq "view") && $redirect ne "just_save"){ |
728 |
elsif(!$encode_error && (($is_a_modif || $redirect eq "view") && $redirect ne "just_save")){ |
717 |
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); |
729 |
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); |
718 |
my $views = { C4::Search::enabled_staff_search_views }; |
730 |
my $views = { C4::Search::enabled_staff_search_views }; |
719 |
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { |
731 |
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { |
Lines 726-753
if ( $op eq "addbiblio" ) {
Link Here
|
726 |
print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); |
738 |
print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); |
727 |
} |
739 |
} |
728 |
exit; |
740 |
exit; |
729 |
|
741 |
} |
730 |
} |
742 |
elsif (!$encode_error && ($redirect eq "just_save")){ |
731 |
elsif ($redirect eq "just_save"){ |
743 |
my $tab = $input->param('current_tab'); |
732 |
my $tab = $input->param('current_tab'); |
744 |
print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab&searchid=$searchid"); |
733 |
print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab&searchid=$searchid"); |
745 |
} |
734 |
} |
746 |
elsif ($encode_error) { |
735 |
else { |
747 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
736 |
$template->param( |
748 |
$template->param( |
737 |
biblionumber => $biblionumber, |
749 |
biblionumber => $biblionumber, |
738 |
done =>1, |
750 |
popup => $mode, |
739 |
popup =>1 |
751 |
frameworkcode => $frameworkcode, |
740 |
); |
752 |
itemtype => $frameworkcode, |
741 |
if ( $record ne '-1' ) { |
753 |
borrowernumber => $loggedinuser, |
742 |
my $title = C4::Context->preference('marcflavour') eq "UNIMARC" ? $record->subfield('200', 'a') : $record->title; |
754 |
tab => scalar $input->param('tab') |
743 |
$template->param( title => $title ); |
755 |
); |
744 |
} |
756 |
output_html_with_http_headers $input, $cookie, $template->output; |
745 |
$template->param( |
757 |
exit; |
746 |
popup => $mode, |
758 |
} else { |
747 |
itemtype => $frameworkcode, |
759 |
$template->param( |
748 |
); |
760 |
biblionumber => $biblionumber, |
749 |
output_html_with_http_headers $input, $cookie, $template->output; |
761 |
done =>1, |
750 |
exit; |
762 |
popup =>1 |
|
|
763 |
); |
764 |
if ( $record ne '-1' ) { |
765 |
my $title = C4::Context->preference('marcflavour') eq "UNIMARC" ? $record->subfield('200', 'a') : $record->title; |
766 |
$template->param( title => $title ); |
767 |
} |
768 |
$template->param( |
769 |
popup => $mode, |
770 |
itemtype => $frameworkcode, |
771 |
); |
772 |
output_html_with_http_headers $input, $cookie, $template->output; |
773 |
exit; |
751 |
} |
774 |
} |
752 |
} else { |
775 |
} else { |
753 |
# it may be a duplicate, warn the user and do nothing |
776 |
# it may be a duplicate, warn the user and do nothing |
754 |
- |
|
|