From: Dan Scott <dan@coffeecode.net>
Date: Sun, 8 Apr 2012 19:47:10 +0000 (-0400)
Subject: TPAC: Show deleted record warning for deleted records
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=1406a46bf12b1e9fdce323b917cf52a4296072d0;p=evergreen%2Fmasslnc.git

TPAC: Show deleted record warning for deleted records

At the cost of an extra database query per record displayed, we can
properly activate the "This record has been deleted..." message. Prior
to this commit, the message was embedded on every page but hidden via
CSS - which isn't great for search engines or source-reading types.

Now we only include & display the message if it has, in fact, been
deleted.

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Ben Shum <bshum@biblio.org>
---

diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
index abb8265cc2..9150480ee7 100644
--- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
+++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
@@ -64,6 +64,14 @@ sub load_record {
 
     $self->get_hold_copy_summary($rec_id, $org);
 
+    $self->ctx->{bib_is_dead} = OpenILS::Application::AppUtils->is_true(
+        OpenILS::Utils::CStoreEditor->new->json_query({
+            select => { bre => [ 'deleted' ] },
+            from => 'bre',
+            where => { 'id' => $rec_id }
+        })->[0]->{deleted}
+    );
+
     $cstore->kill_me;
 
     if (
diff --git a/Open-ILS/src/templates/opac/parts/record/body.tt2 b/Open-ILS/src/templates/opac/parts/record/body.tt2
index 9f120c6cc2..0571a72af4 100644
--- a/Open-ILS/src/templates/opac/parts/record/body.tt2
+++ b/Open-ILS/src/templates/opac/parts/record/body.tt2
@@ -43,10 +43,10 @@
         <div class="clear-both"></div>
     </div>
     [% END %]
-
-    <div style='font-weight: bold; padding: 5px; margin: 5px; width: 100%;'
-        class='hide_me color_4' id='rdetail_deleted_exp'>
+    [%- IF ctx.bib_is_dead %]
+    <div id='rdetail_deleted_exp'>
         [% l("This record has been deleted from the database.  We recommend that you remove this title from any bookbags it may have been added to.") %]
     </div>
+    [%- END %]
     [% INCLUDE "opac/parts/record/summary.tt2" %]
 </div>
diff --git a/Open-ILS/web/css/skin/default/opac/style.css b/Open-ILS/web/css/skin/default/opac/style.css
index 62b677fc1c..b5d4387d78 100644
--- a/Open-ILS/web/css/skin/default/opac/style.css
+++ b/Open-ILS/web/css/skin/default/opac/style.css
@@ -1425,3 +1425,9 @@ a.preflib_change {
 .rdetail-holding-group { margin-left: 1.5em; }
 .rdetail-holding-group span { margin-left: 1.5em; }
 .rdetail-holding-group .paging { margin-left: 1.5em; }
+#rdetail_deleted_exp {
+    font-weight: bold;
+    padding: 1em;
+    margin: 1em;
+    border: thick solid red;
+}