View | Details | Raw Unified | Return to bug 8836
Collapse All | Expand All

(-)a/C4/Circulation.pm (-1 / +4 lines)
Lines 42-47 use C4::Koha qw( Link Here
42
    GetKohaAuthorisedValueLib
42
    GetKohaAuthorisedValueLib
43
);
43
);
44
use C4::Overdues qw(CalcFine UpdateFine);
44
use C4::Overdues qw(CalcFine UpdateFine);
45
use C4::RotatingCollections qw(GetCollectionItemBranches);
45
use Algorithm::CheckDigits;
46
use Algorithm::CheckDigits;
46
47
47
use Data::Dumper;
48
use Data::Dumper;
Lines 1898-1903 sub AddReturn { Link Here
1898
    my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} );
1899
    my ($datesent,$frombranch,$tobranch) = GetTransfers( $item->{'itemnumber'} );
1899
1900
1900
    # if we have a transfer to do, we update the line of transfers with the datearrived
1901
    # if we have a transfer to do, we update the line of transfers with the datearrived
1902
    my $is_in_rotating_collection = 1 if C4::RotatingCollections::isItemInAnyCollection( $item->{'itemnumber'} );
1901
    if ($datesent) {
1903
    if ($datesent) {
1902
        if ( $tobranch eq $branch ) {
1904
        if ( $tobranch eq $branch ) {
1903
            my $sth = C4::Context->dbh->prepare(
1905
            my $sth = C4::Context->dbh->prepare(
Lines 2005-2011 sub AddReturn { Link Here
2005
    #adding message if holdingbranch is non equal a userenv branch to return the document to homebranch
2007
    #adding message if holdingbranch is non equal a userenv branch to return the document to homebranch
2006
    #we check, if we don't have reserv or transfert for this document, if not, return it to homebranch .
2008
    #we check, if we don't have reserv or transfert for this document, if not, return it to homebranch .
2007
2009
2008
    if (($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $hbr) and not $messages->{'WrongTransfer'}){
2010
    if ( !$is_in_rotating_collection && ($doreturn or $messages->{'NotIssued'}) and !$resfound and ($branch ne $hbr) and not $messages->{'WrongTransfer'}){
2009
        if ( C4::Context->preference("AutomaticItemReturn"    ) or
2011
        if ( C4::Context->preference("AutomaticItemReturn"    ) or
2010
            (C4::Context->preference("UseBranchTransferLimits") and
2012
            (C4::Context->preference("UseBranchTransferLimits") and
2011
             ! IsBranchTransferAllowed($branch, $hbr, $item->{C4::Context->preference("BranchTransferLimitsType")} )
2013
             ! IsBranchTransferAllowed($branch, $hbr, $item->{C4::Context->preference("BranchTransferLimitsType")} )
Lines 2018-2023 sub AddReturn { Link Here
2018
            $messages->{'NeedsTransfer'} = 1;   # TODO: instead of 1, specify branchcode that the transfer SHOULD go to, $item->{homebranch}
2020
            $messages->{'NeedsTransfer'} = 1;   # TODO: instead of 1, specify branchcode that the transfer SHOULD go to, $item->{homebranch}
2019
        }
2021
        }
2020
    }
2022
    }
2023
2021
    return ( $doreturn, $messages, $issue, $borrower );
2024
    return ( $doreturn, $messages, $issue, $borrower );
2022
}
2025
}
2023
2026
(-)a/C4/RotatingCollections.pm (-221 / +245 lines)
Lines 1-9 Link Here
1
package C4::RotatingCollections;
1
package C4::RotatingCollections;
2
2
3
# $Id: RotatingCollections.pm,v 0.1 2007/04/20 kylemhall 
3
# $Id: RotatingCollections.pm,v 0.1 2007/04/20 kylemhall
4
4
5
# This package is inteded to keep track of what library
5
# This package is inteded to keep track of what library
6
# Items of a certain collection should be at. 
6
# Items of a certain collection should be at.
7
7
8
# Copyright 2007 Kyle Hall
8
# Copyright 2007 Kyle Hall
9
#
9
#
Lines 22-34 package C4::RotatingCollections; Link Here
22
# with Koha; if not, write to the Free Software Foundation, Inc.,
22
# with Koha; if not, write to the Free Software Foundation, Inc.,
23
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24
24
25
use strict;
25
use Modern::Perl;
26
#use warnings; FIXME - Bug 2505
27
28
require Exporter;
29
26
30
use C4::Context;
27
use C4::Context;
31
use C4::Circulation;
28
use C4::Circulation;
29
use C4::Reserves qw(GetReserveStatus);
32
30
33
use DBI;
31
use DBI;
34
32
Lines 47-69 C4::RotatingCollections - Functions for managing rotating collections Link Here
47
45
48
=cut
46
=cut
49
47
50
@ISA = qw( Exporter );
48
BEGIN {
51
@EXPORT = qw( 
49
    require Exporter;
52
  CreateCollection
50
    @ISA    = qw( Exporter );
53
  UpdateCollection
51
    @EXPORT = qw(
54
  DeleteCollection
52
      CreateCollection
55
  
53
      UpdateCollection
56
  GetItemsInCollection
54
      DeleteCollection
55
56
      GetItemsInCollection
57
58
      GetCollection
59
      GetCollections
57
60
58
  GetCollection
61
      AddItemToCollection
59
  GetCollections
62
      RemoveItemFromCollection
60
  
63
      TransferCollection
61
  AddItemToCollection
62
  RemoveItemFromCollection
63
  TransferCollection  
64
64
65
  GetCollectionItemBranches
65
      GetCollectionItemBranches
66
);
66
    );
67
}
67
68
68
=head2  CreateCollection
69
=head2  CreateCollection
69
 ( $success, $errorcode, $errormessage ) = CreateCollection( $title, $description );
70
 ( $success, $errorcode, $errormessage ) = CreateCollection( $title, $description );
Lines 81-107 C4::RotatingCollections - Functions for managing rotating collections Link Here
81
=cut
82
=cut
82
83
83
sub CreateCollection {
84
sub CreateCollection {
84
  my ( $title, $description ) = @_;
85
    my ( $title, $description ) = @_;
85
86
86
  ## Check for all neccessary parameters
87
    ## Check for all neccessary parameters
87
  if ( ! $title ) {
88
    if ( !$title ) {
88
    return ( 0, 1, "No Title Given" );
89
        return ( 0, 1, "No Title Given" );
89
  } 
90
    }
90
  if ( ! $description ) {
91
    if ( !$description ) {
91
    return ( 0, 2, "No Description Given" );
92
        return ( 0, 2, "No Description Given" );
92
  } 
93
    }
93
94
94
  my $success = 1;
95
    my $success = 1;
95
96
96
  my $dbh = C4::Context->dbh;
97
    my $dbh = C4::Context->dbh;
97
98
98
  my $sth;
99
    my $sth;
99
  $sth = $dbh->prepare("INSERT INTO collections ( colId, colTitle, colDesc ) 
100
    $sth = $dbh->prepare(
100
                        VALUES ( NULL, ?, ? )");
101
        "INSERT INTO collections ( colId, colTitle, colDesc )
101
  $sth->execute( $title, $description ) or return ( 0, 3, $sth->errstr() );
102
                        VALUES ( NULL, ?, ? )"
103
    );
104
    $sth->execute( $title, $description ) or return ( 0, 3, $sth->errstr() );
105
106
    return 1;
102
107
103
  return 1;
104
 
105
}
108
}
106
109
107
=head2 UpdateCollection
110
=head2 UpdateCollection
Lines 123-152 Updates a collection Link Here
123
=cut
126
=cut
124
127
125
sub UpdateCollection {
128
sub UpdateCollection {
126
  my ( $colId, $title, $description ) = @_;
129
    my ( $colId, $title, $description ) = @_;
127
130
128
  ## Check for all neccessary parameters
131
    ## Check for all neccessary parameters
129
  if ( ! $colId ) {
132
    if ( !$colId ) {
130
    return ( 0, 1, "No Id Given" );
133
        return ( 0, 1, "No Id Given" );
131
  }
134
    }
132
  if ( ! $title ) {
135
    if ( !$title ) {
133
    return ( 0, 2, "No Title Given" );
136
        return ( 0, 2, "No Title Given" );
134
  } 
137
    }
135
  if ( ! $description ) {
138
    if ( !$description ) {
136
    return ( 0, 3, "No Description Given" );
139
        return ( 0, 3, "No Description Given" );
137
  } 
140
    }
138
141
139
  my $dbh = C4::Context->dbh;
142
    my $dbh = C4::Context->dbh;
140
143
141
  my $sth;
144
    my $sth;
142
  $sth = $dbh->prepare("UPDATE collections
145
    $sth = $dbh->prepare(
146
        "UPDATE collections
143
                        SET 
147
                        SET 
144
                        colTitle = ?, colDesc = ? 
148
                        colTitle = ?, colDesc = ? 
145
                        WHERE colId = ?");
149
                        WHERE colId = ?"
146
  $sth->execute( $title, $description, $colId ) or return ( 0, 4, $sth->errstr() );
150
    );
147
  
151
    $sth->execute( $title, $description, $colId )
148
  return 1;
152
      or return ( 0, 4, $sth->errstr() );
149
  
153
154
    return 1;
155
150
}
156
}
151
157
152
=head2 DeleteCollection
158
=head2 DeleteCollection
Lines 165-185 sub UpdateCollection { Link Here
165
=cut
171
=cut
166
172
167
sub DeleteCollection {
173
sub DeleteCollection {
168
  my ( $colId ) = @_;
174
    my ($colId) = @_;
175
176
    ## Paramter check
177
    if ( !$colId ) {
178
        return ( 0, 1, "No Collection Id Given" );
179
    }
169
180
170
  ## Paramter check
181
    my $dbh = C4::Context->dbh;
171
  if ( ! $colId ) {
172
    return ( 0, 1, "No Collection Id Given" );;
173
  }
174
  
175
  my $dbh = C4::Context->dbh;
176
182
177
  my $sth;
183
    my $sth;
178
184
179
  $sth = $dbh->prepare("DELETE FROM collections WHERE colId = ?");
185
    $sth = $dbh->prepare("DELETE FROM collections WHERE colId = ?");
180
  $sth->execute( $colId ) or return ( 0, 4, $sth->errstr() );
186
    $sth->execute($colId) or return ( 0, 4, $sth->errstr() );
181
187
182
  return 1;
188
    return 1;
183
}
189
}
184
190
185
=head2 GetCollections
191
=head2 GetCollections
Lines 198-214 sub DeleteCollection { Link Here
198
204
199
sub GetCollections {
205
sub GetCollections {
200
206
201
  my $dbh = C4::Context->dbh;
207
    my $dbh = C4::Context->dbh;
202
  
208
203
  my $sth = $dbh->prepare("SELECT * FROM collections");
209
    my $sth = $dbh->prepare("SELECT * FROM collections");
204
  $sth->execute() or return ( 1, $sth->errstr() );
210
    $sth->execute() or return ( 1, $sth->errstr() );
205
  
211
206
  my @results;
212
    my @results;
207
  while ( my $row = $sth->fetchrow_hashref ) {
213
    while ( my $row = $sth->fetchrow_hashref ) {
208
    push( @results , $row );
214
        push( @results, $row );
209
  }
215
    }
210
  
216
211
  return \@results;
217
    return \@results;
212
}
218
}
213
219
214
=head2 GetItemsInCollection
220
=head2 GetItemsInCollection
Lines 229-244 sub GetCollections { Link Here
229
=cut
235
=cut
230
236
231
sub GetItemsInCollection {
237
sub GetItemsInCollection {
232
  my ( $colId ) = @_;
238
    my ($colId) = @_;
239
240
    ## Paramter check
241
    if ( !$colId ) {
242
        return ( 0, 0, 1, "No Collection Id Given" );
243
    }
233
244
234
  ## Paramter check
245
    my $dbh = C4::Context->dbh;
235
  if ( ! $colId ) {
236
    return ( 0, 0, 1, "No Collection Id Given" );;
237
  }
238
246
239
  my $dbh = C4::Context->dbh;
247
    my $sth = $dbh->prepare(
240
  
248
        "SELECT
241
  my $sth = $dbh->prepare("SELECT 
242
                             biblio.title,
249
                             biblio.title,
243
                             items.itemcallnumber,
250
                             items.itemcallnumber,
244
                             items.barcode
251
                             items.barcode
Lines 246-260 sub GetItemsInCollection { Link Here
246
                           WHERE collections.colId = collections_tracking.colId
253
                           WHERE collections.colId = collections_tracking.colId
247
                           AND collections_tracking.itemnumber = items.itemnumber
254
                           AND collections_tracking.itemnumber = items.itemnumber
248
                           AND items.biblionumber = biblio.biblionumber
255
                           AND items.biblionumber = biblio.biblionumber
249
                           AND collections.colId = ? ORDER BY biblio.title");
256
                           AND collections.colId = ? ORDER BY biblio.title"
250
  $sth->execute( $colId ) or return ( 0, 0, 2, $sth->errstr() );
257
    );
251
  
258
    $sth->execute($colId) or return ( 0, 0, 2, $sth->errstr() );
252
  my @results;
259
253
  while ( my $row = $sth->fetchrow_hashref ) {
260
    my @results;
254
    push( @results , $row );
261
    while ( my $row = $sth->fetchrow_hashref ) {
255
  }
262
        push( @results, $row );
256
  
263
    }
257
  return \@results;
264
265
    return \@results;
258
}
266
}
259
267
260
=head2 GetCollection
268
=head2 GetCollection
Lines 271-293 Returns information about a collection Link Here
271
=cut
279
=cut
272
280
273
sub GetCollection {
281
sub GetCollection {
274
  my ( $colId ) = @_;
282
    my ($colId) = @_;
275
283
276
  my $dbh = C4::Context->dbh;
284
    my $dbh = C4::Context->dbh;
277
285
278
  my ( $sth, @results );
286
    my ( $sth, @results );
279
  $sth = $dbh->prepare("SELECT * FROM collections WHERE colId = ?");
287
    $sth = $dbh->prepare("SELECT * FROM collections WHERE colId = ?");
280
  $sth->execute( $colId ) or return 0;
288
    $sth->execute($colId) or return 0;
281
    
289
282
  my $row = $sth->fetchrow_hashref;
290
    my $row = $sth->fetchrow_hashref;
283
  
291
284
  return (
292
    return (
285
      $$row{'colId'},
293
        $$row{'colId'},   $$row{'colTitle'},
286
      $$row{'colTitle'},
294
        $$row{'colDesc'}, $$row{'colBranchcode'}
287
      $$row{'colDesc'},
295
    );
288
      $$row{'colBranchcode'}
296
289
  );
290
    
291
}
297
}
292
298
293
=head2 AddItemToCollection
299
=head2 AddItemToCollection
Lines 307-337 Adds an item to a rotating collection. Link Here
307
=cut
313
=cut
308
314
309
sub AddItemToCollection {
315
sub AddItemToCollection {
310
  my ( $colId, $itemnumber ) = @_;
316
    my ( $colId, $itemnumber ) = @_;
311
317
312
  ## Check for all neccessary parameters
318
    ## Check for all neccessary parameters
313
  if ( ! $colId ) {
319
    if ( !$colId ) {
314
    return ( 0, 1, "No Collection Given" );
320
        return ( 0, 1, "No Collection Given" );
315
  } 
321
    }
316
  if ( ! $itemnumber ) {
322
    if ( !$itemnumber ) {
317
    return ( 0, 2, "No Itemnumber Given" );
323
        return ( 0, 2, "No Itemnumber Given" );
318
  } 
324
    }
319
  
325
320
  if ( isItemInThisCollection( $itemnumber, $colId ) ) {
326
    if ( isItemInThisCollection( $itemnumber, $colId ) ) {
321
    return ( 0, 2, "Item is already in the collection!" );
327
        return ( 0, 2, "Item is already in the collection!" );
322
  } elsif ( isItemInAnyCollection( $itemnumber ) ) {
328
    }
323
    return ( 0, 3, "Item is already in a different collection!" );
329
    elsif ( isItemInAnyCollection($itemnumber) ) {
324
  }
330
        return ( 0, 3, "Item is already in a different collection!" );
325
331
    }
326
  my $dbh = C4::Context->dbh;
332
327
333
    my $dbh = C4::Context->dbh;
328
  my $sth;
334
329
  $sth = $dbh->prepare("INSERT INTO collections_tracking ( collections_tracking_id, colId, itemnumber )
335
    my $sth;
330
                        VALUES ( NULL, ?, ? )");
336
    $sth = $dbh->prepare("
331
  $sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() );
337
        INSERT INTO collections_tracking (
332
338
            colId,
333
  return 1;
339
            itemnumber
334
  
340
        ) VALUES ( ?, ? )
341
    ");
342
    $sth->execute( $colId, $itemnumber ) or return ( 0, 3, $sth->errstr() );
343
344
    return 1;
345
335
}
346
}
336
347
337
=head2  RemoveItemFromCollection
348
=head2  RemoveItemFromCollection
Lines 352-376 Removes an item to a collection Link Here
352
=cut
363
=cut
353
364
354
sub RemoveItemFromCollection {
365
sub RemoveItemFromCollection {
355
  my ( $colId, $itemnumber ) = @_;
366
    my ( $colId, $itemnumber ) = @_;
367
368
    ## Check for all neccessary parameters
369
    if ( !$itemnumber ) {
370
        return ( 0, 2, "No Itemnumber Given" );
371
    }
356
372
357
  ## Check for all neccessary parameters
373
    if ( !isItemInThisCollection( $itemnumber, $colId ) ) {
358
  if ( ! $itemnumber ) {
374
        return ( 0, 2, "Item is not in the collection!" );
359
    return ( 0, 2, "No Itemnumber Given" );
375
    }
360
  } 
361
  
362
  if ( ! isItemInThisCollection( $itemnumber, $colId ) ) {
363
    return ( 0, 2, "Item is not in the collection!" );
364
  } 
365
376
366
  my $dbh = C4::Context->dbh;
377
    my $dbh = C4::Context->dbh;
367
378
368
  my $sth;
379
    my $sth;
369
  $sth = $dbh->prepare("DELETE FROM collections_tracking 
380
    $sth = $dbh->prepare(
370
                        WHERE itemnumber = ?");
381
        "DELETE FROM collections_tracking
371
  $sth->execute( $itemnumber ) or return ( 0, 3, $sth->errstr() );
382
                        WHERE itemnumber = ?"
383
    );
384
    $sth->execute($itemnumber) or return ( 0, 3, $sth->errstr() );
372
385
373
  return 1;
386
    return 1;
374
}
387
}
375
388
376
=head2 TransferCollection
389
=head2 TransferCollection
Lines 391-426 Transfers a collection to another branch Link Here
391
=cut
404
=cut
392
405
393
sub TransferCollection {
406
sub TransferCollection {
394
  my ( $colId, $colBranchcode ) = @_;
407
    my ( $colId, $colBranchcode ) = @_;
395
408
396
  ## Check for all neccessary parameters
409
    ## Check for all neccessary parameters
397
  if ( ! $colId ) {
410
    if ( !$colId ) {
398
    return ( 0, 1, "No Id Given" );
411
        return ( 0, 1, "No Id Given" );
399
  }
412
    }
400
  if ( ! $colBranchcode ) {
413
    if ( !$colBranchcode ) {
401
    return ( 0, 2, "No Branchcode Given" );
414
        return ( 0, 2, "No Branchcode Given" );
402
  } 
415
    }
403
416
404
  my $dbh = C4::Context->dbh;
417
    my $dbh = C4::Context->dbh;
405
418
406
  my $sth;
419
    my $sth;
407
  $sth = $dbh->prepare("UPDATE collections
420
    $sth = $dbh->prepare(
421
        "UPDATE collections
408
                        SET 
422
                        SET 
409
                        colBranchcode = ? 
423
                        colBranchcode = ? 
410
                        WHERE colId = ?");
424
                        WHERE colId = ?"
411
  $sth->execute( $colBranchcode, $colId ) or return ( 0, 4, $sth->errstr() );
425
    );
412
  
426
    $sth->execute( $colBranchcode, $colId ) or return ( 0, 4, $sth->errstr() );
413
  $sth = $dbh->prepare("SELECT barcode FROM items, collections_tracking 
427
414
                        WHERE items.itemnumber = collections_tracking.itemnumber
428
    $sth = $dbh->prepare(q{
415
                        AND collections_tracking.colId = ?");
429
        SELECT items.itemnumber, items.barcode FROM collections_tracking
416
  $sth->execute( $colId ) or return ( 0, 4, $sth->errstr );
430
        LEFT JOIN items ON collections_tracking.itemnumber = items.itemnumber
417
  my @results;
431
        LEFT JOIN issues ON items.itemnumber = issues.itemnumber
418
  while ( my $item = $sth->fetchrow_hashref ) {
432
        WHERE issues.borrowernumber IS NULL
419
    my ( $dotransfer, $messages, $iteminformation ) = transferbook( $colBranchcode, $item->{'barcode'}, my $ignore_reserves = 1);
433
          AND collections_tracking.colId = ?
420
  }
434
    });
421
435
    $sth->execute($colId) or return ( 0, 4, $sth->errstr );
422
  return 1;
436
    my @results;
423
  
437
    while ( my $item = $sth->fetchrow_hashref ) {
438
        transferbook( $colBranchcode, $item->{barcode},
439
            my $ignore_reserves = 1 )
440
          unless ( GetReserveStatus( $item->{itemnumber} ) eq "Waiting" );
441
    }
442
443
    return 1;
444
424
}
445
}
425
446
426
=head2 GetCollectionItemBranches
447
=head2 GetCollectionItemBranches
Lines 430-456 sub TransferCollection { Link Here
430
=cut
451
=cut
431
452
432
sub GetCollectionItemBranches {
453
sub GetCollectionItemBranches {
433
  my ( $itemnumber ) = @_;
454
    my ($itemnumber) = @_;
434
455
435
  if ( ! $itemnumber ) {
456
    if ( !$itemnumber ) {
436
    return;
457
        return;
437
  }
458
    }
438
459
439
  my $dbh = C4::Context->dbh;
460
    my $dbh = C4::Context->dbh;
440
461
441
  my ( $sth, @results );
462
    my ( $sth, @results );
442
  $sth = $dbh->prepare("SELECT holdingbranch, colBranchcode FROM items, collections, collections_tracking 
463
    $sth = $dbh->prepare(
464
"SELECT holdingbranch, colBranchcode FROM items, collections, collections_tracking
443
                        WHERE items.itemnumber = collections_tracking.itemnumber
465
                        WHERE items.itemnumber = collections_tracking.itemnumber
444
                        AND collections.colId = collections_tracking.colId
466
                        AND collections.colId = collections_tracking.colId
445
                        AND items.itemnumber = ?");
467
                        AND items.itemnumber = ?"
446
  $sth->execute( $itemnumber );
468
    );
447
    
469
    $sth->execute($itemnumber);
448
  my $row = $sth->fetchrow_hashref;
470
449
  
471
    my $row = $sth->fetchrow_hashref;
450
  return (
472
451
      $$row{'holdingbranch'},
473
    return ( $$row{'holdingbranch'}, $$row{'colBranchcode'}, );
452
      $$row{'colBranchcode'},
453
  );  
454
}
474
}
455
475
456
=head2 isItemInThisCollection
476
=head2 isItemInThisCollection
Lines 460-475 sub GetCollectionItemBranches { Link Here
460
=cut
480
=cut
461
481
462
sub isItemInThisCollection {
482
sub isItemInThisCollection {
463
  my ( $itemnumber, $colId ) = @_;
483
    my ( $itemnumber, $colId ) = @_;
464
  
484
465
  my $dbh = C4::Context->dbh;
485
    my $dbh = C4::Context->dbh;
466
  
486
467
  my $sth = $dbh->prepare("SELECT COUNT(*) as inCollection FROM collections_tracking WHERE itemnumber = ? AND colId = ?");
487
    my $sth = $dbh->prepare(
468
  $sth->execute( $itemnumber, $colId ) or return( 0 );
488
"SELECT COUNT(*) as inCollection FROM collections_tracking WHERE itemnumber = ? AND colId = ?"
469
      
489
    );
470
  my $row = $sth->fetchrow_hashref;
490
    $sth->execute( $itemnumber, $colId ) or return (0);
471
        
491
472
  return $$row{'inCollection'};
492
    my $row = $sth->fetchrow_hashref;
493
494
    return $$row{'inCollection'};
473
}
495
}
474
496
475
=head2 isItemInAnyCollection
497
=head2 isItemInAnyCollection
Lines 479-499 $inCollection = isItemInAnyCollection( $itemnumber ); Link Here
479
=cut
501
=cut
480
502
481
sub isItemInAnyCollection {
503
sub isItemInAnyCollection {
482
  my ( $itemnumber ) = @_;
504
    my ($itemnumber) = @_;
483
  
505
484
  my $dbh = C4::Context->dbh;
506
    my $dbh = C4::Context->dbh;
485
  
507
486
  my $sth = $dbh->prepare("SELECT itemnumber FROM collections_tracking WHERE itemnumber = ?");
508
    my $sth = $dbh->prepare(
487
  $sth->execute( $itemnumber ) or return( 0 );
509
        "SELECT itemnumber FROM collections_tracking WHERE itemnumber = ?");
488
      
510
    $sth->execute($itemnumber) or return (0);
489
  my $row = $sth->fetchrow_hashref;
511
490
        
512
    my $row = $sth->fetchrow_hashref;
491
  $itemnumber = $row->{itemnumber};
513
492
  if ( $itemnumber ) {
514
    $itemnumber = $row->{itemnumber};
493
    return 1;
515
    if ($itemnumber) {
494
  } else {
516
        return 1;
495
    return 0;
517
    }
496
  }
518
    else {
519
        return 0;
520
    }
497
}
521
}
498
522
499
1;
523
1;
(-)a/circ/returns.pl (-14 / +10 lines)
Lines 600-619 $template->param( Link Here
600
    BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
600
    BlockReturnOfWithdrawnItems => C4::Context->preference("BlockReturnOfWithdrawnItems"),
601
);
601
);
602
602
603
### Comment out rotating collections for now to allow it a little more time to bake
603
my $itemnumber = GetItemnumberFromBarcode( $query->param('barcode') );
604
### for 3.4; in particular, must ensure that it doesn't fight with transfers required
604
if ( $itemnumber ) {
605
### to fill hold requests
605
   my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
606
### -- Galen Charlton 2010-10-06
606
    if ( ! ( $holdingBranch eq $collectionBranch ) ) {
607
#my $itemnumber = GetItemnumberFromBarcode( $query->param('barcode') );
607
        $template->param(
608
#if ( $itemnumber ) {
608
          collectionItemNeedsTransferred => 1,
609
#   my ( $holdingBranch, $collectionBranch ) = GetCollectionItemBranches( $itemnumber );
609
          collectionBranch => GetBranchName($collectionBranch),
610
#    if ( ! ( $holdingBranch eq $collectionBranch ) ) {
610
        );
611
#        $template->param(
611
    }
612
#          collectionItemNeedsTransferred => 1,
612
}
613
#          collectionBranch => GetBranchName($collectionBranch),
614
#        );
615
#    }
616
#}                                                                                                            
617
613
618
# actually print the page!
614
# actually print the page!
619
output_html_with_http_headers $query, $cookie, $template->output;
615
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/installer/data/mysql/kohastructure.sql (-1 / +7 lines)
Lines 482-492 CREATE TABLE collections ( Link Here
482
  colId integer(11) NOT NULL auto_increment,
482
  colId integer(11) NOT NULL auto_increment,
483
  colTitle varchar(100) NOT NULL DEFAULT '',
483
  colTitle varchar(100) NOT NULL DEFAULT '',
484
  colDesc text NOT NULL,
484
  colDesc text NOT NULL,
485
  colBranchcode varchar(4) DEFAULT NULL comment 'branchcode for branch where item should be held.',
485
  colBranchcode varchar(10) DEFAULT NULL, -- 'branchcode for branch where item should be held.'
486
  PRIMARY KEY (colId)
486
  PRIMARY KEY (colId)
487
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
487
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
488
488
489
--
489
--
490
-- Constraints for table `collections`
491
--
492
ALTER TABLE `collections`
493
  ADD CONSTRAINT `collections_ibfk_1` FOREIGN KEY (`colBranchcode`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE;
494
495
--
490
-- Table: collections_tracking
496
-- Table: collections_tracking
491
--
497
--
492
DROP TABLE IF EXISTS collections_tracking;
498
DROP TABLE IF EXISTS collections_tracking;
(-)a/installer/data/mysql/updatedatabase.pl (-33 / +111 lines)
Lines 2741-2747 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
2741
$DBversion = '3.01.00.066';
2741
$DBversion = '3.01.00.066';
2742
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
2742
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
2743
    $dbh->do('ALTER TABLE issuingrules ADD COLUMN `reservesallowed` smallint(6) NOT NULL default "0" AFTER `renewalsallowed`;');
2743
    $dbh->do('ALTER TABLE issuingrules ADD COLUMN `reservesallowed` smallint(6) NOT NULL default "0" AFTER `renewalsallowed`;');
2744
    
2744
2745
    my $maxreserves = C4::Context->preference('maxreserves');
2745
    my $maxreserves = C4::Context->preference('maxreserves');
2746
    $sth = $dbh->prepare('UPDATE issuingrules SET reservesallowed = ?;');
2746
    $sth = $dbh->prepare('UPDATE issuingrules SET reservesallowed = ?;');
2747
    $sth->execute($maxreserves);
2747
    $sth->execute($maxreserves);
Lines 2948-2954 $$maxbudgetid[0] = 0 if !$$maxbudgetid[0]; Link Here
2948
    $dbh->do(<<BUDGETAUTOINCREMENT);
2948
    $dbh->do(<<BUDGETAUTOINCREMENT);
2949
ALTER TABLE aqbudget AUTO_INCREMENT=$$maxbudgetid[0]
2949
ALTER TABLE aqbudget AUTO_INCREMENT=$$maxbudgetid[0]
2950
BUDGETAUTOINCREMENT
2950
BUDGETAUTOINCREMENT
2951
    
2951
2952
    $dbh->do(<<BUDGETNAME);
2952
    $dbh->do(<<BUDGETNAME);
2953
ALTER TABLE aqbudget RENAME `aqbudgets`
2953
ALTER TABLE aqbudget RENAME `aqbudgets`
2954
BUDGETNAME
2954
BUDGETNAME
Lines 3326-3335 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3326
$DBversion = "3.01.00.101";
3326
$DBversion = "3.01.00.101";
3327
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3327
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3328
	$dbh->do(
3328
	$dbh->do(
3329
        "INSERT INTO systempreferences 
3329
        "INSERT INTO systempreferences
3330
           (variable, value, options, explanation, type)
3330
           (variable, value, options, explanation, type)
3331
         VALUES (
3331
         VALUES (
3332
            'OverdueNoticeBcc', '', '', 
3332
            'OverdueNoticeBcc', '', '',
3333
            'Email address to Bcc outgoing notices sent by email',
3333
            'Email address to Bcc outgoing notices sent by email',
3334
            'free')
3334
            'free')
3335
         ");
3335
         ");
Lines 3364-3370 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3364
    if ($borrnotes_count == 0) {
3364
    if ($borrnotes_count == 0) {
3365
        $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('BOR_NOTES','ADDR','Address Notes')");
3365
        $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('BOR_NOTES','ADDR','Address Notes')");
3366
    }
3366
    }
3367
    
3367
3368
    $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOC','CART','Book Cart')");
3368
    $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOC','CART','Book Cart')");
3369
    $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOC','PROC','Processing Center')");
3369
    $dbh->do("INSERT INTO authorised_values (category,authorised_value,lib) VALUES ('LOC','PROC','Processing Center')");
3370
3370
Lines 3384-3390 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3384
        PRIMARY KEY  (`colId`)
3384
        PRIMARY KEY  (`colId`)
3385
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3385
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3386
    ");
3386
    ");
3387
       
3387
3388
    $dbh->do("
3388
    $dbh->do("
3389
      CREATE TABLE `collections_tracking` (
3389
      CREATE TABLE `collections_tracking` (
3390
        `ctId` int(11) NOT NULL auto_increment,
3390
        `ctId` int(11) NOT NULL auto_increment,
Lines 3394-3400 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3394
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3394
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3395
    ");
3395
    ");
3396
    $dbh->do("
3396
    $dbh->do("
3397
        INSERT INTO permissions (module_bit, code, description) 
3397
        INSERT INTO permissions (module_bit, code, description)
3398
        VALUES ( 13, 'rotating_collections', 'Manage Rotating collections')" );
3398
        VALUES ( 13, 'rotating_collections', 'Manage Rotating collections')" );
3399
	print "Upgrade to $DBversion done (added collection and collection_tracking tables for rotating collections functionality)\n";
3399
	print "Upgrade to $DBversion done (added collection and collection_tracking tables for rotating collections functionality)\n";
3400
    SetVersion ($DBversion);
3400
    SetVersion ($DBversion);
Lines 3419-3425 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3419
	$dbh->do(qq{
3419
	$dbh->do(qq{
3420
	ALTER TABLE `export_format` ADD `csv_separator` VARCHAR( 2 ) NOT NULL AFTER `marcfields` ,
3420
	ALTER TABLE `export_format` ADD `csv_separator` VARCHAR( 2 ) NOT NULL AFTER `marcfields` ,
3421
	ADD `field_separator` VARCHAR( 2 ) NOT NULL AFTER `csv_separator` ,
3421
	ADD `field_separator` VARCHAR( 2 ) NOT NULL AFTER `csv_separator` ,
3422
	ADD `subfield_separator` VARCHAR( 2 ) NOT NULL AFTER `field_separator` 
3422
	ADD `subfield_separator` VARCHAR( 2 ) NOT NULL AFTER `field_separator`
3423
	});
3423
	});
3424
	print "Upgrade to $DBversion done (added separators for csv export)\n";
3424
	print "Upgrade to $DBversion done (added separators for csv export)\n";
3425
    SetVersion ($DBversion);
3425
    SetVersion ($DBversion);
Lines 3592-3598 $DBversion = "3.01.00.126"; Link Here
3592
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3592
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3593
	$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ILS-DI','0','Enable ILS-DI services. See http://your.opac.name/cgi-bin/koha/ilsdi.pl for online documentation.','','YesNo')");
3593
	$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ILS-DI','0','Enable ILS-DI services. See http://your.opac.name/cgi-bin/koha/ilsdi.pl for online documentation.','','YesNo')");
3594
	$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ILS-DI:AuthorizedIPs','127.0.0.1','A comma separated list of IP addresses authorized to access the web services.','','free')");
3594
	$dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('ILS-DI:AuthorizedIPs','127.0.0.1','A comma separated list of IP addresses authorized to access the web services.','','free')");
3595
	
3595
3596
    print "Upgrade to $DBversion done (Adding ILS-DI updates and ILS-DI:AuthorizedIPs)\n";
3596
    print "Upgrade to $DBversion done (Adding ILS-DI updates and ILS-DI:AuthorizedIPs)\n";
3597
    SetVersion ($DBversion);
3597
    SetVersion ($DBversion);
3598
}
3598
}
Lines 3819-3839 if (C4::Context->preference("Version") < TransformToNum($DBversion) && $original Link Here
3819
    $dbh->do("ALTER TABLE subscriptionroutinglist MODIFY COLUMN `borrowernumber` int(11) NOT NULL;");
3819
    $dbh->do("ALTER TABLE subscriptionroutinglist MODIFY COLUMN `borrowernumber` int(11) NOT NULL;");
3820
    $dbh->do("DELETE FROM subscriptionroutinglist WHERE subscriptionid IS NULL;");
3820
    $dbh->do("DELETE FROM subscriptionroutinglist WHERE subscriptionid IS NULL;");
3821
    $dbh->do("ALTER TABLE subscriptionroutinglist MODIFY COLUMN `subscriptionid` int(11) NOT NULL;");
3821
    $dbh->do("ALTER TABLE subscriptionroutinglist MODIFY COLUMN `subscriptionid` int(11) NOT NULL;");
3822
    $dbh->do("CREATE TEMPORARY TABLE del_subscriptionroutinglist 
3822
    $dbh->do("CREATE TEMPORARY TABLE del_subscriptionroutinglist
3823
              SELECT s1.routingid FROM subscriptionroutinglist s1
3823
              SELECT s1.routingid FROM subscriptionroutinglist s1
3824
              WHERE EXISTS (SELECT * FROM subscriptionroutinglist s2
3824
              WHERE EXISTS (SELECT * FROM subscriptionroutinglist s2
3825
                            WHERE s2.borrowernumber = s1.borrowernumber
3825
                            WHERE s2.borrowernumber = s1.borrowernumber
3826
                            AND   s2.subscriptionid = s1.subscriptionid 
3826
                            AND   s2.subscriptionid = s1.subscriptionid
3827
                            AND   s2.routingid < s1.routingid);");
3827
                            AND   s2.routingid < s1.routingid);");
3828
    $dbh->do("DELETE FROM subscriptionroutinglist
3828
    $dbh->do("DELETE FROM subscriptionroutinglist
3829
              WHERE routingid IN (SELECT routingid FROM del_subscriptionroutinglist);");
3829
              WHERE routingid IN (SELECT routingid FROM del_subscriptionroutinglist);");
3830
    $dbh->do("ALTER TABLE subscriptionroutinglist ADD UNIQUE (subscriptionid, borrowernumber);");
3830
    $dbh->do("ALTER TABLE subscriptionroutinglist ADD UNIQUE (subscriptionid, borrowernumber);");
3831
    $dbh->do("ALTER TABLE subscriptionroutinglist 
3831
    $dbh->do("ALTER TABLE subscriptionroutinglist
3832
                ADD CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`) 
3832
                ADD CONSTRAINT `subscriptionroutinglist_ibfk_1` FOREIGN KEY (`borrowernumber`)
3833
                REFERENCES `borrowers` (`borrowernumber`)
3833
                REFERENCES `borrowers` (`borrowernumber`)
3834
                ON DELETE CASCADE ON UPDATE CASCADE");
3834
                ON DELETE CASCADE ON UPDATE CASCADE");
3835
    $dbh->do("ALTER TABLE subscriptionroutinglist 
3835
    $dbh->do("ALTER TABLE subscriptionroutinglist
3836
                ADD CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`) 
3836
                ADD CONSTRAINT `subscriptionroutinglist_ibfk_2` FOREIGN KEY (`subscriptionid`)
3837
                REFERENCES `subscription` (`subscriptionid`)
3837
                REFERENCES `subscription` (`subscriptionid`)
3838
                ON DELETE CASCADE ON UPDATE CASCADE");
3838
                ON DELETE CASCADE ON UPDATE CASCADE");
3839
    print "Upgrade to $DBversion done (Make subscriptionroutinglist more strict)\n";
3839
    print "Upgrade to $DBversion done (Make subscriptionroutinglist more strict)\n";
Lines 4102-4108 if (C4::Context->preference("Version") < TransformToNum($DBversion) && $original Link Here
4102
    SetVersion ($DBversion);
4102
    SetVersion ($DBversion);
4103
}
4103
}
4104
4104
4105
$DBversion = '3.03.00.027'; 
4105
$DBversion = '3.03.00.027';
4106
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4106
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4107
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('displayFacetCount', '0', NULL, NULL, 'YesNo')");
4107
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('displayFacetCount', '0', NULL, NULL, 'YesNo')");
4108
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('maxRecordsForFacets', '20', NULL, NULL, 'Integer')");
4108
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('maxRecordsForFacets', '20', NULL, NULL, 'Integer')");
Lines 4136-4142 $DBversion = "3.03.00.031"; Link Here
4136
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4136
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4137
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('FineNotifyAtCheckin',0,'If ON notify librarians of overdue fines on the items they are checking in.',NULL,'YesNo');");
4137
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('FineNotifyAtCheckin',0,'If ON notify librarians of overdue fines on the items they are checking in.',NULL,'YesNo');");
4138
    print "Upgrade to $DBversion done (Add syspref FineNotifyAtCheckin)\n";
4138
    print "Upgrade to $DBversion done (Add syspref FineNotifyAtCheckin)\n";
4139
    SetVersion ($DBversion);    
4139
    SetVersion ($DBversion);
4140
}
4140
}
4141
4141
4142
$DBversion = '3.03.00.032';
4142
$DBversion = '3.03.00.032';
Lines 4205-4211 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4205
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC',NULL,'YesNo');");
4205
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewer',1,'If ON, name of reviewer will be shown above comments in OPAC',NULL,'YesNo');");
4206
    print "Upgrade to $DBversion done (Add syspref ShowReviewer)\n";
4206
    print "Upgrade to $DBversion done (Add syspref ShowReviewer)\n";
4207
}
4207
}
4208
    
4208
4209
$DBversion = "3.03.00.040";
4209
$DBversion = "3.03.00.040";
4210
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4210
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4211
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('UseControlNumber',0,'If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','','YesNo');");
4211
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('UseControlNumber',0,'If ON, record control number (w subfields) and control number (001) are used for linking of bibliographic records.','','YesNo');");
Lines 4325-4331 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4325
    $dbh->do("UPDATE message_attributes SET message_name = 'Advance_Notice' WHERE message_name='Advance Notice'");
4325
    $dbh->do("UPDATE message_attributes SET message_name = 'Advance_Notice' WHERE message_name='Advance Notice'");
4326
    $dbh->do("UPDATE message_attributes SET message_name = 'Hold_Filled' WHERE message_name='Hold Filled'");
4326
    $dbh->do("UPDATE message_attributes SET message_name = 'Hold_Filled' WHERE message_name='Hold Filled'");
4327
    $dbh->do("UPDATE message_attributes SET message_name = 'Item_Check_in' WHERE message_name='Item Check-in'");
4327
    $dbh->do("UPDATE message_attributes SET message_name = 'Item_Check_in' WHERE message_name='Item Check-in'");
4328
    $dbh->do("UPDATE message_attributes SET message_name = 'Item_Checkout' WHERE message_name='Item Checkout'");    
4328
    $dbh->do("UPDATE message_attributes SET message_name = 'Item_Checkout' WHERE message_name='Item Checkout'");
4329
    SetVersion ($DBversion);
4329
    SetVersion ($DBversion);
4330
}
4330
}
4331
4331
Lines 4372-4380 $DBversion = "3.05.00.004"; Link Here
4372
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4372
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4373
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC',NULL,'YesNo');");
4373
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC',NULL,'YesNo');");
4374
    print "Upgrade to $DBversion done (Add syspref ShowReviewerPhoto)\n";
4374
    print "Upgrade to $DBversion done (Add syspref ShowReviewerPhoto)\n";
4375
    SetVersion($DBversion);    
4375
    SetVersion($DBversion);
4376
}
4376
}
4377
    
4377
4378
$DBversion = "3.05.00.005";
4378
$DBversion = "3.05.00.005";
4379
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4379
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4380
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice');");
4380
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('BasketConfirmations', '1', 'When closing or reopening a basket,', 'always ask for confirmation.|do not ask for confirmation.', 'Choice');");
Lines 4382-4388 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4382
    SetVersion($DBversion);
4382
    SetVersion($DBversion);
4383
}
4383
}
4384
4384
4385
$DBversion = "3.05.00.006"; 
4385
$DBversion = "3.05.00.006";
4386
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4386
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4387
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn           | a|a     d', NULL, NULL, 'Textarea')");
4387
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('MARCAuthorityControlField008', '|| aca||aabn           | a|a     d', NULL, NULL, 'Textarea')");
4388
    print "Upgrade to $DBversion done (Add syspref MARCAuthorityControlField008)\n";
4388
    print "Upgrade to $DBversion done (Add syspref MARCAuthorityControlField008)\n";
Lines 4451-4457 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4451
    print "Upgrade to $DBversion done (add OPACResultsSidebar syspref (enh 6165))\n";
4451
    print "Upgrade to $DBversion done (add OPACResultsSidebar syspref (enh 6165))\n";
4452
    SetVersion($DBversion);
4452
    SetVersion($DBversion);
4453
}
4453
}
4454
    
4454
4455
$DBversion = "3.05.00.012";
4455
$DBversion = "3.05.00.012";
4456
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4456
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4457
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RecordLocalUseOnReturn',0,'If ON, statistically record returns of unissued items as local use, instead of return',NULL,'YesNo')");
4457
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('RecordLocalUseOnReturn',0,'If ON, statistically record returns of unissued items as local use, instead of return',NULL,'YesNo')");
Lines 4532-4542 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4532
$DBversion = "3.05.00.021";
4532
$DBversion = "3.05.00.021";
4533
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4533
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4534
    $dbh->do("ALTER TABLE borrower_attribute_types ADD COLUMN display_checkout TINYINT(1) NOT NULL DEFAULT '0';");
4534
    $dbh->do("ALTER TABLE borrower_attribute_types ADD COLUMN display_checkout TINYINT(1) NOT NULL DEFAULT '0';");
4535
    print "Upgrade to $DBversion done (Added a display_checkout field in borrower_attribute_types table)\n"; 
4535
    print "Upgrade to $DBversion done (Added a display_checkout field in borrower_attribute_types table)\n";
4536
    SetVersion($DBversion);
4536
    SetVersion($DBversion);
4537
}
4537
}
4538
4538
4539
$DBversion = "3.05.00.022"; 
4539
$DBversion = "3.05.00.022";
4540
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4540
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4541
    $dbh->do("CREATE TABLE need_merge_authorities (id int NOT NULL auto_increment PRIMARY KEY, authid bigint NOT NULL, done tinyint DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=utf8");
4541
    $dbh->do("CREATE TABLE need_merge_authorities (id int NOT NULL auto_increment PRIMARY KEY, authid bigint NOT NULL, done tinyint DEFAULT 0) ENGINE=InnoDB DEFAULT CHARSET=utf8");
4542
    print "Upgrade to $DBversion done (6094: Fixing ModAuthority problems, add a need_merge_authorities table)\n";
4542
    print "Upgrade to $DBversion done (6094: Fixing ModAuthority problems, add a need_merge_authorities table)\n";
Lines 5349-5372 $DBversion ="3.09.00.014"; Link Here
5349
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5349
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5350
    # add phone message transport type
5350
    # add phone message transport type
5351
    $dbh->do("INSERT INTO message_transport_types (message_transport_type) VALUES ('phone')");
5351
    $dbh->do("INSERT INTO message_transport_types (message_transport_type) VALUES ('phone')");
5352
    
5352
5353
    # adds HOLD_PHONE and PREDUE_PHONE letters (as placeholders)
5353
    # adds HOLD_PHONE and PREDUE_PHONE letters (as placeholders)
5354
    $dbh->do("INSERT INTO letter (module, code, name, title, content) VALUES
5354
    $dbh->do("INSERT INTO letter (module, code, name, title, content) VALUES
5355
              ('reserves', 'HOLD_PHONE', 'Item Available for Pick-up (phone notice)', 'Item Available for Pick-up (phone notice)', 'Your item is available for pickup'),
5355
              ('reserves', 'HOLD_PHONE', 'Item Available for Pick-up (phone notice)', 'Item Available for Pick-up (phone notice)', 'Your item is available for pickup'),
5356
              ('circulation', 'PREDUE_PHONE', 'Advance Notice of Item Due (phone notice)', 'Advance Notice of Item Due (phone notice)', 'Your item is due soon'),
5356
              ('circulation', 'PREDUE_PHONE', 'Advance Notice of Item Due (phone notice)', 'Advance Notice of Item Due (phone notice)', 'Your item is due soon'),
5357
              ('circulation', 'OVERDUE_PHONE', 'Overdue Notice (phone notice)', 'Overdue Notice (phone notice)', 'Your item is overdue')
5357
              ('circulation', 'OVERDUE_PHONE', 'Overdue Notice (phone notice)', 'Overdue Notice (phone notice)', 'Your item is overdue')
5358
              ");
5358
              ");
5359
    
5359
5360
    # add phone notifications to patron message preferences options
5360
    # add phone notifications to patron message preferences options
5361
    $dbh->do("INSERT INTO message_transports
5361
    $dbh->do("INSERT INTO message_transports
5362
             (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES
5362
             (message_attribute_id, message_transport_type, is_digest, letter_module, letter_code) VALUES
5363
             (4, 'phone', 0, 'reserves', 'HOLD_PHONE'),
5363
             (4, 'phone', 0, 'reserves', 'HOLD_PHONE'),
5364
             (2, 'phone', 0, 'circulation', 'PREDUE_PHONE')
5364
             (2, 'phone', 0, 'circulation', 'PREDUE_PHONE')
5365
             ");
5365
             ");
5366
    
5366
5367
    # add TalkingTechItivaPhoneNotification syspref
5367
    # add TalkingTechItivaPhoneNotification syspref
5368
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('TalkingTechItivaPhoneNotification',0,'If ON, enables Talking Tech I-tiva phone notifications',NULL,'YesNo');");
5368
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('TalkingTechItivaPhoneNotification',0,'If ON, enables Talking Tech I-tiva phone notifications',NULL,'YesNo');");
5369
    
5369
5370
    print "Upgrade done (Support for Talking Tech i-tiva phone notification system)\n";
5370
    print "Upgrade done (Support for Talking Tech i-tiva phone notification system)\n";
5371
    SetVersion($DBversion);
5371
    SetVersion($DBversion);
5372
}
5372
}
Lines 5948-5954 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5948
                ADD COLUMN record_type enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio'");
5948
                ADD COLUMN record_type enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio'");
5949
    $dbh->do("UPDATE import_batches SET record_type='auth' WHERE import_batch_id IN
5949
    $dbh->do("UPDATE import_batches SET record_type='auth' WHERE import_batch_id IN
5950
                (SELECT import_batch_id FROM import_records WHERE record_type='auth')");
5950
                (SELECT import_batch_id FROM import_records WHERE record_type='auth')");
5951
    
5951
5952
    print "Upgrade to $DBversion done (Added support for staging authorities)\n";
5952
    print "Upgrade to $DBversion done (Added support for staging authorities)\n";
5953
    SetVersion ($DBversion);
5953
    SetVersion ($DBversion);
5954
}
5954
}
Lines 7204-7212 if ( CheckVersion($DBversion) ) { Link Here
7204
$DBversion = "3.13.00.029";
7204
$DBversion = "3.13.00.029";
7205
if ( CheckVersion($DBversion) ) {
7205
if ( CheckVersion($DBversion) ) {
7206
    $dbh->do(q{
7206
    $dbh->do(q{
7207
        INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type ) 
7207
        INSERT IGNORE INTO export_format( profile, description, content, csv_separator, type )
7208
        VALUES ( "issues to claim", "efault CSV export for serial issue claims",
7208
        VALUES ( "issues to claim", "efault CSV export for serial issue claims",
7209
                "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate", 
7209
                "SUPPLIER=aqbooksellers.name|TITLE=subscription.title|ISSUE NUMBER=serial.serialseq|LATE SINCE=serial.planneddate",
7210
                ",", "sql" )
7210
                ",", "sql" )
7211
    });
7211
    });
7212
    print "Upgrade to $DBversion done (Bug 10854: Add the default CSV profile for claiming issues)\n";
7212
    print "Upgrade to $DBversion done (Bug 10854: Add the default CSV profile for claiming issues)\n";
Lines 7317-7323 if ( CheckVersion($DBversion) ) { Link Here
7317
                SELECT DISTINCT(parent_ordernumber)
7317
                SELECT DISTINCT(parent_ordernumber)
7318
                FROM aqorders
7318
                FROM aqorders
7319
                WHERE ordernumber != parent_ordernumber
7319
                WHERE ordernumber != parent_ordernumber
7320
            ) AS aq 
7320
            ) AS aq
7321
        )
7321
        )
7322
        AND basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)
7322
        AND basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)
7323
    });
7323
    });
Lines 8952-8957 if ( CheckVersion($DBversion) ) { Link Here
8952
    SetVersion($DBversion);
8952
    SetVersion($DBversion);
8953
}
8953
}
8954
8954
8955
$DBversion = "3.17.00.036";
8956
if ( CheckVersion($DBversion) ) {
8957
    $dbh->do("DELETE FROM systempreferences WHERE variable='OpacShowLibrariesPulldownMobile'");
8958
    print "Upgrade to $DBversion done ( Bug 12513 - PROG/CCSR deprecation: Remove OpacShowLibrariesPulldownMobile system preference )\n";
8959
    SetVersion ($DBversion);
8960
}
8961
8962
$DBversion = "3.17.00.037";
8963
if ( CheckVersion($DBversion) ) {
8964
    $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMainUserBlockMobile'");
8965
    print "Upgrade to $DBversion done ( Bug 12246 - PROG/CCSR deprecation: Remove OpacMainUserBlockMobile system preference )\n";
8966
    SetVersion ($DBversion);
8967
}
8968
8969
$DBversion = "3.17.00.038";
8970
if ( CheckVersion($DBversion) ) {
8971
    $dbh->do("DELETE FROM systempreferences WHERE variable='OPACMobileUserCSS'");
8972
    print "Upgrade to $DBversion done ( Bug 12245 - PROG/CCSR deprecation: Remove OPACMobileUserCSS system preference )\n";
8973
    SetVersion ($DBversion);
8974
}
8975
8976
$DBversion = "3.17.00.039";
8977
if ( CheckVersion($DBversion) ) {
8978
    $dbh->do("INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES
8979
    ('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes')");
8980
    print "Upgrade to $DBversion done (Bug 12539 - PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm)\n";
8981
    SetVersion ($DBversion);
8982
}
8983
8984
$DBversion = "3.17.00.040";
8985
if ( CheckVersion($DBversion) ) {
8986
    my $opac_theme = C4::Context->preference( 'opacthemes' );
8987
    if ( $opac_theme eq 'prog' || $opac_theme eq 'ccsr' ) {
8988
        $dbh->do("UPDATE systempreferences SET value='bootstrap' WHERE variable='opacthemes'");
8989
    }
8990
    print "Upgrade to $DBversion done (Bug 12223: 'prog' and 'ccsr' themes removed)\n";
8991
    SetVersion($DBversion);
8992
}
8993
8994
$DBversion = "3.17.00.041";
8995
if ( CheckVersion($DBversion) ) {
8996
    print "Upgrade to $DBversion done (Bug 11346: Deprecate the 'prog' and 'CCSR' themes)\n";
8997
    SetVersion($DBversion);
8998
}
8999
9000
$DBversion = "3.17.00.042";
9001
if ( CheckVersion($DBversion) ) {
9002
    $dbh->do("DELETE FROM systempreferences WHERE variable='yuipath'");
9003
    print "Upgrade to $DBversion done (Bug 12494: Remove yuipath system preference)\n";
9004
    SetVersion ($DBversion);
9005
}
9006
9007
$DBversion = "3.17.00.043";
9008
if ( CheckVersion($DBversion) ) {
9009
    $dbh->do("
9010
        ALTER TABLE aqorders
9011
        ADD COLUMN cancellationreason TEXT DEFAULT NULL AFTER datecancellationprinted
9012
    ");
9013
    print "Upgrade to $DBversion done (Bug 7162: Add aqorders.cancellationreason)\n";
9014
    SetVersion ($DBversion);
9015
}
9016
9017
$DBversion = "3.17.00.XXX";
9018
if ( CheckVersion($DBversion) ) {
9019
    $dbh->do(q{
9020
        ALTER TABLE collections CHANGE colBranchcode colBranchcode VARCHAR( 10 ) NULL DEFAULT NULL
9021
    });
9022
    $dbh->do(q{
9023
        ALTER TABLE collections ADD INDEX ( colBranchcode )
9024
    });
9025
    $dbh->do(q{
9026
        ALTER TABLE collections
9027
            ADD CONSTRAINT collections_ibfk_1 FOREIGN KEY (colBranchcode) REFERENCES branches (branchcode) ON DELETE CASCADE ON UPDATE CASCADE
9028
    });
9029
    print "Upgrade to $DBversion done (Bug 8836 - Resurrect Rotating Collections)\n";
9030
    SetVersion($DBversion);
9031
}
9032
8955
=head1 FUNCTIONS
9033
=head1 FUNCTIONS
8956
9034
8957
=head2 TableExists($table)
9035
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt (-1 / +1 lines)
Lines 109-115 $(document).ready(function () { Link Here
109
[% END %]
109
[% END %]
110
110
111
[% IF ( collectionItemNeedsTransferred ) %]
111
[% IF ( collectionItemNeedsTransferred ) %]
112
	<div id="rotating-collection" class="dialog message">This item is part of a Rotating Collection and needs to be Transferred to [% collectionBranch %]</div>
112
 <div id="rotating-collection" class="dialog message">This item is part of a rotating collection and needs to be transferred to [% collectionBranch %]</div>
113
[% END %]
113
[% END %]
114
114
115
<!-- Patron has fines -->
115
<!-- Patron has fines -->
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/addItems.tt (+7 lines)
Lines 1-6 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Rotating collections &rsaquo; Add/Remove items</title>
2
<title>Koha &rsaquo; Tools &rsaquo; Rotating collections &rsaquo; Add/Remove items</title>
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
<script type="text/javascript">
5
    //<![CDATA[
6
        $( document ).ready(function() {
7
            $("#barcode").focus();
8
        });
9
    //]]>
10
</script>
4
</head>
11
</head>
5
<body>
12
<body>
6
[% INCLUDE 'header.inc' %]
13
[% INCLUDE 'header.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/rotating_collections/editCollections.tt (-3 / +7 lines)
Lines 44-56 Link Here
44
      <div>
44
      <div>
45
        [% IF ( collectionsLoop ) %]
45
        [% IF ( collectionsLoop ) %]
46
          <table>
46
          <table>
47
           <thead>
47
            <tr>
48
            <tr>
48
              <th>Title</th>
49
              <th>Title</th>
49
              <th>Description</th>
50
              <th>Description</th>
50
              <th>Holding library</th>
51
              <th>Holding library</th>
51
              <td></td>
52
              <th>&nbsp;</th>
52
              <td></td>
53
              <th>&nbsp;</th>
53
            </tr>
54
            </tr>
55
           <thead>
56
           <tbody>
54
            [% FOREACH collectionsLoo IN collectionsLoop %]
57
            [% FOREACH collectionsLoo IN collectionsLoop %]
55
              <tr>
58
              <tr>
56
                <td>[% collectionsLoo.colTitle %]</td>
59
                <td>[% collectionsLoo.colTitle %]</td>
Lines 60-65 Link Here
60
                <td><a href="editCollections.pl?action=delete&amp;colId=[% collectionsLoo.colId %]">Delete</a></td>
63
                <td><a href="editCollections.pl?action=delete&amp;colId=[% collectionsLoo.colId %]">Delete</a></td>
61
              </tr>
64
              </tr>
62
            [% END %]
65
            [% END %]
66
           </tbody>
63
          </table>
67
          </table>
64
        [% ELSE %]
68
        [% ELSE %]
65
          There are no collections currently defined.
69
          There are no collections currently defined.
Lines 99-105 Link Here
99
                <label for="description">Description: </label>
103
                <label for="description">Description: </label>
100
              </td>
104
              </td>
101
              <td>
105
              <td>
102
                [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[ editColDescription %]" />
106
                [% IF (editColDescription ) %]<input type="text" size="50" name="description" value="[% editColDescription %]" />
103
                [% ELSE %]<input type="text" size="50" name="description" />[% END %]
107
                [% ELSE %]<input type="text" size="50" name="description" />[% END %]
104
              </td>
108
              </td>
105
            </tr>
109
            </tr>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (-2 lines)
Lines 142-153 Link Here
142
    <dd>Enter a barcode to generate a printable spine label. For use with dedicated label printers</dd>
142
    <dd>Enter a barcode to generate a printable spine label. For use with dedicated label printers</dd>
143
    [% END %]
143
    [% END %]
144
144
145
<!--
146
    [% IF ( CAN_user_tools_rotating_collections ) %]
145
    [% IF ( CAN_user_tools_rotating_collections ) %]
147
    <dt><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></dt>
146
    <dt><a href="/cgi-bin/koha/rotating_collections/rotatingCollections.pl">Rotating collections</a></dt>
148
    <dd>Manage Rotating Collections</dd>
147
    <dd>Manage Rotating Collections</dd>
149
    [% END %]
148
    [% END %]
150
-->
151
149
152
    [% IF ( CAN_user_tools_marc_modification_templates ) %]
150
    [% IF ( CAN_user_tools_marc_modification_templates ) %]
153
    <dt><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">MARC modification templates</a></dt>
151
    <dt><a href="/cgi-bin/koha/tools/marc_modification_templates.pl">MARC modification templates</a></dt>
(-)a/rotating_collections/addItems.pl (-62 / +70 lines)
Lines 16-24 Link Here
16
# Suite 330, Boston, MA  02111-1307 USA
16
# Suite 330, Boston, MA  02111-1307 USA
17
#
17
#
18
18
19
use strict;
19
use Modern::Perl;
20
#use warnings; FIXME - Bug 2505
21
require Exporter;
22
20
23
use C4::Output;
21
use C4::Output;
24
use C4::Auth;
22
use C4::Auth;
Lines 29-101 use C4::Items; Link Here
29
use CGI;
27
use CGI;
30
28
31
my $query = new CGI;
29
my $query = new CGI;
32
my ($template, $loggedinuser, $cookie)
33
    = get_template_and_user({template_name => "rotating_collections/addItems.tt",
34
			     query => $query,
35
			     type => "intranet",
36
			     authnotrequired => 0,
37
                          flagsrequired => { tools => 'rotating_collections' },
38
			     debug => 1,
39
			     });
40
30
41
if ( $query->param('action') eq 'addItem' ) {
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
42
  ## Add the given item to the collection
32
    {
43
  my $colId = $query->param('colId');
33
        template_name   => "rotating_collections/addItems.tmpl",
44
  my $barcode = $query->param('barcode');
34
        query           => $query,
45
  my $removeItem = $query->param('removeItem');
35
        type            => "intranet",
46
  my $itemnumber = GetItemnumberFromBarcode( $barcode );
36
        authnotrequired => 0,
47
37
        flagsrequired   => { tools => 'rotating_collections' },
48
  my ( $success, $errorCode, $errorMessage );
38
        debug           => 1,
49
  
50
  if ( ! $removeItem ) {
51
    ( $success, $errorCode, $errorMessage ) = AddItemToCollection( $colId, $itemnumber );
52
53
    $template->param(
54
      previousActionAdd => 1,
55
      addedBarcode => $barcode,
56
    );
57
58
    if ( $success ) {
59
      $template->param( addSuccess => 1 );
60
    } else {
61
      $template->param( addFailure => 1 );
62
      $template->param( failureMessage => $errorMessage );
63
    }
39
    }
64
  } else {
40
);
65
    ## Remove the given item from the collection
41
66
    ( $success, $errorCode, $errorMessage ) = RemoveItemFromCollection( $colId, $itemnumber );
42
if ( $query->param('action') eq 'addItem' ) {
67
43
    ## Add the given item to the collection
68
    $template->param(
44
    my $colId      = $query->param('colId');
69
      previousActionRemove => 1,
45
    my $barcode    = $query->param('barcode');
70
      removedBarcode => $barcode,
46
    my $removeItem = $query->param('removeItem');
71
      removeChecked => 1,
47
    my $itemnumber = GetItemnumberFromBarcode($barcode);
72
    );
48
73
49
    my ( $success, $errorCode, $errorMessage );
74
    if ( $success ) {
50
75
      $template->param( removeSuccess => 1 );
51
    if ( !$removeItem ) {
76
    } else {
52
        ( $success, $errorCode, $errorMessage ) =
77
      $template->param( removeFailure => 1 );
53
          AddItemToCollection( $colId, $itemnumber );
78
      $template->param( failureMessage => $errorMessage );
54
55
        $template->param(
56
            previousActionAdd => 1,
57
            addedBarcode      => $barcode,
58
        );
59
60
        if ($success) {
61
            $template->param( addSuccess => 1 );
62
        }
63
        else {
64
            $template->param( addFailure     => 1 );
65
            $template->param( failureMessage => $errorMessage );
66
        }
79
    }
67
    }
68
    else {
69
        ## Remove the given item from the collection
70
        ( $success, $errorCode, $errorMessage ) =
71
          RemoveItemFromCollection( $colId, $itemnumber );
72
73
        $template->param(
74
            previousActionRemove => 1,
75
            removedBarcode       => $barcode,
76
            removeChecked        => 1,
77
        );
78
79
        if ($success) {
80
            $template->param( removeSuccess => 1 );
81
        }
82
        else {
83
            $template->param( removeFailure  => 1 );
84
            $template->param( failureMessage => $errorMessage );
85
        }
80
86
81
  }  
87
    }
82
}
88
}
83
89
84
my ( $colId, $colTitle, $colDescription, $colBranchcode ) = GetCollection( $query->param('colId') );
90
my ( $colId, $colTitle, $colDescription, $colBranchcode ) =
85
my $collectionItems = GetItemsInCollection( $colId );
91
  GetCollection( $query->param('colId') );
86
if ( $collectionItems ) {
92
my $collectionItems = GetItemsInCollection($colId);
87
  $template->param( collectionItemsLoop => $collectionItems );
93
if ($collectionItems) {
94
    $template->param( collectionItemsLoop => $collectionItems );
88
}
95
}
89
96
90
$template->param(
97
$template->param(
91
                intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
98
    intranetcolorstylesheet =>
92
                intranetstylesheet => C4::Context->preference("intranetstylesheet"),
99
      C4::Context->preference("intranetcolorstylesheet"),
93
                IntranetNav => C4::Context->preference("IntranetNav"),
100
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
94
                                  
101
    IntranetNav        => C4::Context->preference("IntranetNav"),
95
                colId => $colId,
102
96
                colTitle => $colTitle,
103
    colId          => $colId,
97
                colDescription => $colDescription,
104
    colTitle       => $colTitle,
98
                colBranchcode => $colBranchcode,
105
    colDescription => $colDescription,
99
                );
106
    colBranchcode  => $colBranchcode,
107
);
100
108
101
output_html_with_http_headers $query, $cookie, $template->output;
109
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/rotating_collections/editCollections.pl (-71 / +78 lines)
Lines 15-23 Link Here
15
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
15
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16
# Suite 330, Boston, MA  02111-1307 USA
16
# Suite 330, Boston, MA  02111-1307 USA
17
#
17
#
18
use strict;
18
19
#use warnings; FIXME - Bug 2505
19
use Modern::Perl;
20
require Exporter;
21
20
22
use CGI;
21
use CGI;
23
22
Lines 28-119 use C4::Context; Link Here
28
use C4::RotatingCollections;
27
use C4::RotatingCollections;
29
28
30
my $query = new CGI;
29
my $query = new CGI;
31
my ($template, $loggedinuser, $cookie)
30
32
    = get_template_and_user({template_name => "rotating_collections/editCollections.tt",
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
33
			     query => $query,
32
    {
34
			     type => "intranet",
33
        template_name   => "rotating_collections/editCollections.tmpl",
35
			     authnotrequired => 0,
34
        query           => $query,
36
                          flagsrequired => { tools => 'rotating_collections' },
35
        type            => "intranet",
37
			     debug => 1,
36
        authnotrequired => 0,
38
			     });
37
        flagsrequired   => { tools => 'rotating_collections' },
38
        debug           => 1,
39
    }
40
);
39
41
40
# Create new Collection
42
# Create new Collection
41
if ( $query->param('action') eq 'create' ) {
43
if ( $query->param('action') eq 'create' ) {
42
  my $title = $query->param('title');
44
    my $title       = $query->param('title');
43
  my $description = $query->param('description');
45
    my $description = $query->param('description');
44
                            
46
45
  my ( $createdSuccessfully, $errorCode, $errorMessage ) = CreateCollection( $title, $description );
47
    my ( $createdSuccessfully, $errorCode, $errorMessage ) =
46
                              
48
      CreateCollection( $title, $description );
47
  $template->param(
49
48
    previousActionCreate => 1,
50
    $template->param(
49
    createdTitle => $title,
51
        previousActionCreate => 1,
50
  );
52
        createdTitle         => $title,
51
                                          
53
    );
52
  if ( $createdSuccessfully ) {
54
53
    $template->param( createSuccess => 1 );
55
    if ($createdSuccessfully) {
54
  } else {
56
        $template->param( createSuccess => 1 );
55
    $template->param( createFailure => 1 );
57
    }
56
    $template->param( failureMessage => $errorMessage );
58
    else {
57
  }                                                        
59
        $template->param( createFailure  => 1 );
60
        $template->param( failureMessage => $errorMessage );
61
    }
58
}
62
}
59
63
60
## Delete a club or service
64
## Delete a club or service
61
elsif ( $query->param('action') eq 'delete' ) {
65
elsif ( $query->param('action') eq 'delete' ) {
62
  my $colId = $query->param('colId');
66
    my $colId = $query->param('colId');
63
  my ( $success, $errorCode, $errorMessage ) = DeleteCollection( $colId );
67
    my ( $success, $errorCode, $errorMessage ) = DeleteCollection($colId);
64
    
68
65
  $template->param( previousActionDelete => 1 );
69
    $template->param( previousActionDelete => 1 );
66
  if ( $success ) {
70
    if ($success) {
67
    $template->param( deleteSuccess => 1 );
71
        $template->param( deleteSuccess => 1 );
68
  } else {
72
    }
69
    $template->param( deleteFailure => 1 );
73
    else {
70
    $template->param( failureMessage => $errorMessage );
74
        $template->param( deleteFailure  => 1 );
71
  }
75
        $template->param( failureMessage => $errorMessage );
76
    }
72
}
77
}
73
78
74
## Edit a club or service: grab data, put in form.
79
## Edit a club or service: grab data, put in form.
75
elsif ( $query->param('action') eq 'edit' ) {
80
elsif ( $query->param('action') eq 'edit' ) {
76
  my $colId = $query->param('colId');
81
    my $colId = $query->param('colId');
77
  my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );
82
    my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection($colId);
78
83
79
  $template->param(
84
    $template->param(
80
      previousActionEdit => 1,
85
        previousActionEdit => 1,
81
      editColId => $colId,
86
        editColId          => $colId,
82
      editColTitle => $colTitle,
87
        editColTitle       => $colTitle,
83
      editColDescription => $colDesc,
88
        editColDescription => $colDesc,
84
  );
89
    );
85
}
90
}
86
91
87
# Update a Club or Service
92
# Update a Club or Service
88
elsif ( $query->param('action') eq 'update' ) {
93
elsif ( $query->param('action') eq 'update' ) {
89
  my $colId = $query->param('colId');
94
    my $colId       = $query->param('colId');
90
  my $title = $query->param('title');
95
    my $title       = $query->param('title');
91
  my $description = $query->param('description');
96
    my $description = $query->param('description');
92
                            
97
93
  my ( $createdSuccessfully, $errorCode, $errorMessage ) 
98
    my ( $createdSuccessfully, $errorCode, $errorMessage ) =
94
    = UpdateCollection( $colId, $title, $description );
99
      UpdateCollection( $colId, $title, $description );
95
                              
100
96
  $template->param(
101
    $template->param(
97
    previousActionUpdate => 1,
102
        previousActionUpdate => 1,
98
    updatedTitle => $title,
103
        updatedTitle         => $title,
99
  );
104
    );
100
                                          
105
101
  if ( $createdSuccessfully ) {
106
    if ($createdSuccessfully) {
102
    $template->param( updateSuccess => 1 );
107
        $template->param( updateSuccess => 1 );
103
  } else {
108
    }
104
    $template->param( updateFailure => 1 );
109
    else {
105
    $template->param( failureMessage => $errorMessage );
110
        $template->param( updateFailure  => 1 );
106
  }                                                        
111
        $template->param( failureMessage => $errorMessage );
112
    }
107
}
113
}
108
                                                        
114
109
my $collections = GetCollections();
115
my $collections = GetCollections();
110
116
111
$template->param(
117
$template->param(
112
		intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
118
    intranetcolorstylesheet =>
113
		intranetstylesheet => C4::Context->preference("intranetstylesheet"),
119
      C4::Context->preference("intranetcolorstylesheet"),
114
		IntranetNav => C4::Context->preference("IntranetNav"),
120
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
115
		
121
    IntranetNav        => C4::Context->preference("IntranetNav"),
116
		collectionsLoop => $collections,
122
117
		);
123
    collectionsLoop => $collections,
124
);
118
125
119
output_html_with_http_headers $query, $cookie, $template->output;
126
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/rotating_collections/rotatingCollections.pl (-18 / +20 lines)
Lines 16-24 Link Here
16
# Suite 330, Boston, MA  02111-1307 USA
16
# Suite 330, Boston, MA  02111-1307 USA
17
#
17
#
18
18
19
use strict;
19
use Modern::Perl;
20
#use warnings; FIXME - Bug 2505
21
require Exporter;
22
20
23
use CGI;
21
use CGI;
24
22
Lines 28-52 use C4::Context; Link Here
28
use C4::RotatingCollections;
26
use C4::RotatingCollections;
29
27
30
my $query = new CGI;
28
my $query = new CGI;
31
my ($template, $loggedinuser, $cookie)
29
32
    = get_template_and_user({template_name => "rotating_collections/rotatingCollections.tt",
30
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
33
			     query => $query,
31
    {
34
			     type => "intranet",
32
        template_name   => "rotating_collections/rotatingCollections.tmpl",
35
			     authnotrequired => 0,
33
        query           => $query,
36
                          flagsrequired => { tools => 'rotating_collections' },
34
        type            => "intranet",
37
			     debug => 1,
35
        authnotrequired => 0,
38
			     });
36
        flagsrequired   => { tools => 'rotating_collections' },
37
        debug           => 1,
38
    }
39
);
39
40
40
my $branchcode = $query->cookie('branch');
41
my $branchcode = $query->cookie('branch');
41
42
42
my $collections = GetCollections();
43
my $collections = GetCollections();
43
44
44
$template->param(
45
$template->param(
45
                intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
46
    intranetcolorstylesheet =>
46
                intranetstylesheet => C4::Context->preference("intranetstylesheet"),
47
      C4::Context->preference("intranetcolorstylesheet"),
47
                IntranetNav => C4::Context->preference("IntranetNav"),
48
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
48
                                  
49
    IntranetNav        => C4::Context->preference("IntranetNav"),
49
                collectionsLoop => $collections,
50
50
                );
51
    collectionsLoop => $collections,
51
                                                                                                
52
);
53
52
output_html_with_http_headers $query, $cookie, $template->output;
54
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/rotating_collections/transferCollection.pl (-41 / +44 lines)
Lines 16-24 Link Here
16
# Suite 330, Boston, MA  02111-1307 USA
16
# Suite 330, Boston, MA  02111-1307 USA
17
#
17
#
18
18
19
use strict;
19
use Modern::Perl;
20
#use warnings; FIXME - Bug 2505
21
require Exporter;
22
20
23
use C4::Output;
21
use C4::Output;
24
use C4::Auth;
22
use C4::Auth;
Lines 30-84 use CGI; Link Here
30
28
31
my $query = new CGI;
29
my $query = new CGI;
32
30
33
my $colId = $query->param('colId');
31
my $colId    = $query->param('colId');
34
my $toBranch = $query->param('toBranch');
32
my $toBranch = $query->param('toBranch');
35
33
36
my ($template, $loggedinuser, $cookie)
34
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37
    = get_template_and_user({template_name => "rotating_collections/transferCollection.tt",
35
    {
38
			     query => $query,
36
        template_name   => "rotating_collections/transferCollection.tmpl",
39
			     type => "intranet",
37
        query           => $query,
40
			     authnotrequired => 0,
38
        type            => "intranet",
41
                          flagsrequired => { tools => 'rotating_collections' },
39
        authnotrequired => 0,
42
			     debug => 1,
40
        flagsrequired   => { tools => 'rotating_collections' },
43
			     });
41
        debug           => 1,
42
    }
43
);
44
44
45
## Transfer collection
45
## Transfer collection
46
my ( $success, $errorCode, $errorMessage );
46
my ( $success, $errorCode, $errorMessage );
47
if ( $toBranch ) {
47
if ($toBranch) {
48
  ( $success, $errorCode, $errorMessage ) = TransferCollection( $colId, $toBranch );
48
    ( $success, $errorCode, $errorMessage ) =
49
      TransferCollection( $colId, $toBranch );
49
50
50
  if ( $success ) {
51
    if ($success) {
51
    $template->param( transferSuccess => 1 );
52
        $template->param( transferSuccess => 1 );
52
  } else {
53
    }
53
    $template->param( transferFailure => 1,
54
    else {
54
                      errorCode => $errorCode,
55
        $template->param(
55
                      errorMessage => $errorMessage
56
            transferFailure => 1,
56
    );
57
            errorCode       => $errorCode,
57
  }
58
            errorMessage    => $errorMessage
59
        );
60
    }
58
}
61
}
59
62
60
## Set up the toBranch select options
63
## Set up the toBranch select options
61
my $branches = GetBranches();
64
my $branches = GetBranches();
62
my @branchoptionloop;
65
my @branchoptionloop;
63
foreach my $br (keys %$branches) {
66
foreach my $br ( keys %$branches ) {
64
  my %branch;
67
    my %branch;
65
  $branch{code}=$br;
68
    $branch{code} = $br;
66
  $branch{name}=$branches->{$br}->{'branchname'};
69
    $branch{name} = $branches->{$br}->{'branchname'};
67
  push (@branchoptionloop, \%branch);
70
    push( @branchoptionloop, \%branch );
68
}
71
}
69
    
72
70
## Get data about collection
73
## Get data about collection
71
my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection( $colId );                                
74
my ( $colId, $colTitle, $colDesc, $colBranchcode ) = GetCollection($colId);
72
$template->param(
75
$template->param(
73
                intranetcolorstylesheet => C4::Context->preference("intranetcolorstylesheet"),
76
    intranetcolorstylesheet =>
74
                intranetstylesheet => C4::Context->preference("intranetstylesheet"),
77
      C4::Context->preference("intranetcolorstylesheet"),
75
                IntranetNav => C4::Context->preference("IntranetNav"),
78
    intranetstylesheet => C4::Context->preference("intranetstylesheet"),
76
                                  
79
    IntranetNav        => C4::Context->preference("IntranetNav"),
77
                colId => $colId,
80
78
                colTitle => $colTitle,
81
    colId            => $colId,
79
                colDesc => $colDesc,
82
    colTitle         => $colTitle,
80
                colBranchcode => $colBranchcode,
83
    colDesc          => $colDesc,
81
                branchoptionloop => \@branchoptionloop
84
    colBranchcode    => $colBranchcode,
82
                );
85
    branchoptionloop => \@branchoptionloop
83
                                                                                                
86
);
87
84
output_html_with_http_headers $query, $cookie, $template->output;
88
output_html_with_http_headers $query, $cookie, $template->output;
85
- 

Return to bug 8836