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 714-719
sub add {
Link Here
|
714 |
my $flavour = $headers->header('x-record-schema'); |
715 |
my $flavour = $headers->header('x-record-schema'); |
715 |
$flavour //= C4::Context->preference('marcflavour'); |
716 |
$flavour //= C4::Context->preference('marcflavour'); |
716 |
|
717 |
|
|
|
718 |
my $record_source_id = $headers->header('x-record-source-id'); |
719 |
|
720 |
if ($record_source_id) { |
721 |
|
722 |
# We've been passed a record source. Verify they are allowed to |
723 |
unless ( haspermission( $c->stash('koha.user')->userid, { editcatalogue => 'set_record_sources' } ) ) { |
724 |
return $c->render( |
725 |
status => 403, |
726 |
openapi => { error => 'You do not have permission to set the record source' } |
727 |
); |
728 |
} |
729 |
} |
730 |
|
717 |
my $record; |
731 |
my $record; |
718 |
|
732 |
|
719 |
my $frameworkcode = $headers->header('x-framework-id'); |
733 |
my $frameworkcode = $headers->header('x-framework-id'); |
Lines 751-762
sub add {
Link Here
|
751 |
} |
765 |
} |
752 |
) unless !$duplicatebiblionumber || $confirm_not_duplicate; |
766 |
) unless !$duplicatebiblionumber || $confirm_not_duplicate; |
753 |
|
767 |
|
754 |
my ( $biblionumber, $oldbibitemnum ); |
768 |
my ( $biblio_id ) = AddBiblio( $record, $frameworkcode, { record_source_id => $record_source_id } ); |
755 |
( $biblionumber, $oldbibitemnum ) = AddBiblio( $record, $frameworkcode ); |
|
|
756 |
|
769 |
|
757 |
$c->render( |
770 |
$c->render( |
758 |
status => 200, |
771 |
status => 200, |
759 |
openapi => { id => $biblionumber } |
772 |
openapi => { id => $biblio_id } |
760 |
); |
773 |
); |
761 |
} |
774 |
} |
762 |
catch { |
775 |
catch { |