|
Lines 184-194
sub add_biblio {
Link Here
|
| 184 |
)->count; |
184 |
)->count; |
| 185 |
return if $already_exists; |
185 |
return if $already_exists; |
| 186 |
|
186 |
|
| 187 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
|
|
| 188 |
my $staffuser = 1 if ( C4::Auth::haspermission( $patron->userid, {'catalogue' => 1 }) ); |
| 189 |
|
| 190 |
# Check permissions |
187 |
# Check permissions |
| 191 |
return unless ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) || ( $self->allow_change_from_staff && $staffuser ) || $self->allow_change_from_others; |
188 |
return unless ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) || ( $self->allow_change_from_staff && Koha::Patrons->find( $borrowernumber )->can_patron_change_staff_only_lists ) || $self->allow_change_from_others; |
| 192 |
|
189 |
|
| 193 |
my $content = Koha::Virtualshelfcontent->new( |
190 |
my $content = Koha::Virtualshelfcontent->new( |
| 194 |
{ |
191 |
{ |
|
Lines 209-219
sub remove_biblios {
Link Here
|
| 209 |
my $borrowernumber = $params->{borrowernumber}; |
206 |
my $borrowernumber = $params->{borrowernumber}; |
| 210 |
return unless @$biblionumbers; |
207 |
return unless @$biblionumbers; |
| 211 |
|
208 |
|
| 212 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
|
|
| 213 |
my $staffuser = 1 if ( haspermission( $patron->userid, {'catalogue' => 1 })); |
| 214 |
my $number_removed = 0; |
209 |
my $number_removed = 0; |
| 215 |
if( ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) |
210 |
if( ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) |
| 216 |
|| ( $staffuser && $self->allow_change_from_staff ) |
211 |
|| ( $self->allow_change_from_staff && Koha::Patrons->find( $borrowernumber )->can_patron_change_staff_only_lists ) |
| 217 |
|| $self->allow_change_from_others ) { |
212 |
|| $self->allow_change_from_others ) { |
| 218 |
$number_removed += $self->get_contents->search({ |
213 |
$number_removed += $self->get_contents->search({ |
| 219 |
biblionumber => $biblionumbers, |
214 |
biblionumber => $biblionumbers, |
|
Lines 242-248
sub can_be_deleted {
Link Here
|
| 242 |
|
237 |
|
| 243 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
238 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
| 244 |
|
239 |
|
| 245 |
return 1 if $self->is_public and C4::Auth::haspermission( $patron->userid, { lists => 'delete_public_lists' } ); |
240 |
return 1 if $self->is_public and haspermission( $patron->userid, { lists => 'delete_public_lists' } ); |
| 246 |
|
241 |
|
| 247 |
return 0; |
242 |
return 0; |
| 248 |
} |
243 |
} |
|
Lines 257-268
sub can_be_managed {
Link Here
|
| 257 |
sub can_biblios_be_added { |
252 |
sub can_biblios_be_added { |
| 258 |
my ( $self, $borrowernumber ) = @_; |
253 |
my ( $self, $borrowernumber ) = @_; |
| 259 |
|
254 |
|
| 260 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
|
|
| 261 |
my $staffuser = 1 if ( C4::Auth::haspermission( $patron->userid, {'catalogue' => 1 } )); |
| 262 |
|
| 263 |
return 1 |
255 |
return 1 |
| 264 |
if $borrowernumber |
256 |
if $borrowernumber |
| 265 |
and ( ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) or ( $self->allow_change_from_staff && $staffuser ) or $self->allow_change_from_others ); |
257 |
and ( ( $self->owner == $borrowernumber && $self->allow_change_from_owner ) or ( $self->allow_change_from_staff && Koha::Patrons->find( $borrowernumber )->can_patron_change_staff_only_lists ) or $self->allow_change_from_others ); |
| 266 |
return 0; |
258 |
return 0; |
| 267 |
} |
259 |
} |
| 268 |
|
260 |
|