Skip to content

Commit 804c7f5

Browse files
committed
Fix initiation of Bib object from SRU response
Alma started using namespaces quite some time ago. One of our xpath queries didn't reflect that, so the MMS id wasn't set on the Bib object.
1 parent f5fe31a commit 804c7f5

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
66

77
## [Unreleased]
88

9-
(nothing yet)
9+
### Fixed
10+
11+
- Set MMS id on Bib object when initiated from SRU response.
1012

1113
## [0.7.2] - 2018-11-09
1214

spec/Bibs/BibsSpec.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function it_provides_lookup_by_isbn(AlmaClient $client, SruClient $sru)
5959
->shouldBeCalled()
6060
->willReturn([SruRecord::make(
6161
1,
62-
'<record><controlfield tag="001">990114012304702201</controlfield></record>'
62+
'<record xmlns="http://www.loc.gov/MARC21/slim"><controlfield tag="001">990114012304702201</controlfield></record>'
6363
)]);
6464

6565
$bib = $this->fromIsbn('123');

src/Bibs/Bib.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function setMarcRecord($xml)
7070
public static function fromSruRecord(SruRecord $record, Client $client = null)
7171
{
7272
$record->data->registerXPathNamespace('marc', 'http://www.loc.gov/MARC21/slim');
73-
$mmsId = $record->data->text('.//controlfield[@tag="001"]');
73+
$mmsId = $record->data->text('.//marc:controlfield[@tag="001"]');
7474

7575
return (new self($client, $mmsId))
7676
->setMarcRecord($record->data->asXML());

0 commit comments

Comments
 (0)