Bug 5671 - Add a column of custom HTML to "my summary"
Summary: Add a column of custom HTML to "my summary"
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: unspecified
Hardware: All All
: PATCH-Sent (DO NOT USE) normal (vote)
Deadline: 2011-03-01
Assignee: Magnus Enger
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-31 14:38 UTC by Magnus Enger
Modified: 2019-12-04 20:28 UTC (History)
4 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Screenshot showing the desired functionality (84.40 KB, image/jpeg)
2011-01-31 14:38 UTC, Magnus Enger
Details
Proposed patch (25.42 KB, patch)
2011-03-31 17:15 UTC, Magnus Enger
Details | Diff | Splinter Review
patch removed the tabs from the summary (67.62 KB, image/png)
2011-03-31 17:46 UTC, Nicole C. Engard
Details
Revised patch (24.96 KB, patch)
2011-03-31 19:22 UTC, Magnus Enger
Details | Diff | Splinter Review
This revised patch should fix the problem with missing tabs on My Summary (23.53 KB, patch)
2011-04-04 14:12 UTC, Magnus Enger
Details | Diff | Splinter Review
Fines messed up, Links missing (57.68 KB, image/png)
2011-04-18 19:47 UTC, Magnus Enger
Details
Followup patch, fixing missing Links column (1.45 KB, patch)
2011-04-19 08:33 UTC, Magnus Enger
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2011-01-31 14:38:05 UTC
Created attachment 3040 [details]
Screenshot showing the desired functionality

A client would like to be able to display custom HTML (specifically a link called "Share on Facebook") in a new column on the "my summary" tab in the OPAC. The rationale for this is that the user will be highly motivated to tell others about a book when they are about to renew the loan. 

It should work similar to the current OPACSearchForTitleIn syspref, with placeholders for relevant pieces of information. 

See the wiki for further details: http://wiki.koha-community.org/wiki/Add_a_column_of_custom_HTML_to_%22my_summary%22_RFC

This enhancement is sponsored by The Halland libraries, Sweden.
Comment 1 Nicole C. Engard 2011-01-31 14:44:07 UTC
I love it!! :)
Comment 2 Jane Wagner 2011-03-30 13:34:17 UTC
I think there could be wider application if the variables were available in other places, such as on record display, lists, cart.
Comment 3 Magnus Enger 2011-03-31 17:15:54 UTC Comment hidden (obsolete)
Comment 4 Magnus Enger 2011-03-31 17:22:21 UTC
(In reply to comment #2)
> I think there could be wider application if the variables were available in
> other places, such as on record display, lists, cart.

I agree completely, but do not have the time to do anything about it now. I can imagine a number of sysprefs that would allow libraries to "inject" HTML all over the opac - e.g. in detail view: above the items, below the items, in different spots in the right hand column etc.
Comment 5 Ian Walls 2011-03-31 17:36:52 UTC
The patch attached does not perform the database update on my system; had to remove the escaped single quotes around "my profile"... Also, the actual name of the system preferences, OPACMySummaryHTML, is not what's in the update message:  OPACMyProfileHTML.

The patch applies, but when logging into my account in the OPAC, I find the Checkouts/Overdues/Fines tabs broken.

It may be my data, but {CONTROLNUMBER is not parsed}; it remains {CONTROLNUMBER}
Comment 6 Magnus Enger 2011-03-31 17:46:23 UTC
(In reply to comment #5)
> The patch attached does not perform the database update on my system; had to
> remove the escaped single quotes around "my profile"... Also, the actual name
> of the system preferences, OPACMySummaryHTML, is not what's in the update
> message:  OPACMyProfileHTML.
> 
> The patch applies, but when logging into my account in the OPAC, I find the
> Checkouts/Overdues/Fines tabs broken.
> 
> It may be my data, but {CONTROLNUMBER is not parsed}; it remains
> {CONTROLNUMBER}

Thanks for testing, Ian. I definitely messed some things up. Revised patch coming!
Comment 7 Nicole C. Engard 2011-03-31 17:46:46 UTC
Created attachment 3582 [details]
patch removed the tabs from the summary

It looks like applying this patch removes the tabs from the summary page
Comment 8 Nicole C. Engard 2011-03-31 17:49:59 UTC
What is 'controlnumber'?

I thought it would be the bib number so I tried to create a twitter link (http://twitter.com/about/resources/tweetbutton) and on the page it appeared like this:

http://twitter.com/share?_=1301593733583&count=vertical&text=Nicole%27s%20Library%20Catalog%20%E2%80%BA%20Library%20Home%20for%20Nicole%20Engard&url=http%3A%2F%2Flocalhost-opac%3A8000%2Fcgi-bin%2Fkoha%2Fopac-detail.pl%3Fbiblionumber%3D%7BCONTROLNUMBER%7D


Note the controlnumber text in there.
Comment 9 Nicole C. Engard 2011-03-31 17:54:26 UTC
fyi i'm using FF4
Comment 10 Magnus Enger 2011-03-31 19:22:49 UTC Comment hidden (obsolete)
Comment 11 Magnus Enger 2011-03-31 19:26:12 UTC
(In reply to comment #10)
> Created attachment 3583 [details] [review]
> Revised patch

I have looked for the broken tabs in FF 3.6 on Linux and Windows, and FF4 on Mac OS X, but have not been able to reproduce them, either with the the first or the second patch. Will look into that further later.
Comment 12 MJ Ray (software.coop) 2011-04-01 09:42:31 UTC
This bug is mentioned in:
Bug 5671 - Add a column of custom HTML to my	summary http://lists.koha-community.org/pipermail/koha-patches/2011-March/014405.html
Bug 5671 - Revised Patch - Add a column of	custom HTML to my summary http://lists.koha-community.org/pipermail/koha-patches/2011-March/014407.html
Comment 13 claire.hernandez@biblibre.com 2011-04-04 13:53:13 UTC
What I did:
- git am the patch
- resolved conflicts with updatedatabase version (and kohaversion)
- add a content syspref with TITLE, AUTHOR, ISBN and BIBLIONUMBER
- connect in opac with a used and see checkout in "my summary" tab

I saw what I put in syspref with good data in Chrome 10.0.6 and FFx 3.6.15 under Linux system without removing tabs display on the left. Seems ok for me.
Comment 14 Magnus Enger 2011-04-04 14:12:32 UTC
Created attachment 3630 [details] [review]
This revised patch should fix the problem with missing tabs on My Summary

There was a JavaScript error that was causing the tabs on "my summary" to (sometimes?) disappear. This revised patch should fix the JS error and restor the tabs.
Comment 15 Chris Cormack 2011-04-09 07:24:05 UTC
Pushed, please test
Comment 16 Nicole C. Engard 2011-04-18 16:43:34 UTC
I can't seem to get this working since switching to Template Toolkit ... can anyone fix or confirm?

I'm on Mac and FF4
Comment 17 Magnus Enger 2011-04-18 19:47:40 UTC
Created attachment 3948 [details]
Fines messed up, Links missing

I'm probably seeing the same as Nicole, see the attached screenshot from FF4 on Mac. Same thing in Safari on Mac. The fines column is messed up and Links are missing. The contents of OPACMySummaryHTML does not seem to affect this, however.
Comment 18 Magnus Enger 2011-04-18 20:20:16 UTC
I see a couple of problems: 

In koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tt, *html should be *HTML:  

266 [% IF ( OPACMySummaryhtml ) %]
267    <td>[% MySummaryhtml %]</td>
268 [% END %]

In opac/opac-user.pl, normalized_isbn and MySummaryHTML are both added to $issue after it has been pushed onto @issuedat, which is what gets assigned to the ISSUES template variable: 

161 $issue->{date_due} = format_date($issue->{date_due});
162 push @issuedat, $issue;
163 $count++;
164                 
165 my $isbn = GetNormalizedISBN($issue->{'isbn'});
166 $issue->{normalized_isbn} = $isbn;
167 
168 # My Summary HTML
169 if (my $my_summary_html = C4::Context->preference('OPACMySummaryHTML')){
...
176     $issue->{MySummaryHTML} = $my_summary_html;
...
180 $template->param( ISSUES       => \@issuedat );

But fixing both of these does not fix the "My Summary" page... Will look some more tomorrow...
Comment 19 Magnus Enger 2011-04-19 08:33:19 UTC
Created attachment 3949 [details] [review]
Followup patch, fixing missing Links column

The missing fines was due to me testing on an installation with not-quite-uptodate Norwegian templates, when I switched to English they showed just fine. 

The missing Links were due to OPACMySummaryHTML/MySummaryHTML being spelled as OPACMySummaryhtml/MySummaryhtml, and MySummaryHTML not being tied to issues with ISSUE.MySummaryHTML.
Comment 20 Chris Cormack 2011-04-20 00:01:45 UTC
Follow up patch pushed please test
Comment 21 Viktor Sarge 2011-06-07 12:32:47 UTC
(In reply to comment #20)
> Follow up patch pushed please test

Works fine for me.