use C4::XSLT;
use Koha::Biblioitems;
+use Koha::ItemTypes;
use Koha::Virtualshelves;
use Koha::RecordProcessor;
+use constant ANYONE => 2;
+
my $query = new CGI;
my $template_name = $query->param('rss') ? "opac-shelves-rss.tt" : "opac-shelves.tt";
my ( $shelf, $shelfnumber, @messages );
if ( $op eq 'add_form' ) {
- # Nothing to do
+ # Only pass default
+ $shelf = { allow_change_from_owner => 1 };
} elsif ( $op eq 'edit_form' ) {
$shelfnumber = $query->param('shelfnumber');
$shelf = Koha::Virtualshelves->find($shelfnumber);
}
} elsif ( $op eq 'add' ) {
if ( $loggedinuser ) {
+ my $allow_changes_from = $query->param('allow_changes_from');
eval {
$shelf = Koha::Virtualshelf->new(
{ shelfname => scalar $query->param('shelfname'),
sortfield => scalar $query->param('sortfield'),
category => scalar $query->param('category') || 1,
- allow_add => scalar $query->param('allow_add'),
- allow_delete_own => scalar $query->param('allow_delete_own'),
- allow_delete_other => scalar $query->param('allow_delete_other'),
+ allow_change_from_owner => $allow_changes_from > 0,
+ allow_change_from_others => $allow_changes_from == ANYONE,
owner => scalar $loggedinuser,
}
);
if ( $shelf->can_be_managed( $loggedinuser ) ) {
$shelf->shelfname( scalar $query->param('shelfname') );
$shelf->sortfield( $sortfield );
- $shelf->allow_add( scalar $query->param('allow_add') );
- $shelf->allow_delete_own( scalar $query->param('allow_delete_own') );
- $shelf->allow_delete_other( scalar $query->param('allow_delete_other') );
+ my $allow_changes_from = $query->param('allow_changes_from');
+ $shelf->allow_change_from_owner( $allow_changes_from > 0 );
+ $shelf->allow_change_from_others( $allow_changes_from == ANYONE );
$shelf->category( scalar $query->param('category') );
eval { $shelf->store };
my $marcflavour = C4::Context->preference("marcflavour");
my $itemtype = Koha::Biblioitems->search({ biblionumber => $content->biblionumber })->next->itemtype;
- my $itemtypeinfo = getitemtypeinfo( $itemtype, 'opac' );
- $this_item->{imageurl} = $itemtypeinfo->{imageurl};
- $this_item->{description} = $itemtypeinfo->{description};
- $this_item->{notforloan} = $itemtypeinfo->{notforloan};
+ $itemtype = Koha::ItemTypes->find( $itemtype );
+ $this_item->{imageurl} = C4::Koha::getitemtypeimagelocation( 'opac', $itemtype->imageurl );
+ $this_item->{description} = $itemtype->description; #FIXME Should not it be translated_description?
+ $this_item->{notforloan} = $itemtype->notforloan;
$this_item->{'coins'} = GetCOinSBiblio($record);
$this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) );
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour );