f22e0145cbec6fe5bf033d971966a5933319dd56
[koha.git] / C4 / VirtualShelves / Page.pm
1 package C4::VirtualShelves::Page;
2
3 #
4 # Copyright 2000-2002 Katipo Communications
5 #
6 # This file is part of Koha.
7 #
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20
21 # perldoc at the end of the file, per convention.
22
23 use strict;
24 use warnings;
25
26 use CGI qw ( -utf8 );
27 use Exporter;
28 use Data::Dumper;
29
30 use C4::VirtualShelves qw/:DEFAULT ShelvesMax/;
31 use C4::Biblio;
32 use C4::Items;
33 use C4::Reserves;
34 use C4::Koha;
35 use C4::Auth qw/get_session/;
36 use C4::Members;
37 use C4::Output;
38 use C4::Dates qw/format_date/;
39 use C4::Tags qw(get_tags);
40 use C4::Csv;
41 use C4::XSLT;
42
43 use Koha::Virtualshelves;
44
45 use constant VIRTUALSHELVES_COUNT => 20;
46
47 use vars qw($debug @EXPORT @ISA $VERSION);
48
49 BEGIN {
50     $VERSION = 3.07.00.049;
51     @ISA     = qw(Exporter);
52     @EXPORT  = qw(&shelfpage);
53     $debug   = $ENV{DEBUG} || 0;
54 }
55
56 my @messages;
57 our %pages = (
58     intranet => { redirect => '/cgi-bin/koha/virtualshelves/shelves.pl', },
59     opac     => { redirect => '/cgi-bin/koha/opac-shelves.pl', },
60 );
61
62 sub shelfpage {
63     my ( $type, $query, $template, $loggedinuser, $cookie ) = @_;
64     ( $pages{$type} ) or $type = 'opac';
65     $query            or die "No query";
66     $template         or die "No template";
67     $template->param(
68     loggedinuser => $loggedinuser,
69     OpacAllowPublicListCreation => C4::Context->preference('OpacAllowPublicListCreation'),
70     );
71     my $edit;
72     my $shelves;
73     my @paramsloop;
74     my $totitems;
75     my $shelfoff    = ( $query->param('shelfoff') ? $query->param('shelfoff') : 1 );
76     $template->{VARS}->{'shelfoff'} = $shelfoff;
77     my $itemoff     = ( $query->param('itemoff')  ? $query->param('itemoff')  : 1 );
78     my $displaymode = ( $query->param('display')  ? $query->param('display')  : 'publicshelves' );
79     my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset );
80     my $marcflavour = C4::Context->preference("marcflavour");
81
82     unless ( $query->param('print') ) {
83         $shelflimit = ( $type eq 'opac' ? C4::Context->preference('OPACnumSearchResults') : C4::Context->preference('numSearchResults') );
84         $shelflimit = $shelflimit || ShelvesMax('MGRPAGE');
85         $shelflimit = undef if $query->param('rss');
86         $shelfoffset   = ( $itemoff - 1 ) * $shelflimit;     # Sets the offset to begin retrieving items at
87         $shelveslimit  = $shelflimit;                        # Limits number of shelves returned for a given query (row_count)
88         $shelvesoffset = ( $shelfoff - 1 ) * $shelflimit;    # Sets the offset to begin retrieving shelves at (offset)
89     }
90
91     # getting the Shelves list
92     my $category = ( ( $displaymode eq 'privateshelves' ) ? 1 : 2 );
93     my $shelflist = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );
94     my $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category );
95
96     my $op = $query->param('op');
97
98     # the format of this is unindented for ease of diff comparison to the old script
99     # Note: do not mistake the assignment statements below for comparisons!
100     if ( $query->param('modifyshelfcontents') ) {
101         my ( $shelfnumber, $barcode, $item, $biblio );
102         if ( $shelfnumber = $query->param('viewshelf') ) {
103             #add to shelf
104             if($barcode = $query->param('addbarcode') ) {
105                 if(ShelfPossibleAction( $loggedinuser, $shelfnumber, 'add')) {
106                     $item = GetItem( 0, $barcode);
107                     if (defined $item && $item->{'itemnumber'}) {
108                         $biblio = GetBiblioFromItemNumber( $item->{'itemnumber'} );
109                         Koha::Virtualshelves->find( $shelfnumber )->add_biblio( $biblio->{biblionumber}, $loggedinuser )
110                           or push @paramsloop, { duplicatebiblio => $barcode };
111                     }
112                     else {
113                         push @paramsloop, { failgetitem => $barcode };
114                     }
115                 }
116                 else {
117                     push @paramsloop, { nopermission => $shelfnumber };
118                 }
119             }
120             elsif(grep { /REM-(\d+)/ } $query->param) {
121             #remove item(s) from shelf
122                 if(ShelfPossibleAction($loggedinuser, $shelfnumber, 'delete')) {
123                     my @bib;
124                     foreach($query->param) {
125                         /REM-(\d+)/ or next;
126                         push @bib, $1; #$1 is biblionumber
127                     }
128                     my $shelf = Koha::Virtualshelves->find( $shelfnumber );
129                     my $number_of_biblios_removed = $shelf->remove_biblios( { biblionumbers => \@bib, borrowernumber => $loggedinuser } );
130                     if( $number_of_biblios_removed == 0) {
131                         push @paramsloop, {nothingdeleted => $shelfnumber};
132                     }
133                     elsif( $number_of_biblios_removed < @bib ) {
134                         push @paramsloop, {somedeleted => $shelfnumber};
135                     }
136                 }
137                 else {
138                     push @paramsloop, { nopermission => $shelfnumber };
139                 }
140             }
141         }
142         else {
143             push @paramsloop, { noshelfnumber => 1 };
144         }
145     }
146
147     my $showadd = 1;
148
149     # set the default tab, etc. (for OPAC)
150     my $shelf_type = ( $query->param('display') ? $query->param('display') : 'publicshelves' );
151     if ( defined $shelf_type ) {
152         if ( $shelf_type eq 'privateshelves' ) {
153             $template->param( showprivateshelves => 1 );
154         } elsif ( $shelf_type eq 'publicshelves' ) {
155             $template->param( showpublicshelves => 1 );
156             $showadd = 0;
157         } else {
158             $debug and warn "Invalid 'display' param ($shelf_type)";
159         }
160     } elsif ( $loggedinuser == -1 ) {
161         $template->param( showpublicshelves => 1 );
162     } else {
163         $template->param( showprivateshelves => 1 );
164     }
165
166     my ( $okmanage, $okview );
167     my $shelfnumber = $query->param('shelfnumber') || $query->param('viewshelf');
168     if ($shelfnumber) {
169         $okmanage = ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' );
170         $okview   = ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' );
171     }
172
173     my $delflag = 0;
174
175   SWITCH: {
176         if ($op) {
177         #Saving modified shelf
178             if ( $op eq 'modifsave' ) {
179                 unless ($okmanage) {
180                         push @paramsloop, { nopermission => $shelfnumber };
181                         last SWITCH;
182                 }
183                 my $shelf = Koha::Virtualshelves->find( $shelfnumber );
184                 $shelf->shelfname($query->param('shelfname'));
185                 $shelf->sortfield($query->param('sortfield'));
186                 $shelf->allow_add($query->param('allow_add'));
187                 $shelf->allow_delete_own($query->param('allow_delete_own'));
188                 $shelf->allow_delete_other($query->param('allow_delete_other'));
189                 if( my $category = $query->param('category')) { #optional
190                     $shelf->category($category);
191                 }
192                 eval { $shelf->store };
193                 if ( $@ ) {
194                   push @paramsloop, {modifyfailure => $shelf->{shelfname}};
195                   last SWITCH;
196                 }
197
198                 if($displaymode eq "viewshelf"){
199                     print $query->redirect( $pages{$type}->{redirect} . "?viewshelf=$shelfnumber" );
200                 } elsif($displaymode eq "publicshelves"){
201                     print $query->redirect( $pages{$type}->{redirect} );
202                 } else {
203                     print $query->redirect( $pages{$type}->{redirect} . "?display=privateshelves" );
204                 }
205                 exit;
206             }
207         #Editing a shelf
208         elsif ( $op eq 'modif' ) {
209                 my $shelf = Koha::Virtualshelves->find( $shelfnumber );
210                 my $member = GetMember( 'borrowernumber' => $shelf->owner );
211                 my $ownername = defined($member) ? $member->{firstname} . " " . $member->{surname} : '';
212                 $edit = 1;
213                 $template->param(
214                     edit                => 1,
215                     display             => $displaymode,
216                     shelfnumber         => $shelf->shelfnumber,
217                     shelfname           => $shelf->shelfname,
218                     owner               => $shelf->owner,
219                     ownername           => $ownername,
220                     "category".$shelf->category => 1,
221                     category            => $shelf->category,
222                     sortfield           => $shelf->sortfield,
223                     allow_add           => $shelf->allow_add,
224                     allow_delete_own    => $shelf->allow_delete_own,
225                     allow_delete_other  => $shelf->allow_delete_other,
226                 );
227             }
228             last SWITCH;
229         }
230
231         #View a shelf
232         if ( $shelfnumber = $query->param('viewshelf') ) {
233             my $shelf = Koha::Virtualshelves->find( $shelfnumber );
234             $template->param(
235                 'DisplayMultiPlaceHold' => C4::Context->preference('DisplayMultiPlaceHold'),
236             );
237             if (C4::Context->preference('TagsEnabled')) {
238                 $template->param(TagsEnabled => 1);
239                     foreach (qw(TagsShowOnList TagsInputOnList)) {
240                     C4::Context->preference($_) and $template->param($_ => 1);
241                 }
242             }
243             #check that the user can view the shelf
244             if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) {
245                 my $items;
246                 my $tag_quantity;
247                 my $sortfield = ( $shelf->sortfield ? $shelf->sortfield : 'title' );
248                 $sortfield = $query->param('sort') || $sortfield; ## Passed in sorting overrides default sorting
249                 my $direction = $query->param('direction') || 'asc';
250                 $template->param(
251                     sort      => $sortfield,
252                     direction => $direction,
253                 );
254                 ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction );
255
256                 # get biblionumbers stored in the cart
257                 # Note that it's not use at the intranet
258                 my @cart_list;
259                 my $cart_cookie = ( $type eq 'opac' ? "bib_list" : "intranet_bib_list" );
260                 if($query->cookie($cart_cookie)){
261                     my $cart_list = $query->cookie($cart_cookie);
262                     @cart_list = split(/\//, $cart_list);
263                 }
264
265                 my $borrower = GetMember( 'borrowernumber' => $loggedinuser );
266
267                 for my $this_item (@$items) {
268                     my $biblionumber = $this_item->{'biblionumber'};
269                     my $record = GetMarcBiblio($biblionumber);
270                     if (C4::Context->preference("OPACXSLTResultsDisplay") && $type eq 'opac') {
271                         $this_item->{XSLTBloc} = XSLTParse4Display($biblionumber, $record, "OPACXSLTResultsDisplay");
272                     } elsif (C4::Context->preference("XSLTResultsDisplay") && $type eq 'intranet') {
273                         $this_item->{XSLTBloc} = XSLTParse4Display($biblionumber, $record, "XSLTResultsDisplay");
274                     }
275
276                     # the virtualshelfcontents table does not store these columns nor are they retrieved from the items
277                     # and itemtypes tables, so I'm commenting them out for now to quiet the log -crn
278                     #$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype}  }->{'imageurl'};
279                     #$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'};
280                     $this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} );
281                     $this_item->{'imageurl'}  = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'};
282                     $this_item->{'coins'}     = GetCOinSBiblio( $record );
283                     $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
284                     $this_item->{'normalized_upc'}  = GetNormalizedUPC(       $record,$marcflavour);
285                     $this_item->{'normalized_ean'}  = GetNormalizedEAN(       $record,$marcflavour);
286                     $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber($record,$marcflavour);
287                     $this_item->{'normalized_isbn'} = GetNormalizedISBN(undef,$record,$marcflavour);
288                     if(!defined($this_item->{'size'})) { $this_item->{'size'} = "" }; #TT has problems with size
289                     # Getting items infos for location display
290                     my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'});
291                     $this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} );
292                     $this_item->{'ITEM_RESULTS'} = \@items_infos;
293                     if ( grep {$_ eq $biblionumber} @cart_list) {
294                         $this_item->{'incart'} = 1;
295                     }
296
297                     if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnList')) {
298                         $this_item->{'TagLoop'} = get_tags({
299                             biblionumber=>$this_item->{'biblionumber'}, approved=>1, 'sort'=>'-weight',
300                             limit=>$tag_quantity
301                             });
302                     }
303
304                     $this_item->{'allow_onshelf_holds'} = C4::Reserves::OnShelfHoldsAllowed($this_item, $borrower);
305                 }
306                 if($type eq 'intranet'){
307                     # Build drop-down list for 'Add To:' menu...
308                     my ($totalref, $pubshelves, $barshelves)=
309                     C4::VirtualShelves::GetSomeShelfNames($loggedinuser,'COMBO',1);
310                     $template->param(
311                         addbarshelves     => $totalref->{bartotal},
312                         addbarshelvesloop => $barshelves,
313                         addpubshelves     => $totalref->{pubtotal},
314                         addpubshelvesloop => $pubshelves,
315                     );
316                 }
317                 push @paramsloop, { display => 'privateshelves' } if $shelf->category == 1;
318                 $showadd = 1;
319                 my $i = 0;
320                 my $manageshelf = ShelfPossibleAction( $loggedinuser, $shelfnumber, 'manage' );
321                 my $can_delete_shelf = ShelfPossibleAction( $loggedinuser, $shelfnumber, 'delete_shelf' );
322                 $template->param(
323                     shelfname           => $shelf->shelfname,
324                     shelfnumber         => $shelfnumber,
325                     viewshelf           => $shelfnumber,
326                     sortfield           => $sortfield,
327                     manageshelf         => $manageshelf,
328                     allowremovingitems  => ShelfPossibleAction( $loggedinuser, $shelfnumber, 'delete'),
329                     allowaddingitem     => ShelfPossibleAction( $loggedinuser, $shelfnumber, 'add'),
330                     allowdeletingshelf  => $can_delete_shelf,
331                     "category".$shelf->category => 1,
332                     category            => $shelf->category,
333                     itemsloop           => $items,
334                     showprivateshelves  => $shelf->category==1,
335                 );
336             } else {
337                 push @paramsloop, { nopermission => $shelfnumber };
338             }
339             last SWITCH;
340         }
341
342         if ( $query->param('shelves') ) {
343             my $stay = 1;
344
345             #Add a shelf
346             my $shelfname = $query->param('addshelf');
347
348             if ( $shelfname ) {
349
350                 # note: a user can always add a new shelf (except database administrator account)
351                 my $shelf = eval {
352                     Koha::Virtualshelf->new(
353                         {
354                             shelfname          => $shelfname,
355                             sortfield          => $query->param('sortfield'),
356                             category           => $query->param('category'),
357                             allow_add          => $query->param('allow_add'),
358                             allow_delete_own   => $query->param('allow_delete_own'),
359                             allow_delete_other => $query->param('allow_delete_other'),
360                             owner              => $query->param('owner'),
361                         }
362                     )->store;
363                 };
364                 if ( $@ ) {
365                     $showadd = 1;
366                     push @messages, { type => 'error', code => ref($@) };
367                 } elsif ( not $shelf ) {
368                     $showadd = 1;
369                     push @messages, { type => 'error', 'error_on_insert' };
370                 } else {
371                     print $query->redirect( $pages{$type}->{redirect} . "?viewshelf=$shelfnumber" );
372                     exit;
373                 }
374
375                 $template->param(
376                     shelfname => $shelfname,
377                 );
378                 $stay = 1;
379             }
380
381         #Deleting a shelf (asking for confirmation if it has entries)
382             foreach ( $query->param() ) {
383                 /(DEL|REMSHR)-(\d+)/ or next;
384                 $delflag = 1;
385                 my $number = $2;
386                 unless ( defined $shelflist->{$number} ) {
387                     push( @paramsloop, { unrecognized => $number } );
388                     last;
389                 }
390                 #remove a share
391                 if(/REMSHR/) {
392                     my $shelf = Koha::Virtualshelves->find( $number );
393                     $shelf->delete_share( $loggedinuser );
394                     delete $shelflist->{$number} if exists $shelflist->{$number};
395                     $stay=0;
396                     next;
397                 }
398
399                 my $can_manage = ShelfPossibleAction( $loggedinuser, $number, 'manage' );
400                 my $can_delete = ShelfPossibleAction( $loggedinuser, $number, 'delete_shelf' );
401                 unless ( $can_manage or $can_delete ) {
402                     push( @paramsloop, { nopermission => $shelfnumber } );
403                     last;
404                 }
405                 my $contents;
406                 ( $contents, $totshelves ) = GetShelfContents( $number, $shelveslimit, $shelvesoffset );
407                 if ( $totshelves > 0 ) {
408                     unless ( scalar grep { /^CONFIRM-$number$/ } $query->param() ) {
409                         if ( defined $shelflist->{$number} ) {
410                             push( @paramsloop, { need_confirm => $shelflist->{$number}->{shelfname}, count => $totshelves, single => ($totshelves eq 1 ? 1:0) } );
411                             $shelflist->{$number}->{confirm} = $number;
412                         }
413                         $stay = 0;
414                         next;
415                     }
416                 }
417                 my $name;
418                 if ( defined $shelflist->{$number} ) {
419                     $name = $shelflist->{$number}->{'shelfname'};
420                     delete $shelflist->{$number};
421                 }
422                 unless( Koha::Virtualshelves->find($number)->delete ) {
423                     push( @paramsloop, { delete_fail => $name } );
424                     last;
425                 }
426                 push( @paramsloop, { delete_ok => $name } );
427
428                 $stay = 0;
429             }
430             $showadd = 1;
431             if ($stay){
432                 $template->param( shelves => 1 );
433                 $shelves = 1;
434             }
435             last SWITCH;
436         }
437     } # end of SWITCH block
438
439     (@paramsloop) and $template->param( paramsloop => \@paramsloop );
440     $showadd      and $template->param( showadd    => 1 );
441     my @shelvesloop;
442     my @shelveslooppriv;
443     my $numberCanManage = 0;
444
445     # rebuild shelflist in case a shelf has been added
446     $shelflist = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser ) unless $delflag;
447     $totshelves = C4::VirtualShelves::GetShelfCount( $loggedinuser, $category ) unless $delflag;
448     foreach my $element ( sort { lc( $shelflist->{$a}->{'shelfname'} ) cmp lc( $shelflist->{$b}->{'shelfname'} ) } keys %$shelflist ) {
449         my %line;
450         $shelflist->{$element}->{shelf} = $element;
451         my $category  = $shelflist->{$element}->{'category'};
452         my $owner     = $shelflist->{$element}->{'owner'}||0;
453         my $canmanage = ShelfPossibleAction( $loggedinuser, $element, 'manage' );
454         my $candelete = ShelfPossibleAction( $loggedinuser, $element, 'delete_shelf' );
455         $shelflist->{$element}->{"viewcategory$category"} = 1;
456         $shelflist->{$element}->{manageshelf} = $canmanage;
457         $shelflist->{$element}->{allowdeletingshelf} = $candelete;
458         if($canmanage || ($loggedinuser && $owner==$loggedinuser)) {
459             $shelflist->{$element}->{'mine'} = 1;
460         }
461         my $member = GetMember( 'borrowernumber' => $owner );
462         $shelflist->{$element}->{ownername} = defined($member) ? $member->{firstname} . " " . $member->{surname} : '';
463         $numberCanManage++ if $canmanage;    # possibly outmoded
464         if ( $shelflist->{$element}->{'category'} eq '1' ) {
465             my $shelf = Koha::Virtualshelves->find( $element );
466             $shelflist->{$element}->{shares} = $shelf->is_shared;
467             push( @shelveslooppriv, $shelflist->{$element} );
468         } else {
469             push( @shelvesloop, $shelflist->{$element} );
470         }
471     }
472
473     my $url = $type eq 'opac' ? "/cgi-bin/koha/opac-shelves.pl" : "/cgi-bin/koha/virtualshelves/shelves.pl";
474     my %qhash = ();
475     foreach (qw(display viewshelf sortfield sort direction)) {
476         $qhash{$_} = $query->param($_) if $query->param($_);
477     }
478     ( scalar keys %qhash ) and $url .= '?' . join '&', map { "$_=$qhash{$_}" } keys %qhash;
479     if ( $shelflimit ) {
480         if ( $shelfnumber && $totitems ) {
481             $template->param(  pagination_bar => pagination_bar( $url, ( int( $totitems / $shelflimit ) ) + ( ( $totitems % $shelflimit ) > 0 ? 1 : 0 ), $itemoff, "itemoff" )  );
482         } elsif ( $totshelves ) {
483             $template->param(
484                  pagination_bar => pagination_bar( $url, ( int( $totshelves / $shelveslimit ) ) + ( ( $totshelves % $shelveslimit ) > 0 ? 1 : 0 ), $shelfoff, "shelfoff" )  );
485         }
486     }
487
488     $template->param(
489         shelveslooppriv                                                    => \@shelveslooppriv,
490         shelvesloop                                                        => \@shelvesloop,
491         shelvesloopall                                                     => [ ( @shelvesloop, @shelveslooppriv ) ],
492         numberCanManage                                                    => $numberCanManage,
493         "BiblioDefaultView" . C4::Context->preference("BiblioDefaultView") => 1,
494         csv_profiles                                                       => GetCsvProfilesLoop('marc')
495     );
496
497     unless( $shelfnumber or $shelves or $edit ) {
498         # Only used for intranet
499         $template->param( op => 'list' );
500     }
501
502     if ($shelves or    # note: this part looks duplicative, but is intentional
503         $edit
504       ) {
505         $template->param( seflag => 1 );
506         #This hack is just another argument for refactoring this script one day
507         #At this point you are adding or editing a list; if you add, then you add a private list (by default) with permissions as below; if you edit, do not pass these permissions, they must come from the database
508         $template->param( allow_add => 0, allow_delete_own => 1, allow_delete_other => 0) unless $shelfnumber;
509     }
510
511 #Next call updates the shelves for the Lists button.
512 #May not always be needed (when nothing changed), but doesn't take much.
513     my ($total, $pubshelves, $barshelves) = C4::VirtualShelves::GetSomeShelfNames($loggedinuser, 'MASTHEAD');
514     $template->param(
515             barshelves     => $total->{bartotal},
516             barshelvesloop => $barshelves,
517             pubshelves     => $total->{pubtotal},
518             pubshelvesloop => $pubshelves,
519             messages       => \@messages,
520     );
521
522     output_html_with_http_headers $query, $cookie, $template->output;
523 }
524
525 1;
526 __END__
527
528 =head1 NAME
529
530 VirtualShelves/Page.pm
531
532 =head1 DESCRIPTION
533
534 Module used for both OPAC and intranet pages.
535
536 =head1 CGI PARAMETERS
537
538 =over 4
539
540 =item C<modifyshelfcontents>
541
542 If this script has to modify the shelf content.
543
544 =item C<shelfnumber>
545
546 To know on which shelf to work.
547
548 =item C<addbarcode>
549
550 =item C<op>
551
552  Op can be:
553     * modif: show the template allowing modification of the shelves;
554     * modifsave: save changes from modif mode.
555
556 =item C<viewshelf>
557
558 Load template with 'viewshelves param' displaying the shelf's information.
559
560 =item C<shelves>
561
562 If the param shelves == 1, then add or delete a shelf.
563
564 =item C<addshelf>
565
566 If the param shelves == 1, then addshelf is the name of the shelf to add.
567
568 =back
569
570 =cut