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

Update February 2022: To prevent text messages from getting caught in carriers’ spam filters, all text messages will be sent from no-reply@orbiscascade.org. Contacting the PCSG before using this customization is no longer necessary.

  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

PCSG is unable to resolve issues with specific cell phone carriers, so we cannot guarantee that texts will always go through. If your patrons are unable to receive text messages, they can use Primo’s QR code (if turned on) or take a screenshot of the record.