|
Lines 42-48
Link Here
|
| 42 |
[% IF Koha.Preference('EasyAnalyticalRecords') %]<th id="[% tab | html %]_hostrecord" data-colname="hostrecord">Host records</th>[% END %] |
42 |
[% IF Koha.Preference('EasyAnalyticalRecords') %]<th id="[% tab | html %]_hostrecord" data-colname="hostrecord">Host records</th>[% END %] |
| 43 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="usedin">Used in</th><th></th>[% END %] |
43 |
[% IF ( analyze ) %]<th id="[% tab | html %]_usedin" data-colname="usedin">Used in</th><th></th>[% END %] |
| 44 |
[% IF Koha.Preference('UseCourseReserves') %]<th id="[% tab | html %]_course_reserves" data-colname="course_reserves">Course reserves</th>[% END %] |
44 |
[% IF Koha.Preference('UseCourseReserves') %]<th id="[% tab | html %]_course_reserves" data-colname="course_reserves">Course reserves</th>[% END %] |
| 45 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %]<th id="[% tab | html %]_spinelabel" data-colname="spinelabel" class="no-sort">Spine label</th>[% END %] |
45 |
[% IF Koha.Preference('SpineLabelShowPrintOnBibDetails') %]<th id="[% tab | html %]_spinelabel" data-colname="spinelabel" class="no-sort">Spine label</th>[% END %] |
| 46 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="actions" class="no-sort no-export"> </th>[% END %] |
46 |
[% IF ( CAN_user_editcatalogue_edit_items ) %]<th id="[% tab | html %]_actions" data-colname="actions" class="no-sort no-export"> </th>[% END %] |
| 47 |
</tr> |
47 |
</tr> |
| 48 |
</thead> |
48 |
</thead> |
|
Lines 95-101
Link Here
|
| 95 |
[% BLOCK build_items_table_js %] |
95 |
[% BLOCK build_items_table_js %] |
| 96 |
<script> |
96 |
<script> |
| 97 |
let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %]; |
97 |
let hide_patron_name = [% IF Koha.Preference('HidePatronName') %]true[% ELSE %]false[% END %]; |
|
|
98 |
const all_libraries = [% To.json(Branches.all) | $raw %].map(e => { |
| 99 |
e["_id"] = e["branchcode"]; |
| 100 |
e["_str"] = e["branchname"]; |
| 101 |
return e; |
| 102 |
}); |
| 103 |
const libraries_names = new Map(all_libraries.map( l => [l.branchcode, l.branchname] )); |
| 104 |
const all_item_types = [% To.json(ItemTypes.Get) | $raw %].map(e => { |
| 105 |
e["_id"] = e["itemtype"]; |
| 106 |
e["_str"] = e["translated_description"]; |
| 107 |
return e; |
| 108 |
}); |
| 109 |
const item_types_notforloan = new Map(all_item_types.map( it => [it.itemtype, it.notforloan] )); |
| 110 |
|
| 111 |
const can_edit_items_from = [% To.json(can_edit_items_from || []) | $raw %]; |
| 112 |
const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %]; |
| 113 |
const av_loc = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.location' })) | $raw %].map( av => [av.lib, av.authorised_value])); |
| 114 |
const av_lost = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.itemlost' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 115 |
const av_withdrawn = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.withdrawn' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 116 |
const av_damaged = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.damaged' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 117 |
const av_not_for_loan= new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.notforloan' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 118 |
const av_restricted = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.restricted' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 119 |
[% IF Koha.Preference('UseCourseReserves') %] |
| 120 |
const av_courses_term = new Map([% To.json(AuthorisedValues.Get('TERM')) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 121 |
[% END %] |
| 122 |
const av_ccode = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.ccode' })) | $raw %].map( av => [av.lib, av.authorised_value])); |
| 123 |
|
| 124 |
[% IF Koha.Preference('URLLinkText') %] |
| 125 |
const url_link_text = "[% Koha.Preference('URLLinkText') | html %]"; |
| 126 |
[% ELSE %] |
| 127 |
const url_link_text = _("Link to resource"); |
| 128 |
[% END %] |
| 98 |
|
129 |
|
|
|
130 |
var biblionumber = [% biblio.biblionumber | html %]; |
| 131 |
const is_serial = [% biblio.serial ? 1 : 0 | html %]; |
| 132 |
const analyze = [% analyze ? 1 : 0 | html %]; |
| 133 |
const hidden_count = [% hidden_count ? 1 : 0 | html %]; |
| 134 |
const bundlesEnabled = [% bundlesEnabled ? 1 : 0 | html %]; |
| 135 |
addPrefs({ |
| 136 |
LocalCoverImages: [% Koha.Preference('LocalCoverImages') ? 1 : 0 | html %], |
| 137 |
OPACLocalCoverImages: [% Koha.Preference('OPACLocalCoverImages') ? 1 : 0 | html %], |
| 138 |
EnableItemGroups: [% Koha.Preference('EnableItemGroups') ? 1 : 0 | html %], |
| 139 |
UseRecalls: [% Koha.Preference('UseRecalls') ? 1 : 0 | html %], |
| 140 |
UseCourseReserves: [% Koha.Preference('UseCourseReserves') ? 1 : 0 | html %], |
| 141 |
ClaimReturnedLostValue: [% Koha.Preference('ClaimReturnedLostValue') | html %], |
| 142 |
EasyAnalyticalRecords: [% Koha.Preference('EasyAnalyticalRecords') ? 1 : 0| html %], |
| 143 |
SeparateHoldings: [% Koha.Preference('SeparateHoldings') ? 1 : 0 | html %], |
| 144 |
SeparateHoldingsBranch: "[% Koha.Preference('SeparateHoldingsBranch') || 'homebranch' | html %]", |
| 145 |
item_level_itypes: [% item_level_itypes ? 1 : 0 | html %], |
| 146 |
noItemTypeImages: [% Koha.Preference('noItemTypeImages') ? 1 : 0 | html %], |
| 147 |
DisplayPublishedDate: [% Koha.Preference('DisplayPublishedDate') ? 1 : 0 | html %], |
| 148 |
canreservefromotherbranches: [% Koha.Preference('canreservefromotherbranches') ? 1 : 0 | html %], |
| 149 |
SpineLabelShowPrintOnBibDetails: [% Koha.Preference('SpineLabelShowPrintOnBibDetails') ? 1 : 0 | html %], |
| 150 |
}); |
| 151 |
addPermissions({ |
| 152 |
CAN_user_editcatalogue_edit_items: [% CAN_user_editcatalogue_edit_items ? 1 : 0 | html %], |
| 153 |
}); |
| 154 |
const logged_in_branchcode = '[% Branches.GetLoggedInBranchcode() | html %]'; |
| 155 |
|
| 156 |
var items_table_settings = { |
| 157 |
holdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], |
| 158 |
otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %], |
| 159 |
}; |
| 160 |
|
| 161 |
let table_nodes = { |
| 162 |
holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]", |
| 163 |
otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", |
| 164 |
}; |
| 165 |
|
| 166 |
</script> |
| 167 |
|
| 168 |
<script> |
| 99 |
let items_selection = {}; |
169 |
let items_selection = {}; |
| 100 |
|
170 |
|
| 101 |
function _itemSelectionBuildLink(tab_id, link_class) { |
171 |
function _itemSelectionBuildLink(tab_id, link_class) { |
|
Lines 205-243
Link Here
|
| 205 |
}); |
275 |
}); |
| 206 |
}); |
276 |
}); |
| 207 |
|
277 |
|
| 208 |
const all_libraries = [% To.json(Branches.all) | $raw %].map(e => { |
|
|
| 209 |
e["_id"] = e["branchcode"]; |
| 210 |
e["_str"] = e["branchname"]; |
| 211 |
return e; |
| 212 |
}); |
| 213 |
const libraries_names = new Map(all_libraries.map( l => [l.branchcode, l.branchname] )); |
| 214 |
const all_item_types = [% To.json(ItemTypes.Get) | $raw %].map(e => { |
| 215 |
e["_id"] = e["itemtype"]; |
| 216 |
e["_str"] = e["translated_description"]; |
| 217 |
return e; |
| 218 |
}); |
| 219 |
const item_types_notforloan = new Map(all_item_types.map( it => [it.itemtype, it.notforloan] )); |
| 220 |
|
| 221 |
const statuses = {checked_out: _("Checked out"), local_use: _("On-site checkout"), in_transit: _("In transit"), lost: _("Lost"), withdrawn: _("Withdrawn"), damaged:_("Damaged"), not_for_loan: _("Not for loan"), on_hold: _("On hold"), recalled: _("Recalled"), available: _("Available"), restricted: _("Restricted"), in_bundle: _("In bundle")}; |
278 |
const statuses = {checked_out: _("Checked out"), local_use: _("On-site checkout"), in_transit: _("In transit"), lost: _("Lost"), withdrawn: _("Withdrawn"), damaged:_("Damaged"), not_for_loan: _("Not for loan"), on_hold: _("On hold"), recalled: _("Recalled"), available: _("Available"), restricted: _("Restricted"), in_bundle: _("In bundle")}; |
| 222 |
const all_statuses = Object.keys(statuses).map(k => {return {_id: k, _str: statuses[k]}}); |
279 |
const all_statuses = Object.keys(statuses).map(k => {return {_id: k, _str: statuses[k]}}); |
| 223 |
|
280 |
|
| 224 |
const can_edit_items_from = [% To.json(can_edit_items_from || []) | $raw %]; |
|
|
| 225 |
const item_type_image_locations = [% To.json(item_type_image_locations) | $raw %]; |
| 226 |
const av_loc = new Map([% To.json(AuthorisedValues.Get('LOC')) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 227 |
const av_lost = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.itemlost' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 228 |
const av_withdrawn = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.withdrawn' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 229 |
const av_damaged = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.damaged' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 230 |
const av_not_for_loan= new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.notforloan' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 231 |
const av_restricted = new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.restricted' })) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 232 |
[% IF Koha.Preference('UseCourseReserves') %] |
| 233 |
const av_courses_term = new Map([% To.json(AuthorisedValues.Get('TERM')) | $raw %].map( av => [av.authorised_value, av.lib])); |
| 234 |
[% END %] |
| 235 |
|
| 236 |
var coded_values = { |
281 |
var coded_values = { |
| 237 |
library: new Map(all_libraries.map( l => [l.branchname, l.branchcode] )), |
282 |
library: new Map(all_libraries.map( l => [l.branchname, l.branchcode] )), |
| 238 |
item_type: new Map(all_item_types.map( i => [i.translated_description, i.itemtype] )), |
283 |
item_type: new Map(all_item_types.map( i => [i.translated_description, i.itemtype] )), |
| 239 |
collection_code: new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.ccode' })) | $raw %].map( av => [av.lib, av.authorised_value])), |
284 |
collection_code: av_ccode, |
| 240 |
location: new Map([% To.json(AuthorisedValues.GetDescriptionsByKohaField({ kohafield => 'items.location' })) | $raw %].map( av => [av.lib, av.authorised_value])), |
285 |
location: av_loc, |
| 241 |
}; |
286 |
}; |
| 242 |
|
287 |
|
| 243 |
let filters_options = { |
288 |
let filters_options = { |
|
Lines 247-301
Link Here
|
| 247 |
statuses: all_statuses, |
292 |
statuses: all_statuses, |
| 248 |
}; |
293 |
}; |
| 249 |
|
294 |
|
| 250 |
[% IF Koha.Preference('URLLinkText') %] |
295 |
// FIXME The X-Base-Total-Count will be the number of items of the biblios |
| 251 |
const url_link_text = "[% Koha.Preference('URLLinkText') | html %]"; |
296 |
// In case or SeparateHoldings we may need to display the number of biblios in each tab |
| 252 |
[% ELSE %] |
297 |
// Do we need separate/new endpoints or do we hack the somewhere client-side? |
| 253 |
const url_link_text = _("Link to resource"); |
298 |
let item_table_url = `/api/v1/biblios/${biblionumber}/items?`; |
| 254 |
[% END %] |
|
|
| 255 |
[%# FIXME The X-Base-Total-Count will be the number of items of the biblios %] |
| 256 |
[%# In case or SeparateHoldings we may need to display the number of biblios in each tab %] |
| 257 |
[%# Do we need separate/new endpoints or do we hack the somewhere client-side? %] |
| 258 |
let item_table_url = "/api/v1/biblios/[% biblio.biblionumber | uri %]/items?"; |
| 259 |
let embed = ["+strings,_status,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
299 |
let embed = ["+strings,_status,home_library,holding_library,checkout,checkout.patron,transfer,transfer+strings,first_hold,first_hold+strings,first_hold.patron,first_hold.desk"]; |
| 260 |
[% IF Koha.Preference('LocalCoverImages') %] |
300 |
if (prefs.LocalCoverImages){ |
| 261 |
embed.push('cover_image_ids'); |
301 |
embed.push('cover_image_ids'); |
| 262 |
[% END %] |
302 |
} |
| 263 |
[% IF Koha.Preference('EnableItemGroups') %] |
303 |
if (prefs.EnableItemGroups){ |
| 264 |
embed.push('item_group_item.item_group.description'); |
304 |
embed.push('item_group_item.item_group.description'); |
| 265 |
[% END %] |
305 |
} |
| 266 |
[% IF biblio.serial %] |
306 |
if (is_serial){ |
| 267 |
embed.push('serial_item.serial'); |
307 |
embed.push('serial_item.serial'); |
| 268 |
[% END %] |
308 |
} |
| 269 |
[% IF Koha.Preference('UseRecalls') %] |
309 |
if (prefs.UseRecalls){ |
| 270 |
embed.push('recall', 'recall+strings', 'recall.patron') |
310 |
embed.push('recall', 'recall+strings', 'recall.patron') |
| 271 |
[% END %] |
311 |
} |
| 272 |
embed.push('in_bundle', 'bundle_host', 'bundle_host.biblio', 'bundle_items_lost+count', 'bundle_items_not_lost+count'); |
312 |
embed.push('in_bundle', 'bundle_host', 'bundle_host.biblio', 'bundle_items_lost+count', 'bundle_items_not_lost+count'); |
| 273 |
[% IF Koha.Preference('UseCourseReserves') %] |
313 |
if (prefs.UseCourseReserves){ |
| 274 |
embed.push('course_item.course_reserves.course'); |
314 |
embed.push('course_item.course_reserves.course'); |
| 275 |
[% END %] |
315 |
} |
| 276 |
[% IF Koha.Preference('ClaimReturnedLostValue') %] |
316 |
if (prefs.ClaimReturnedLostValue){ |
| 277 |
embed.push('return_claims'); |
317 |
embed.push('return_claims'); |
| 278 |
[% END %] |
318 |
} |
| 279 |
|
319 |
|
| 280 |
[% IF Koha.Preference('EasyAnalyticalRecords') %] |
320 |
if (prefs.EasyAnalyticalRecords){ |
| 281 |
// For host records |
321 |
// For host records |
| 282 |
embed.push('biblio.title'); |
322 |
embed.push('biblio.title'); |
| 283 |
[% END %] |
323 |
} |
| 284 |
|
324 |
|
| 285 |
[% IF analyze %] |
325 |
if (analyze){ |
| 286 |
embed.push('analytics_count'); |
326 |
embed.push('analytics_count'); |
| 287 |
[% END %] |
327 |
} |
| 288 |
|
|
|
| 289 |
var items_table_settings = { |
| 290 |
holdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], |
| 291 |
otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %], |
| 292 |
}; |
| 293 |
|
328 |
|
| 294 |
let user_colvis = {holdings: {}, otherholdings: {}}; |
329 |
let user_colvis = {holdings: {}, otherholdings: {}}; |
| 295 |
let table_nodes = { |
|
|
| 296 |
holdings: "[% PROCESS 'build_table' tab="holdings" | collapse | $tojson %]", |
| 297 |
otherholdings: "[% PROCESS 'build_table' tab="otherholdings" | collapse | $tojson %]", |
| 298 |
}; |
| 299 |
function build_items_table (tab_id, add_filters, dt_options, drawcallback) { |
330 |
function build_items_table (tab_id, add_filters, dt_options, drawcallback) { |
| 300 |
|
331 |
|
| 301 |
let table_dt; |
332 |
let table_dt; |
|
Lines 311-329
Link Here
|
| 311 |
user_colvis[tab_id] = user_colvis_bak; |
342 |
user_colvis[tab_id] = user_colvis_bak; |
| 312 |
} |
343 |
} |
| 313 |
let default_filters = {}; |
344 |
let default_filters = {}; |
| 314 |
[% IF Koha.Preference('SeparateHoldings') %] |
345 |
if (prefs.SeparateHoldings){ |
| 315 |
[% SET SeparateHoldingsBranch = Koha.Preference('SeparateHoldingsBranch') || 'homebranch' %]; |
346 |
let branch = prefs.SeparateHoldingsBranch == 'homebranch' ? 'me.home_library_id' : 'me.holding_library_id'; |
| 316 |
let branch = '[% IF SeparateHoldingsBranch == 'homebranch' %]me.home_library_id[% ELSE %]me.holding_library_id[% END %]'; |
|
|
| 317 |
if ( tab_id == 'holdings' ) { |
347 |
if ( tab_id == 'holdings' ) { |
| 318 |
default_filters[branch] = '[% Branches.GetLoggedInBranchcode() | html %]'; |
348 |
default_filters[branch] = logged_in_branchcode; |
| 319 |
} else { |
349 |
} else { |
| 320 |
default_filters[branch] = { '!=': '[% Branches.GetLoggedInBranchcode() | html %]' }; |
350 |
default_filters[branch] = { '!=': logged_in_branchcode }; |
| 321 |
} |
351 |
} |
| 322 |
[% END %] |
352 |
} |
| 323 |
|
353 |
|
| 324 |
[% IF hidden_count %] |
354 |
if (hidden_count){ |
| 325 |
default_filters.lost_status = "0"; |
355 |
default_filters.lost_status = "0"; |
| 326 |
[% END %] |
356 |
} |
| 327 |
if ( !items_selection.hasOwnProperty(tab_id) ){ |
357 |
if ( !items_selection.hasOwnProperty(tab_id) ){ |
| 328 |
items_selection[tab_id] = []; |
358 |
items_selection[tab_id] = []; |
| 329 |
} |
359 |
} |
|
Lines 332-344
Link Here
|
| 332 |
return $("#" + tab_id + "_status select").val(); |
362 |
return $("#" + tab_id + "_status select").val(); |
| 333 |
}; |
363 |
}; |
| 334 |
|
364 |
|
| 335 |
var items_table = $("#" + tab_id + '_table').kohaTable({ |
365 |
var columns = [ |
| 336 |
ajax: { url: item_table_url }, |
|
|
| 337 |
order: [], |
| 338 |
embed, |
| 339 |
autoWidth: false, |
| 340 |
bKohaColumnsUseNames: true, |
| 341 |
columns: [ |
| 342 |
{ |
366 |
{ |
| 343 |
data: "me.item_id", |
367 |
data: "me.item_id", |
| 344 |
searchable: false, |
368 |
searchable: false, |
|
Lines 355-362
Link Here
|
| 355 |
} |
379 |
} |
| 356 |
} |
380 |
} |
| 357 |
}, |
381 |
}, |
| 358 |
[% IF Koha.Preference('LocalCoverImages') %] |
382 |
...(prefs.LocalCoverImages ? |
| 359 |
{ |
383 |
[{ |
| 360 |
data: "", |
384 |
data: "", |
| 361 |
className: "cover", |
385 |
className: "cover", |
| 362 |
searchable: false, |
386 |
searchable: false, |
|
Lines 378-387
Link Here
|
| 378 |
node += '</div>'; |
402 |
node += '</div>'; |
| 379 |
return node; |
403 |
return node; |
| 380 |
} |
404 |
} |
| 381 |
}, |
405 |
}] : []), |
| 382 |
[% END %] |
406 |
...(prefs.item_level_itypes ? |
| 383 |
[% IF ( item_level_itypes ) %] |
407 |
[{ |
| 384 |
{ |
|
|
| 385 |
data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype |
408 |
data: "me.item_type_id", // FIXME Cannot filter by biblioitem.itemtype |
| 386 |
datatype: "coded_value:item_type", |
409 |
datatype: "coded_value:item_type", |
| 387 |
dataFilter: "item_types", |
410 |
dataFilter: "item_types", |
|
Lines 391-407
Link Here
|
| 391 |
render: function (data, type, row, meta) { |
414 |
render: function (data, type, row, meta) { |
| 392 |
let node = ''; |
415 |
let node = ''; |
| 393 |
let item_type_description = row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id; |
416 |
let item_type_description = row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id; |
| 394 |
[% UNLESS noItemTypeImages %] |
417 |
if (prefs.noItemTypeImages){ |
| 395 |
let image_location = item_type_image_locations[row.item_type_id]; |
418 |
let image_location = item_type_image_locations[row.item_type_id]; |
| 396 |
node += image_location |
419 |
node += image_location |
| 397 |
? '<img class="itemtype-image" src="%s" alt="" /> '.format(escape_str(image_location), escape_str(item_type_description), escape_str(item_type_description)) |
420 |
? '<img class="itemtype-image" src="%s" alt="" /> '.format(escape_str(image_location), escape_str(item_type_description), escape_str(item_type_description)) |
| 398 |
: ''; |
421 |
: ''; |
| 399 |
[% END %] |
422 |
} |
| 400 |
node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description)); |
423 |
node += '<span class="itypedesc itypetext">%s</span>'.format(escape_str(item_type_description)); |
| 401 |
return node; |
424 |
return node; |
| 402 |
} |
425 |
} |
| 403 |
}, |
426 |
}] : []), |
| 404 |
[% END %] |
|
|
| 405 |
{ |
427 |
{ |
| 406 |
data: "me.holding_library_id", |
428 |
data: "me.holding_library_id", |
| 407 |
datatype: "coded_value:library", |
429 |
datatype: "coded_value:library", |
|
Lines 431-439
Link Here
|
| 431 |
orderable: true, |
453 |
orderable: true, |
| 432 |
render: function (data, type, row, meta) { |
454 |
render: function (data, type, row, meta) { |
| 433 |
let nodes = '<span class="shelvingloc">'; |
455 |
let nodes = '<span class="shelvingloc">'; |
| 434 |
[%# If permanent location is defined, show description or code and %] |
456 |
// If permanent location is defined, show description or code and |
| 435 |
[%# display current location in parentheses. If not, display current location. %] |
457 |
// display current location in parentheses. If not, display current location. |
| 436 |
[%# Note that permanent location is a code, and location may be an authval. %] |
458 |
// Note that permanent location is a code, and location may be an authval. |
| 437 |
let loc_str = row._strings.location ? row._strings.location.str : row.location; |
459 |
let loc_str = row._strings.location ? row._strings.location.str : row.location; |
| 438 |
if ( row.permanent_location && row.permanent_location != row.location ) { |
460 |
if ( row.permanent_location && row.permanent_location != row.location ) { |
| 439 |
let permanent_loc_str = av_loc.get(row.permanent_location); |
461 |
let permanent_loc_str = av_loc.get(row.permanent_location); |
|
Lines 454-461
Link Here
|
| 454 |
return escape_str(row._strings.collection_code ? row._strings.collection_code.str : row.collection_code); |
476 |
return escape_str(row._strings.collection_code ? row._strings.collection_code.str : row.collection_code); |
| 455 |
} |
477 |
} |
| 456 |
}, |
478 |
}, |
| 457 |
[% IF Koha.Preference('EnableItemGroups') %] |
479 |
...(prefs.EnableItemGroups ? |
| 458 |
{ |
480 |
[{ |
| 459 |
data: "item_group_item.item_group.description", |
481 |
data: "item_group_item.item_group.description", |
| 460 |
className: "item_group", |
482 |
className: "item_group", |
| 461 |
searchable: true, |
483 |
searchable: true, |
|
Lines 467-474
Link Here
|
| 467 |
return ""; |
489 |
return ""; |
| 468 |
} |
490 |
} |
| 469 |
} |
491 |
} |
| 470 |
}, |
492 |
}] : []), |
| 471 |
[% END %] |
|
|
| 472 |
{ |
493 |
{ |
| 473 |
data: "me.callnumber", |
494 |
data: "me.callnumber", |
| 474 |
className: "itemcallnumber", |
495 |
className: "itemcallnumber", |
|
Lines 486-492
Link Here
|
| 486 |
orderable: true, |
507 |
orderable: true, |
| 487 |
render: function (data, type, row, meta) { |
508 |
render: function (data, type, row, meta) { |
| 488 |
let nodes = ""; |
509 |
let nodes = ""; |
| 489 |
[%# FIXME Previously we displayed the column if at least one item of the biblio had an enumchron/serial_issue_number. Now it's only if one item of the ones displayed on the current page, how is that bad? How can it be fixed in an elegant way? Should we display the column only if biblio.serial? %] |
510 |
// FIXME Previously we displayed the column if at least one item of the biblio had an enumchron/serial_issue_number. Now it's only if one item of the ones displayed on the current page, how is that bad? How can it be fixed in an elegant way? Should we display the column only if biblio.serial? |
| 490 |
let serial = row.serial_item ? row.serial_item.serial : null; |
511 |
let serial = row.serial_item ? row.serial_item.serial : null; |
| 491 |
if ( row.serial_issue_number && serial && serial.serialseq ) { |
512 |
if ( row.serial_issue_number && serial && serial.serialseq ) { |
| 492 |
nodes += '<span class="enum">%s</span>'.format(escape_str(row.serial_issue_number)); |
513 |
nodes += '<span class="enum">%s</span>'.format(escape_str(row.serial_issue_number)); |
|
Lines 499-509
Link Here
|
| 499 |
} else if ( serial && serial.serialseq ) { |
520 |
} else if ( serial && serial.serialseq ) { |
| 500 |
nodes += '<span class="serialseq">%s</span>'.format(escape_str(serial.serialseq)); |
521 |
nodes += '<span class="serialseq">%s</span>'.format(escape_str(serial.serialseq)); |
| 501 |
} |
522 |
} |
| 502 |
[% IF Koha.Preference('DisplayPublishedDate') %] |
523 |
if (prefs.DisplayPublishedDate){ |
| 503 |
if ( serial && serial.publisheddate ) { |
524 |
if ( serial && serial.publisheddate ) { |
| 504 |
nodes += ' <span class="pubdate">(%s)</span>'.format($date(serial.publisheddate)); |
525 |
nodes += ' <span class="pubdate">(%s)</span>'.format($date(serial.publisheddate)); |
| 505 |
} |
526 |
} |
| 506 |
[% END %] |
527 |
} |
| 507 |
return nodes; |
528 |
return nodes; |
| 508 |
} |
529 |
} |
| 509 |
}, |
530 |
}, |
|
Lines 519-525
Link Here
|
| 519 |
if ( status == 'checked_out' || status == 'local_use') { |
540 |
if ( status == 'checked_out' || status == 'local_use') { |
| 520 |
nodes += '<span>'; |
541 |
nodes += '<span>'; |
| 521 |
|
542 |
|
| 522 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
543 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
| 523 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
544 |
row.checkout.patron.library = { name: libraries_names.get(row.checkout.patron.library_id) }; |
| 524 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
545 |
let patron_to_html = $patron_to_html(row.checkout.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
| 525 |
|
546 |
|
|
Lines 574-606
Link Here
|
| 574 |
} else { |
595 |
} else { |
| 575 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.".format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date)))); |
596 |
nodes += '<span class="waitingat">%s</span>'.format(_("Waiting at %s since %s.".format(row.first_hold._strings.pickup_library_id.str, $date(row.first_hold.waiting_date)))); |
| 576 |
} |
597 |
} |
| 577 |
[% IF Koha.Preference('canreservefromotherbranches') %] |
598 |
if (prefs.canreservefromotherbranches){ |
| 578 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
599 |
if ( row.first_hold.waiting_date || row.first_hold.priority == 1 ) { |
| 579 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
600 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
| 580 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
601 |
row.first_hold.patron.library = { name: libraries_names.get(row.first_hold.patron.library_id) }; |
| 581 |
|
602 |
|
| 582 |
let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
603 |
let patron_to_html = $patron_to_html(row.first_hold.patron, { url: true, display_cardnumber: true, hide_patron_name }); |
| 583 |
nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
604 |
nodes += ' <span class="heldfor">%s</span>'.format(_("Hold for: %s").format(patron_to_html)); |
| 584 |
} |
605 |
} |
| 585 |
[% END %] |
606 |
} |
| 586 |
} else { |
607 |
} else { |
| 587 |
nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
608 |
nodes += ' <span class="holdonitem">%s</span>'.format(_("There is an item level hold on this item (priority = %s).").format(row.first_hold.priority)); |
| 588 |
} |
609 |
} |
| 589 |
} |
610 |
} |
| 590 |
|
611 |
|
| 591 |
[% IF Koha.Preference('UseRecalls') %] |
612 |
if (prefs.UseRecalls){ |
| 592 |
if ( row.recall && ( row.item_id === row.recall.item_id ) ) { |
613 |
if ( row.recall && ( row.item_id === row.recall.item_id ) ) { |
| 593 |
if ( row.recall.waiting_date ) { |
614 |
if ( row.recall.waiting_date ) { |
| 594 |
nodes += '<span class="holding_status recallwaiting">%s</span>'.format(_("Waiting recall at %s since %s").format(escape_str(row.recall._strings.pickup_library_id.str), $date(row.recall.waiting_date))); |
615 |
nodes += '<span class="holding_status recallwaiting">%s</span>'.format(_("Waiting recall at %s since %s").format(escape_str(row.recall._strings.pickup_library_id.str), $date(row.recall.waiting_date))); |
| 595 |
} else { |
616 |
} else { |
| 596 |
[%# Hacky for patron_to_html in case we simply want to display the patron's library name %] |
617 |
// Hacky for patron_to_html in case we simply want to display the patron's library name |
| 597 |
row.recall.patron.library = { name: libraries_names.get(row.recall.patron.library_id) }; |
618 |
row.recall.patron.library = { name: libraries_names.get(row.recall.patron.library_id) }; |
| 598 |
|
619 |
|
| 599 |
let patron_to_html = $patron_to_html(row.recall.patron, {url: true, display_cardnumber: true, hide_patron_name }); |
620 |
let patron_to_html = $patron_to_html(row.recall.patron, {url: true, display_cardnumber: true, hide_patron_name }); |
| 600 |
nodes += '<span class="holding_status recalledby">%s</span>'.format(_("Recalled by %s on %s").format(patron_to_html, $date(row.recall.created_date))) |
621 |
nodes += '<span class="holding_status recalledby">%s</span>'.format(_("Recalled by %s on %s").format(patron_to_html, $date(row.recall.created_date))) |
| 601 |
} |
622 |
} |
| 602 |
} |
623 |
} |
| 603 |
[% END %] |
624 |
} |
| 604 |
if ( status == 'available' ) { |
625 |
if ( status == 'available' ) { |
| 605 |
nodes += ' <span>%s</span>'.format(_("Available")) |
626 |
nodes += ' <span>%s</span>'.format(_("Available")) |
| 606 |
} |
627 |
} |
|
Lines 759-777
Link Here
|
| 759 |
return escape_str(row.internal_notes); |
780 |
return escape_str(row.internal_notes); |
| 760 |
} |
781 |
} |
| 761 |
}, |
782 |
}, |
| 762 |
[% IF Koha.Preference('EasyAnalyticalRecords') %] |
783 |
...(prefs.EasyAnalyticalRecords? |
| 763 |
{ |
784 |
[{ |
| 764 |
data: "biblio.title", |
785 |
data: "biblio.title", |
| 765 |
searchable: false, |
786 |
searchable: false, |
| 766 |
orderable: true, |
787 |
orderable: true, |
| 767 |
render: function (data, type, row, meta) { |
788 |
render: function (data, type, row, meta) { |
| 768 |
if ( row.biblio_id == [% biblio.biblionumber | html %] ) return ""; |
789 |
if ( row.biblio_id == biblionumber ) return ""; |
| 769 |
return '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a>'.format(row.biblio_id, row.biblio.title); |
790 |
return '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=%s">%s</a>'.format(row.biblio_id, row.biblio.title); |
| 770 |
} |
791 |
} |
| 771 |
}, |
792 |
}]:[]), |
| 772 |
[% END %] |
793 |
...(analyze ? |
| 773 |
[% IF analyze %] |
794 |
[{ |
| 774 |
{ |
|
|
| 775 |
data: "analytics_count", |
795 |
data: "analytics_count", |
| 776 |
searchable: false, |
796 |
searchable: false, |
| 777 |
orderable: false, |
797 |
orderable: false, |
|
Lines 787-796
Link Here
|
| 787 |
render: function (data, type, row, meta) { |
807 |
render: function (data, type, row, meta) { |
| 788 |
return '<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=%s&hostitemnumber=%s">%s</a>'.format(row.biblio_id, row.item_id, _("Create analytics")); |
808 |
return '<a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=%s&hostitemnumber=%s">%s</a>'.format(row.biblio_id, row.item_id, _("Create analytics")); |
| 789 |
} |
809 |
} |
| 790 |
}, |
810 |
}]:[]), |
| 791 |
[% END %] |
811 |
...(prefs.UseCourseReserves? |
| 792 |
[% IF Koha.Preference('UseCourseReserves') %] |
812 |
[{ |
| 793 |
{ |
|
|
| 794 |
data: "course_item.course_reserves.course.course_name", |
813 |
data: "course_item.course_reserves.course.course_name", |
| 795 |
searchable: true, |
814 |
searchable: true, |
| 796 |
orderable: true, |
815 |
orderable: true, |
|
Lines 813-858
Link Here
|
| 813 |
}); |
832 |
}); |
| 814 |
return nodes; |
833 |
return nodes; |
| 815 |
} |
834 |
} |
| 816 |
}, |
835 |
}]:[]), |
| 817 |
[% END %] |
836 |
...(prefs.SpineLabelShowPrintOnBibDetails? |
| 818 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %] |
837 |
[{ |
| 819 |
{ |
|
|
| 820 |
data: "", |
838 |
data: "", |
| 821 |
searchable: false, |
839 |
searchable: false, |
| 822 |
orderable: false, |
840 |
orderable: false, |
| 823 |
render: function (data, type, row, meta) { |
841 |
render: function (data, type, row, meta) { |
| 824 |
return '<a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=%s"><i class="fa fa-print"></i> Print label</a>'.format(escape_str(row.external_id)); |
842 |
return '<a class="btn btn-default btn-xs print-label" href="/cgi-bin/koha/labels/spinelabel-print.pl?barcode=%s"><i class="fa fa-print"></i> Print label</a>'.format(escape_str(row.external_id)); |
| 825 |
} |
843 |
} |
| 826 |
}, |
844 |
}]:[]), |
| 827 |
[% END %] |
845 |
...(permissions.CAN_user_editcatalogue_edit_items ? |
| 828 |
[% IF CAN_user_editcatalogue_edit_items %] |
846 |
[{ |
| 829 |
{ |
|
|
| 830 |
data: function( row, type, val, meta ) { |
847 |
data: function( row, type, val, meta ) { |
| 831 |
let nodes = ''; |
848 |
let nodes = ''; |
| 832 |
if ( can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length ){ |
849 |
if ( can_edit_items_from.includes(row.home_library_id) || !can_edit_items_from.length ){ |
| 833 |
[% IF Koha.Preference('LocalCoverImages') OR Koha.Preference('OPACLocalCoverImages') %] |
850 |
if (prefs.LocalCoverImages || prefs.OPACLocalCoverImages){ |
| 834 |
nodes += '<div class="btn-group dropup">'; |
851 |
nodes += '<div class="btn-group dropup">'; |
| 835 |
nodes += ' <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a><a class="btn btn-default btn-xs dropdown-toggle" data-bs-toggle="dropdown"><span class="caret"></span></a>'.format(row.biblio_id, row.item_id, _("Edit")); |
852 |
nodes += ' <a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a><a class="btn btn-default btn-xs dropdown-toggle" data-bs-toggle="dropdown"><span class="caret"></span></a>'.format(row.biblio_id, row.item_id, _("Edit")); |
| 836 |
nodes += ' <ul class="dropdown-menu">'; |
853 |
nodes += ' <ul class="dropdown-menu">'; |
| 837 |
nodes += ' <li><a class="dropdown-item" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=%s&filetype=image"><i class="fa fa-upload"></i> %s</a></li>'.format(row.item_id, _("Upload image")); |
854 |
nodes += ' <li><a class="dropdown-item" href="/cgi-bin/koha/tools/upload-cover-image.pl?itemnumber=%s&filetype=image"><i class="fa fa-upload"></i> %s</a></li>'.format(row.item_id, _("Upload image")); |
| 838 |
nodes += ' </ul>'; |
855 |
nodes += ' </ul>'; |
| 839 |
nodes += '</div>'; |
856 |
nodes += '</div>'; |
| 840 |
[% ELSE %] |
857 |
} else { |
| 841 |
nodes += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a>'.format(row.biblio_id, row.item_id, _("Edit")); |
858 |
nodes += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/cataloguing/additem.pl?op=edititem&biblionumber=%s&itemnumber=%s#edititem"><i class="fa-solid fa-pencil"></i> %s</a>'.format(row.biblio_id, row.item_id, _("Edit")); |
| 842 |
[% END %] |
859 |
} |
| 843 |
} |
860 |
} |
| 844 |
[% IF bundlesEnabled %] |
861 |
if (bundlesEnabled){ |
| 845 |
nodes += '<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> %s</button>'.format(_("Manage bundle (%s|%s)").format(row.bundle_items_not_lost_count, row.bundle_items_lost_count)); |
862 |
nodes += '<button class="btn btn-default btn-xs details-control"><i class="fa fa-folder"></i> %s</button>'.format(_("Manage bundle (%s|%s)").format(row.bundle_items_not_lost_count, row.bundle_items_lost_count)); |
| 846 |
[% END %] |
863 |
} |
| 847 |
|
864 |
|
| 848 |
return nodes; |
865 |
return nodes; |
| 849 |
}, |
866 |
}, |
| 850 |
className: "actions", |
867 |
className: "actions", |
| 851 |
searchable: false, |
868 |
searchable: false, |
| 852 |
orderable: false |
869 |
orderable: false |
| 853 |
} |
870 |
}]:[]) |
| 854 |
[% END %] |
871 |
]; |
| 855 |
], |
872 |
var items_table = $("#" + tab_id + '_table').kohaTable({ |
|
|
873 |
ajax: { url: item_table_url }, |
| 874 |
order: [], |
| 875 |
embed, |
| 876 |
autoWidth: false, |
| 877 |
bKohaColumnsUseNames: true, |
| 878 |
columns, |
| 856 |
initComplete: function( settings, json ){ |
879 |
initComplete: function( settings, json ){ |
| 857 |
itemSelectionBuildActionLinks(tab_id); |
880 |
itemSelectionBuildActionLinks(tab_id); |
| 858 |
}, |
881 |
}, |
|
Lines 885-897
Link Here
|
| 885 |
container.find(".bottom.pager").remove(); |
908 |
container.find(".bottom.pager").remove(); |
| 886 |
} |
909 |
} |
| 887 |
|
910 |
|
| 888 |
[% IF ( SpineLabelShowPrintOnBibDetails ) %] |
911 |
if (prefs.SpineLabelShowPrintOnBibDetails){ |
| 889 |
$(".print-label").on("click", function(e){ |
912 |
$(".print-label").on("click", function(e){ |
| 890 |
e.preventDefault(); |
913 |
e.preventDefault(); |
| 891 |
link = $(this).attr("href"); |
914 |
link = $(this).attr("href"); |
| 892 |
openWindow(link,"Print spine label",400,400); |
915 |
openWindow(link,"Print spine label",400,400); |
| 893 |
}); |
916 |
}); |
| 894 |
[% END %] |
917 |
} |
| 895 |
|
918 |
|
| 896 |
if ( api.data().length ) { |
919 |
if ( api.data().length ) { |
| 897 |
update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]); |
920 |
update_columns_visibility(api, items_table_settings[tab_id], user_colvis[tab_id]); |