From 416c0eb06b38b6b9fe114af41e2792968103c3f3 Mon Sep 17 00:00:00 2001 From: Tomasz Meka Date: Tue, 13 Dec 2016 08:26:38 +0100 Subject: [PATCH] proper check for publisher name & id --- lib/elibri_onix_generator.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/elibri_onix_generator.rb b/lib/elibri_onix_generator.rb index d203061..0cde686 100644 --- a/lib/elibri_onix_generator.rb +++ b/lib/elibri_onix_generator.rb @@ -587,14 +587,16 @@ def export_publisher_info!(product) end end - if product.respond_to?(:publisher_name) && product.publisher_name + if product.respond_to?(:publisher_name_for_onix) && product.publisher_name_for_onix tag(:Publisher) do comment "Wydawca - używamy tylko kodu 01 (główny wydawca)", :kind => :onix_publisher_info tag(:PublishingRole, '01') # Publisher, lista 45 #TODO jeszcze może być współwydawca - tag(:PublisherIdentifier) do - tag(:PublisherIDType, '01') #prioprietary - tag(:IDTypeName, 'ElibriPublisherCode') - tag(:IDValue, product.publisher_id_for_onix) + if product.respond_to?(:publisher_id_for_onix) + tag(:PublisherIdentifier) do + tag(:PublisherIDType, '01') #prioprietary + tag(:IDTypeName, 'ElibriPublisherCode') + tag(:IDValue, product.publisher_id_for_onix) + end end tag(:PublisherName, product.publisher_name_for_onix) end