-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathBoundwith.php
65 lines (54 loc) · 1.42 KB
/
Boundwith.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
require_once("../grima-lib.php");
class Boundwith extends GrimaTask {
public $biblist = array();
function do_task() {
$this->bibs = preg_split('/\r\n|\r|\n/',$this['mms']);
# BIBS
foreach ($this->bibs as $mmsid) {
$bib = new Bib();
$bib->loadFromAlma($mmsid);
$this->biblist[] = $bib;
}
# build array of unique titles
$arrfor501 = array();
foreach ($this->biblist as $k => $bib) {
$title = $bib->get_title_proper();
if ($k > 0) {
$this->biblist[0]->appendField("774","1"," ",array(
't' => $title,
'w' => $bib['mms_id']
)
);
}
if (!in_array($title,$arrfor501)) {
$arrfor501[] = $title;
}
}
foreach ($this->biblist as $bib) {
$my501text = "Bound with: ";
$skip = $bib->get_title_proper();
foreach ($arrfor501 as $title) {
if ($title != $skip) {
$my501text .= $title . "; ";
}
}
$my501text = preg_replace("/; $/",".",$my501text);
$bib->appendField("501"," "," ",array('a' => $my501text));
$bib->updateAlma();
}
## HOLDING
$this->biblist[0]->getHoldings();
$mfhd = $this->biblist[0]->holdings[0];
foreach ($this->biblist as $k => $bib) {
if ($k > 0) {
$mfhd->appendField("014","1"," ",array('a' => $bib['mms_id']));
}
}
$mfhd->updateAlma();
$this->splatVars['width'] = 12;
$this->splatVars['biblist'] = $this->biblist;
$this->splatVars['body'] = array( 'list', 'messages' );
}
}
Boundwith::RunIt();