@@ -88,12 +88,6 @@ impl XmlElementBlock<Onix3Oapen> for Work {
8888 "Missing Landing Page" . to_string ( ) ,
8989 )
9090 } ) ?;
91- if !self . publications . iter ( ) . any ( |p| p. isbn . is_some ( ) ) {
92- return Err ( ThothError :: IncompleteMetadataRecord (
93- ONIX_ERROR . to_string ( ) ,
94- "Missing ISBN" . to_string ( ) ,
95- ) ) ;
96- }
9791 if self . languages . is_empty ( ) {
9892 return Err ( ThothError :: IncompleteMetadataRecord (
9993 ONIX_ERROR . to_string ( ) ,
@@ -126,6 +120,13 @@ impl XmlElementBlock<Onix3Oapen> for Work {
126120 "Missing Publication Date" . to_string ( ) ,
127121 )
128122 } ) ?;
123+ let ( main_isbn, isbns) = get_publications_data ( & self . publications ) ;
124+ if main_isbn. is_empty ( ) {
125+ return Err ( ThothError :: IncompleteMetadataRecord (
126+ ONIX_ERROR . to_string ( ) ,
127+ "Missing ISBN" . to_string ( ) ,
128+ ) ) ;
129+ }
129130 // We can only generate the document if there's a PDF
130131 let pdf_publication = self
131132 . publications
@@ -136,7 +137,6 @@ impl XmlElementBlock<Onix3Oapen> for Work {
136137 . and_then ( |l| l. full_text_url . as_ref ( ) )
137138 {
138139 let work_id = format ! ( "urn:uuid:{}" , self . work_id) ;
139- let ( main_isbn, isbns) = get_publications_data ( & self . publications ) ;
140140 write_element_block ( "Product" , w, |w| {
141141 write_element_block ( "RecordReference" , w, |w| {
142142 w. write ( XmlEvent :: Characters ( & work_id) )
0 commit comments