Bug 30135: Add EdifactLSQ mapping preference
This patch adds a new system preference, EdifactLSQ, to allow configuration of the ambiguous LSQ, sequence code, field included in the EDIFACT specifications. Originally the field was hard coded to map to 'location', but as per the specification it could have been mapped to 'ccode'. From the specification: A code or other designation which identifies stock which is to be shelved in a specified sequence or collection. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
ce51b4daef
commit
509aebd60e
17
Koha/EDI.pm
17
Koha/EDI.pm
|
|
@ -869,8 +869,6 @@ sub quote_item {
|
|||
my $new_item = {
|
||||
itype =>
|
||||
$item->girfield( 'stock_category', $occurrence ),
|
||||
location =>
|
||||
$item->girfield( 'collection_code', $occurrence ),
|
||||
itemcallnumber =>
|
||||
$item->girfield( 'shelfmark', $occurrence )
|
||||
|| $item->girfield( 'classification', $occurrence )
|
||||
|
|
@ -879,11 +877,15 @@ sub quote_item {
|
|||
$item->girfield( 'branch', $occurrence ),
|
||||
homebranch => $item->girfield( 'branch', $occurrence ),
|
||||
};
|
||||
|
||||
my $lsq_field = C4::Context->preference('EdifactLSQ');
|
||||
$new_item->{$lsq_field} = $item->girfield( 'sequence_code', $occurrence );
|
||||
|
||||
if ( $new_item->{itype} ) {
|
||||
$item_hash->{itype} = $new_item->{itype};
|
||||
}
|
||||
if ( $new_item->{location} ) {
|
||||
$item_hash->{location} = $new_item->{location};
|
||||
if ( $new_item->{$lsq_field} ) {
|
||||
$item_hash->{$lsq_field} = $new_item->{$lsq_field};
|
||||
}
|
||||
if ( $new_item->{itemcallnumber} ) {
|
||||
$item_hash->{itemcallnumber} =
|
||||
|
|
@ -957,8 +959,6 @@ sub quote_item {
|
|||
replacementprice => $price,
|
||||
itype =>
|
||||
$item->girfield( 'stock_category', $occurrence ),
|
||||
location =>
|
||||
$item->girfield( 'collection_code', $occurrence ),
|
||||
itemcallnumber =>
|
||||
$item->girfield( 'shelfmark', $occurrence )
|
||||
|| $item->girfield( 'classification', $occurrence )
|
||||
|
|
@ -967,6 +967,8 @@ sub quote_item {
|
|||
$item->girfield( 'branch', $occurrence ),
|
||||
homebranch => $item->girfield( 'branch', $occurrence ),
|
||||
};
|
||||
my $lsq_field = C4::Context->preference('EdifactLSQ');
|
||||
$new_item->{$lsq_field} = $item->girfield( 'sequence_code', $occurrence );
|
||||
$new_item->{biblionumber} = $bib->{biblionumber};
|
||||
$new_item->{biblioitemnumber} = $bib->{biblioitemnumber};
|
||||
my $kitem = Koha::Item->new( $new_item )->store;
|
||||
|
|
@ -1173,7 +1175,8 @@ sub _create_item_from_quote {
|
|||
$item_hash->{booksellerid} = $quote->vendor_id;
|
||||
$item_hash->{price} = $item_hash->{replacementprice} = $item->price;
|
||||
$item_hash->{itype} = $item->girfield('stock_category');
|
||||
$item_hash->{location} = $item->girfield('collection_code');
|
||||
my $lsq_field = C4::Context->preference('EdifactLSQ');
|
||||
$item_hash->{$lsq_field} = $item->girfield('sequence_code');
|
||||
|
||||
my $note = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -686,7 +686,7 @@ sub extract_gir {
|
|||
LQT => 'part_order_quantity',
|
||||
LRS => 'record_sublocation',
|
||||
LSM => 'shelfmark',
|
||||
LSQ => 'collection_code',
|
||||
LSQ => 'sequence_code',
|
||||
LST => 'stock_category',
|
||||
LSZ => 'size_code',
|
||||
LVC => 'coded_servicing_instruction',
|
||||
|
|
|
|||
|
|
@ -373,17 +373,18 @@ sub order_line {
|
|||
# DTM Optional date constraints on delivery
|
||||
# we dont currently support this in koha
|
||||
# GIR copy-related data
|
||||
my $lsq_field = C4::Context->preference('EdifactLSQ');
|
||||
my @items;
|
||||
if ( $basket->effective_create_items eq 'ordering' ) {
|
||||
my @linked_itemnumbers = $orderline->aqorders_items;
|
||||
|
||||
my @linked_itemnumbers = $orderline->aqorders_items;
|
||||
foreach my $item (@linked_itemnumbers) {
|
||||
my $i_obj = $schema->resultset('Item')->find( $item->itemnumber );
|
||||
if ( defined $i_obj ) {
|
||||
push @items, {
|
||||
branchcode => $i_obj->get_column('homebranch'),
|
||||
itype => $i_obj->effective_itemtype,
|
||||
location => $i_obj->location,
|
||||
$lsq_field => $i_obj->$lsq_field,
|
||||
itemcallnumber => $i_obj->itemcallnumber,
|
||||
};
|
||||
}
|
||||
|
|
@ -411,7 +412,7 @@ sub order_line {
|
|||
{
|
||||
branchcode => $item->{branchcode},
|
||||
itype => $item->{itype},
|
||||
location => $item->{location},
|
||||
$lsq_field => $item->{$lsq_field},
|
||||
itemcallnumber => $item->{itemcallnumber},
|
||||
};
|
||||
}
|
||||
|
|
@ -543,6 +544,7 @@ sub gir_segments {
|
|||
my $budget_code = $orderfields->{budget_code};
|
||||
my @segments;
|
||||
my $sequence_no = 1;
|
||||
my $lsq_field = C4::Context->preference('EdifactLSQ');
|
||||
foreach my $item (@onorderitems) {
|
||||
my $elements_added = 0;
|
||||
my @gir_elements;
|
||||
|
|
@ -558,9 +560,9 @@ sub gir_segments {
|
|||
push @gir_elements,
|
||||
{ identity_number => 'LST', data => $item->{itype} };
|
||||
}
|
||||
if ( $item->{location} ) {
|
||||
if ( $item->{$lsq_field} ) {
|
||||
push @gir_elements,
|
||||
{ identity_number => 'LSQ', data => $item->{location} };
|
||||
{ identity_number => 'LSQ', data => $item->{$lsq_field} };
|
||||
}
|
||||
if ( $item->{itemcallnumber} ) {
|
||||
push @gir_elements,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "30135",
|
||||
description => "Add EdifactLSQ mapping system preference",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh, $out) = @$args{qw(dbh out)};
|
||||
$dbh->do(q{
|
||||
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
|
||||
('EdifactLSQ', 'location', 'location|ccode', "Map EDI sequence code (GIR+LSQ) to Koha Item field', 'Choice')
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
@ -189,6 +189,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
|
|||
('EasyAnalyticalRecords','0','','If on, display in the catalogue screens tools to easily setup analytical record relationships','YesNo'),
|
||||
('EDIFACT','0',NULL,'Enables EDIFACT acquisitions functions','YesNo'),
|
||||
('EdifactInvoiceImport', 'automatic', 'automatic|manual', "If on, don't auto-import EDI invoices, just keep them in the database with the status 'new'", 'Choice'),
|
||||
('EdifactLSQ', 'location', 'location|ccode', "Map EDI sequence code (GIR+LSQ) to Koha Item field', 'Choice'),
|
||||
('ElasticsearchIndexStatus_authorities', '0', 'Authorities index status', NULL, NULL),
|
||||
('ElasticsearchIndexStatus_biblios', '0', 'Biblios index status', NULL, NULL),
|
||||
('ElasticsearchMARCFormat', 'ISO2709', 'ISO2709|ARRAY', 'Elasticsearch MARC format. ISO2709 format is recommended as it is faster and takes less space, whereas array is searchable.', 'Choice'),
|
||||
|
|
|
|||
|
|
@ -138,3 +138,11 @@ Acquisitions:
|
|||
automatic: "Do"
|
||||
manual: "Don't"
|
||||
- " automatically import EDIFACT invoice message files when they are downloaded."
|
||||
-
|
||||
- "Map sequence code (GIR:LSQ) field to Koha item "
|
||||
- pref: EdifactLSQ
|
||||
default: location
|
||||
choices:
|
||||
location: "location"
|
||||
ccode: "ccode"
|
||||
- " field."
|
||||
|
|
|
|||
Loading…
Reference in New Issue