Skip to content

Instantly share code, notes, and snippets.

@lawlesst
Created November 15, 2011 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lawlesst/1367769 to your computer and use it in GitHub Desktop.
Save lawlesst/1367769 to your computer and use it in GitHub Desktop.
Innovative driver patch
Index: web/conf/Innovative.ini
===================================================================
--- web/conf/Innovative.ini (revision 4582)
+++ web/conf/Innovative.ini (working copy)
@@ -1,6 +1,14 @@
[Catalog]
url = http://catalog.library.myuniversity.edu
+; Do not change unless you have changed your indexing routine to
+; strip the leading '.' and trailing check
+; digit in your III record numbers.
+; E.g. .b1000167x - set to true
+; b1000167 - set to false
+[RecordID]
+use_full_id = true
+
; The following is a set of fields to look up for
; Change them to match your HTML
[OPAC]
Index: web/Drivers/Innovative.php
===================================================================
--- web/Drivers/Innovative.php (revision 4582)
+++ web/Drivers/Innovative.php (working copy)
@@ -56,6 +56,27 @@
dirname(__FILE__) . '/../conf/Innovative.ini', true
);
}
+
+ /**
+ * prepID
+ *
+ * This function returns the correct record id format as defined
+ * in the Innovative.ini file.
+ *
+ * @access public
+ */
+ public function prepID($id)
+ {
+ //Get the ID format from config
+ if ($this->config['RecordID']['use_full_id']) {
+ // Strip ID leading period and trailing check digit.
+ $id_ = substr(str_replace('.b', '', $id), 0, -1);
+ } else {
+ //Return digits only.
+ $id_ = substr($id, 1);
+ };
+ return $id_;
+ }
/**
* Get Status
@@ -72,8 +93,8 @@
*/
public function getStatus($id)
{
- // Strip ID
- $id_ = substr(str_replace('.b', '', $id), 0, -1);
+
+ $id_ = $this->prepID($id);
// Load Record Page
if (substr($this->config['Catalog']['url'], -1) == '/') {
@@ -264,8 +285,7 @@
*/
public function getHoldLink($id)
{
- // Strip ID
- $id_ = substr(str_replace('.b', '', $id), 0, -1);
+ $id_ = $this->prepID($id);
//Build request link
$link = $this->config['Catalog']['url'] . '/search?/.b' . $id_ . '/.b' .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment