Bug 33568: Restore analytics
FIXME We cannot have the usual _count/+count pattern for the REST API, I think it's acceptable FIXME We lost the sort on this column, not a big deal IMO Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Laurence Rault <laurence.rault@biblibre.com> Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
09934c0160
commit
cf9fb86a01
4 changed files with 28 additions and 5 deletions
|
@ -2366,6 +2366,11 @@ sub is_denied_renewal {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub analytics_count {
|
||||||
|
my ($self) = @_;
|
||||||
|
return C4::Items::GetAnalyticsCount($self->itemnumber);
|
||||||
|
}
|
||||||
|
|
||||||
=head3 strings_map
|
=head3 strings_map
|
||||||
|
|
||||||
Returns a map of column name to string representations including the string,
|
Returns a map of column name to string representations including the string,
|
||||||
|
|
|
@ -288,6 +288,10 @@ properties:
|
||||||
type:
|
type:
|
||||||
- object
|
- object
|
||||||
- "null"
|
- "null"
|
||||||
|
analytics_count:
|
||||||
|
type:
|
||||||
|
- integer
|
||||||
|
- "null"
|
||||||
_strings:
|
_strings:
|
||||||
type:
|
type:
|
||||||
- object
|
- object
|
||||||
|
|
|
@ -441,6 +441,7 @@
|
||||||
- bundle_items_lost+count
|
- bundle_items_lost+count
|
||||||
- bundle_items_not_lost+count
|
- bundle_items_not_lost+count
|
||||||
- course_item.course_reserves.course
|
- course_item.course_reserves.course
|
||||||
|
- analytics_count
|
||||||
- cover_image_ids
|
- cover_image_ids
|
||||||
- item_group_item.item_group.description
|
- item_group_item.item_group.description
|
||||||
- serialitem.serial
|
- serialitem.serial
|
||||||
|
|
|
@ -2197,6 +2197,10 @@
|
||||||
// For host records
|
// For host records
|
||||||
embed.push('biblio.title');
|
embed.push('biblio.title');
|
||||||
|
|
||||||
|
[% IF analyze %]
|
||||||
|
embed.push('analytics_count');
|
||||||
|
[% END %]
|
||||||
|
|
||||||
let items_table_settings = {
|
let items_table_settings = {
|
||||||
holdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %],
|
holdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %],
|
||||||
otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %],
|
otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %],
|
||||||
|
@ -2601,13 +2605,22 @@
|
||||||
return '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a>'.format(row.biblio_id, row.biblio.title);
|
return '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a>'.format(row.biblio_id, row.biblio.title);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[% IF ( analyze ) %]
|
[% IF analyze %]
|
||||||
{
|
{
|
||||||
data: "",
|
data: "analytics_count",
|
||||||
searchable: false, // FIXME
|
searchable: false,
|
||||||
orderable: true,
|
orderable: false,
|
||||||
render: function (data, type, row, meta) {
|
render: function (data, type, row, meta) {
|
||||||
return ""; // FIXME Display analytic count + link
|
if (row.analytics_count == 0) return ""
|
||||||
|
return '<a href="/cgi-bin/koha/catalogue/search.pl?idx=hi&q=%s">%s analytics</a>'.format(row.item_id, row.analytics_count);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
data: "analytics_count", // create analytics link
|
||||||
|
searchable: false,
|
||||||
|
orderable: false,
|
||||||
|
render: function (data, type, row, meta) {
|
||||||
|
return '<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=%s&hostitemnumber=%s">Create analytics</a>'.format(row.biblio_id, row.item_id);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
Loading…
Reference in a new issue