Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not use the ISBNs validator #2100

Merged
merged 5 commits into from
Nov 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import { SnackbarService } from 'src/app/cdk/snackbar/snackbar.service'
import { WorkIdentifiers } from 'src/app/shared/validators/work-identifiers/work-identifiers.validator'
import { workCitationValidator } from 'src/app/shared/validators/citation/work-citation.validator'
import { translatedTitleValidator } from 'src/app/shared/validators/translated-title/translated-title.validator'
import { merge, Subject } from 'rxjs'
import { merge, Subject, of } from 'rxjs'
import { RecordService } from 'src/app/core/record/record.service'

@Component({
Expand Down Expand Up @@ -266,8 +266,15 @@ export class WorkFormComponent implements OnInit {
formGroup: UntypedFormGroup,
externalIdentifierType: string
): AsyncValidatorFn {
return (control: AbstractControl) => {
return this._workService
return (control: AbstractControl) => {
if(externalIdentifierType === 'isbn') {
if(!(control.value?.length === 10 || control.value?.length === 13)) {
return of({ validFormat: true, })
} else {
return of({})
}
} else {
return this._workService
.validateWorkIdTypes(externalIdentifierType, control.value)
.pipe(
map((value) => {
Expand Down Expand Up @@ -312,6 +319,7 @@ export class WorkFormComponent implements OnInit {
}
})
)
}
}
}

Expand Down