<ng-container *ngIf="copyIdx === 0">
<input class="form-control form-control-sm" type="text"
spellcheck="false"
- [required]="true"
- [ngClass]="{invalid: !volNode.target.label()}"
+ [required]="requireCNL"
+ [ngClass]="{invalid: !volNode.target.label() && requireCNL}"
[ngModel]="volNode.target.label()"
(change)="applyVolValue(volNode.target, 'label', $event.target.value)">
</ng-container>
deleteVolCount: number = null;
deleteCopyCount: number = null;
+ // Set default for Call Number Label requirement
+ requireCNL = true;
+
// When adding multiple vols via add-many popover.
addVolCount: number = null;
// It's possible the loaded data is not strictly allowed,
// e.g. empty string call number labels
.then(_ => this.emitSaveChange(true));
+
+ // Check to see if call number label is required
+ this.org.settings('cat.require_call_number_labels')
+ .then(settings => {this.requireCNL =
+ Boolean(settings['cat.require_call_number_labels']);
+ });
}
copyStatLabel(copy: IdlObject): string {
const badVols = this.context.volNodes().filter(volNode => {
const vol = volNode.target;
- return !(
- vol.prefix() && vol.label() && vol.suffix && vol.label_class()
- );
+
+ // If call number label is not required, then require prefix
+ if (!vol.label()) {
+ if (this.requireCNL == true) {
+ return !(
+ vol.label()
+ );
+ } else {
+ return (
+ vol.prefix() < 0
+ );
+ }
+ }
}).length > 0;
return !badVols;
);
my $label = undef;
+ my $labelexists = undef;
if(@$vols) {
# we've found an exising volume
if($override->{all} || grep { $_ eq 'VOLUME_LABEL_EXISTS' } @{$override->{events}}) {
$label = $vol->label;
+ $labelexists = 1;
} else {
return (
undef,
# create a temp label so we can create the new volume,
# then de-dup it with the existing volume
- $vol->label( "__SYSTEM_TMP_$$".time) if $label;
+ $vol->label( "__SYSTEM_TMP_$$".time) if $labelexists;
$vol->creator($editor->requestor->id);
$vol->create_date('now');
$editor->create_asset_call_number($vol) or return (undef, $editor->die_event);
- if($label) {
+ if($labelexists) {
# now restore the label and merge into the existing record
$vol->label($label);
return OpenILS::Application::Cat::Merge::merge_volumes($editor, [$vol], $$vols[0]);
$scope.prefix = $scope.callNumber.prefix();
$scope.suffix = $scope.callNumber.suffix();
$scope.classification = $scope.callNumber.label_class();
+
+ // If no call number label, set to empty string to avoid merging problem
+ if ($scope.callNumber.label() == null) {
+ $scope.callNumber.label('');
+ }
$scope.label = $scope.callNumber.label();
$scope.copy_count = $scope.copies.length;