From 00429a1f4f24a6e1852c9665d30cea22fee36aaa Mon Sep 17 00:00:00 2001 From: Dan Briem Date: Fri, 28 May 2021 11:57:07 -0400 Subject: [PATCH] LP#1929587 Place hold button in staff client This disables and re-styles the place hold button on search results and record pages if the record is deleted or doesn't have any holdable copies. This is similar to the OPAC, except the OPAC hides the button, while this disables and greys out the button. To test: * Search for records without any copies * Search for records without holdable copies * If using concerto data, a keyword search for map will give you a mix of records with or without copies Signed-off-by: Dan Briem Signed-off-by: Terran McCanna --- .../src/eg2/src/app/share/catalog/bib-record.service.ts | 5 +++++ .../src/app/staff/catalog/record/actions.component.html | 6 +++++- .../src/app/staff/catalog/record/actions.component.ts | 2 ++ .../src/app/staff/catalog/record/record.component.html | 1 + .../src/app/staff/catalog/result/record.component.html | 17 ++++++++--------- .../perlmods/lib/OpenILS/Application/Search/Biblio.pm | 8 ++++++++ 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts index ce352c7868..7c41cf5a35 100644 --- a/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts +++ b/Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts @@ -38,6 +38,7 @@ export class BibRecordSummary { net: NetService; displayHighlights: {[name: string]: string | string[]} = {}; eResourceUrls: EResourceUrl[] = []; + isHoldable: boolean; constructor(record: IdlObject, orgId: number, orgDepth?: number) { this.id = Number(record.id()); @@ -113,6 +114,8 @@ export class BibRecordService { summary.holdCount = bibSummary.hold_count; summary.holdingsSummary = bibSummary.copy_counts; summary.eResourceUrls = bibSummary.urls; + summary.isHoldable = bibSummary.record.deleted() == 'f' + && bibSummary.has_holdable_copy; return summary; })); } @@ -136,6 +139,8 @@ export class BibRecordService { summary.attributes = metabibSummary.attributes; summary.holdCount = metabibSummary.hold_count; summary.holdingsSummary = metabibSummary.copy_counts; + summary.isHoldable = metabibSummary.record.deleted() == 'f' + && metabibSummary.has_holdable_copy; return summary; })); } diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html b/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html index 9a64f73fad..a8d3e45578 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html +++ b/Open-ILS/src/eg2/src/app/staff/catalog/record/actions.component.html @@ -15,9 +15,13 @@
- + + - - + + +
diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index 5aec63549d..77464edaef 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -3075,6 +3075,12 @@ sub catalog_record_summary { $copy_method = $self->method_lookup($copy_method); # local method + my $holdable_method = $is_meta ? + 'open-ils.search.biblio.metarecord.has_holdable_copy': + 'open-ils.search.biblio.record.has_holdable_copy'; + + $holdable_method = $self->method_lookup($holdable_method); # local method + for my $rec_id (@$record_ids) { my $response = $is_meta ? @@ -3086,6 +3092,8 @@ sub catalog_record_summary { $response->{hold_count} = $U->simplereq('open-ils.circ', $holds_method, $rec_id); + ($response->{has_holdable_copy}) = $holdable_method->run($rec_id); + $client->respond($response); } -- 2.11.0