forked from AtlasSystems/AlmaPrimoDefinitiveCatalogAddon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataMapping.lua
More file actions
189 lines (177 loc) · 7.28 KB
/
DataMapping.lua
File metadata and controls
189 lines (177 loc) · 7.28 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
DataMapping = {}
DataMapping.Icons = {};
DataMapping.SearchTypes = {};
DataMapping.SearchStyleUrls = {};
DataMapping.SourceFields = {};
DataMapping.ImportProfiles = {};
DataMapping.ImportFields = {};
DataMapping.ImportFields.Bibliographic = {};
DataMapping.ImportFields.Holding = {};
DataMapping.ImportFields.Item = {};
DataMapping.ImportFields.StaticHolding = {};
-- The display name for the addon's tab.
DataMapping.LabelName = "Catalog Search";
-- Icons for non-search buttons for Aeon.
-- Icons can also be added for ILLiad or Ares by using those product names as keys.
DataMapping.Icons["Aeon"] = {};
DataMapping.Icons["Aeon"]["Home"] = "home_32x32";
DataMapping.Icons["Aeon"]["Web"] = "web_32x32";
DataMapping.Icons["Aeon"]["Retrieve Items"] = "record_32x32";
--[[
SearchTypes
- ButtonText: The text that appears on the ribbon button for the search.
- PrimoField: The field name used by Primo in the seach URL.
- SearchStyle: Query or Browse.
- AeonIcon: The name of the icon file to use as the button's image.
Icons for ILLiad and Ares can be used by adding an "ILLiadIcon" or "AresIcon" property.
- AeonSourceField: The table and field name to draw the search term from in the request.
Source fields for ILLiad and Ares can be used by adding an ILLiadSourceField or AresSourceField property.
--]]
DataMapping.SearchTypes["Title"] = {
ButtonText = "Title",
PrimoField = "title",
SearchStyle = "Query",
AeonIcon = "srch_32x32",
AeonSourceField = { Table = "Transaction", Field = "ItemTitle" }
};
DataMapping.SearchTypes["Author"] = {
ButtonText = "Author",
PrimoField = "creator",
SearchStyle = "Query",
AeonIcon = "srch_32x32",
AeonSourceField = { Table = "Transaction", Field = "ItemAuthor" }
};
DataMapping.SearchTypes["Call Number"] = {
ButtonText = "Call Number",
PrimoField = "lsr01",
SearchStyle = "Query",
AeonIcon = "srch_32x32",
AeonSourceField = { Table = "Transaction", Field = "CallNumber" }
};
DataMapping.SearchTypes["ISBN"] = {
ButtonText = "ISBN",
PrimoField = "isbn",
SearchStyle = "Query",
AeonIcon = "srch_32x32",
AeonSourceField = { Table = "Transaction", Field = "ItemISxN" }
};
DataMapping.SearchTypes["ISSN"] = {
ButtonText = "ISSN",
PrimoField = "issn",
SearchStyle = "Query",
AeonIcon = "srch_32x32",
AeonSourceField = { Table = "Transaction", Field = "ItemISxN" }
};
-- Catalog Number uses the Any search type because Primo catalogs don't have built in MMS ID searching.
DataMapping.SearchTypes["Catalog Number"] = {
ButtonText = "Catalog Number",
PrimoField = "any",
SearchStyle = "Query",
AeonIcon = "srch_32x32",
AeonSourceField = { Table = "Transaction", Field = "ReferenceNumber" }
};
-- SearchStyleUrls
-- Words in brackets will be replaced by their corresponding settings or values by the addon.
-- Only one Query and one Browse style URL may be defined. These will be concatenated to the
-- end of the CatalogUrl setting when searching.
DataMapping.SearchStyleUrls["Query"] = "search?vid={PrimoSiteCode}&query={SearchType},contains,{SearchTerm},AND&tab=books&search_scope=default_scope&mode=advanced";
DataMapping.SearchStyleUrls["Browse"] = "browse?vid={PrimoSiteCode}&browseQuery={SearchTerm}&browseScope={SearchType}&innerPnxIndex=-1&numOfUsedTerms=-1&fn=BrowseSearch";
-- Source Fields: Aeon
-- Only necessary for source fields not associated with a SearchType. To define source fields used in searches,
-- add a SourceField property prefixed with the product name to the SearchType.
DataMapping.SourceFields["Aeon"] = {};
DataMapping.SourceFields["Aeon"]["TransactionNumber"] = { Table = "Transaction", Field = "TransactionNumber" };
--[[
Import Profiles
Each import profile defines a set of fields to be imported. A button will be generated for each
profile with a Product property matching the product you're using. The key for the import profile
must have a corresponding set of import fields with matching keys in the next section.
- ButtonText: The text that appears on the ribbon button for the import.
- Product: The product the import profile is for.
- Icon: The name of the icon file to use as the button's image.
--]]
DataMapping.ImportProfiles["Default"] = {
ButtonText = "Import",
Product = "Aeon",
Icon = "impt_32x32"
}
-- Import Fields: The table for each ImportFields section must be defined for each import profile above.
-- running the addon to work properly, even if it is empty. Example of an empty ImportFields table:
-- DataMapping.ImportFields.Bibliographic["Default"] = { };
--[[
Bib-level import fields.
- Table and Field determine which request field the value will be imported to.
- The character limit (MaxSize) for a field can be found at https://support.atlas-sys.com/hc/en-us/articles/360011920013-Aeon-Database-Tables
for Aeon, https://support.atlas-sys.com/hc/en-us/articles/360011812074-ILLiad-Database-Tables for ILLiad,
and https://support.atlas-sys.com/hc/en-us/articles/360011923233-Ares-Database-Tables for Ares. The character limit is
in parentheses next to the field type.
- Value must be an XPath expression.
--]]
DataMapping.ImportFields.Bibliographic["Default"] = {
{
Table = "Transaction",
Field = "ItemTitle", MaxSize = 255,
Value = "//datafield[@tag='245']/subfield[@code='a']|//datafield[@tag='245']/subfield[@code='b']"
},
{
Table = "Transaction",
Field = "ItemAuthor", MaxSize = 255,
Value = "//datafield[@tag='100']/subfield[@code='a']|//datafield[@tag='100']/subfield[@code='b'],//datafield[@tag='110']/subfield[@code='a']|//datafield[@tag='110']/subfield[@code='b'],//datafield[@tag='111']/subfield[@code='a']|//datafield[@tag='111']/subfield[@code='b']"
},
{
Table = "Transaction",
Field ="ItemPublisher", MaxSize = 255,
Value = "//datafield[@tag='260']/subfield[@code='b']"
},
{
Table = "Transaction",
Field ="ItemPlace", MaxSize = 255,
Value = "//datafield[@tag='260']/subfield[@code='a']"
},
{
Table = "Transaction",
Field ="ItemDate", MaxSize = 50,
Value = "//datafield[@tag='260']/subfield[@code='c']"
},
{
Table = "Transaction",
Field ="ItemEdition", MaxSize = 50,
Value = "//datafield[@tag='250']/subfield[@code='a']"
},
{
Table = "Transaction",
Field ="ItemIssue", MaxSize = 255,
Value = "//datafield[@tag='773']/subfield[@code='g']"
}
};
-- Holding-level import fields. Value must be an XPath expression.
DataMapping.ImportFields.Holding["Default"] = {
}
-- Item-level import fields. Value should not be changed.
DataMapping.ImportFields.Item["Default"] = {
{
Table = "Transaction",
Field = "ReferenceNumber", MaxSize = 50,
Value = "ReferenceNumber"
},
{
Table = "Transaction",
Field = "CallNumber", MaxSize = 255,
Value = "CallNumber"
},
{
Table = "Transaction",
Field = "ItemNumber", MaxSize = 255,
Value = "Barcode"
},
{
Table = "Transaction",
Field = "Location", MaxSize = 255,
Value = "Location"
},
{
Table = "Transaction",
Field = "SubLocation", MaxSize = 255,
Value = "Library"
}
};