Text a Call Number

Developer

Tamara Marnell, Central Oregon Community College

Description

Add an action to brief and full Primo records to text the location(s) and call number(s) of a physical title to a phone number.

Primo full record with Text Call Number in the Send To ribbon
Text Call Number modal window with form to send text.

System Components

PBO and Package Manager

Skillset Requirements

PBO, JavaScript, and CSS

Accessibility

Not tested for accessibility.

Browser Support

Tested on Chrome, Firefox, Edge, IE11, and Safari.

Mobile Support

Tested on Android and Apple phones.

Implementation

Overview

To enable this module, you will need to:

  • Provide a “reply to” email to the Primo Customization Standing Group.
  • Declare the module and options in your custom.js file (steps 2 through 4)

Steps

Before you begin, notify the chair of the Primo Customization Standing Group that you will be using this
module, and provide the Primo VID and a “reply to” email address for your library. The Alliance IT Manager will set this up on the server side.

  1. In the PBO, make sure you have the “Inherit Central Package” box checked.
  2. In your local package, in the custom.js file, include the modules ‘customActions’ and ‘smsAction’ in your app definition. For example:

    var app = angular.module('viewCustom', ['customActions', 'smsAction']);
  3. Also in the custom.js file, add the following line of code within the anonymous function (that is, before the closing brackets at the end of the file):

    app.component('prmActionListAfter', { template: '<sms-action />' });

    If you have other custom actions targeting the prmActionListAfter component, instead add the <sms-action /> tag to your existing module or template. For example:

    angular
      .module('myActions', [])
      .component('prmActionListAfter', {
         controller: function controller($scope) {
           // Functions for my custom actions here
         },
         template: '<custom-action [etc.]></custom-action><sms-action />'
      });
  4. If you want to customize the display of the action, add the following block of code within the anonymous function and edit the values.

    app.value('smsActionOptions', {
        label: "Text Call Number",
        index: 0,
        icon: {
          icon: 'ic_textsms_24px',
          iconSet: 'communication',
          type: 'svg'
        },
        libraries: '[LIBRARY CODE]: [LIBRARY NAME], [etc.]'
    });

    For “label,” set the text that appears on the new action in the Send To section of a full record. The default is “Text Call Number.”

    For “index,” set the position of the custom action in relation to other actions on Primo records. The default is 0, the leftmost position.

    For “icon,” you can select any icon from the Material Design library. For example, the smartphone icon is in the Hardware group of the page, so the icon definition would be:

    icon: {
      icon: 'ic_smartphone_24px',
      iconSet: 'hardware',
      type: 'svg'
    }

    Text Call Number with phone icon

    In “libraries,” you can define names to add in front of locations and call numbers. Configure this by using pairs of the library’s code in Alma and the name you want to display, separated by commas. For example:

    libraries: 'cocc: Barber Library, redmond: Redmond Campus'

    This will add “Barber Library” to the front of locations within the main library with code “cocc,” and “Redmond Campus” in front of locations in the branch library with the code “redmond.”

    Text Call Number window

    You can find the codes for your institution in Alma under Configuration > General > Libraries > Add a Library or Edit Library Information. If you don’t want any library names included, remove the “libraries” line from the options.
  5. Style the Text a Call Number form in your custom1.css file. Here are suggested rulesets:

    smsForm md-input-container {
    display: flex;
    }

    smsLinkContainer input,
    smsLinkContainer label {
    vertical-align: middle;
    }

    smsError {
    display: none;
    background-color: #ffffcc;
    padding: .5rem .5rem 0.17rem .5rem;
    margin: 0 0 1rem 0;
    }

    smsItemInfo {
    max-width: 400px;
    white-space: pre-wrap;
    }

  6. Zip and upload your package in the PBO.
  7. Deploy your view.

Troubleshooting

Some carriers may block specific email addresses, causing SMS messages from those addresses to fail. PCSG is unable to resolve issues with specific cell phone carriers, so we cannot guarantee that texts will always go through. If you notice this issue while testing or using this customization, you should notify the chair of the PCSG that you are having issues. You can also direct patrons who express that they were unable to receive text messages to use Primo’s QR code (if turned on) or take a screenshot of the item information, instead.