Lines 56-61
use Koha::Patrons;
Link Here
|
56 |
use MARC::File::USMARC; |
56 |
use MARC::File::USMARC; |
57 |
use MARC::File::XML; |
57 |
use MARC::File::XML; |
58 |
use URI::Escape qw( uri_escape_utf8 ); |
58 |
use URI::Escape qw( uri_escape_utf8 ); |
|
|
59 |
use Business::ISBN qw( valid_isbn_checksum ); |
59 |
|
60 |
|
60 |
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { |
61 |
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) { |
61 |
MARC::File::XML->default_record_format('UNIMARC'); |
62 |
MARC::File::XML->default_record_format('UNIMARC'); |
Lines 862-869
if ( $op eq "addbiblio" ) {
Link Here
|
862 |
( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($record); |
863 |
( $duplicatebiblionumber, $duplicatetitle ) = FindDuplicate($record); |
863 |
} |
864 |
} |
864 |
my $confirm_not_duplicate = $input->param('confirm_not_duplicate'); |
865 |
my $confirm_not_duplicate = $input->param('confirm_not_duplicate'); |
|
|
866 |
my @input_isbns = ( C4::Context->preference('marcflavour') eq "UNIMARC" ) ? $record->subfield('010','a') : $record->subfield('020','a'); |
867 |
my $valid_isbn = 1; |
868 |
if ( C4::Context->preference('ValidateISBN') ) { |
869 |
foreach my $input_isbn ( @input_isbns ) { |
870 |
$valid_isbn = valid_isbn_checksum( $input_isbn ); |
871 |
unless ( $valid_isbn ) { |
872 |
last; |
873 |
} |
874 |
} |
875 |
} |
876 |
my $bypass_isbn = C4::Context->preference('ValidateISBN') ? $input->param('bypass_isbn') : 1; |
865 |
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate) |
877 |
# it is not a duplicate (determined either by Koha itself or by user checking it's not a duplicate) |
866 |
if ( !$duplicatebiblionumber or $confirm_not_duplicate ) { |
878 |
if ( ( !$duplicatebiblionumber or $confirm_not_duplicate ) and ( $valid_isbn or $bypass_isbn ) ) { |
867 |
my $oldbibitemnum; |
879 |
my $oldbibitemnum; |
868 |
if ( $is_a_modif ) { |
880 |
if ( $is_a_modif ) { |
869 |
my $member = Koha::Patrons->find($loggedinuser); |
881 |
my $member = Koha::Patrons->find($loggedinuser); |
Lines 884-910
if ( $op eq "addbiblio" ) {
Link Here
|
884 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
896 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
885 |
} |
897 |
} |
886 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
898 |
if ($redirect eq "items" || ($mode ne "popup" && !$is_a_modif && $redirect ne "view" && $redirect ne "just_save")){ |
887 |
if ($frameworkcode eq 'FA'){ |
899 |
if ($frameworkcode eq 'FA'){ |
888 |
print $input->redirect( |
900 |
print $input->redirect( |
889 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
901 |
'/cgi-bin/koha/cataloguing/additem.pl?' |
890 |
.'biblionumber='.$biblionumber |
902 |
.'biblionumber='.$biblionumber |
891 |
.'&frameworkcode='.$frameworkcode |
903 |
.'&frameworkcode='.$frameworkcode |
892 |
.'&circborrowernumber='.$fa_circborrowernumber |
904 |
.'&circborrowernumber='.$fa_circborrowernumber |
893 |
.'&branch='.$fa_branch |
905 |
.'&branch='.$fa_branch |
894 |
.'&barcode='.uri_escape_utf8($fa_barcode) |
906 |
.'&barcode='.uri_escape_utf8($fa_barcode) |
895 |
.'&stickyduedate='.$fa_stickyduedate |
907 |
.'&stickyduedate='.$fa_stickyduedate |
896 |
.'&duedatespec='.$fa_duedatespec |
908 |
.'&duedatespec='.$fa_duedatespec |
897 |
); |
909 |
); |
898 |
exit; |
910 |
exit; |
899 |
} |
911 |
} |
900 |
else { |
912 |
else { |
901 |
print $input->redirect( |
913 |
print $input->redirect( |
902 |
"/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&searchid=$searchid" |
914 |
"/cgi-bin/koha/cataloguing/additem.pl?biblionumber=$biblionumber&frameworkcode=$frameworkcode&searchid=$searchid" |
903 |
); |
915 |
); |
904 |
exit; |
916 |
exit; |
905 |
} |
917 |
} |
906 |
} |
918 |
} |
907 |
elsif(($is_a_modif || $redirect eq "view") && $redirect ne "just_save"){ |
919 |
elsif(($is_a_modif || $redirect eq "view") && $redirect ne "just_save"){ |
908 |
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); |
920 |
my $defaultview = C4::Context->preference('IntranetBiblioDefaultView'); |
909 |
my $views = { C4::Search::enabled_staff_search_views }; |
921 |
my $views = { C4::Search::enabled_staff_search_views }; |
910 |
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { |
922 |
if ($defaultview eq 'isbd' && $views->{can_view_ISBD}) { |
Lines 917-945
if ( $op eq "addbiblio" ) {
Link Here
|
917 |
print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); |
929 |
print $input->redirect("/cgi-bin/koha/catalogue/detail.pl?biblionumber=$biblionumber&searchid=$searchid"); |
918 |
} |
930 |
} |
919 |
exit; |
931 |
exit; |
920 |
|
|
|
921 |
} |
922 |
elsif ($redirect eq "just_save"){ |
923 |
my $tab = $input->param('current_tab'); |
924 |
print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab&searchid=$searchid"); |
925 |
} |
926 |
else { |
927 |
$template->param( |
928 |
biblionumber => $biblionumber, |
929 |
done =>1, |
930 |
popup =>1 |
931 |
); |
932 |
if ( $record ne '-1' ) { |
933 |
my $title = C4::Context->preference('marcflavour') eq "UNIMARC" ? $record->subfield('200', 'a') : $record->title; |
934 |
$template->param( title => $title ); |
935 |
} |
936 |
$template->param( |
937 |
popup => $mode, |
938 |
itemtype => $frameworkcode, |
939 |
); |
940 |
output_html_with_http_headers $input, $cookie, $template->output; |
941 |
exit; |
942 |
} |
932 |
} |
|
|
933 |
elsif ($redirect eq "just_save"){ |
934 |
my $tab = $input->param('current_tab'); |
935 |
print $input->redirect("/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber&framework=$frameworkcode&tab=$tab&searchid=$searchid"); |
936 |
} |
937 |
else { |
938 |
$template->param( |
939 |
biblionumber => $biblionumber, |
940 |
done =>1, |
941 |
popup =>1 |
942 |
); |
943 |
if ( $record ne '-1' ) { |
944 |
my $title = C4::Context->preference('marcflavour') eq "UNIMARC" ? $record->subfield('200', 'a') : $record->title; |
945 |
$template->param( title => $title ); |
946 |
} |
947 |
$template->param( |
948 |
popup => $mode, |
949 |
itemtype => $frameworkcode, |
950 |
); |
951 |
output_html_with_http_headers $input, $cookie, $template->output; |
952 |
exit; |
953 |
} |
954 |
} elsif ( !$valid_isbn ) { |
955 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
956 |
$template->param( |
957 |
biblionumber => $biblionumber, |
958 |
invalid_isbn => 1, |
959 |
); |
943 |
} else { |
960 |
} else { |
944 |
# it may be a duplicate, warn the user and do nothing |
961 |
# it may be a duplicate, warn the user and do nothing |
945 |
build_tabs ($template, $record, $dbh,$encoding,$input); |
962 |
build_tabs ($template, $record, $dbh,$encoding,$input); |