Commit f3745362 authored by LAVENIER's avatar LAVENIER
Browse files

Merge branch 'release/1.5.3'

parents 50e3d956 ed0350fd
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="10502" id="net.sumaris.app" version="1.5.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-versionCode="10503" id="net.sumaris.app" version="1.5.3" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>SUMARiS</name>
<description>Halieutic data capture</description>
<author email="contact@e-is.pro" href="http://www.e-is.pro">Environmental Information Systems</author>
......
......@@ -15,7 +15,7 @@ if [[ "_$INSTALL_DIR" == "_" ]]; then
fi
latest_version() {
echo "1.5.2" #lastest
echo "1.5.3" #lastest
}
api_release_url() {
......
{
"name": "sumaris-app",
"description": "SUMARiS app",
"version": "1.5.2",
"version": "1.5.3",
"author": "contact@e-is.pro",
"license": "AGPL-3.0",
"readmeFilename": "README.md",
......
......@@ -45,7 +45,7 @@ export class PmfmValidators {
validatorFns.push(SharedValidators.entity);
}
return validatorFns.length > 1 ? Validators.compose(validatorFns) : (validatorFns.length === 1 ? validatorFns[0] : undefined);
return validatorFns.length > 1 ? Validators.compose(validatorFns) : (validatorFns.length === 1 ? validatorFns[0] : null);
}
}
......@@ -147,11 +147,11 @@ export class VesselPage extends AppEntityEditor<Vessel, VesselService> implement
this.form.setValue({...json, ...{features: { ...json.features, id: null, startDate: null, endDate: null}}});
this.form.get("features.startDate").setValidators(Validators.compose([
this.form.get("features.startDate").setValidators([
Validators.required,
SharedValidators.dateIsAfter(this.previousVessel.features.startDate,
this.dateAdapter.format(this.previousVessel.features.startDate, this.translate.instant('COMMON.DATE_PATTERN')))
]));
]);
this.form.enable();
this.form.get("registration").disable();
......@@ -193,11 +193,11 @@ export class VesselPage extends AppEntityEditor<Vessel, VesselService> implement
}
});
this.form.get("registration.startDate").setValidators(Validators.compose([
this.form.get("registration.startDate").setValidators([
Validators.required,
SharedValidators.dateIsAfter(this.previousVessel.registration.startDate,
this.dateAdapter.format(this.previousVessel.registration.startDate, this.translate.instant('COMMON.DATE_PATTERN')))
]));
]);
this.form.enable();
this.form.get("features").disable();
......
......@@ -142,7 +142,7 @@ export class MatDate implements OnInit, OnDestroy, ControlValueAccessor, InputEl
this.dayControl = this.formBuilder.control(null, () => $error.getValue());
// Add custom 'validDate' validator
this.formControl.setValidators(this.required ? Validators.compose([Validators.required, SharedValidators.validDate]) : SharedValidators.validDate);
this.formControl.setValidators(this.required ? [Validators.required, SharedValidators.validDate] : SharedValidators.validDate);
// Get patterns to display date
this.updatePattern(this.translate.instant(['COMMON.DATE_PATTERN']))
......
......@@ -172,7 +172,7 @@ export class MatDateTime implements OnInit, OnDestroy, ControlValueAccessor, Inp
}
// Add custom 'validDate' validator
this.formControl.setValidators(this.required ? Validators.compose([Validators.required, SharedValidators.validDate]) : SharedValidators.validDate);
this.formControl.setValidators(this.required ? [Validators.required, SharedValidators.validDate] : SharedValidators.validDate);
// Get patterns to display date and date+time
//this.updatePattern(this.translate.instant(['COMMON.DATE_PATTERN', 'COMMON.DATE_TIME_PATTERN']))
......
......@@ -195,10 +195,16 @@ export class MatLatLongField implements OnInit, AfterViewInit, OnDestroy, Contro
this.formControl = this.formControl || this.formControlName && this.formGroupDir && this.formGroupDir.form.get(this.formControlName) as FormControl;
if (!this.formControl) throw new Error("Missing mandatory attribute 'formControl' or 'formControlName' in <mat-latlong-field>.");
this.formControl.setValidators(Validators.compose([
this.formControl.validator,
this.type === 'latitude' ? SharedValidators.latitude : SharedValidators.longitude
]));
const existingValidators = this.formControl.validator;
if (existingValidators) {
this.formControl.setValidators([
existingValidators,
this.type === 'latitude' ? SharedValidators.latitude : SharedValidators.longitude
]);
}
else {
this.formControl.setValidators(this.type === 'latitude' ? SharedValidators.latitude : SharedValidators.longitude);
}
this._subscription.add(
this.textFormControl.valueChanges
......
......@@ -481,9 +481,9 @@ export class BatchForm<T extends Batch<any> = Batch<any>> extends MeasurementVal
// If sampling weight is required, make batch weight required also
if (this._requiredSampleWeight) {
this.weightForm.setValidators(Validators.compose([
this.weightForm.setValidators(
SharedFormGroupValidators.requiredIf('value', samplingForm.get('weight.value'))
]));
);
}
// If sampling weight is required, make batch weight required also
......
......@@ -85,10 +85,10 @@ export class SubBatchForm extends MeasurementValuesForm<SubBatch>
const taxonNameControl = this.form && this.form.get('taxonName');
if (taxonNameControl) {
if (show) {
taxonNameControl.setValidators(Validators.compose([SharedValidators.entity, Validators.required]));
taxonNameControl.setValidators([SharedValidators.entity, Validators.required]);
}
else {
taxonNameControl.setValidators([]);
taxonNameControl.setValidators(null);
}
}
}
......@@ -240,7 +240,7 @@ export class SubBatchForm extends MeasurementValuesForm<SubBatch>
const taxonNameControl = this.form.get('taxonName');
if (this.showTaxonName) {
// Add required validator on TaxonName
taxonNameControl.setValidators(Validators.compose([SharedValidators.entity, Validators.required]));
taxonNameControl.setValidators([SharedValidators.entity, Validators.required]);
}
this.registerAutocompleteField('taxonName', {
items: this.$taxonNames,
......@@ -367,7 +367,7 @@ export class SubBatchForm extends MeasurementValuesForm<SubBatch>
const individualCountControl = this.form.get('individualCount');
if (enable) {
individualCountControl.enable();
individualCountControl.setValidators(Validators.compose([Validators.required, Validators.min(0)]));
individualCountControl.setValidators([Validators.required, Validators.min(0)]);
} else {
individualCountControl.disable();
individualCountControl.setValue(null);
......@@ -515,7 +515,7 @@ export class SubBatchForm extends MeasurementValuesForm<SubBatch>
discardReasonControl.updateValueAndValidity({onlySelf: true});
} else {
discardReasonControl.setValue(null);
discardReasonControl.setValidators([]);
discardReasonControl.setValidators(null);
discardReasonControl.disable();
}
}));
......
......@@ -244,7 +244,7 @@ export class SubBatchesTable extends AppMeasurementsTable<SubBatch, SubBatchFilt
if (controls[PmfmIds.DISCARD_REASON]) {
controls[PmfmIds.DISCARD_REASON].disable();
controls[PmfmIds.DISCARD_REASON].setValue(null);
controls[PmfmIds.DISCARD_REASON].setValidators([]);
controls[PmfmIds.DISCARD_REASON].setValidators(null);
}
}
});
......@@ -276,7 +276,7 @@ export class SubBatchesTable extends AppMeasurementsTable<SubBatch, SubBatchFilt
}
else {
control.disable();
control.setValidators([]);
control.setValidators(null);
control.setValue(null);
}
}
......
......@@ -308,7 +308,7 @@ export class OperationPage extends AppEntityEditor<Operation, OperationService>
commentControl.setValidators(Validators.required);
commentControl.markAsTouched({onlySelf: true});
} else {
commentControl.setValidators([]);
commentControl.setValidators(null);
}
commentControl.updateValueAndValidity({emitEvent: false, onlySelf: true});
})
......
......@@ -59,11 +59,11 @@ export class IndividualMonitoringSubSamplesTable extends SubSamplesTable impleme
if (controls[PmfmIds.DEATH_TIME]) {
controls[PmfmIds.DEATH_TIME].disable();
controls[PmfmIds.DEATH_TIME].setValue(null);
controls[PmfmIds.DEATH_TIME].setValidators([]);
controls[PmfmIds.DEATH_TIME].setValidators(null);
}
if (controls[PmfmIds.VERTEBRAL_COLUMN_ANALYSIS]) {
controls[PmfmIds.VERTEBRAL_COLUMN_ANALYSIS].setValue(null);
controls[PmfmIds.VERTEBRAL_COLUMN_ANALYSIS].setValidators([]);
controls[PmfmIds.VERTEBRAL_COLUMN_ANALYSIS].setValidators(null);
controls[PmfmIds.VERTEBRAL_COLUMN_ANALYSIS].disable();
}
}
......
......@@ -12,7 +12,7 @@ export class AuctionControlValidators {
opts?: { markForCheck: () => void }): Subscription {
// Label: remove 'required', and add integer
form.get('label').setValidators([Validators.pattern(/^[0-9]*$/)]);
form.get('label').setValidators(Validators.pattern(/^[0-9]*$/));
// Disable computed pmfms
AppFormUtils.disableControls(form,
......
......@@ -68,8 +68,8 @@ export class SaleValidatorService<O extends SaleValidatorOptions = SaleValidator
opts = this.fillDefaultOptions(opts);
if (opts && opts.required === true) {
form.controls['vesselSnapshot'].setValidators(Validators.compose([Validators.required, SharedValidators.entity]));
form.controls['saleType'].setValidators(Validators.compose([Validators.required, SharedValidators.entity]));
form.controls['vesselSnapshot'].setValidators([Validators.required, SharedValidators.entity]);
form.controls['saleType'].setValidators([Validators.required, SharedValidators.entity]);
}
else {
form.controls['vesselSnapshot'].setValidators(SharedValidators.entity);
......
......@@ -101,7 +101,7 @@ export class TripValidatorService<O extends TripValidatorOptions = TripValidator
opts = this.fillDefaultOptions(opts);
form.get('returnDateTime').setValidators(opts.isOnFieldMode ? null : Validators.required);
form.get('returnLocation').setValidators(opts.isOnFieldMode ? SharedValidators.entity : Validators.compose([Validators.required, SharedValidators.entity]));
form.get('returnLocation').setValidators(opts.isOnFieldMode ? SharedValidators.entity : [Validators.required, SharedValidators.entity]);
return form;
}
......
......@@ -51,7 +51,7 @@ export class TypedExpenseValidatorService extends MeasurementsValidatorService<M
}
}
if (additionalValidators.length) {
form.setValidators(Validators.compose(this.getDefaultValidators().concat(additionalValidators)));
form.setValidators(this.getDefaultValidators().concat(...additionalValidators));
}
}
......
......@@ -2,7 +2,7 @@
"name": "ADAP",
"short_name": "ADAP",
"manifest_version": 1,
"version": "1.5.2",
"version": "1.5.3",
"default_locale": "fr",
"description": "ADAP App.",
"icons": [{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment