|
Lines 26-31
use Koha::RecordProcessor;
Link Here
|
| 26 |
use C4::Biblio qw( DelBiblio AddBiblio ModBiblio ); |
26 |
use C4::Biblio qw( DelBiblio AddBiblio ModBiblio ); |
| 27 |
use C4::Search qw( FindDuplicate ); |
27 |
use C4::Search qw( FindDuplicate ); |
| 28 |
|
28 |
|
|
|
29 |
use C4::Auth qw( haspermission ); |
| 29 |
use C4::Barcodes::ValueBuilder; |
30 |
use C4::Barcodes::ValueBuilder; |
| 30 |
use C4::Context; |
31 |
use C4::Context; |
| 31 |
|
32 |
|
|
Lines 709-714
sub add {
Link Here
|
| 709 |
my $flavour = $headers->header('x-record-schema'); |
710 |
my $flavour = $headers->header('x-record-schema'); |
| 710 |
$flavour //= C4::Context->preference('marcflavour'); |
711 |
$flavour //= C4::Context->preference('marcflavour'); |
| 711 |
|
712 |
|
|
|
713 |
my $record_source_id = $headers->header('x-record-source-id'); |
| 714 |
|
| 715 |
if ($record_source_id) { |
| 716 |
|
| 717 |
# We've been passed a record source. Verify they are allowed to |
| 718 |
unless ( haspermission( $c->stash('koha.user')->userid, { editcatalogue => 'set_record_sources' } ) ) { |
| 719 |
return $c->render( |
| 720 |
status => 403, |
| 721 |
openapi => { error => 'You do not have permission to set the record source' } |
| 722 |
); |
| 723 |
} |
| 724 |
} |
| 725 |
|
| 712 |
my $record; |
726 |
my $record; |
| 713 |
|
727 |
|
| 714 |
my $frameworkcode = $headers->header('x-framework-id'); |
728 |
my $frameworkcode = $headers->header('x-framework-id'); |
|
Lines 746-757
sub add {
Link Here
|
| 746 |
} |
760 |
} |
| 747 |
) unless !$duplicatebiblionumber || $confirm_not_duplicate; |
761 |
) unless !$duplicatebiblionumber || $confirm_not_duplicate; |
| 748 |
|
762 |
|
| 749 |
my ( $biblionumber, $oldbibitemnum ); |
763 |
my ( $biblio_id ) = AddBiblio( $record, $frameworkcode, { record_source_id => $record_source_id } ); |
| 750 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
|
|
| 751 |
|
764 |
|
| 752 |
$c->render( |
765 |
$c->render( |
| 753 |
status => 200, |
766 |
status => 200, |
| 754 |
openapi => { id => $biblionumber } |
767 |
openapi => { id => $biblio_id } |
| 755 |
); |
768 |
); |
| 756 |
} |
769 |
} |
| 757 |
catch { |
770 |
catch { |