Now we have biblio records in our drupal site, we will be able to get items data.
The first thing to do is enable the items module. So, go to "Admin > module" page, search and check the opac items module and click on Save at the bottom.
Add item fields
Go to your OPAC server (admin/config/opac/servers/manage//view and click on "Items mapping" tab.
Here you can add a rule. A rule is a mapping between ILS field (item field) and the column of the table that will be shown by drupal.
Add a rule:
- Item field: Select the one you want,
- Displayed name: This is the name in column header,
- Weight: A high weight will move the column to the right,
Add new field again. Clicking on Save button should redirect you to items mapping overview page. Here you can reorder items fields by drag and drop.
Link an item field to a vocabulary.
In OPAC, Items are not harvested and no data from them are stored in Drupal. This means that items are not drupal entities. So they have'nt fields known by Drupal and link items data to a vocabulary seems not possible. But it is !
Indeed, items data are retrieved at the fly. The fields are linked to a term at the fly too. Let's say that we have a vocabulary named "Location". We added a text field "code" in this vocabulary. So we have the following terms:
- Name: St Victor, Code: STV, tid: 1
- Name: Archive, Code: ARC, tid: 2
- Name: Bibliothèque principale, Code: BP, tid: 3
Each time an item will be displayed, the field(s) related to a vocabulary will be checked to find a coreponding term. i.e. i choose to get the field "Lacation" of my items in a column "Location" and link it to the vocabulary "Location". When showing an item that have STV in this column, the value in items table will be a link to term n° 1 (taxonomy/term/1).
Let's look at an exemple:
Add a rule like above. After completing "item field", "Displayed name" and "Weight", click on "linked to a vocabulary":
- Vocabulary: Select the one you want to link this field,
- Term field to compare: This the code field we created before. It will contain STV, ARC or BP,
- No match rule: For items it is better to let the default value: Leave empty,
- Show term as link: If this option is not checked, the field won't be displayed as a link the term but just with the term name.
What is the point to have a link to the term ?
Items are not drupal entities, so clicking on this link will not create a list of items with the same term. But if you harvest the same data in you biblios, you can get a list of biblio having at least one item with the same term.
Configure items display
There is 2 place where items can be displayed:
- In a dedicated page at "node//items. OPAC will show there all items for the current record identifyed with .
- In the node itself. OPAC dynamically fill a field named OPAC items information (field_opac_items_info) with items informations.
To customize a litlle bit this display, go to "admin/config/opac/opac-items":
- Show a tab on bibliographic record pages: If checked, a tab will appear on node pages to go to the items page (node//items).
- Show items in node content (dynamic field): Show items table in the "OPAC items information" field. If ckecked a new configuration fieldset will appear.
It time to see the result. Before, be sure your Drupal user have the opac items permissions. Go to "Admin > People > Permissions" and check "View items informations". To learn more about permissions visit Users, roles and permissions page.
If you have harvested some records you can view them by going to the "/node/xxx" path. Where "xxx" is the node id. If you don't know the node id go to "Admin > Content" page. Here you have all the content (nodes) of your drupal site. Click on the title of a node of opac type. Then you should see your records with values you have mapped in biblio mapping. Now click on the "Items" tab and see ...
Hide some items
You may want to hide some items to the user. For example, showing lost items is useless since users can't hold them.
Configuration is made in Configuration » OPAC Servers » Your Server » Items settings.
For each item field you can choose:
- if you want to use this field as a criterion (column "Use")
- comparison operator (column "Operator")
- comparison value (column "Value")
Available fields are those returned by the connector.
You may choose if item must meet all criteria in order to be hidden, or if one criterion is enough.
The form returns an error if:
- you chose a numeric comparison operator and comparison value is not numeric
- you chose a regex operator and value is not a valid regex (value have to start and end with '/')
Items that meet the conditions are hidden, and totals (total number of items and total number of available items) correspond to visible items.