1. Part A - Registration 3 112

Add new registration to a service

This page explains how to add a registration that can be chosen by the user in the guide.
The registration will appear in the list of mandatory or optional registrations when its determinant is set in the preliminary questions. The user will then be able to select it or leave it unchecked if he/she has already processed this registration.
A registration must be configured with its certificate(s), requirement(s), cost, etc.


Usually registration is about resolution of a single certificate document. In such case, this certificate document should be referenced on registration constructor. This will make the new registration reuse certificates label and abbreviation.

In order to define a new certificate, see Add a new certificate how-to.

  1. In model/business-process-<your-service>/registrations directory create a new file <your-registration>.js.
  2. Create a registration instance on a BusinessProcessYourService.prototype.registrations.map and set its Document property (See the listing below).
  3. Add a require for the new registration in model/business-process-<your-service>/registrations/index.js

Listings

BusinessProcessYourService.prototype.registrations.map.defineProperties({
    yourRegistration: { nested: true }
});

BusinessProcessYourService.prototype.registrations.map.yourRegistration.setProperties({
    Document: require('../../documents/your-certificate-document')
});

Example

In the branch “add-a-registration-to-a-service” of eregistrations-demo :

Add a new registration “companyIncorporation”:

  • Add a new document “Company incorporation” with abbreviated name “CINC”
  • Define a certificate based on the new document that will require number and issueDate on its dataForm
  • Set the new certificate processing step to processing.
  • Add a new registration companyIncorporation based on the certificates document.

Solution

View
21 model/business-process-demo/certificates/company-incorporation.js
@@ -0,0 +1,21 @@
+'use strict';
+
+var db = require('../../../db')
+ , FormSection = require('eregistrations/model/form-section')(db)
+ , CompanyIncorporation = require('../../documents/company-incorporation');
+
+module.exports = CompanyIncorporation;
+
+CompanyIncorporation.prototype.defineProperties({
+ dataForm: { type: FormSection },
+ processingStep: { value: function () { return this.master.processingSteps.map.processing; } },
+ isToBeHanded: { value: false }
+});
+
+CompanyIncorporation.prototype.dataForm.setProperties({
+ label: function () { return this.propertyMaster.label; },
+ disablePartialSubmit: true,
+ actionUrl: function () { return this.master.__id__ + '/certificate/company-incorporation'; },
+ propertyMasterType: CompanyIncorporation,
+ propertyNames: ['number', 'issueDate']
+});
View
3 model/business-process-demo/certificates/index.js
@@ -7,5 +7,6 @@ var defineCertificates =
module.exports = defineCertificates(BusinessProcessDemo, [
require('./company-registration'),
- require('./certificate-of-incentives')
+ require('./certificate-of-incentives'),
+ require('./company-incorporation')
]);
View
11 model/business-process-demo/registrations/company-incorporation.js
@@ -0,0 +1,11 @@
+'use strict';
+
+var BusinessProcessDemo = require('../base');
+
+BusinessProcessDemo.prototype.registrations.map.defineProperties({
+ companyIncorporation: { nested: true }
+});
+
+BusinessProcessDemo.prototype.registrations.map.companyIncorporation.setProperties({
+ Document: require('../../documents/company-incorporation')
+});
View
1 model/business-process-demo/registrations/index.js
@@ -4,3 +4,4 @@ module.exports = require('../base');
require('./company-registration');
require('./certificate-of-incentives');
+require('./company-incorporation');
View
9 model/documents/company-incorporation.js
@@ -0,0 +1,9 @@
+'use strict';
+
+var _ = require('../../i18n')
+ , db = require('../../db');
+
+module.exports = require('eregistrations/model/document')(db).extend('CompanyIncorporation', {}, {
+ label: { value: _("Company incorporation") },
+ abbr: { value: "CINC" }
+});