Bug 14544: QA fixes - some minor bug fixes

See comment 171 and 172 for more details.

This patch mainly fixes typo or silly error in templates.

It also uses the relationships added by previous patch to join the
biblioitems and items tables (changes in opac-shelves.pl and
shelves.pl).

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2015-10-12 09:34:41 +01:00 committed by Tomas Cohen Arazi
parent 44cd6841fa
commit 8cd4dc9bb7
9 changed files with 53 additions and 29 deletions

View File

@ -15,7 +15,7 @@ use Exception::Class (
'Koha::Exceptions::Virtualshelves::DuplicateObject' => {
isa => 'Koha::Exceptions::DuplicateObject',
description => "poeut",
description => "Duplicate shelf object",
},
'Koha::Exceptions::Virtualshelves::InvalidInviteKey' => {
isa => 'Koha::Exceptions::Exception',

View File

@ -357,7 +357,7 @@ function verify_images() {
[% IF ( XSLTDetailsDisplay ) %]
[% XSLTBloc %]
[% IF shelves %]
[% IF shelves.count %]
<span class="results_summary"><span class="label">Lists that include this title: </span>
[% FOREACH s IN shelves %]
<a href="/cgi-bin/koha/virtualshelves/shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber %]">[% s.shelfname %]</a>

View File

@ -564,24 +564,30 @@ function placeHold () {
[% END %]
</select></li>
[% FOR permission IN ['allow_add', 'allow_delete_own', 'allow_delete_other'] %]
<li>
[% IF loop.first %]
<label for="permissions">Permissions: </label>
[% ELSE %]
<label>&nbsp;</label>
[% END %]
<select name="[% permission %]" id="[% permission %]">
[% IF shelf.$permission %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
[% IF shelf.$permission %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
</select>
[% SWITCH permission %]
[% CASE 'allow_add' %]&nbsp;<span>anyone else to add entries.</span>
[% CASE 'allow_delete_own' %]&nbsp;<span>anyone to remove his own contributed entries.</span>
[% CASE 'allow_delete_other' %]&nbsp;<span>anyone to remove other contributed entries.</span>
[% END %]
</li>
[% END %]
<li>
<label for="allow_add">Permissions: </label>
<select name="allow_add" id="allow_add">
[% IF shelf.allow_add %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
[% IF shelf.allow_add %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
</select>
&nbsp;<span>anyone else to add entries.</span>
</li>
<li>
<label>&nbsp;</label>
<select name="allow_delete_own" id="allow_delete_own">
[% IF shelf and not shelf.allow_delete_own %]<option value="0" selected="selected">Do not allow</option>[% ELSE %]<option value="0">Do not allow</option>[% END %]
[% IF not shelf or shelf.allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
</select>
&nbsp;<span>anyone to remove his own contributed entries.</span>
</li>
<li>
<label>&nbsp;</label>
<select name="allow_delete_other" id="allow_delete_other">
[% IF shelf.allow_delete_other %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
[% IF shelf.allow_delete_other %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
</select>
&nbsp;<span>anyone to remove other contributed entries.</span>
</li>
</ol>
</fieldset>

View File

@ -390,7 +390,7 @@
[% END # / LibraryThingForLibrariesID %]
<!--This grabs all of the lists a bib record appears in -->
[% IF shelves %]
[% IF shelves.count %]
<span class="results_summary lists"><span class="label">List(s) this item appears in: </span>
[% FOREACH s IN shelves %]
<a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% s.shelfnumber %]">[% s.shelfname %]</a>

View File

@ -59,7 +59,7 @@
</fieldset>
<fieldset class="action">
<input type="submit" value="Send" class="btn" />
<a href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;category=1" class="cancel">Cancel</a>
<a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1" class="cancel">Cancel</a>
</fieldset>
</form>
</div>

View File

@ -22,8 +22,8 @@
<li>
<label>&nbsp;</label>
<select name="allow_delete_own" id="allow_delete_own">
[% IF shelf.allow_delete_own %]<option value="0">Do not allow</option>[% ELSE %]<option value="0" selected="selected">Do not allow</option>[% END %]
[% IF shelf.allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
[% IF shelf and not shelf.allow_delete_own %]<option value="0" selected="selected">Do not allow</option>[% ELSE %]<option value="0">Do not allow</option>[% END %]
[% IF not shelf or shelf.allow_delete_own %]<option value="1" selected="selected">Allow</option>[% ELSE %]<option value="1">Allow</option>[% END %]
</select>
&nbsp;<span>anyone to remove his own contributed entries.</span>
</li>
@ -168,7 +168,7 @@
<a href="/cgi-bin/koha/opac-downloadshelf.pl?shelfnumber=[% shelf.shelfnumber | html %]" class="download" data-toggle="modal" data-target="#modalWin">Download list</a>
[% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
<span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false; ">Send list</a></span>
<span class="sendlist"><a href="/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]" class="send" onclick="open('/cgi-bin/koha/opac-sendshelf.pl?shelfid=[% shelf.shelfnumber | html %]','win_form','scrollbars=no,resizable=no,height=300,width=450,top=50,left=100'); return false; ">Send list</a></span>
[% END %]
<a class="print-small" target="_blank" href="/cgi-bin/koha/opac-shelves.pl?op=view&amp;shelfnumber=[% shelf.shelfnumber %]&sortfield=[% sortfield %]&direction=[% direction |uri %]&print=1">Print list</a>
@ -521,7 +521,7 @@
[% END %]
[% IF itemsloop && can_remove_biblios %]
<input type="hidden" name="op" value="view" />
<input type="hidden" name="op" value="remove_biblios" />
<input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
<input type="hidden" name="modifyshelfcontents" value="1" />
<input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>

View File

@ -52,7 +52,7 @@ my $email = $query->param('email');
my $dbh = C4::Context->dbh;
my $shelf = Koha::Virtualshelves->find( $shelfid );
if ( $shelf->can_be_viewed( $borrowernumber ) ) {
if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) {
if ( $email ) {
my $message = Koha::Email->new();

View File

@ -222,7 +222,16 @@ if ( $op eq 'view' ) {
$rows = C4::Context->preference('OPACnumSearchResults') || 20;
$page = ( $query->param('page') ? $query->param('page') : 1 );
}
my $contents = $shelf->get_contents->search({}, { join => [ 'biblionumber' ], page => $page, rows => $rows, order_by => "$sortfield $direction", });
my $order_by = $sortfield eq 'itemcallnumber' ? 'items.itemcallnumber' : $sortfield;
my $contents = $shelf->get_contents->search(
{},
{
prefetch => [ { 'biblionumber' => { 'biblioitems' => 'items' } } ],
page => $page,
rows => $rows,
order_by => "$order_by $direction",
}
);
# get biblionumbers stored in the cart
my @cart_list;

View File

@ -201,7 +201,16 @@ if ( $op eq 'view' ) {
$page = ( $query->param('page') ? $query->param('page') : 1 );
}
my $contents = $shelf->get_contents->search({}, { join => [ 'biblionumber' ], page => $page, rows => $rows, order_by => "$sortfield $direction", });
my $order_by = $sortfield eq 'itemcallnumber' ? 'items.itemcallnumber' : $sortfield;
my $contents = $shelf->get_contents->search(
{},
{
prefetch => [ { 'biblionumber' => { 'biblioitems' => 'items' } } ],
page => $page,
rows => $rows,
order_by => "$order_by $direction",
}
);
my $borrower = GetMember( borrowernumber => $loggedinuser );