Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Overview

This feature allows for the limiting of which applications and/or field values may be selected based on the contractors “classification”.

This feature is only available currently for the permits and entitlements modules on the portal

A contractor_classification AIF field must be added to the clients backoffice contractors(license) module for this feature to work.

Example config can be found here: https://lookfirst.atlassian.net/browse/MAG-5375

The current portal workflow will remain. The user will select the type of permit they are applying for, agree to the terms, select a location and then enter the contact information. When the contractor is selected, the portal will gather the contractors classification and verify if the selected application is valid for the selected contractor.

If the contractor classification does not allow the selected permit type or field selection, a configured message will be displayed and the user will not be able to move forward with the application.

Configuration

Table Structure

Before enabling this feature, ensure the section tables have been created on the portal

-- REQUIRED db struct for permits
CREATE TABLE permits.config_contractor_classification
(
  id serial,
  project_id integer,
  classification character varying,
  enabled boolean  
)
WITH (
  OIDS=FALSE
);
ALTER TABLE permits.config_contractor_classification
  OWNER TO north;
GRANT ALL ON TABLE permits.config_contractor_classification TO north;
--GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE permits.config_contractor_classification TO limited;

-- REQUIRED db struct for entitlements
CREATE TABLE entitlements.config_contractor_classification
(
  id serial,
  project_id integer,
  classification character varying,
  enabled boolean  
)
WITH (
  OIDS=FALSE
);
ALTER TABLE entitlements.config_contractor_classification
  OWNER TO north;
GRANT ALL ON TABLE entitlements.config_contractor_classification TO north;
--GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE entitlements.config_contractor_classification TO limited;


-- REQUIRED db struct for permits
CREATE TABLE permits.config_contractor_classification_fields
(
  id serial,
  field_id integer,
  classification character varying,
  option_value character varying,
  enabled boolean  
)
WITH (
  OIDS=FALSE
);
ALTER TABLE permits.config_contractor_classification_fields
  OWNER TO north;
GRANT ALL ON TABLE permits.config_contractor_classification_fields TO north;
--GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE permits.config_contractor_classification_fields TO limited;


-- REQUIRED db struct for entitlements
CREATE TABLE entitlements.config_contractor_classification_fields
(
  id serial,
  field_id integer,
  classification character varying,
  option_value character varying,
  enabled boolean  
)
WITH (
  OIDS=FALSE
);
ALTER TABLE entitlements.config_contractor_classification_fields
  OWNER TO north;
GRANT ALL ON TABLE entitlements.config_contractor_classification_fields TO north;
--GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE entitlements.config_contractor_classification_fields TO limited;

Enabling the feature

-- REQUIRED enable feature on portal
--select setval('public.options_id_seq', 139);
INSERT INTO public.options (name, value) VALUES ('contractor_classification_permits', 'on');
INSERT INTO public.options (name, value) VALUES ('contractor_classification_entitlements', 'on');

Basic Configuration options

Application restrictions

Configure which contractor classifications can apply for a permit.

$module.config.contractor_classification

Column

Description

Notes

project_id

The ID of the project

from $module.config_projects

classification

The textual value of the classification that should be allowed to apply for this project.

This must match the value of the contractor_classification AIF in the backoffice exactly

enabled

boolean (true)

Determines if this rule is enforced

-- EXAMPLE specify required classification for permits section project_id of 1
-- if none are specified feature is disabled
INSERT INTO permits.config_contractor_classification (project_id, classification, enabled) VALUES (441, 'Type C Contractor (CC)', 't');
INSERT INTO permits.config_contractor_classification (project_id, classification, enabled) VALUES (441, 'Type A Contractor (AC)', 't');
INSERT INTO entitlements.config_contractor_classification (project_id, classification, enabled) VALUES (6, 'Type C Contractor (CC)', 't');
INSERT INTO entitlements.config_contractor_classification (project_id, classification, enabled) VALUES (6, 'Type A Contractor (AC)', 't');

Field Restrictions

Sets which values are available for the configured field based on the contractors classification

This only works with single select fields

Column

Description

Notes

field_id

The ID of the field

From $module.config_fields

classification

The textual value of the classification that should be allowed to apply for this project.

This must match the value of the contractor_classification AIF in the backoffice exactly

option_value

The value in the select box that should be allowed for this classification

enabled

boolean (true)

Determines if this rule should be enforced

-- EXAMPLE relate a field id to allowed values for a classification type
INSERT INTO permits.config_contractor_classification_fields (field_id, classification, option_value, enabled) VALUES (26159, 'Type C Contractor (CC)', 'H-5', 't');
INSERT INTO entitlements.config_contractor_classification_fields (field_id, classification, option_value, enabled) VALUES (26159, 'Type C Contractor (CC)', 'H-5', 't');

Error text

The text shown when a user attempts to apply for a application they are not permitted to or select a field value they are not permitted to is configurable

-- EXAMPLE error text
INSERT INTO public.options (name, value) VALUES ('contractor_classification_error_permits', 'ERROR: The selected contractor does not appear to be authorized to apply for this permit type.<br /> Please click here [A link to contractor type documentation] for more details on contractor classification requirements.');
INSERT INTO public.options (name, value) VALUES ('contractor_classification_error_entitlements', 'ERROR: The selected contractor does not appear to be authorized to apply for this public works type.<br /> Please click here [A link to contractor type documentation] for more details on contractor classification requirements.');
INSERT INTO public.options (name, value) VALUES ('contractor_classification_field_error_permits', 'ERROR: The selected contractor does not appear to be authorized to apply for this type.  Please try again.');
INSERT INTO public.options (name, value) VALUES ('contractor_classification_field_error_entitlements', 'ERROR: The selected contractor does not appear to be authorized to apply for this type.  Please try again.');
  • No labels