diff --git a/projects/admin/src/app/circulation/checkin/checkin.component.ts b/projects/admin/src/app/circulation/checkin/checkin.component.ts
index 4fc77870c..a7b533d59 100644
--- a/projects/admin/src/app/circulation/checkin/checkin.component.ts
+++ b/projects/admin/src/app/circulation/checkin/checkin.component.ts
@@ -127,7 +127,7 @@ export class CheckinComponent implements OnInit {
);
break;
case ItemAction.checkin:
- this._displayCirculationNote(item, ItemNoteType.CHECKIN);
+ this.displayCirculationInformation(item, ItemNoteType.CHECKIN);
if (item.action_applied && item.action_applied.checkin) {
this.getPatronInfo(item.action_applied.checkin.patron.barcode);
}
@@ -140,7 +140,7 @@ export class CheckinComponent implements OnInit {
break;
case ItemAction.receive:
if (item.library.pid === this.userService.user.currentLibrary) {
- this._displayCirculationNote(item, ItemNoteType.CHECKIN);
+ this.displayCirculationInformation(item, ItemNoteType.CHECKIN);
}
break;
}
@@ -266,17 +266,32 @@ export class CheckinComponent implements OnInit {
);
}
- /** display a circulation note about an item as a permanent toastr message
- *
+ /** display a circulation infos about an item as a permanent toastr message
* @param item: the item
* @param noteType: the note type to display
*/
- private _displayCirculationNote(item: Item, noteType: ItemNoteType): void {
+ private displayCirculationInformation(item: Item, noteType: ItemNoteType): void {
+ let message = [];
const note = item.getNote(noteType);
if (note != null) {
+ message.push(note.content);
+ }
+ // Show additional message only for the owning library
+ if (item.library.pid === this.userService.user.currentLibrary) {
+ const additionalMessage = this.displayCollectionsAndTemporaryLocation(item);
+ if (additionalMessage.length > 0) {
+ if (message.length > 0) {
+ message.push('
');
+ }
+ message.push(additionalMessage);
+ }
+ }
+ if (message.length > 0) {
this.toastService.warning(
- note.content, null,
+ message.join(),
+ this.translate.instant('Checkin'),
{
+ enableHtml: true,
closeButton: true, // add a close button to the toastr message
disableTimeOut: true, // permanent toastr message (until click on 'close' button)
tapToDismiss: false // toastr message only close when click on the 'close' button.
@@ -306,14 +321,42 @@ export class CheckinComponent implements OnInit {
if (checkinNote) {
message += `
${this.translate.instant('Note')}: ${checkinNote.content}`
}
+ // Show additional message only for the owning library
+ if (item.library.pid === this.userService.user.currentLibrary) {
+ const additionalMessage = this.displayCollectionsAndTemporaryLocation(item);
+ if (additionalMessage.length > 0) {
+ message += `
${additionalMessage}`;
+ }
+ }
this.toastService.warning(
- this.translate.instant(message),
+ message,
this.translate.instant('Checkin'),
- { enableHtml: true }
+ {
+ enableHtml: true,
+ closeButton: true,
+ disableTimeOut: true,
+ tapToDismiss: false
+ }
);
this._resetSearchInput();
}
+ private displayCollectionsAndTemporaryLocation(item: Item): string {
+ let message = [];
+ if (item.collections && item.collections.length > 0) {
+ message.push(`${this.translate.instant('This item is in exhibition/course')} "${item.collections[0]}"`);
+ if (item.collections.length > 1) {
+ message.push(` ${this.translate.instant('and {{ count }} other(s)', { count: item.collections.length - 1 })}`);
+ }
+ message.push('.');
+ }
+ if (item.temporary_location) {
+ message.push(`
${this.translate.instant('This item is in temporary location')} "${item.temporary_location.name}".`);
+ }
+
+ return message.join('');
+ }
+
hasFees(event: boolean) {
if (event) {
this.toastService.error(
diff --git a/projects/admin/src/app/circulation/item/item.component.html b/projects/admin/src/app/circulation/item/item.component.html
index 57580fcd9..39686533d 100644
--- a/projects/admin/src/app/circulation/item/item.component.html
+++ b/projects/admin/src/app/circulation/item/item.component.html
@@ -184,6 +184,18 @@
{{ $any(location).metadata.name }}
}
+ @if (item.temporary_location) {
+
Temporary location
+
+ {{ item.temporary_location.name }}
+
+ }
+ @if (item.collections && item.collections.length > 0) {
+ Collection
+
+ {{ item.collections.join(', ') }}
+
+ }
@if (item.loan && item.loan.extension_count) {
Renewals
diff --git a/projects/admin/src/app/circulation/patron/loan/loan.component.ts b/projects/admin/src/app/circulation/patron/loan/loan.component.ts
index 08059f0af..5ad40a769 100644
--- a/projects/admin/src/app/circulation/patron/loan/loan.component.ts
+++ b/projects/admin/src/app/circulation/patron/loan/loan.component.ts
@@ -285,7 +285,7 @@ export class LoanComponent implements OnInit, OnDestroy {
newItems.map((newItem: Item) => {
switch (newItem.actionDone) {
case ItemAction.checkin: {
- this._displayCirculationNote(newItem, ItemNoteType.CHECKIN);
+ this.displayCirculationInformation(ItemAction.checkin, newItem, ItemNoteType.CHECKIN);
this.checkedOutItems = this.checkedOutItems.filter(currItem => currItem.pid !== newItem.pid);
this.checkedInItems.unshift(newItem);
// display a toast message if the item goes in transit...
@@ -302,7 +302,7 @@ export class LoanComponent implements OnInit, OnDestroy {
}
case ItemAction.checkout: {
this._displayTransactionEndDateChanged(newItem);
- this._displayCirculationNote(newItem, ItemNoteType.CHECKOUT);
+ this.displayCirculationInformation(ItemAction.checkout, newItem, ItemNoteType.CHECKOUT);
this.checkedOutItems.unshift(newItem);
this.checkedInItems = this.checkedInItems.filter(currItem => currItem.pid !== newItem.pid);
this.circulationService.incrementCirculationStatistic('loans');
@@ -357,15 +357,32 @@ export class LoanComponent implements OnInit, OnDestroy {
/**
* display a circulation note about an item as a permanent toastr message
+ * @param action: the current action
* @param item: the item
* @param noteType: the note type to display
*/
- private _displayCirculationNote(item: Item, noteType: ItemNoteType): void {
+ private displayCirculationInformation(action: string, item: Item, noteType: ItemNoteType): void {
+ let message = [];
const note = item.getNote(noteType);
if (note != null) {
+ message.push(note.content);
+ }
+ // Show additional message only for the owning library
+ if (action === ItemAction.checkin && (item.library.pid === this.userService.user.currentLibrary)) {
+ const additionalMessage = this.displayCollectionsAndTemporaryLocation(item);
+ if (additionalMessage.length > 0) {
+ if (message.length > 0) {
+ message.push('
');
+ }
+ message.push(additionalMessage);
+ }
+ }
+ if (message.length > 0) {
this.toastService.warning(
- note.content, null,
+ message.join(),
+ this.translateService.instant('Checkin'),
{
+ enableHtml: true,
closeButton: true, // add a close button to the toastr message
disableTimeOut: true, // permanent toastr message (until click on 'close' button)
tapToDismiss: false // toastr message only close when click on the 'close' button.
@@ -374,6 +391,22 @@ export class LoanComponent implements OnInit, OnDestroy {
}
}
+ private displayCollectionsAndTemporaryLocation(item: Item): string {
+ let message = [];
+ if (item.collections && item.collections.length > 0) {
+ message.push(`${this.translateService.instant('This item is in exhibition/course')} "${item.collections[0]}"`);
+ if (item.collections.length > 1) {
+ message.push(` ${this.translateService.instant('and {{ count }} other(s)', {count: item.collections.length - 1 })}`);
+ }
+ message.push('.');
+ }
+ if (item.temporary_location) {
+ message.push(`
${this.translateService.instant('This item is in temporary location')} "${item.temporary_location.name}".`);
+ }
+
+ return message.join('');
+ }
+
/**
* Display a warning toastr message if transaction end_date is not the same as the user selected end_date.
* The backend will check if the selected end_date is an opening day ; if not then it will automatically
diff --git a/projects/admin/src/app/classes/items.ts b/projects/admin/src/app/classes/items.ts
index 6a61f65f6..4df5cbaf0 100644
--- a/projects/admin/src/app/classes/items.ts
+++ b/projects/admin/src/app/classes/items.ts
@@ -81,6 +81,7 @@ export class Item {
available: boolean;
barcode: string;
call_number: string;
+ collections?: string[];
document: any;
status: ItemStatus;
organisation: Organisation;
@@ -99,6 +100,7 @@ export class Item {
notes: ItemNote[];
acquisition_date: Moment;
enumerationAndChronology: string;
+ temporary_location?: any;
constructor(obj?: any) {
diff --git a/projects/admin/src/app/record/brief-view/collection-brief-view.component.ts b/projects/admin/src/app/record/brief-view/collection-brief-view.component.ts
index 83542003e..088fc7717 100644
--- a/projects/admin/src/app/record/brief-view/collection-brief-view.component.ts
+++ b/projects/admin/src/app/record/brief-view/collection-brief-view.component.ts
@@ -24,7 +24,9 @@ import { ResultItem } from '@rero/ng-core';
{{ record.metadata.title }}
- ({{ record.metadata.collection_id }})
+ @if (record.metadata.collection_id) {
+ ({{ record.metadata.collection_id }})
+ }
@if (record.metadata.teachers) {
diff --git a/projects/public-search/src/app/collection-brief/collection-brief.component.html b/projects/public-search/src/app/collection-brief/collection-brief.component.html
index ca7bbea4c..b59700644 100644
--- a/projects/public-search/src/app/collection-brief/collection-brief.component.html
+++ b/projects/public-search/src/app/collection-brief/collection-brief.component.html
@@ -18,7 +18,9 @@
@if (record) {
{{ record.metadata.title }}
- ({{ record.metadata.collection_id }})
+ @if (record.metadata.collection_id) {
+ ({{ record.metadata.collection_id }})
+ }
@if (record.metadata.teachers) {