Tomas Cohen Arazi
0c72031539
This patchset moves the 'category' attribute for virtual shelves, that takes values of 1 and 2 (private and public respectively) into a boolean for public. The DBRev is trivial, and the changes to the code are as well. To test: 1. have some known public and private lists 2. Apply this patches 3. Run: $ updatedatabase => SUCCESS: Public lists have public=1, private have public=0 4. Run: $ kshell k$ prove t/db_dependent/Utils/Datatables_Virtualshelves.t \ t/db_dependent/Virtualshelves.t => SUCCESS: Tests pass! 5. Try the feature in staff and OPAC => SUCCESS: All good 6. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
62 lines
3.6 KiB
Text
62 lines
3.6 KiB
Text
[% USE raw %]
|
|
[% USE KohaDates %]
|
|
[% USE To %]
|
|
{
|
|
"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":
|
|
"[% data.count | html %] item(s)",
|
|
"dt_is_shared":
|
|
"[% IF data.public %]Public[% ELSIF data.is_shared %]Shared[% ELSE %]Private[% 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" %]"Author"[% ELSIF data.sortby == "copyrightdate" %]"Year"[% ELSIF data.sortby == "itemcallnumber" %]"Call number"[% ELSIF data.sortby == "dateadded" %]"Date added"[% ELSE %]"Title"[% 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_manage_shelf OR 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 ~%]
|
|
[%~ ELSE ~%]
|
|
[%~ SET action_block = 'None' ~%]
|
|
[%~ END ~%]
|
|
[%~ To.json(action_block) | $raw ~%]
|
|
[%~ END ~%]
|