Koha/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/tables/shelves_results.tt
Marcel de Rooy ad83180fb0
Bug 25498: Add transfer button on intranet
Note: Adjusting shelves_results template too for not allowing delete
when you do not have delete_public_lists (or higher). If you are the
owner, you are allowed to edit or delete. But transfer specifically
needs edit_public_lists (or higher).

Note: Removed a few useless POD lines to make qa tools happy.

Test plan:
Check if you see the transfer button on public lists only when having
permission edit_public_lists (or higher). And never on private lists.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-07-19 11:25:23 -03:00

73 lines
4.6 KiB
Text

[% USE raw %]
[% USE KohaDates %]
[% USE To %]
[% PROCESS 'i18n.inc' %]
{
"sEcho": [% sEcho | html %],
"iTotalRecords": [% iTotalRecords | html %],
"iTotalDisplayRecords": [% iTotalDisplayRecords | html %],
"aaData": [
[% FOREACH data IN aaData %]
{
"dt_public":
"[% data.public | html %]",
"dt_shelfname":
"<a href='/cgi-bin/koha/virtualshelves/shelves.pl?op=view&shelfnumber=[% data.shelfnumber | html %]'>[% data.shelfname | html | $To %]</a>",
"dt_count":
"[% tnx('{count} item', '{count} items', count, { count = data.count }) | $raw %]",
"dt_is_shared":
"[% IF data.public %]<span>Public</span>[% ELSIF data.is_shared %]<span>Shared</span>[% ELSE %]<span>Private</span>[% END %]",
"dt_owner":
"<a href='/cgi-bin/koha/members/moremember.pl?borrowernumber=[% data.owner | html %]'>[% data.firstname | html | $To %] [% data.surname | html | $To %]</a>",
"dt_sortby":
[% IF data.sortby == "author" %]"<span>Author</span>"[% ELSIF data.sortby == "copyrightdate" %]"<span>Year</span>"[% ELSIF data.sortby == "itemcallnumber" %]"<span>Call number</span>"[% ELSIF data.sortby == "dateadded" %]"<span>Date added</span>"[% ELSE %]"<span>Title</span>"[% END %],
"dt_created_on":
"[% data.created_on | $KohaDates %]",
"dt_modification_time":
"[% data.modification_time | $KohaDates %]",
"dt_action":
"[% PROCESS action_form shelfnumber=data.shelfnumber can_manage_shelf=data.can_manage_shelf can_delete_shelf=data.can_delete_shelf type=data.type %]"
}[% UNLESS loop.last %],[% END %]
[% END %]
]
}
[% BLOCK action_form -%]
[%~ SET action_block = '' ~%]
[%~ IF can_manage_shelf OR can_delete_shelf ~%]
[%~ shelfnumber = shelfnumber | html ~%]
[%~ public = public | html ~%]
[%~ IF can_manage_shelf ~%]
[%~ action_block = '<form action="shelves.pl" method="get">' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber _ '" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="op" value="edit_form" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="public" value="' _ public _ '" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
[%~ action_block = action_block _ '<button class="editshelf btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</button>' ~%]
[%~ action_block = action_block _ '</form> ' ~%]
[%~ END ~%]
[%~ IF can_delete_shelf ~%]
[%~ action_block = action_block _ ' <form action="shelves.pl" method="post">' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="shelves" value="1" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="op" value="delete" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber _ '" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="public" value="' _ public _ '" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
[%~ action_block = action_block _ '<button type="submit" class="deleteshelf btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>' ~%]
[%~ action_block = action_block _ '</form>' ~%]
[%~ END ~%]
[%~ IF public AND allow_transfer ~%]
[%~ action_block = action_block _ ' <form action="shelves.pl" method="post">' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="shelves" value="1" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="op" value="transfer" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="shelfnumber" value="' _ shelfnumber _ '" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="public" value="1" />' ~%]
[%~ action_block = action_block _ '<input type="hidden" name="referer" value="list" />' ~%]
[%~ action_block = action_block _ '<button type="submit" class="btn btn-default btn-xs"><i class="fa"></i> Transfer</button>' ~%]
[%~ action_block = action_block _ '</form>' ~%]
[%~ END ~%]
[%~ ELSE ~%]
[%~ SET action_block = 'None' ~%]
[%~ END ~%]
[%~ To.json(action_block) | $raw ~%]
[%~ END ~%]