Fix: get highest ASN regardless of user (#4326)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Component, forwardRef, Input } from '@angular/core'
|
||||
import { NG_VALUE_ACCESSOR } from '@angular/forms'
|
||||
import { FILTER_ASN_ISNULL } from 'src/app/data/filter-rule-type'
|
||||
import { DocumentService } from 'src/app/services/rest/document.service'
|
||||
import { AbstractInputComponent } from '../abstract-input'
|
||||
|
||||
@@ -28,17 +27,9 @@ export class NumberComponent extends AbstractInputComponent<number> {
|
||||
if (this.value) {
|
||||
return
|
||||
}
|
||||
this.documentService
|
||||
.listFiltered(1, 1, 'archive_serial_number', true, [
|
||||
{ rule_type: FILTER_ASN_ISNULL, value: 'false' },
|
||||
])
|
||||
.subscribe((results) => {
|
||||
if (results.count > 0) {
|
||||
this.value = results.results[0].archive_serial_number + 1
|
||||
} else {
|
||||
this.value = 1
|
||||
}
|
||||
this.onChange(this.value)
|
||||
})
|
||||
this.documentService.getNextAsn().subscribe((nextAsn) => {
|
||||
this.value = nextAsn
|
||||
this.onChange(this.value)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user