2017 © Pedro Peláez
 

silverstripe-module silverstripe-nhi-field

Provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.

image

webtorque/silverstripe-nhi-field

Provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.

  • Tuesday, September 26, 2017
  • by webtorque
  • Repository
  • 2 Watchers
  • 0 Stars
  • 157 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 59 % Grown

The README.md

silverstripe-nhi-field

A Silverstipe module to provide a NHI db field and NHI Form field to track NZ's "National Health Index" number., (*1)

Build Status, (*2)

Features

  • Custom DB field type
  • Custom form field type with basic pattern validation and checksum validation.
  • Consistently save NHI in all caps.

Requirements

  • PHP 5.4 or greater (tested with up to PHP 7.1)
  • silverstripe/framework:^3.0
  • silverstripe/cms:^3.0

Installation

composer require webtorque/silverstripe-nhi-field:^0.0

Usage

To specify a NHI db field on a DataObject:, (*3)

class Patient extends DataObject {
    private static $db = [
        'NationalHealthIndex' => 'NHI',
    ];
}

The NHI field type is equivalent to Varchar(7). When scaffolding a form, any NHI db field will autmatically use the NHIField form field instead of TextField., (*4)

Validating an NHI

Just use the NHIField in your form and validate your Form normally., (*5)


$nhiField = NHIField::create( $name = 'nhi', // required $title = 'National Health Index', // optional $value = 'CGC2720', // optional $form = null, // optional $html5pattern = false // optional, output an `html5` pattern attribute );

NHIField is a simple extension of TextField with the following alteration: * The maxlength is automatically set to 7. * When setting the value of the field, it will automatically be converted to uppercase. * The value is validated with a basic regex and with a checksum as specified by the NHI standard. * You can ouput an html5 pattern attribute with $nhiField->setHtml5Pattern(true);., (*6)

For testing purposes, checksum validation can be disabled by setting the disable_checksum_validation flag on the NHIField config., (*7)

if (Director::isDev()) {
    NHIField::config()->disable_checksum_validation = true;
}

The Versions

26/09 2017

dev-dev

dev-dev

Provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxime Rainville

26/09 2017

dev-master

9999999-dev

Provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxime Rainville

26/09 2017

v0.1.0

0.1.0.0

Provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxime Rainville

26/09 2017

v0.0.0

0.0.0.0

Provide a NHI db field and NHI Form field to track NZ's "National Health Index" number.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Maxime Rainville