openchs-models 1.31.66 → 1.31.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -115,7 +115,7 @@ class IdentifierAssignment extends _BaseEntity.default {
115
115
  }
116
116
 
117
117
  static fromResource(identifierAssignmentResource, entityService) {
118
- const identifierAssignment = _General.default.assignFields(identifierAssignmentResource, new IdentifierAssignment(), ["uuid", "identifier", "assignmentOrder", "voided"]);
118
+ const identifierAssignment = _General.default.assignFields(identifierAssignmentResource, new IdentifierAssignment(), ["uuid", "identifier", "assignmentOrder", "voided", "used"]);
119
119
 
120
120
  identifierAssignment.identifierSource = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(identifierAssignmentResource, "identifierSourceUUID"), _IdentifierSource.default.schema.name);
121
121
  identifierAssignment.individual = entityService.findByKey("uuid", _ResourceUtil.default.getUUIDFor(identifierAssignmentResource, "individualUUID"), _Individual.default.schema.name);
@@ -125,7 +125,7 @@ class IdentifierAssignment extends _BaseEntity.default {
125
125
  }
126
126
 
127
127
  get toResource() {
128
- const resource = _lodash.default.pick(this, ["uuid", "identifier", "assignmentOrder", "voided"]);
128
+ const resource = _lodash.default.pick(this, ["uuid", "identifier", "assignmentOrder", "voided", "used"]);
129
129
 
130
130
  resource.individualUUID = this.individual ? this.individual.uuid : null;
131
131
  resource.programEnrolmentUUID = this.programEnrolment ? this.programEnrolment.uuid : null;
@@ -480,8 +480,12 @@ class Individual extends _BaseEntity.default {
480
480
  return _Duration.default.inYear(0);
481
481
  }
482
482
 
483
+ getTranslatedNameString(i18n) {
484
+ return this.isPerson() ? Individual.getFullName(this) : this.subjectType.type === _SubjectType.default.types.User ? `${this.firstName}(${i18n.t('you')})` : this.firstName;
485
+ }
486
+
483
487
  get nameString() {
484
- return this.isPerson() ? Individual.getFullName(this) : this.firstName;
488
+ return this.isPerson() ? Individual.getFullName(this) : this.subjectType.type === _SubjectType.default.types.User ? `${this.firstName}(You)` : this.firstName;
485
489
  }
486
490
 
487
491
  static getFullName(obj) {
@@ -235,7 +235,7 @@ class FormElement extends _BaseEntity.default {
235
235
  }
236
236
  } else if (this.concept.datatype === _Concept.default.dataType.Time && !(0, _moment.default)(value, 'HH:mm').isValid() && (!this.mandatory && !_lodash.default.isNil(value) || this.mandatory)) {
237
237
  failure.messageKey = "invalidTimeFormat";
238
- } else if (this.concept.datatype === _Concept.default.dataType.Date && !(0, _moment.default)(value).isValid() && (!this.mandatory && !_lodash.default.isNil(value) || this.mandatory)) {
238
+ } else if (this.concept.datatype === _Concept.default.dataType.Date && !(0, _moment.default)(value, 'YYYY-MM-DD').isValid() && (!this.mandatory && !_lodash.default.isNil(value) || this.mandatory)) {
239
239
  failure.messageKey = "invalidDateFormat";
240
240
  } else if (this.mandatory && this.concept.datatype === _Concept.default.dataType.Duration && _lodash.default.some(_lodash.default.map(value.durations, "durationValue"), durationValue => _lodash.default.isEmpty(durationValue))) {
241
241
  failure.messageKey = "emptyValidationMessage";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "openchs-models",
3
3
  "description": "OpenCHS data model to be used by front end clients",
4
- "version": "1.31.66",
4
+ "version": "1.31.68",
5
5
  "private": false,
6
6
  "repository": {
7
7
  "type": "git",