Table of Contents

Patron Statistical Category Enhancements

This proposal covers the following enhancements to Patron Statistical Categories:

Background Information

Evergreen has user-defined fields called statistical categories (aka stat cats) that can be configured with the following information:

Statistical categories are intended to be used for reporting and are not used in any business logic in the application itself. Stat cats can be set up for patrons and copies (an individual item in a library).

Statistical categories for copies can be made required when they are set up in the Statistical Categories Editor. When a user enters a value for a statistical category, they must select from the list of valid values in the drop down list.

Statistical categories for patrons cannot be made required. In addition, the user is allowed to type in value for the statistical category instead of selecting from a drop down list.

Use Case

Certain patron statistical categories are used for important consortium-wide reporting that determines funding levels. For reports to be meaningful, the data used to generate the reports must be available and consistent. Towards this end, it is important that patron records are entered with valid values for these fields.

Requirements

Statistical Categories Editor

Patron Registration Screen

Objects Affected

All modified files are available at https://github.com/sprater/Evergreen/tree/patstatcat.

Comparisons: https://github.com/sprater/Evergreen/compare/patstatcat

Database TABLE actor.stat_cat

NEW Database TABLE actor.stat_cat_entry_default

      id              SERIAL  PRIMARY KEY,
      stat_cat_entry  INT     NOT NULL REFERENCES actor.stat_cat_entry(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
      stat_cat        INT     NOT NULL REFERENCES actor.stat_cat(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
      owner           INT     NOT NULL REFERENCES actor.org_unit(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
      CONSTRAINT sced_once_per_owner UNIQUE (stat_cat,owner)

See 005.schema.actors.sql and 950.data.seed-values.sql.

Statistical category editor

See

Patron registration

See Open-ILS/web/js/ui/default/actor/user/register.js

Tests

The purpose of the tests is to verify that the new functions work as expected, as well as to ascertain that previous functionality has not been changed or broken.

Test suite 1: Verify required patron statistical field with fixed values and an entry marked as default

  1. Create a new patron stat category and make it required and disallow user-entered values. Create one or more entries.
  2. Mark one of the fixed entries as the default entry in the new patron stat category.
  3. Make an existing patron statistical category required and disallow user-entered values. Mark one of the fixed entries as the default entry.
  4. Register a new patron.
  5. Don’t enter values for the required statistical categories. Confirm that the record will be saved with the specified default value.
  6. Confirm that the user cannot enter their own values.
  7. Edit an existing patron.
  8. Don’t enter values for the required statistical categories. Confirm that the record will be saved with the previously-saved default.
  9. Confirm that the user cannot enter their own values.

Test suite 2: Verify required patron statistical field with fixed values and no entry marked as default

  1. Create a new patron stat category and make it required and disallow user-entered values. Do not mark any entry as the default.
  2. Make an existing patron statistical category required and disallow user-entered values. Do not mark any entry as the default.
  3. Register a new patron.
  4. Don’t enter values for the required statistical categories. Confirm that the user must select a value from the drop-down before the record will be saved.
  5. Confirm that the user cannot enter their own values and must select from the drop-down.
  6. Edit an existing patron and repeat the tests in step 4 and 5.

Test suite 3: Verify required patron statistical field with user-entered values and no entry marked as default

  1. Create a new patron stat category, make it required and allow user-entered values.
  2. Edit an existing patron stat category, make it required and allow user-entered values.
  3. Register a new patron.
  4. Don’t enter values for the required statistical categories. Confirm that the record can not be saved until values are entered for the required statistical categories.
  5. Confirm that a user can enter their own values and save their record.
  6. Edit an existing patron and repeat steps 4 and 5.

Test suite 4: Verify optional patron statistical field with fixed values and an entry marked as default

  1. Create a new patron stat category, make it optional and disallow user-entered values.
  2. Edit an existing patron stat category, make it optional and disallow user-entered values.
  3. Register a new patron.
  4. Confirm that a user can save their record without entering any values in the optional category. Confirm that the value saved is the default value.
  5. Confirm that a user cannot enter their own values and must select from the drop-down if they choose to fill in the field.
  6. Edit an existing patron.
  7. Confirm that a user can save their record without entering any values in the optional category. Confirm that no value is saved.
  8. Confirm that a user cannot enter their own values and must select from the drop-down if they choose to fill in the field.
  9. Confirm that if no value was previously saved for the optional category, the patron edit screen displays an empty field for the category.

Test suite 5: Verify optional patron statistical field with fixed values and no entry marked as default

  1. Create a new patron stat category, make it optional and disallow user-entered values.
  2. Edit an existing patron stat category, make it optional and disallow user-entered values.
  3. Register a new patron.
  4. Confirm that a user can save their record without entering any values in the optional category. Confirm that no value is saved for the optional category.
  5. Confirm that a user cannot enter their own values and must select from the drop-down if they choose to fill in the field.
  6. Edit an existing patron and repeat steps 4 and 5.

Test suite 6: Verify optional patron statistical field with user-entered values and no entry marked as default (original behavior)

  1. Create a new patron stat category, make it optional and allow user-entered values.
  2. Edit an existing patron stat category, make it optional and allow user-entered values.
  3. Register a patron.
  4. Confirm that a user can save their record without entering any values in the optional category.
  5. Confirm that a user can enter their own values and save their record if they choose to fill in the field.
  6. Edit an existing patron and repeat steps 4 and 5.