Lines 21-27
Link Here
|
21 |
|
21 |
|
22 |
use Modern::Perl; |
22 |
use Modern::Perl; |
23 |
use CGI; |
23 |
use CGI; |
24 |
use POSIX qw( strftime ); |
24 |
use POSIX qw(strftime); |
25 |
use Try::Tiny qw(catch try); |
25 |
use Try::Tiny qw(catch try); |
26 |
|
26 |
|
27 |
use C4::Output qw( output_html_with_http_headers ); |
27 |
use C4::Output qw( output_html_with_http_headers ); |
Lines 703-747
if ( $op eq "cud-addbiblio" ) {
Link Here
|
703 |
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate) |
703 |
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate) |
704 |
if ( !$duplicatebiblionumber or $confirm_not_duplicate ) { |
704 |
if ( !$duplicatebiblionumber or $confirm_not_duplicate ) { |
705 |
my $oldbibitemnum; |
705 |
my $oldbibitemnum; |
706 |
if ( $is_a_modif ) { |
706 |
my $encode_error = try { |
707 |
ModBiblio( |
707 |
if ( $is_a_modif ) { |
708 |
$record, |
708 |
ModBiblio( |
709 |
$biblionumber, |
709 |
$record, |
710 |
$frameworkcode, |
710 |
$biblionumber, |
711 |
{ |
711 |
$frameworkcode, |
712 |
overlay_context => { |
712 |
{ |
713 |
source => $z3950 ? 'z3950' : 'intranet', |
713 |
overlay_context => { |
714 |
categorycode => $logged_in_patron->categorycode, |
714 |
source => $z3950 ? 'z3950' : 'intranet', |
715 |
userid => $logged_in_patron->userid, |
715 |
categorycode => $logged_in_patron->categorycode, |
|
|
716 |
userid => $logged_in_patron->userid, |
717 |
} |
716 |
} |
718 |
} |
717 |
} |
719 |
); |
718 |
); |
720 |
} else { |
719 |
} |
721 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
720 |
else { |
722 |
} |
721 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
723 |
return 0; |
722 |
} |
724 |
} catch { |
723 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
725 |
my $exception = $_; |
724 |
if ($frameworkcode eq 'FA'){ |
726 |
if ( ref($exception) eq 'Koha::Exceptions::Metadata::Invalid' ) { |
725 |
print $input->redirect( |
727 |
$template->param( INVALID_METADATA => $exception ); |
726 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
728 |
} else { |
727 |
.'biblionumber='.$biblionumber |
729 |
$exception->rethrow; |
728 |
.'&frameworkcode='.$frameworkcode |
730 |
} |
729 |
.'&circborrowernumber='.$fa_circborrowernumber |
731 |
return 1; |
730 |
.'&branch='.$fa_branch |
732 |
}; |
731 |
.'&barcode='.uri_escape_utf8($fa_barcode) |
733 |
if (!$encode_error && ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save"))){ |
732 |
.'&stickyduedate='.$fa_stickyduedate |
734 |
if ($frameworkcode eq 'FA'){ |
733 |
.'&duedatespec='.$fa_duedatespec |
735 |
print $input->redirect( |
734 |
); |
736 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
735 |
exit; |
737 |
.'biblionumber='.$biblionumber |
736 |
} |
738 |
.'&frameworkcode='.$frameworkcode |
737 |
else { |
739 |
.'&circborrowernumber='.$fa_circborrowernumber |
738 |
print $input->redirect( |
740 |
.'&branch='.$fa_branch |
739 |
"/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&searchid=$searchid" |
741 |
.'&barcode='.uri_escape_utf8($fa_barcode) |
740 |
); |
742 |
.'&stickyduedate='.$fa_stickyduedate |
741 |
exit; |
743 |
.'&duedatespec='.$fa_duedatespec |
742 |
} |
744 |
); |
743 |
} |
745 |
exit; |
744 |
elsif(($is_a_modif || $redirect eq "view") && $redirect ne "just_save"){ |
746 |
} |
|
|
747 |
else { |
748 |
print $input->redirect( |
749 |
"/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&searchid=$searchid" |
750 |
); |
751 |
exit; |
752 |
} |
753 |
} elsif(!$encode_error && (($is_a_modif || $redirect eq "view") && $redirect ne "just_save")){ |
745 |
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); |
754 |
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); |
746 |
my $views = { C4::Search::enabled_staff_search_views }; |
755 |
my $views = { C4::Search::enabled_staff_search_views }; |
747 |
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { |
756 |
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { |
Lines 754-781
if ( $op eq "cud-addbiblio" ) {
Link Here
|
754 |
print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); |
763 |
print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); |
755 |
} |
764 |
} |
756 |
exit; |
765 |
exit; |
757 |
|
766 |
} |
758 |
} |
767 |
elsif ( !$encode_error && ( $redirect eq "just_save" ) ) { |
759 |
elsif ($redirect eq "just_save"){ |
768 |
my $tab = $input->param('current_tab'); |
760 |
my $tab = $input->param('current_tab'); |
769 |
print $input->redirect( |
761 |
print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab&searchid=$searchid"); |
770 |
"/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab&searchid=$searchid" |
762 |
} |
771 |
); |
763 |
else { |
772 |
} elsif ($encode_error) { |
764 |
$template->param( |
773 |
build_tabs( $template, $record, $dbh, $encoding, $input ); |
765 |
biblionumber => $biblionumber, |
774 |
$template->param( |
766 |
done =>1, |
775 |
biblionumber => $biblionumber, |
767 |
popup =>1 |
776 |
popup => $mode, |
768 |
); |
777 |
frameworkcode => $frameworkcode, |
769 |
if ( $record ne '-1' ) { |
778 |
itemtype => $frameworkcode, |
770 |
my $title = C4::Context->preference('marcflavour') eq "UNIMARC" ? $record->subfield('200', 'a') : $record->title; |
779 |
borrowernumber => $loggedinuser, |
771 |
$template->param( title => $title ); |
780 |
tab => scalar $input->param('tab') |
772 |
} |
781 |
); |
773 |
$template->param( |
782 |
output_html_with_http_headers $input, $cookie, $template->output; |
774 |
popup => $mode, |
783 |
exit; |
775 |
itemtype => $frameworkcode, |
784 |
} else { |
776 |
); |
785 |
$template->param( |
777 |
output_html_with_http_headers $input, $cookie, $template->output; |
786 |
biblionumber => $biblionumber, |
778 |
exit; |
787 |
done => 1, |
|
|
788 |
popup => 1 |
789 |
); |
790 |
if ( $record ne '-1' ) { |
791 |
my $title = |
792 |
C4::Context->preference('marcflavour') eq "UNIMARC" |
793 |
? $record->subfield( '200', 'a' ) |
794 |
: $record->title; |
795 |
$template->param( title => $title ); |
796 |
} |
797 |
$template->param( |
798 |
popup => $mode, |
799 |
itemtype => $frameworkcode, |
800 |
); |
801 |
output_html_with_http_headers $input, $cookie, $template->output; |
802 |
exit; |
779 |
} |
803 |
} |
780 |
} else { |
804 |
} else { |
781 |
# it may be a duplicate, warn the user and do nothing |
805 |
# it may be a duplicate, warn the user and do nothing |
782 |
- |
|
|