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

(-)a/C4/Auth.pm (-1 / +3 lines)
Lines 195-201 sub get_template_and_user { Link Here
195
            $template->param( CAN_user_reserveforothers => 1 );
195
            $template->param( CAN_user_reserveforothers => 1 );
196
            $template->param( CAN_user_borrow           => 1 );
196
            $template->param( CAN_user_borrow           => 1 );
197
            $template->param( CAN_user_editcatalogue    => 1 );
197
            $template->param( CAN_user_editcatalogue    => 1 );
198
            $template->param( CAN_user_updatecharges     => 1 );
198
            $template->param( CAN_user_updatecharges    => 1 );
199
            $template->param( CAN_user_acquisition      => 1 );
199
            $template->param( CAN_user_acquisition      => 1 );
200
            $template->param( CAN_user_management       => 1 );
200
            $template->param( CAN_user_management       => 1 );
201
            $template->param( CAN_user_tools            => 1 );
201
            $template->param( CAN_user_tools            => 1 );
Lines 203-208 sub get_template_and_user { Link Here
203
            $template->param( CAN_user_serials          => 1 );
203
            $template->param( CAN_user_serials          => 1 );
204
            $template->param( CAN_user_reports          => 1 );
204
            $template->param( CAN_user_reports          => 1 );
205
            $template->param( CAN_user_staffaccess      => 1 );
205
            $template->param( CAN_user_staffaccess      => 1 );
206
            $template->param( CAN_user_coursereserves   => 1 );
206
            foreach my $module (keys %$all_perms) {
207
            foreach my $module (keys %$all_perms) {
207
                foreach my $subperm (keys %{ $all_perms->{$module} }) {
208
                foreach my $subperm (keys %{ $all_perms->{$module} }) {
208
                    $template->param( "CAN_user_${module}_${subperm}" => 1 );
209
                    $template->param( "CAN_user_${module}_${subperm}" => 1 );
Lines 336-341 sub get_template_and_user { Link Here
336
            noItemTypeImages             => C4::Context->preference("noItemTypeImages"),
337
            noItemTypeImages             => C4::Context->preference("noItemTypeImages"),
337
            marcflavour                  => C4::Context->preference("marcflavour"),
338
            marcflavour                  => C4::Context->preference("marcflavour"),
338
            persona                      => C4::Context->preference("persona"),
339
            persona                      => C4::Context->preference("persona"),
340
            UseCourseReserves            => C4::Context->preference("UseCourseReserves"),
339
    );
341
    );
340
    if ( $in->{'type'} eq "intranet" ) {
342
    if ( $in->{'type'} eq "intranet" ) {
341
        $template->param(
343
        $template->param(
(-)a/C4/CourseReserves.pm (+1116 lines)
Line 0 Link Here
1
package C4::CourseReserves;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 2 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along with
15
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
16
# Suite 330, Boston, MA  02111-1307 USA
17
18
use Modern::Perl;
19
20
require Exporter;
21
22
use C4::Context;
23
use C4::Items qw(GetItem ModItem);
24
use C4::Biblio qw(GetBiblioFromItemNumber);
25
use C4::Circulation qw(GetOpenIssue);
26
27
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $DEBUG @FIELDS);
28
29
BEGIN {
30
    @ISA    = qw(Exporter);
31
    @EXPORT = qw(
32
      &GetCourse
33
      &ModCourse
34
      &GetCourses
35
      &DelCourse
36
37
      &GetCourseInstructors
38
      &ModCourseInstructors
39
40
      &GetCourseItem
41
      &ModCourseItem
42
43
      &GetCourseReserve
44
      &ModCourseReserve
45
      &GetCourseReserves
46
      &DelCourseReserve
47
48
      &SearchCourses
49
50
      &GetItemReservesInfo
51
    );
52
53
    $DEBUG = 0;
54
    @FIELDS = ( 'itype', 'ccode', 'holdingbranch', 'location' );
55
}
56
57
=head1 NAME
58
59
C4::CourseReserves - Koha course reserves module
60
61
=head1 SYNOPSIS
62
63
use C4::CourseReserves;
64
65
=head1 DESCRIPTION
66
67
This module deals with course reserves.
68
69
=head1 FUNCTIONS
70
71
=head2 GetCourse
72
73
    $course = GetCourse( $course_id );
74
75
=cut
76
77
sub GetCourse {
78
    my ($course_id) = @_;
79
    warn whoami() . "( $course_id )" if $DEBUG;
80
81
    my $query = "SELECT * FROM courses WHERE course_id = ?";
82
    my $dbh   = C4::Context->dbh;
83
    my $sth   = $dbh->prepare($query);
84
    $sth->execute($course_id);
85
86
    my $course = $sth->fetchrow_hashref();
87
88
    $query = "
89
        SELECT b.* FROM course_instructors ci
90
        LEFT JOIN borrowers b ON ( ci.borrowernumber = b.borrowernumber )
91
        WHERE course_id =  ?
92
    ";
93
    $sth = $dbh->prepare($query);
94
    $sth->execute($course_id);
95
    $course->{'instructors'} = $sth->fetchall_arrayref( {} );
96
97
    return $course;
98
}
99
100
=head2 ModCourse
101
102
    ModCourse( [ course_id => $id ] [, course_name => $course_name ] [etc...] );
103
104
=cut
105
106
sub ModCourse {
107
    my (%params) = @_;
108
    warn identify_myself(%params) if $DEBUG;
109
110
    my $dbh = C4::Context->dbh;
111
112
    my $course_id;
113
    if ( defined $params{'course_id'} ) {
114
        $course_id = $params{'course_id'};
115
        delete $params{'course_id'};
116
    }
117
118
    my @query_keys;
119
    my @query_values;
120
121
    my $query;
122
123
    $query .= ($course_id) ? ' UPDATE ' : ' INSERT ';
124
    $query .= ' courses SET ';
125
126
    foreach my $key ( keys %params ) {
127
        push( @query_keys,   "$key=?" );
128
        push( @query_values, $params{$key} );
129
    }
130
    $query .= join( ',', @query_keys );
131
132
    if ($course_id) {
133
        $query .= " WHERE course_id = ?";
134
        push( @query_values, $course_id );
135
    }
136
137
    $dbh->do( $query, undef, @query_values );
138
139
    $course_id = $course_id
140
      || $dbh->last_insert_id( undef, undef, 'courses', 'course_id' );
141
142
    EnableOrDisableCourseItems(
143
        course_id => $course_id,
144
        enabled   => $params{'enabled'}
145
    );
146
147
    return $course_id;
148
}
149
150
=head2 GetCourses
151
152
  @courses = GetCourses( [ fieldname => $value ] [, fieldname2 => $value2 ] [etc...] );
153
154
=cut
155
156
sub GetCourses {
157
    my (%params) = @_;
158
    warn identify_myself(%params) if $DEBUG;
159
160
    my @query_keys;
161
    my @query_values;
162
163
    my $query = "
164
        SELECT courses.*
165
        FROM courses
166
        LEFT JOIN course_reserves ON course_reserves.course_id = courses.course_id
167
        LEFT JOIN course_items ON course_items.ci_id = course_reserves.ci_id
168
    ";
169
170
    if ( keys %params ) {
171
172
        $query .= " WHERE ";
173
174
        foreach my $key ( keys %params ) {
175
            push( @query_keys,   " $key LIKE ? " );
176
            push( @query_values, $params{$key} );
177
        }
178
179
        $query .= join( ' AND ', @query_keys );
180
    }
181
182
    $query .= " GROUP BY courses.course_id ";
183
184
    my $dbh = C4::Context->dbh;
185
    my $sth = $dbh->prepare($query);
186
    $sth->execute(@query_values);
187
188
    my $courses = $sth->fetchall_arrayref( {} );
189
190
    foreach my $c (@$courses) {
191
        $c->{'instructors'} = GetCourseInstructors( $c->{'course_id'} );
192
    }
193
194
    return $courses;
195
}
196
197
=head2 DelCourse
198
199
  DelCourse( $course_id );
200
201
=cut
202
203
sub DelCourse {
204
    my ($course_id) = @_;
205
206
    my $course_reserves = GetCourseReserves( course_id => $course_id );
207
208
    foreach my $res (@$course_reserves) {
209
        DelCourseReserve( cr_id => $res->{'cr_id'} );
210
    }
211
212
    my $query = "
213
        DELETE FROM courses
214
        WHERE course_id = ?
215
    ";
216
    C4::Context->dbh->do( $query, undef, $course_id );
217
}
218
219
=head2 EnableOrDisableCourseItems
220
221
  EnableOrDisableCourseItems( course_id => $course_id, enabled => $enabled );
222
223
  For each item on reserve for this course,
224
  if the course item has no active course reserves,
225
  swap the fields for the item to make it 'normal'
226
  again.
227
228
  enabled => 'yes' to enable course items
229
  enabled => 'no' to disable course items
230
231
=cut
232
233
sub EnableOrDisableCourseItems {
234
    my (%params) = @_;
235
    warn identify_myself(%params) if $DEBUG;
236
237
    my $course_id = $params{'course_id'};
238
    my $enabled   = $params{'enabled'};
239
240
    my $lookfor = ( $enabled eq 'yes' ) ? 'no' : 'yes';
241
242
    return unless ( $course_id && $enabled );
243
    return unless ( $enabled eq 'yes' || $enabled eq 'no' );
244
245
    my $course_reserves = GetCourseReserves( course_id => $course_id );
246
247
    if ( $enabled eq 'yes' ) {
248
        foreach my $course_reserve (@$course_reserves) {
249
            if (
250
                CountCourseReservesForItem(
251
                    ci_id   => $course_reserve->{'ci_id'},
252
                    enabled => 'yes'
253
                )
254
              )
255
            {
256
                EnableOrDisableCourseItem(
257
                    ci_id   => $course_reserve->{'ci_id'},
258
                    enabled => 'yes',
259
                );
260
            }
261
        }
262
    }
263
    if ( $enabled eq 'no' ) {
264
        foreach my $course_reserve (@$course_reserves) {
265
            unless (
266
                CountCourseReservesForItem(
267
                    ci_id   => $course_reserve->{'ci_id'},
268
                    enabled => 'yes'
269
                )
270
              )
271
            {
272
                EnableOrDisableCourseItem(
273
                    ci_id   => $course_reserve->{'ci_id'},
274
                    enabled => 'no',
275
                );
276
            }
277
        }
278
    }
279
}
280
281
=head2 EnableOrDisableCourseItem
282
283
    EnableOrDisableCourseItem( ci_id => $ci_id, enabled => $enabled );
284
285
    enabled => 'yes' to enable course items
286
    enabled => 'no' to disable course items
287
288
=cut
289
290
sub EnableOrDisableCourseItem {
291
    my (%params) = @_;
292
    warn identify_myself(%params) if $DEBUG;
293
294
    my $ci_id   = $params{'ci_id'};
295
    my $enabled = $params{'enabled'};
296
297
    return unless ( $ci_id && $enabled );
298
    return unless ( $enabled eq 'yes' || $enabled eq 'no' );
299
300
    my $course_item = GetCourseItem( ci_id => $ci_id );
301
302
    ## We don't want to 'enable' an already enabled item,
303
    ## or disable and already disabled item,
304
    ## as that would cause the fields to swap
305
    if ( $course_item->{'enabled'} ne $enabled ) {
306
        _SwapAllFields($ci_id);
307
308
        my $query = "
309
            UPDATE course_items
310
            SET enabled = ?
311
            WHERE ci_id = ?
312
        ";
313
314
        C4::Context->dbh->do( $query, undef, $enabled, $ci_id );
315
316
    }
317
318
}
319
320
=head2 GetCourseInstructors
321
322
    @borrowernumbers = GetCourseInstructors( $course_id );
323
324
=cut
325
326
sub GetCourseInstructors {
327
    my ($course_id) = @_;
328
    warn "C4::CourseReserves::GetCourseInstructors( $course_id )"
329
      if $DEBUG;
330
331
    my $query = "
332
        SELECT * FROM borrowers
333
        RIGHT JOIN course_instructors ON ( course_instructors.borrowernumber = borrowers.borrowernumber )
334
        WHERE course_instructors.course_id = ?
335
    ";
336
337
    my $dbh = C4::Context->dbh;
338
    my $sth = $dbh->prepare($query);
339
    $sth->execute($course_id);
340
341
    return $sth->fetchall_arrayref( {} );
342
}
343
344
=head2 ModCourseInstructors
345
346
    ModCourseInstructors( mode => $mode, course_id => $course_id, [ cardnumbers => $cardnumbers ] OR [ borrowernumbers => $borrowernumbers  );
347
348
    $mode can be 'replace', 'add', or 'delete'
349
350
    $cardnumbers and $borrowernumbers are both references to arrays
351
352
    Use either cardnumbers or borrowernumber, but not both.
353
354
=cut
355
356
sub ModCourseInstructors {
357
    my (%params) = @_;
358
    warn identify_myself(%params) if $DEBUG;
359
360
    my $course_id       = $params{'course_id'};
361
    my $mode            = $params{'mode'};
362
    my $cardnumbers     = $params{'cardnumbers'};
363
    my $borrowernumbers = $params{'borrowernumbers'};
364
365
    return unless ($course_id);
366
    return
367
      unless ( $mode eq 'replace'
368
        || $mode eq 'add'
369
        || $mode eq 'delete' );
370
    return unless ( $cardnumbers || $borrowernumbers );
371
    return if ( $cardnumbers && $borrowernumbers );
372
373
    my @cardnumbers = @$cardnumbers if ( ref($cardnumbers) eq 'ARRAY' );
374
    my @borrowernumbers = @$borrowernumbers
375
      if ( ref($borrowernumbers) eq 'ARRAY' );
376
377
    my $field  = (@cardnumbers) ? 'cardnumber' : 'borrowernumber';
378
    my @fields = (@cardnumbers) ? @cardnumbers : @borrowernumbers;
379
    my $placeholders = join( ',', ('?') x scalar @fields );
380
381
    my $dbh = C4::Context->dbh;
382
383
    $dbh->do( "DELETE FROM course_instructors WHERE course_id = ?",
384
        undef, $course_id )
385
      if ( $mode eq 'replace' );
386
387
    my $query;
388
389
    if ( $mode eq 'add' || $mode eq 'replace' ) {
390
        $query = "
391
            INSERT INTO course_instructors ( course_id, borrowernumber )
392
            SELECT ?, borrowernumber
393
            FROM borrowers
394
            WHERE $field IN ( $placeholders )
395
        ";
396
    }
397
    else {
398
        $query = "
399
            DELETE FROM course_instructors
400
            WHERE course_id = ?
401
            AND borrowernumber IN (
402
                SELECT borrowernumber FROM borrowers WHERE $field IN ( $placeholders )
403
            )
404
        ";
405
    }
406
407
    my $sth = $dbh->prepare($query);
408
409
    $sth->execute( $course_id, @fields ) if (@fields);
410
}
411
412
=head2 GetCourseItem {
413
414
  $course_item = GetCourseItem( itemnumber => $itemnumber [, ci_id => $ci_id );
415
416
=cut
417
418
sub GetCourseItem {
419
    my (%params) = @_;
420
    warn identify_myself(%params) if $DEBUG;
421
422
    my $ci_id      = $params{'ci_id'};
423
    my $itemnumber = $params{'itemnumber'};
424
425
    return unless ( $itemnumber || $ci_id );
426
427
    my $field = ($itemnumber) ? 'itemnumber' : 'ci_id';
428
    my $value = ($itemnumber) ? $itemnumber  : $ci_id;
429
430
    my $query = "SELECT * FROM course_items WHERE $field = ?";
431
    my $dbh   = C4::Context->dbh;
432
    my $sth   = $dbh->prepare($query);
433
    $sth->execute($value);
434
435
    my $course_item = $sth->fetchrow_hashref();
436
437
    if ($course_item) {
438
        $query = "SELECT * FROM course_reserves WHERE ci_id = ?";
439
        $sth   = $dbh->prepare($query);
440
        $sth->execute( $course_item->{'ci_id'} );
441
        my $course_reserves = $sth->fetchall_arrayref( {} );
442
443
        $course_item->{'course_reserves'} = $course_reserves
444
          if ($course_reserves);
445
    }
446
    return $course_item;
447
}
448
449
=head2 ModCourseItem {
450
451
  ModCourseItem( %params );
452
453
  Creates or modifies an existing course item.
454
455
=cut
456
457
sub ModCourseItem {
458
    my (%params) = @_;
459
    warn identify_myself(%params) if $DEBUG;
460
461
    my $itemnumber    = $params{'itemnumber'};
462
    my $itype         = $params{'itype'};
463
    my $ccode         = $params{'ccode'};
464
    my $holdingbranch = $params{'holdingbranch'};
465
    my $location      = $params{'location'};
466
467
    return unless ($itemnumber);
468
469
    my $course_item = GetCourseItem( itemnumber => $itemnumber );
470
471
    my $ci_id;
472
473
    if ($course_item) {
474
        $ci_id = $course_item->{'ci_id'};
475
476
        _UpdateCourseItem(
477
            ci_id       => $ci_id,
478
            course_item => $course_item,
479
            %params
480
        );
481
    }
482
    else {
483
        $ci_id = _AddCourseItem(%params);
484
    }
485
486
    return $ci_id;
487
488
}
489
490
=head2 _AddCourseItem
491
492
    my $ci_id = _AddCourseItem( %params );
493
494
=cut
495
496
sub _AddCourseItem {
497
    my (%params) = @_;
498
    warn identify_myself(%params) if $DEBUG;
499
500
    my ( @fields, @values );
501
502
    push( @fields, 'itemnumber = ?' );
503
    push( @values, $params{'itemnumber'} );
504
505
    foreach (@FIELDS) {
506
        if ( $params{$_} ) {
507
            push( @fields, "$_ = ?" );
508
            push( @values, $params{$_} );
509
        }
510
    }
511
512
    my $query = "INSERT INTO course_items SET " . join( ',', @fields );
513
    my $dbh = C4::Context->dbh;
514
    $dbh->do( $query, undef, @values );
515
516
    my $ci_id = $dbh->last_insert_id( undef, undef, 'course_items', 'ci_id' );
517
518
    return $ci_id;
519
}
520
521
=head2 _UpdateCourseItem
522
523
  _UpdateCourseItem( %params );
524
525
=cut
526
527
sub _UpdateCourseItem {
528
    my (%params) = @_;
529
    warn identify_myself(%params) if $DEBUG;
530
531
    my $ci_id         = $params{'ci_id'};
532
    my $course_item   = $params{'course_item'};
533
    my $itype         = $params{'itype'};
534
    my $ccode         = $params{'ccode'};
535
    my $holdingbranch = $params{'holdingbranch'};
536
    my $location      = $params{'location'};
537
538
    return unless ( $ci_id || $course_item );
539
540
    $course_item = GetCourseItem( ci_id => $ci_id )
541
      unless ($course_item);
542
    $ci_id = $course_item->{'ci_id'} unless ($ci_id);
543
544
    ## Revert fields that had an 'original' value, but now don't
545
    ## Update the item fields to the stored values from course_items
546
    ## and then set those fields in course_items to NULL
547
    my @fields_to_revert;
548
    foreach (@FIELDS) {
549
        if ( !$params{$_} && $course_item->{$_} ) {
550
            push( @fields_to_revert, $_ );
551
        }
552
    }
553
    _RevertFields(
554
        ci_id       => $ci_id,
555
        fields      => \@fields_to_revert,
556
        course_item => $course_item
557
    ) if (@fields_to_revert);
558
559
    ## Update fields that still have an original value, but it has changed
560
    ## This necessitates only changing the current item values, as we still
561
    ## have the original values stored in course_items
562
    my %mod_params;
563
    foreach (@FIELDS) {
564
        if (   $params{$_}
565
            && $course_item->{$_}
566
            && $params{$_} ne $course_item->{$_} )
567
        {
568
            $mod_params{$_} = $params{$_};
569
        }
570
    }
571
    ModItem( \%mod_params, undef, $course_item->{'itemnumber'} );
572
573
    ## Update fields that didn't have an original value, but now do
574
    ## We must save the original value in course_items, and also
575
    ## update the item fields to the new value
576
    my $item = GetItem( $course_item->{'itemnumber'} );
577
    my %mod_params_new;
578
    my %mod_params_old;
579
    foreach (@FIELDS) {
580
        if ( $params{$_} && !$course_item->{$_} ) {
581
            $mod_params_new{$_} = $params{$_};
582
            $mod_params_old{$_} = $item->{$_};
583
        }
584
    }
585
    _ModStoredFields( 'ci_id' => $params{'ci_id'}, %mod_params_old );
586
    ModItem( \%mod_params_new, undef, $course_item->{'itemnumber'} );
587
588
}
589
590
=head2 _ModStoredFields
591
592
    _ModStoredFields( %params );
593
594
    Updates the values for the 'original' fields in course_items
595
    for a given ci_id
596
597
=cut
598
599
sub _ModStoredFields {
600
    my (%params) = @_;
601
    warn identify_myself(%params) if $DEBUG;
602
603
    return unless ( $params{'ci_id'} );
604
605
    my ( @fields_to_update, @values_to_update );
606
607
    foreach (@FIELDS) {
608
        if ( $params{$_} ) {
609
            push( @fields_to_update, $_ );
610
            push( @values_to_update, $params{$_} );
611
        }
612
    }
613
614
    my $query =
615
        "UPDATE course_items SET "
616
      . join( ',', map { "$_=?" } @fields_to_update )
617
      . " WHERE ci_id = ?";
618
619
    C4::Context->dbh->do( $query, undef, @values_to_update, $params{'ci_id'} )
620
      if (@values_to_update);
621
622
}
623
624
=head2 _RevertFields
625
626
    _RevertFields( ci_id => $ci_id, fields => \@fields_to_revert );
627
628
=cut
629
630
sub _RevertFields {
631
    my (%params) = @_;
632
    warn identify_myself(%params) if $DEBUG;
633
634
    my $ci_id       = $params{'ci_id'};
635
    my $course_item = $params{'course_item'};
636
    my $fields      = $params{'fields'};
637
    my @fields      = @$fields;
638
639
    return unless ($ci_id);
640
641
    $course_item = GetCourseItem( ci_id => $params{'ci_id'} )
642
      unless ($course_item);
643
644
    my $mod_item_params;
645
    my @fields_to_null;
646
    foreach my $field (@fields) {
647
        foreach (@FIELDS) {
648
            if ( $field eq $_ && $course_item->{$_} ) {
649
                $mod_item_params->{$_} = $course_item->{$_};
650
                push( @fields_to_null, $_ );
651
            }
652
        }
653
    }
654
    ModItem( $mod_item_params, undef, $course_item->{'itemnumber'} );
655
656
    my $query =
657
        "UPDATE course_items SET "
658
      . join( ',', map { "$_=NULL" } @fields_to_null )
659
      . " WHERE ci_id = ?";
660
661
    C4::Context->dbh->do( $query, undef, $ci_id ) if (@fields_to_null);
662
}
663
664
=head2 _SwapAllFields
665
666
    _SwapAllFields( $ci_id );
667
668
=cut
669
670
sub _SwapAllFields {
671
    my ($ci_id) = @_;
672
    warn "C4::CourseReserves::_SwapFields( $ci_id )" if $DEBUG;
673
674
    my $course_item = GetCourseItem( ci_id => $ci_id );
675
    my $item = GetItem( $course_item->{'itemnumber'} );
676
677
    my %course_item_fields;
678
    my %item_fields;
679
    foreach (@FIELDS) {
680
        if ( $course_item->{$_} ) {
681
            $course_item_fields{$_} = $course_item->{$_};
682
            $item_fields{$_}        = $item->{$_};
683
        }
684
    }
685
686
    ModItem( \%course_item_fields, undef, $course_item->{'itemnumber'} );
687
    _ModStoredFields( %item_fields, ci_id => $ci_id );
688
}
689
690
=head2 GetCourseItems {
691
692
  $course_items = GetCourseItems(
693
      [course_id => $course_id]
694
      [, itemnumber => $itemnumber ]
695
  );
696
697
=cut
698
699
sub GetCourseItems {
700
    my (%params) = @_;
701
    warn identify_myself(%params) if $DEBUG;
702
703
    my $course_id  = $params{'course_id'};
704
    my $itemnumber = $params{'itemnumber'};
705
706
    return unless ($course_id);
707
708
    my @query_keys;
709
    my @query_values;
710
711
    my $query = "SELECT * FROM course_items";
712
713
    if ( keys %params ) {
714
715
        $query .= " WHERE ";
716
717
        foreach my $key ( keys %params ) {
718
            push( @query_keys,   " $key LIKE ? " );
719
            push( @query_values, $params{$key} );
720
        }
721
722
        $query .= join( ' AND ', @query_keys );
723
    }
724
725
    my $dbh = C4::Context->dbh;
726
    my $sth = $dbh->prepare($query);
727
    $sth->execute(@query_values);
728
729
    return $sth->fetchall_arrayref( {} );
730
}
731
732
=head2 DelCourseItem {
733
734
  DelCourseItem( ci_id => $cr_id );
735
736
=cut
737
738
sub DelCourseItem {
739
    my (%params) = @_;
740
    warn identify_myself(%params) if $DEBUG;
741
742
    my $ci_id = $params{'ci_id'};
743
744
    return unless ($ci_id);
745
746
    _RevertFields( ci_id => $ci_id, fields => \@FIELDS );
747
748
    my $query = "
749
        DELETE FROM course_items
750
        WHERE ci_id = ?
751
    ";
752
    C4::Context->dbh->do( $query, undef, $ci_id );
753
}
754
755
=head2 GetCourseReserve {
756
757
  $course_item = GetCourseReserve( %params );
758
759
=cut
760
761
sub GetCourseReserve {
762
    my (%params) = @_;
763
    warn identify_myself(%params) if $DEBUG;
764
765
    my $cr_id     = $params{'cr_id'};
766
    my $course_id = $params{'course_id'};
767
    my $ci_id     = $params{'ci_id'};
768
769
    return unless ( $cr_id || ( $course_id && $ci_id ) );
770
771
    my $dbh = C4::Context->dbh;
772
    my $sth;
773
774
    if ($cr_id) {
775
        my $query = "
776
            SELECT * FROM course_reserves
777
            WHERE cr_id = ?
778
        ";
779
        $sth = $dbh->prepare($query);
780
        $sth->execute($cr_id);
781
    }
782
    else {
783
        my $query = "
784
            SELECT * FROM course_reserves
785
            WHERE course_id = ? AND ci_id = ?
786
        ";
787
        $sth = $dbh->prepare($query);
788
        $sth->execute( $course_id, $ci_id );
789
    }
790
791
    my $course_reserve = $sth->fetchrow_hashref();
792
    return $course_reserve;
793
}
794
795
=head2 ModCourseReserve
796
797
    $id = ModCourseReserve( %params );
798
799
=cut
800
801
sub ModCourseReserve {
802
    my (%params) = @_;
803
    warn identify_myself(%params) if $DEBUG;
804
805
    my $course_id   = $params{'course_id'};
806
    my $ci_id       = $params{'ci_id'};
807
    my $staff_note  = $params{'staff_note'};
808
    my $public_note = $params{'public_note'};
809
810
    return unless ( $course_id && $ci_id );
811
812
    my $course_reserve =
813
      GetCourseReserve( course_id => $course_id, ci_id => $ci_id );
814
    my $cr_id;
815
816
    my $dbh = C4::Context->dbh;
817
818
    if ($course_reserve) {
819
        $cr_id = $course_reserve->{'cr_id'};
820
821
        my $query = "
822
            UPDATE course_reserves
823
            SET staff_note = ?, public_note = ?
824
            WHERE cr_id = ?
825
        ";
826
        $dbh->do( $query, undef, $staff_note, $public_note, $cr_id );
827
    }
828
    else {
829
        my $query = "
830
            INSERT INTO course_reserves SET
831
            course_id = ?,
832
            ci_id = ?,
833
            staff_note = ?,
834
            public_note = ?
835
        ";
836
        $dbh->do( $query, undef, $course_id, $ci_id, $staff_note,
837
            $public_note );
838
        $cr_id =
839
          $dbh->last_insert_id( undef, undef, 'course_reserves', 'cr_id' );
840
    }
841
842
    my $course = GetCourse($course_id);
843
    EnableOrDisableCourseItem(
844
        ci_id   => $params{'ci_id'},
845
        enabled => $course->{'enabled'}
846
    );
847
848
    return $cr_id;
849
}
850
851
=head2 GetCourseReserves {
852
853
  $course_reserves = GetCourseReserves( %params );
854
855
  Required:
856
      course_id OR ci_id
857
  Optional:
858
      include_items   => 1,
859
      include_count   => 1,
860
      include_courses => 1,
861
862
=cut
863
864
sub GetCourseReserves {
865
    my (%params) = @_;
866
    warn identify_myself(%params) if $DEBUG;
867
868
    my $course_id     = $params{'course_id'};
869
    my $ci_id         = $params{'ci_id'};
870
    my $include_items = $params{'include_items'};
871
    my $include_count = $params{'include_count'};
872
    my $include_courses = $params{'include_courses'};
873
874
    return unless ( $course_id || $ci_id );
875
876
    my $field = ($course_id) ? 'course_id' : 'ci_id';
877
    my $value = ($course_id) ? $course_id  : $ci_id;
878
879
    my $query = "
880
        SELECT cr.*, ci.itemnumber
881
        FROM course_reserves cr, course_items ci
882
        WHERE cr.$field = ?
883
        AND cr.ci_id = ci.ci_id
884
    ";
885
    my $dbh = C4::Context->dbh;
886
    my $sth = $dbh->prepare($query);
887
    $sth->execute($value);
888
889
    my $course_reserves = $sth->fetchall_arrayref( {} );
890
891
    if ($include_items) {
892
        foreach my $cr (@$course_reserves) {
893
            $cr->{'course_item'} = GetCourseItem( ci_id => $cr->{'ci_id'} );
894
            $cr->{'item'} = GetBiblioFromItemNumber( $cr->{'itemnumber'} );
895
            $cr->{'issue'} = GetOpenIssue( $cr->{'itemnumber'} );
896
        }
897
    }
898
899
    if ($include_count) {
900
        foreach my $cr (@$course_reserves) {
901
            $cr->{'reserves_count'} =
902
              CountCourseReservesForItem( ci_id => $cr->{'ci_id'} );
903
        }
904
    }
905
906
    if ($include_courses) {
907
        foreach my $cr (@$course_reserves) {
908
            $cr->{'courses'} =
909
              GetCourses( itemnumber => $cr->{'itemnumber'} );
910
        }
911
    }
912
913
    return $course_reserves;
914
}
915
916
=head2 DelCourseReserve {
917
918
  DelCourseReserve( cr_id => $cr_id );
919
920
=cut
921
922
sub DelCourseReserve {
923
    my (%params) = @_;
924
    warn identify_myself(%params) if $DEBUG;
925
926
    my $cr_id = $params{'cr_id'};
927
928
    return unless ($cr_id);
929
930
    my $dbh = C4::Context->dbh;
931
932
    my $course_reserve = GetCourseReserve( cr_id => $cr_id );
933
934
    my $query = "
935
        DELETE FROM course_reserves
936
        WHERE cr_id = ?
937
    ";
938
    $dbh->do( $query, undef, $cr_id );
939
940
    ## If there are no other course reserves for this item
941
    ## delete the course_item as well
942
    unless ( CountCourseReservesForItem( ci_id => $course_reserve->{'ci_id'} ) )
943
    {
944
        DelCourseItem( ci_id => $course_reserve->{'ci_id'} );
945
    }
946
947
}
948
949
=head2 GetReservesInfo
950
951
    my $arrayref = GetItemReservesInfo( itemnumber => $itemnumber );
952
953
    For a given item, returns an arrayref of reserves hashrefs,
954
    with a course hashref under the key 'course'
955
956
=cut
957
958
sub GetItemReservesInfo {
959
    my (%params) = @_;
960
    warn identify_myself(%params) if $DEBUG;
961
962
    my $itemnumber = $params{'itemnumber'};
963
964
    return unless ($itemnumber);
965
966
    my $course_item = GetCourseItem( itemnumber => $itemnumber );
967
968
    return unless ( keys %$course_item );
969
970
    my $course_reserves = GetCourseReserves( ci_id => $course_item->{'ci_id'} );
971
972
    foreach my $cr (@$course_reserves) {
973
        $cr->{'course'} = GetCourse( $cr->{'course_id'} );
974
    }
975
976
    return $course_reserves;
977
}
978
979
=head2 CountCourseReservesForItem
980
981
    $bool = CountCourseReservesForItem( %params );
982
983
    ci_id - course_item id
984
    OR
985
    itemnumber - course_item itemnumber
986
987
    enabled = 'yes' or 'no'
988
    Optional, if not supplied, counts reserves
989
    for both enabled and disabled courses
990
991
=cut
992
993
sub CountCourseReservesForItem {
994
    my (%params) = @_;
995
    warn identify_myself(%params) if $DEBUG;
996
997
    my $ci_id      = $params{'ci_id'};
998
    my $itemnumber = $params{'itemnumber'};
999
    my $enabled    = $params{'enabled'};
1000
1001
    return unless ( $ci_id || $itemnumber );
1002
1003
    my $course_item =
1004
      GetCourseItem( ci_id => $ci_id, itemnumber => $itemnumber );
1005
1006
    my @params = ( $course_item->{'ci_id'} );
1007
    push( @params, $enabled ) if ($enabled);
1008
1009
    my $query = "
1010
        SELECT COUNT(*) AS count
1011
        FROM course_reserves cr
1012
        LEFT JOIN courses c ON ( c.course_id = cr.course_id )
1013
        WHERE ci_id = ?
1014
    ";
1015
    $query .= "AND c.enabled = ?" if ($enabled);
1016
1017
    my $dbh = C4::Context->dbh;
1018
    my $sth = $dbh->prepare($query);
1019
    $sth->execute(@params);
1020
1021
    my $row = $sth->fetchrow_hashref();
1022
1023
    return $row->{'count'};
1024
}
1025
1026
=head2 SearchCourses
1027
1028
    my $courses = SearchCourses( term => $search_term, enabled => 'yes' );
1029
1030
=cut
1031
1032
sub SearchCourses {
1033
    my (%params) = @_;
1034
    warn identify_myself(%params) if $DEBUG;
1035
1036
    my $term = $params{'term'};
1037
1038
    my $enabled = $params{'enabled'} || '%';
1039
1040
    my @params;
1041
    my $query = "SELECT c.* FROM courses c";
1042
1043
    $query .= "
1044
        LEFT JOIN course_instructors ci
1045
            ON ( c.course_id = ci.course_id )
1046
        LEFT JOIN borrowers b
1047
            ON ( ci.borrowernumber = b.borrowernumber )
1048
        LEFT JOIN authorised_values av
1049
            ON ( c.department = av.authorised_value )
1050
        WHERE
1051
            ( av.category = 'DEPARTMENT' OR av.category = 'TERM' )
1052
            AND
1053
            (
1054
                department LIKE ? OR
1055
                course_number LIKE ? OR
1056
                section LIKE ? OR
1057
                course_name LIKE ? OR
1058
                term LIKE ? OR
1059
                public_note LIKE ? OR
1060
                CONCAT(surname,' ',firstname) LIKE ? OR
1061
                CONCAT(firstname,' ',surname) LIKE ? OR
1062
                lib LIKE ? OR
1063
                lib_opac LIKE ?
1064
           )
1065
           AND
1066
           c.enabled LIKE ?
1067
        GROUP BY c.course_id
1068
    ";
1069
1070
    $term   = "%$term%";
1071
    @params = ($term) x 10;
1072
1073
    $query .= " ORDER BY department, course_number, section, term, course_name ";
1074
1075
    my $dbh = C4::Context->dbh;
1076
    my $sth = $dbh->prepare($query);
1077
1078
    $sth->execute(@params, $enabled);
1079
1080
    my $courses = $sth->fetchall_arrayref( {} );
1081
1082
    foreach my $c (@$courses) {
1083
        $c->{'instructors'} = GetCourseInstructors( $c->{'course_id'} );
1084
    }
1085
1086
    return $courses;
1087
}
1088
1089
sub whoami  { ( caller(1) )[3] }
1090
sub whowasi { ( caller(2) )[3] }
1091
1092
sub stringify_params {
1093
    my (%params) = @_;
1094
1095
    my $string = "\n";
1096
1097
    foreach my $key ( keys %params ) {
1098
        $string .= "    $key => " . $params{$key} . "\n";
1099
    }
1100
1101
    return "( $string )";
1102
}
1103
1104
sub identify_myself {
1105
    my (%params) = @_;
1106
1107
    return whowasi() . stringify_params(%params);
1108
}
1109
1110
1;
1111
1112
=head1 AUTHOR
1113
1114
Kyle M Hall <kyle@bywatersolutions.com>
1115
1116
=cut
(-)a/C4/Koha.pm (-5 / +17 lines)
Lines 204-213 sub GetSupportList{ Link Here
204
}
204
}
205
=head2 GetItemTypes
205
=head2 GetItemTypes
206
206
207
  $itemtypes = &GetItemTypes();
207
  $itemtypes = &GetItemTypes( style => $style );
208
208
209
Returns information about existing itemtypes.
209
Returns information about existing itemtypes.
210
210
211
Params:
212
    style: either 'array' or 'hash', defaults to 'hash'.
213
           'array' returns an arrayref,
214
           'hash' return a hashref with the itemtype value as the key
215
211
build a HTML select with the following code :
216
build a HTML select with the following code :
212
217
213
=head3 in PERL SCRIPT
218
=head3 in PERL SCRIPT
Lines 240-245 build a HTML select with the following code : Link Here
240
=cut
245
=cut
241
246
242
sub GetItemTypes {
247
sub GetItemTypes {
248
    my ( %params ) = @_;
249
    my $style = defined( $params{'style'} ) ? $params{'style'} : 'hash';
243
250
244
    # returns a reference to a hash of references to itemtypes...
251
    # returns a reference to a hash of references to itemtypes...
245
    my %itemtypes;
252
    my %itemtypes;
Lines 250-259 sub GetItemTypes { Link Here
250
    |;
257
    |;
251
    my $sth = $dbh->prepare($query);
258
    my $sth = $dbh->prepare($query);
252
    $sth->execute;
259
    $sth->execute;
253
    while ( my $IT = $sth->fetchrow_hashref ) {
260
254
        $itemtypes{ $IT->{'itemtype'} } = $IT;
261
    if ( $style eq 'hash' ) {
262
        while ( my $IT = $sth->fetchrow_hashref ) {
263
            $itemtypes{ $IT->{'itemtype'} } = $IT;
264
        }
265
        return ( \%itemtypes );
266
    } else {
267
        return $sth->fetchall_arrayref({});
255
    }
268
    }
256
    return ( \%itemtypes );
257
}
269
}
258
270
259
sub get_itemtypeinfos_of {
271
sub get_itemtypeinfos_of {
Lines 1106-1112 sub GetAuthorisedValueCategories { Link Here
1106
1118
1107
=head2 GetAuthorisedValueByCode
1119
=head2 GetAuthorisedValueByCode
1108
1120
1109
$authhorised_value = GetAuthorisedValueByCode( $category, $authvalcode );
1121
$authorised_value = GetAuthorisedValueByCode( $category, $authvalcode, $opac );
1110
1122
1111
Return the lib attribute from authorised_values from the row identified
1123
Return the lib attribute from authorised_values from the row identified
1112
by the passed category and code
1124
by the passed category and code
(-)a/Koha/Template/Plugin/AuthorisedValues.pm (+34 lines)
Line 0 Link Here
1
package Koha::Template::Plugin::AuthorisedValues;
2
3
# Copyright ByWater Solutions 2012
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Template::Plugin;
23
use base qw( Template::Plugin );
24
25
use Encode qw{encode decode};
26
27
use C4::Koha;
28
29
sub GetByCode {
30
    my ( $self, $category, $code, $opac ) = @_;
31
    return encode('UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) );
32
}
33
34
1;
(-)a/Koha/Template/Plugin/Branches.pm (+37 lines)
Line 0 Link Here
1
package Koha::Template::Plugin::Branches;
2
3
# Copyright ByWater Solutions 2012
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Template::Plugin;
23
use base qw( Template::Plugin );
24
25
use C4::Koha;
26
27
sub GetName {
28
    my ( $self, $branchcode ) = @_;
29
30
    my $query = "SELECT branchname FROM branches WHERE branchcode = ?";
31
    my $sth   = C4::Context->dbh->prepare($query);
32
    $sth->execute($branchcode);
33
    my $b = $sth->fetchrow_hashref();
34
    return $b->{'branchname'};
35
}
36
37
1;
(-)a/Koha/Template/Plugin/ItemTypes.pm (+38 lines)
Line 0 Link Here
1
package Koha::Template::Plugin::ItemTypes;
2
3
# Copyright ByWater Solutions 2012
4
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use Template::Plugin;
23
use base qw( Template::Plugin );
24
25
use C4::Koha;
26
27
sub GetDescription {
28
    my ( $self, $itemtype ) = @_;
29
30
    my $query = "SELECT description FROM itemtypes WHERE itemtype = ?";
31
    my $sth   = C4::Context->dbh->prepare($query);
32
    $sth->execute($itemtype);
33
    my $d = $sth->fetchrow_hashref();
34
    return $d->{'description'};
35
36
}
37
38
1;
(-)a/Makefile.PL (+1 lines)
Lines 261-266 my $target_map = { Link Here
261
  './changelanguage.pl'         => 'INTRANET_CGI_DIR',
261
  './changelanguage.pl'         => 'INTRANET_CGI_DIR',
262
  './check_sysprefs.pl'         => 'NONE',
262
  './check_sysprefs.pl'         => 'NONE',
263
  './circ'                      => 'INTRANET_CGI_DIR',
263
  './circ'                      => 'INTRANET_CGI_DIR',
264
  './course_reserves'           => 'INTRANET_CGI_DIR',
264
  './offline_circ'		=> 'INTRANET_CGI_DIR',
265
  './offline_circ'		=> 'INTRANET_CGI_DIR',
265
  './edithelp.pl'               => 'INTRANET_CGI_DIR',
266
  './edithelp.pl'               => 'INTRANET_CGI_DIR',
266
  './etc'                       => { target => 'KOHA_CONF_DIR', trimdir => -1 },
267
  './etc'                       => { target => 'KOHA_CONF_DIR', trimdir => -1 },
(-)a/admin/authorised_values.pl (-1 / +1 lines)
Lines 247-253 sub default_form { Link Here
247
    }
247
    }
248
248
249
    # push koha system categories
249
    # push koha system categories
250
    foreach (qw(Asort1 Asort2 Bsort1 Bsort2 SUGGEST DAMAGED LOST REPORT_GROUP REPORT_SUBGROUP)) {
250
    foreach (qw(Asort1 Asort2 Bsort1 Bsort2 SUGGEST DAMAGED LOST REPORT_GROUP REPORT_SUBGROUP DEPARTMENT TERM)) {
251
        push @category_list, $_ unless $categories{$_};
251
        push @category_list, $_ unless $categories{$_};
252
    }
252
    }
253
253
(-)a/catalogue/detail.pl (+5 lines)
Lines 41-46 use C4::XSLT; Link Here
41
use C4::Images;
41
use C4::Images;
42
use Koha::DateUtils;
42
use Koha::DateUtils;
43
use C4::HTML5Media;
43
use C4::HTML5Media;
44
use C4::CourseReserves;
44
45
45
# use Smart::Comments;
46
# use Smart::Comments;
46
47
Lines 269-274 foreach my $item (@items) { Link Here
269
	$materials_flag = 1;
270
	$materials_flag = 1;
270
    }
271
    }
271
272
273
    if ( C4::Context->preference('UseCourseReserves') ) {
274
        $item->{'course_reserves'} = GetItemReservesInfo( itemnumber => $item->{'itemnumber'} );
275
    }
276
272
    if ($currentbranch and $currentbranch ne "NO_LIBRARY_SET"
277
    if ($currentbranch and $currentbranch ne "NO_LIBRARY_SET"
273
    and C4::Context->preference('SeparateHoldings')) {
278
    and C4::Context->preference('SeparateHoldings')) {
274
        if ($itembranchcode and $itembranchcode eq $currentbranch) {
279
        if ($itembranchcode and $itembranchcode eq $currentbranch) {
(-)a/course_reserves/add_items.pl (+97 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#
4
# Copyright 2012 Bywater Solutions
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use Modern::Perl;
22
23
use CGI;
24
25
use C4::Auth;
26
use C4::Output;
27
use C4::Koha;
28
use C4::Biblio;
29
use C4::Branch;
30
31
use C4::CourseReserves;
32
33
my $cgi = new CGI;
34
35
my $action    = $cgi->param('action')    || '';
36
my $course_id = $cgi->param('course_id') || '';
37
my $barcode   = $cgi->param('barcode')   || '';
38
39
die('No course_id provided') unless ($course_id);
40
41
my $item = GetBiblioFromItemNumber( undef, $barcode );
42
43
my $step = ( $action eq 'lookup' && $item ) ? '2' : '1';
44
45
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
46
    {
47
        template_name   => "course_reserves/add_items-step$step.tmpl",
48
        query           => $cgi,
49
        type            => "intranet",
50
        authnotrequired => 0,
51
        flagsrequired   => { coursereserves => 'add_reserves' },
52
    }
53
);
54
$template->param( ERROR_BARCODE_NOT_FOUND => $barcode )
55
  unless ( $barcode && $item && $action eq 'lookup' );
56
57
$template->param( course => GetCourse($course_id) );
58
59
if ( $action eq 'lookup' ) {
60
    my $course_item = GetCourseItem( itemnumber => $item->{'itemnumber'} );
61
    my $course_reserve = ($course_item)
62
      ? GetCourseReserve(
63
        course_id => $course_id,
64
        ci_id     => $course_item->{'ci_id'}
65
      )
66
      : undef;
67
68
    $template->param(
69
        item           => $item,
70
        course_item    => $course_item,
71
        course_reserve => $course_reserve,
72
73
        ccodes    => GetAuthorisedValues('CCODE'),
74
        locations => GetAuthorisedValues('LOC'),
75
        itypes    => GetItemTypes( style => 'array' ),
76
        branches  => GetBranchesLoop(),
77
    );
78
79
}
80
elsif ( $action eq 'add' ) {
81
    my $ci_id = ModCourseItem(
82
        itemnumber    => $cgi->param('itemnumber'),
83
        itype         => $cgi->param('itype'),
84
        ccode         => $cgi->param('ccode'),
85
        holdingbranch => $cgi->param('holdingbranch'),
86
        location      => $cgi->param('location'),
87
    );
88
89
    my $cr_id = ModCourseReserve(
90
        course_id   => $course_id,
91
        ci_id       => $ci_id,
92
        staff_note  => $cgi->param('staff_note'),
93
        public_note => $cgi->param('public_note'),
94
    );
95
}
96
97
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/course_reserves/course-details.pl (+67 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#
4
# Copyright 2012 Bywater Solutions
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use Modern::Perl;
22
23
use CGI;
24
25
use C4::Auth;
26
use C4::Output;
27
use C4::Koha;
28
29
use C4::CourseReserves;
30
31
my $cgi = new CGI;
32
33
my $action = $cgi->param('action') || '';
34
my $course_id = $cgi->param('course_id');
35
36
my $flagsrequired;
37
$flagsrequired->{coursereserves} = 'delete_reserves' if ( $action eq 'del_reserve' );
38
39
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
40
    {
41
        template_name   => "course_reserves/course-details.tmpl",
42
        query           => $cgi,
43
        type            => "intranet",
44
        authnotrequired => 0,
45
        flagsrequired   => $flagsrequired,
46
    }
47
);
48
49
die("No course_id given") unless ($course_id);
50
51
if ( $action eq 'del_reserve' ) {
52
    DelCourseReserve( cr_id => $cgi->param('cr_id') );
53
}
54
55
my $course          = GetCourse($course_id);
56
my $course_reserves = GetCourseReserves(
57
    course_id       => $course_id,
58
    include_items   => 1,
59
    include_courses => 1
60
);
61
62
$template->param(
63
    course          => $course,
64
    course_reserves => $course_reserves,
65
);
66
67
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/course_reserves/course-reserves.pl (+54 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#
4
# Copyright 2012 Bywater Solutions
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use Modern::Perl;
22
23
use CGI;
24
25
use C4::Auth;
26
use C4::Output;
27
28
use C4::CourseReserves;
29
30
my $cgi = new CGI;
31
32
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
33
    {
34
        template_name   => "course_reserves/course-reserves.tmpl",
35
        query           => $cgi,
36
        type            => "intranet",
37
        authnotrequired => 0,
38
        flagsrequired   => {},
39
    }
40
);
41
42
my $search_on = $cgi->param('search_on');
43
my %params;
44
if ($search_on) {
45
    $params{'course_name'} = "%$search_on%";
46
}
47
48
my $courses = GetCourses(%params);
49
if ( $search_on && @$courses == 1 ) {
50
    print $cgi->redirect("/cgi-bin/koha/course_reserves/course-details.pl?course_id=" . $courses->[0]->{'course_id'});
51
} else {
52
    $template->param( courses => $courses );
53
    output_html_with_http_headers $cgi, $cookie, $template->output;
54
}
(-)a/course_reserves/course.pl (+55 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#
4
# Copyright 2012 Bywater Solutions
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use Modern::Perl;
22
23
use CGI;
24
25
use C4::Auth;
26
use C4::Output;
27
use C4::Koha;
28
29
use C4::CourseReserves;
30
31
my $cgi = new CGI;
32
33
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
34
    {
35
        template_name   => "course_reserves/course.tmpl",
36
        query           => $cgi,
37
        type            => "intranet",
38
        authnotrequired => 0,
39
        flagsrequired   => { coursereserves => 'manage_courses' },
40
    }
41
);
42
43
my $course_id = $cgi->param('course_id');
44
45
if ($course_id) {
46
    my $course = GetCourse($course_id);
47
    $template->param(%$course);
48
}
49
50
$template->param(
51
    departments => GetAuthorisedValues('DEPARTMENT'),
52
    terms => GetAuthorisedValues('TERM'),
53
);
54
55
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/course_reserves/mod_course.pl (+72 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2012 ByWater Solutions
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use CGI;
23
24
use C4::Output;
25
use C4::Reserves;
26
use C4::Auth;
27
28
use C4::CourseReserves;
29
30
my $cgi = new CGI;
31
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
32
    {
33
        template_name   => "about.tmpl",
34
        query           => $cgi,
35
        type            => "intranet",
36
        authnotrequired => 0,
37
        flagsrequired   => { coursereserves => 'manage_courses' },
38
    }
39
);
40
41
my $action = $cgi->param('action');
42
43
if ( $action eq 'del' ) {
44
    DelCourse( $cgi->param('course_id') );
45
    print $cgi->redirect("/cgi-bin/koha/course_reserves/course-reserves.pl");
46
}
47
else {
48
    my %params;
49
50
    $params{'course_id'} = $cgi->param('course_id')
51
      if ( $cgi->param('course_id') );
52
    $params{'department'}     = $cgi->param('department');
53
    $params{'course_number'}  = $cgi->param('course_number');
54
    $params{'section'}        = $cgi->param('section');
55
    $params{'course_name'}    = $cgi->param('course_name');
56
    $params{'term'}           = $cgi->param('term');
57
    $params{'staff_note'}     = $cgi->param('staff_note');
58
    $params{'public_note'}    = $cgi->param('public_note');
59
    $params{'students_count'} = $cgi->param('students_count');
60
    $params{'enabled'} = ( $cgi->param('enabled') eq 'on' ) ? 'yes' : 'no';
61
62
    my $course_id = ModCourse(%params);
63
64
    my @instructors = $cgi->param('instructors');
65
    ModCourseInstructors(
66
        mode        => 'replace',
67
        cardnumbers => \@instructors,
68
        course_id   => $course_id
69
    );
70
    print $cgi->redirect(
71
        "/cgi-bin/koha/course_reserves/course-details.pl?course_id=$course_id");
72
}
(-)a/installer/data/mysql/de-DE/mandatory/userflags.sql (+1 lines)
Lines 15-17 INSERT INTO `userflags` VALUES(14,'editauthorities','Normdaten ändern',0); Link Here
15
INSERT INTO `userflags` VALUES(15,'serials','Zugang auf Abonnementverwaltung/Zeitschriftenmodul',0);
15
INSERT INTO `userflags` VALUES(15,'serials','Zugang auf Abonnementverwaltung/Zeitschriftenmodul',0);
16
INSERT INTO `userflags` VALUES(16,'reports','Zugang auf Reportmodul',0);
16
INSERT INTO `userflags` VALUES(16,'reports','Zugang auf Reportmodul',0);
17
INSERT INTO `userflags` VALUES(17,'staffaccess','Berechtigungen für Bibliotheksmitarbeiter vergeben',0);
17
INSERT INTO `userflags` VALUES(17,'staffaccess','Berechtigungen für Bibliotheksmitarbeiter vergeben',0);
18
INSERT INTO `userflags` VALUES(18,'coursereserves','Course Reserves',0);
(-)a/installer/data/mysql/de-DE/mandatory/userpermissions.sql (-1 / +4 lines)
Lines 52-56 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
52
   (15, 'renew_subscription', 'Abonnements verlängern'),
52
   (15, 'renew_subscription', 'Abonnements verlängern'),
53
   (15, 'routing', 'Umlauflisten verwalten'),
53
   (15, 'routing', 'Umlauflisten verwalten'),
54
   (16, 'execute_reports', 'SQL-Reports ausführen'),
54
   (16, 'execute_reports', 'SQL-Reports ausführen'),
55
   (16, 'create_reports', 'SQL-Reports erstellen')
55
   (16, 'create_reports', 'SQL-Reports erstellen'),
56
   (18, 'manage_courses', 'Add, edit and delete courses'),
57
   (18, 'add_reserves', 'Add course reserves'),
58
   (18, 'delete_reserves', 'Remove course reserves')
56
;
59
;
(-)a/installer/data/mysql/en/mandatory/userflags.sql (+1 lines)
Lines 15-17 INSERT INTO `userflags` VALUES(14,'editauthorities','Edit Authorities',0); Link Here
15
INSERT INTO `userflags` VALUES(15,'serials','Manage serial subscriptions',0);
15
INSERT INTO `userflags` VALUES(15,'serials','Manage serial subscriptions',0);
16
INSERT INTO `userflags` VALUES(16,'reports','Allow access to the reports module',0);
16
INSERT INTO `userflags` VALUES(16,'reports','Allow access to the reports module',0);
17
INSERT INTO `userflags` VALUES(17,'staffaccess','Allow staff members to modify permissions for other staff members',0);
17
INSERT INTO `userflags` VALUES(17,'staffaccess','Allow staff members to modify permissions for other staff members',0);
18
INSERT INTO `userflags` VALUES(18,'coursereserves','Course Reserves',0);
(-)a/installer/data/mysql/en/mandatory/userpermissions.sql (-1 / +4 lines)
Lines 52-56 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
52
   (15, 'renew_subscription', 'Renew a subscription'),
52
   (15, 'renew_subscription', 'Renew a subscription'),
53
   (15, 'routing', 'Routing'),
53
   (15, 'routing', 'Routing'),
54
   (16, 'execute_reports', 'Execute SQL reports'),
54
   (16, 'execute_reports', 'Execute SQL reports'),
55
   (16, 'create_reports', 'Create SQL Reports')
55
   (16, 'create_reports', 'Create SQL Reports'),
56
   (18, 'manage_courses', 'Add, edit and delete courses'),
57
   (18, 'add_reserves', 'Add course reserves'),
58
   (18, 'delete_reserves', 'Remove course reserves')
56
;
59
;
(-)a/installer/data/mysql/es-ES/mandatory/userflags.sql (+1 lines)
Lines 15-17 INSERT INTO `userflags` VALUES(14,'editauthorities','Allow to edit authorities', Link Here
15
INSERT INTO `userflags` VALUES(15,'serials','Allow to manage serials subscriptions',0);
15
INSERT INTO `userflags` VALUES(15,'serials','Allow to manage serials subscriptions',0);
16
INSERT INTO `userflags` VALUES(16,'reports','Allow to access to the reports module',0);
16
INSERT INTO `userflags` VALUES(16,'reports','Allow to access to the reports module',0);
17
INSERT INTO `userflags` VALUES(17,'staffaccess','Modify login / permissions for staff users',0);
17
INSERT INTO `userflags` VALUES(17,'staffaccess','Modify login / permissions for staff users',0);
18
INSERT INTO `userflags` VALUES(18,'coursereserves','Course Reserves',0);
(-)a/installer/data/mysql/es-ES/mandatory/userpermissions.sql (-1 / +4 lines)
Lines 52-56 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
52
   (15, 'renew_subscription', 'Renew a subscription'),
52
   (15, 'renew_subscription', 'Renew a subscription'),
53
   (15, 'routing', 'Routing'),
53
   (15, 'routing', 'Routing'),
54
   (16, 'execute_reports', 'Execute SQL reports'),
54
   (16, 'execute_reports', 'Execute SQL reports'),
55
   (16, 'create_reports', 'Create SQL Reports')
55
   (16, 'create_reports', 'Create SQL Reports'),
56
   (18, 'manage_courses', 'Add, edit and delete courses'),
57
   (18, 'add_reserves', 'Add course reserves'),
58
   (18, 'delete_reserves', 'Remove course reserves')
56
;
59
;
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/userflags.sql (+1 lines)
Lines 16-18 INSERT INTO `userflags` VALUES(13,'tools','Outils (export, import, impression de Link Here
16
INSERT INTO `userflags` VALUES(14,'editauthorities','Gestion des autorités',0);
16
INSERT INTO `userflags` VALUES(14,'editauthorities','Gestion des autorités',0);
17
INSERT INTO `userflags` VALUES(15,'serials','Gestion du module périodique',0);
17
INSERT INTO `userflags` VALUES(15,'serials','Gestion du module périodique',0);
18
INSERT INTO `userflags` VALUES(16,'reports','Accès aux statistiques',0);
18
INSERT INTO `userflags` VALUES(16,'reports','Accès aux statistiques',0);
19
INSERT INTO `userflags` VALUES(18,'coursereserves','Course Reserves',0);
(-)a/installer/data/mysql/fr-FR/1-Obligatoire/userpermissions.sql (-2 / +4 lines)
Lines 52-57 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
52
   (15, 'renew_subscription', 'Renouveler les abonnements'),
52
   (15, 'renew_subscription', 'Renouveler les abonnements'),
53
   (15, 'routing', 'Mettre en circulation'),
53
   (15, 'routing', 'Mettre en circulation'),
54
   (16, 'execute_reports', 'Lancer les rapports SQL'),
54
   (16, 'execute_reports', 'Lancer les rapports SQL'),
55
   (16, 'create_reports', 'Créer les rapports SQL Reports')
55
   (16, 'create_reports', 'Créer les rapports SQL Reports'),
56
56
   (18, 'manage_courses', 'Add, edit and delete courses'),
57
   (18, 'add_reserves', 'Add course reserves'),
58
   (18, 'delete_reserves', 'Remove course reserves')
57
;
59
;
(-)a/installer/data/mysql/it-IT/necessari/userflags.sql (+1 lines)
Lines 17-21 INSERT INTO `userflags` VALUES(14,'editauthorities','autorizza la modifica delle Link Here
17
INSERT INTO `userflags` VALUES(15,'serials','autorizza la gestione degli abbonamenti ai periodici',0);
17
INSERT INTO `userflags` VALUES(15,'serials','autorizza la gestione degli abbonamenti ai periodici',0);
18
INSERT INTO `userflags` VALUES(16,'reports','autorizza accesso al modulo dei reports',0);
18
INSERT INTO `userflags` VALUES(16,'reports','autorizza accesso al modulo dei reports',0);
19
INSERT INTO `userflags` VALUES(17,'staffaccess','modifica la login o i permessi degli staff users',0);
19
INSERT INTO `userflags` VALUES(17,'staffaccess','modifica la login o i permessi degli staff users',0);
20
INSERT INTO `userflags` VALUES(18,'coursereserves','Course Reserves',0);
20
21
21
SET FOREIGN_KEY_CHECKS=1;
22
SET FOREIGN_KEY_CHECKS=1;
(-)a/installer/data/mysql/it-IT/necessari/userpermissions.sql (-1 / +4 lines)
Lines 54-59 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
54
   (15, 'renew_subscription', 'Rinnova un abbonamento'),
54
   (15, 'renew_subscription', 'Rinnova un abbonamento'),
55
   (15, 'routing', 'Crea/Manipola liste di distribuzione dei fascicoli ( routing list)'),
55
   (15, 'routing', 'Crea/Manipola liste di distribuzione dei fascicoli ( routing list)'),
56
   (16, 'execute_reports', 'Esegui reports SQL'),
56
   (16, 'execute_reports', 'Esegui reports SQL'),
57
   (16, 'create_reports', 'Crea reports SQL')
57
   (16, 'create_reports', 'Crea reports SQL'),
58
   (18, 'manage_courses', 'Add, edit and delete courses'),
59
   (18, 'add_reserves', 'Add course reserves'),
60
   (18, 'delete_reserves', 'Remove course reserves')
58
;
61
;
59
SET FOREIGN_KEY_CHECKS=1;
62
SET FOREIGN_KEY_CHECKS=1;
(-)a/installer/data/mysql/kohastructure.sql (+102 lines)
Lines 466-471 CREATE TABLE collections_tracking ( Link Here
466
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
466
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8;
467
467
468
--
468
--
469
-- Table structure for table `courses`
470
--
471
472
-- The courses table stores the courses created for the
473
-- course reserves feature.
474
475
DROP TABLE IF EXISTS courses;
476
CREATE TABLE `courses` (
477
  `course_id` int(11) NOT NULL AUTO_INCREMENT,
478
  `department` varchar(20) DEFAULT NULL, -- Stores the authorised value DEPT
479
  `course_number` varchar(255) DEFAULT NULL, -- An arbitrary field meant to store the "course number" assigned to a course
480
  `section` varchar(255) DEFAULT NULL, -- Also arbitrary, but for the 'section' of a course.
481
  `course_name` varchar(255) DEFAULT NULL,
482
  `term` varchar(20) DEFAULT NULL, -- Stores the authorised value TERM
483
  `staff_note` mediumtext,
484
  `public_note` mediumtext,
485
  `students_count` varchar(20) DEFAULT NULL, -- Meant to be just an estimate of how many students will be taking this course/section
486
  `enabled` enum('yes','no') NOT NULL DEFAULT 'yes', -- Determines whether the course is active
487
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
488
   PRIMARY KEY (`course_id`)
489
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
490
491
--
492
-- Table structure for table `course_instructors`
493
--
494
495
-- The course instructors table links Koha borrowers to the
496
-- courses they are teaching. Many instructors can teach many
497
-- courses. course_instructors is just a many-to-many join table.
498
499
DROP TABLE IF EXISTS course_instructors;
500
CREATE TABLE `course_instructors` (
501
  `course_id` int(11) NOT NULL,
502
  `borrowernumber` int(11) NOT NULL,
503
  PRIMARY KEY (`course_id`,`borrowernumber`),
504
  KEY `borrowernumber` (`borrowernumber`)
505
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
506
507
--
508
-- Constraints for table `course_instructors`
509
--
510
ALTER TABLE `course_instructors`
511
  ADD CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
512
  ADD CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE;
513
514
--
515
-- Table structure for table `course_items`
516
--
517
518
-- If an item is placed on course reserve for one or more courses
519
-- it will have an entry in this table. No matter how many courses an item
520
-- is part of, it will only have one row in this table.
521
522
DROP TABLE IF EXISTS course_items;
523
CREATE TABLE `course_items` (
524
  `ci_id` int(11) NOT NULL AUTO_INCREMENT,
525
  `itemnumber` int(11) NOT NULL, -- items.itemnumber for the item on reserve
526
  `itype` varchar(10) DEFAULT NULL, -- an optional new itemtype for the item to have while on reserve
527
  `ccode` varchar(10) DEFAULT NULL, -- an optional new category code for the item to have while on reserve
528
  `holdingbranch` varchar(10) DEFAULT NULL, -- an optional new holding branch for the item to have while on reserve
529
  `location` varchar(80) DEFAULT NULL, -- an optional new shelving location for the item to have while on reseve
530
  `enabled` enum('yes','no') NOT NULL DEFAULT 'no', -- If at least one enabled course has this item on reseve, this field will be 'yes', otherwise it will be 'no'
531
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
532
   PRIMARY KEY (`ci_id`),
533
   UNIQUE KEY `itemnumber` (`itemnumber`),
534
   KEY `holdingbranch` (`holdingbranch`)
535
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
536
537
--
538
-- Constraints for table `course_items`
539
--
540
ALTER TABLE `course_items`
541
  ADD CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
542
  ADD CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE;
543
544
--
545
-- Table structure for table `course_reserves`
546
--
547
548
-- This table connects an item placed on course reserve to a course it is on reserve for.
549
-- There will be a row in this table for each course an item is on reserve for.
550
551
DROP TABLE IF EXISTS course_reserves;
552
CREATE TABLE `course_reserves` (
553
  `cr_id` int(11) NOT NULL AUTO_INCREMENT,
554
  `course_id` int(11) NOT NULL, -- Foreign key to the courses table
555
  `ci_id` int(11) NOT NULL, -- Foreign key to the course_items table
556
  `staff_note` mediumtext, -- Staff only note
557
  `public_note` mediumtext, -- Public, OPAC visible note
558
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
559
   PRIMARY KEY (`cr_id`),
560
   UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
561
   KEY `course_id` (`course_id`)
562
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
563
564
--
565
-- Constraints for table `course_reserves`
566
--
567
ALTER TABLE `course_reserves`
568
  ADD CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`);
569
570
--
469
-- Table structure for table `borrower_branch_circ_rules`
571
-- Table structure for table `borrower_branch_circ_rules`
470
--
572
--
471
573
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/userflags.sql (+1 lines)
Lines 36-38 INSERT INTO `userflags` VALUES(14,'editauthorities','Tilgang til å endre autori Link Here
36
INSERT INTO `userflags` VALUES(15,'serials','Tilgang til å endre abonnementer',0);
36
INSERT INTO `userflags` VALUES(15,'serials','Tilgang til å endre abonnementer',0);
37
INSERT INTO `userflags` VALUES(16,'reports','Tilgang til rapportmodulen',0);
37
INSERT INTO `userflags` VALUES(16,'reports','Tilgang til rapportmodulen',0);
38
INSERT INTO `userflags` VALUES(17,'staffaccess','Endre innlogging og rettigheter for bibliotekansatte',0);
38
INSERT INTO `userflags` VALUES(17,'staffaccess','Endre innlogging og rettigheter for bibliotekansatte',0);
39
INSERT INTO `userflags` VALUES(18,'coursereserves','Course Reserves',0);
(-)a/installer/data/mysql/nb-NO/1-Obligatorisk/userpermissions.sql (-1 / +4 lines)
Lines 72-76 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
72
   (15, 'renew_subscription', 'Fornye abonnementer'),
72
   (15, 'renew_subscription', 'Fornye abonnementer'),
73
   (15, 'routing', 'Sirkulasjon'),
73
   (15, 'routing', 'Sirkulasjon'),
74
   (16, 'execute_reports', 'Kjøre SQL-rapporter'),
74
   (16, 'execute_reports', 'Kjøre SQL-rapporter'),
75
   (16, 'create_reports', 'Opprette SQL-rapporter')
75
   (16, 'create_reports', 'Opprette SQL-rapporter'),
76
   (18, 'manage_courses', 'Add, edit and delete courses'),
77
   (18, 'add_reserves', 'Add course reserves'),
78
   (18, 'delete_reserves', 'Remove course reserves')
76
;
79
;
(-)a/installer/data/mysql/pl-PL/mandatory/userflags.sql (+1 lines)
Lines 15-17 INSERT INTO `userflags` VALUES(14,'editauthorities','Allow to edit authorities', Link Here
15
INSERT INTO `userflags` VALUES(15,'serials','Allow to manage serials subscriptions',0);
15
INSERT INTO `userflags` VALUES(15,'serials','Allow to manage serials subscriptions',0);
16
INSERT INTO `userflags` VALUES(16,'reports','Allow to access to the reports module',0);
16
INSERT INTO `userflags` VALUES(16,'reports','Allow to access to the reports module',0);
17
INSERT INTO `userflags` VALUES(17,'staffaccess','Modify login / permissions for staff users',0);
17
INSERT INTO `userflags` VALUES(17,'staffaccess','Modify login / permissions for staff users',0);
18
INSERT INTO `userflags` VALUES(18,'coursereserves','Course Reserves',0);
(-)a/installer/data/mysql/pl-PL/mandatory/userpermissions.sql (-1 / +4 lines)
Lines 53-57 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
53
   (15, 'renew_subscription', 'Renew a subscription'),
53
   (15, 'renew_subscription', 'Renew a subscription'),
54
   (15, 'routing', 'Routing'),
54
   (15, 'routing', 'Routing'),
55
   (16, 'execute_reports', 'Execute SQL reports'),
55
   (16, 'execute_reports', 'Execute SQL reports'),
56
   (16, 'create_reports', 'Create SQL Reports')
56
   (16, 'create_reports', 'Create SQL Reports'),
57
   (18, 'manage_courses', 'Add, edit and delete courses'),
58
   (18, 'add_reserves', 'Add course reserves'),
59
   (18, 'delete_reserves', 'Remove course reserves')
57
;
60
;
(-)a/installer/data/mysql/ru-RU/mandatory/permissions_and_user_flags.sql (-2 / +6 lines)
Lines 17-23 INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES Link Here
17
   (14,'editauthorities', 'Разрешение на изменение авторитетных источников',0),
17
   (14,'editauthorities', 'Разрешение на изменение авторитетных источников',0),
18
   (15,'serials',         'Разрешение на управление подпиской периодических изданий',0),
18
   (15,'serials',         'Разрешение на управление подпиской периодических изданий',0),
19
   (16,'reports',         'Разрешение на доступ к модулю отчетов',0),
19
   (16,'reports',         'Разрешение на доступ к модулю отчетов',0),
20
   (17,'staffaccess',     'Смена имени(логина)/привилегий для работников библиотеки',0)
20
   (17,'staffaccess',     'Смена имени(логина)/привилегий для работников библиотеки',0),
21
   (18,'coursereserves',  'Course Reserves',0);
21
;
22
;
22
23
23
TRUNCATE permissions;
24
TRUNCATE permissions;
Lines 76-81 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
76
   (15, 'renew_subscription',          'Renew a subscription'),
77
   (15, 'renew_subscription',          'Renew a subscription'),
77
   (15, 'routing',                     'Routing'),
78
   (15, 'routing',                     'Routing'),
78
   (16, 'execute_reports', 'Execute SQL reports'),
79
   (16, 'execute_reports', 'Execute SQL reports'),
79
   (16, 'create_reports', 'Create SQL Reports')
80
   (16, 'create_reports', 'Create SQL Reports'),
81
   (18, 'manage_courses', 'Add, edit and delete courses'),
82
   (18, 'add_reserves', 'Add course reserves'),
83
   (18, 'delete_reserves', 'Remove course reserves')
80
;
84
;
81
85
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 421-423 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES( Link Here
421
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PatronSelfRegistrationAdditionalInstructions','','A free text field to display additional instructions to newly self registered patrons.','','free');
421
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('PatronSelfRegistrationAdditionalInstructions','','A free text field to display additional instructions to newly self registered patrons.','','free');
422
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '0', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo');
422
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '0', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo');
423
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo');
423
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('FinesIncludeGracePeriod','1','If enabled, fines calculations will include the grace period.',NULL,'YesNo');
424
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo');
(-)a/installer/data/mysql/uk-UA/mandatory/permissions_and_user_flags.sql (-2 / +6 lines)
Lines 17-23 INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES Link Here
17
   (14,'editauthorities', 'Дозвіл на редагування авторитетних джерел',0),
17
   (14,'editauthorities', 'Дозвіл на редагування авторитетних джерел',0),
18
   (15,'serials',         'Дозвіл на керування підпискою періодичних видань',0),
18
   (15,'serials',         'Дозвіл на керування підпискою періодичних видань',0),
19
   (16,'reports',         'Дозвіл на доступ до модуля звітів',0),
19
   (16,'reports',         'Дозвіл на доступ до модуля звітів',0),
20
   (17,'staffaccess',     'Зміна імені(логіну)/привілеїв для працівників бібліотеки',0)
20
   (17,'staffaccess',     'Зміна імені(логіну)/привілеїв для працівників бібліотеки',0),
21
   (18,'coursereserves',  'Course Reserves',0);
21
;
22
;
22
23
23
TRUNCATE permissions;
24
TRUNCATE permissions;
Lines 76-81 INSERT INTO permissions (module_bit, code, description) VALUES Link Here
76
   (15, 'renew_subscription',          'Renew a subscription'),
77
   (15, 'renew_subscription',          'Renew a subscription'),
77
   (15, 'routing',                     'Routing'),
78
   (15, 'routing',                     'Routing'),
78
   (16, 'execute_reports', 'Execute SQL reports'),
79
   (16, 'execute_reports', 'Execute SQL reports'),
79
   (16, 'create_reports', 'Create SQL Reports')
80
   (16, 'create_reports', 'Create SQL Reports'),
81
   (18, 'manage_courses', 'Add, edit and delete courses'),
82
   (18, 'add_reserves', 'Add course reserves'),
83
   (18, 'delete_reserves', 'Remove course reserves')
80
;
84
;
81
85
(-)a/installer/data/mysql/updatedatabase.pl (-3 / +90 lines)
Lines 5797-5803 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5797
    SetVersion($DBversion);
5797
    SetVersion($DBversion);
5798
}
5798
}
5799
5799
5800
5801
$DBversion = "3.09.00.047";
5800
$DBversion = "3.09.00.047";
5802
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5801
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5803
    # to preserve default behaviour as best as possible, set this new preference differently depending on whether IndependantBranches is set or not
5802
    # to preserve default behaviour as best as possible, set this new preference differently depending on whether IndependantBranches is set or not
Lines 5828-5835 if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5828
    SetVersion($DBversion);
5827
    SetVersion($DBversion);
5829
}
5828
}
5830
5829
5831
5832
5833
$DBversion = "3.09.00.050";
5830
$DBversion = "3.09.00.050";
5834
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5831
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5835
    $dbh->do("ALTER TABLE authorised_values MODIFY category varchar(16) NOT NULL DEFAULT '';");
5832
    $dbh->do("ALTER TABLE authorised_values MODIFY category varchar(16) NOT NULL DEFAULT '';");
Lines 6532-6537 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6532
    SetVersion ($DBversion);
6529
    SetVersion ($DBversion);
6533
}
6530
}
6534
6531
6532
$DBversion = "3.11.00.XXX";
6533
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
6534
    $dbh->do("INSERT INTO `systempreferences` (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('UseCourseReserves', '0', NULL, 'Enable the course reserves feature.', 'YesNo')");
6535
    $dbh->do("INSERT INTO userflags (bit,flag,flagdesc,defaulton) VALUES ('18','coursereserves','Course Reserves','0')");
6536
    $dbh->do("
6537
CREATE TABLE `courses` (
6538
  `course_id` int(11) NOT NULL AUTO_INCREMENT,
6539
  `department` varchar(20) DEFAULT NULL,
6540
  `course_number` varchar(255) DEFAULT NULL,
6541
  `section` varchar(255) DEFAULT NULL,
6542
  `course_name` varchar(255) DEFAULT NULL,
6543
  `term` varchar(20) DEFAULT NULL,
6544
  `staff_note` mediumtext,
6545
  `public_note` mediumtext,
6546
  `students_count` varchar(20) DEFAULT NULL,
6547
  `enabled` enum('yes','no') NOT NULL DEFAULT 'yes',
6548
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
6549
   PRIMARY KEY (`course_id`)
6550
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
6551
    ");
6552
6553
    $dbh->do("
6554
CREATE TABLE `course_instructors` (
6555
  `course_id` int(11) NOT NULL,
6556
  `borrowernumber` int(11) NOT NULL,
6557
  PRIMARY KEY (`course_id`,`borrowernumber`),
6558
  KEY `borrowernumber` (`borrowernumber`)
6559
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
6560
    ");
6561
6562
    $dbh->do("
6563
ALTER TABLE `course_instructors`
6564
  ADD CONSTRAINT `course_instructors_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`),
6565
  ADD CONSTRAINT `course_instructors_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE;
6566
    ");
6567
6568
    $dbh->do("
6569
CREATE TABLE `course_items` (
6570
  `ci_id` int(11) NOT NULL AUTO_INCREMENT,
6571
  `itemnumber` int(11) NOT NULL,
6572
  `itype` varchar(10) DEFAULT NULL,
6573
  `ccode` varchar(10) DEFAULT NULL,
6574
  `holdingbranch` varchar(10) DEFAULT NULL,
6575
  `location` varchar(80) DEFAULT NULL,
6576
  `enabled` enum('yes','no') NOT NULL DEFAULT 'no',
6577
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
6578
   PRIMARY KEY (`ci_id`),
6579
   UNIQUE KEY `itemnumber` (`itemnumber`),
6580
   KEY `holdingbranch` (`holdingbranch`)
6581
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
6582
    ");
6583
6584
$dbh->do("
6585
ALTER TABLE `course_items`
6586
  ADD CONSTRAINT `course_items_ibfk_2` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON DELETE CASCADE ON UPDATE CASCADE,
6587
  ADD CONSTRAINT `course_items_ibfk_1` FOREIGN KEY (`itemnumber`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE;
6588
");
6589
6590
$dbh->do("
6591
CREATE TABLE `course_reserves` (
6592
  `cr_id` int(11) NOT NULL AUTO_INCREMENT,
6593
  `course_id` int(11) NOT NULL,
6594
  `ci_id` int(11) NOT NULL,
6595
  `staff_note` mediumtext,
6596
  `public_note` mediumtext,
6597
  `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
6598
   PRIMARY KEY (`cr_id`),
6599
   UNIQUE KEY `pseudo_key` (`course_id`,`ci_id`),
6600
   KEY `course_id` (`course_id`)
6601
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
6602
");
6603
6604
    $dbh->do("
6605
ALTER TABLE `course_reserves`
6606
  ADD CONSTRAINT `course_reserves_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`course_id`);
6607
    ");
6608
6609
    $dbh->do("
6610
INSERT INTO permissions (module_bit, code, description) VALUES
6611
  (18, 'manage_courses', 'Add, edit and delete courses'),
6612
  (18, 'add_reserves', 'Add course reserves'),
6613
  (18, 'delete_reserves', 'Remove course reserves')
6614
;
6615
    ");
6616
6617
6618
    print "Upgrade to $DBversion done (Add Course Reserves ( system preference UseCourseReserves ))\n";
6619
    SetVersion($DBversion);
6620
}
6621
6535
=head1 FUNCTIONS
6622
=head1 FUNCTIONS
6536
6623
6537
=head2 TableExists($table)
6624
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css (-2 / +2 lines)
Lines 744-750 fieldset.rows .inputnote { Link Here
744
    visibility:visible; /* you propably don't need to change this one */
744
    visibility:visible; /* you propably don't need to change this one */
745
    display:block;
745
    display:block;
746
}
746
}
747
#newbiblio a, #addchild a, #newentry a, #newshelf a, #newmenuc .first-child, #newsupplier .first-child, #newlabel a, #newtemplate a, #newlabelbatch a, #newpatroncardbatch a, #newprofile a, #newsubscription a, #newdictionary a, #newbasket a, #newrootbudget-button, #budgets_menuc .first-child {
747
#new_course a, #newbiblio a, #addchild a, #newentry a, #newshelf a, #newmenuc .first-child, #newsupplier .first-child, #newlabel a, #newtemplate a, #newlabelbatch a, #newpatroncardbatch a, #newprofile a, #newsubscription a, #newdictionary a, #newbasket a, #newrootbudget-button, #budgets_menuc .first-child {
748
	padding-left : 34px;
748
	padding-left : 34px;
749
	background-image: url("../../img/toolbar-new.gif");
749
	background-image: url("../../img/toolbar-new.gif");
750
	background-position : center left;
750
	background-position : center left;
Lines 2550-2553 button.closebtn{padding:0;cursor:pointer;background:transparent;border:0;-webkit Link Here
2550
.btn-group label,
2550
.btn-group label,
2551
.btn-group select {
2551
.btn-group select {
2552
    font-size: 13px;
2552
    font-size: 13px;
2553
}
2553
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (-1 / +4 lines)
Lines 24-29 Link Here
24
                            [% IF ( CAN_user_serials ) %]
24
                            [% IF ( CAN_user_serials ) %]
25
                            <li><a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a></li>
25
                            <li><a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a></li>
26
                            [% END %]
26
                            [% END %]
27
                            [% IF ( CAN_user_coursereserves ) %]
28
                            <li><a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course Reserves</a></li>
29
                            [% END %]
27
                            [% IF ( CAN_user_reports ) %]
30
                            [% IF ( CAN_user_reports ) %]
28
                            <li><a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a></li>
31
                            <li><a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a></li>
29
                            [% END %]
32
                            [% END %]
Lines 93-96 Link Here
93
       </div>
96
       </div>
94
   </div>
97
   </div>
95
[% IF ( intranetbookbag ) %]<div id="cartDetails">Your cart is empty.</div>[% END %]
98
[% IF ( intranetbookbag ) %]<div id="cartDetails">Your cart is empty.</div>[% END %]
96
</div>
99
</div>
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/staff-global.js (-2 / +4 lines)
Lines 5-18 function _(s) { return s; } // dummy function for gettext Link Here
5
5
6
 $(document).ready(function() {
6
 $(document).ready(function() {
7
    $('#header_search').tabs().bind('tabsshow', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); });
7
    $('#header_search').tabs().bind('tabsshow', function(e, ui) { $('#header_search > div:not(.ui-tabs-hide)').find('input').eq(0).focus(); });
8
	$(".close").click(function(){ window.close(); });
8
9
    $(".close").click(function(){ window.close(); });
10
9
    if($("#header_search #checkin_search").length > 0){ $(document).bind('keydown','Alt+r',function (){ $("#header_search").tabs("select","#checkin_search"); $("#ret_barcode").focus(); }); } else { $(document).bind('keydown','Alt+r',function (){ location.href="/cgi-bin/koha/circ/returns.pl"; }); }
11
    if($("#header_search #checkin_search").length > 0){ $(document).bind('keydown','Alt+r',function (){ $("#header_search").tabs("select","#checkin_search"); $("#ret_barcode").focus(); }); } else { $(document).bind('keydown','Alt+r',function (){ location.href="/cgi-bin/koha/circ/returns.pl"; }); }
10
    if($("#header_search #circ_search").length > 0){ $(document).bind('keydown','Alt+u',function (){ $("#header_search").tabs("select","#circ_search"); $("#findborrower").focus(); }); } else { $(document).bind('keydown','Alt+u',function(){ location.href="/cgi-bin/koha/circ/circulation.pl"; }); }
12
    if($("#header_search #circ_search").length > 0){ $(document).bind('keydown','Alt+u',function (){ $("#header_search").tabs("select","#circ_search"); $("#findborrower").focus(); }); } else { $(document).bind('keydown','Alt+u',function(){ location.href="/cgi-bin/koha/circ/circulation.pl"; }); }
11
    if($("#header_search #catalog_search").length > 0){ $(document).bind('keydown','Alt+q',function (){ $("#header_search").tabs("select","#catalog_search"); $("#search-form").focus(); }); } else { $(document).bind('keydown','Alt+q',function(){ location.href="/cgi-bin/koha/catalogue/search.pl"; }); }
13
    if($("#header_search #catalog_search").length > 0){ $(document).bind('keydown','Alt+q',function (){ $("#header_search").tabs("select","#catalog_search"); $("#search-form").focus(); }); } else { $(document).bind('keydown','Alt+q',function(){ location.href="/cgi-bin/koha/catalogue/search.pl"; }); }
14
12
    $(".focus").focus();
15
    $(".focus").focus();
13
});
16
});
14
17
15
16
// http://jennifermadden.com/javascript/stringEnterKeyDetector.html
18
// http://jennifermadden.com/javascript/stringEnterKeyDetector.html
17
function checkEnter(e){ //e is event object passed from function invocation
19
function checkEnter(e){ //e is event object passed from function invocation
18
	var characterCode; // literal character code will be stored in this variable
20
	var characterCode; // literal character code will be stored in this variable
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (+7 lines)
Lines 543-545 Circulation: Link Here
543
            - and this password
543
            - and this password
544
            - pref: AutoSelfCheckPass
544
            - pref: AutoSelfCheckPass
545
            - .
545
            - .
546
    Course Reserves:
547
        -
548
            - pref: UseCourseReserves
549
              choices:
550
                  yes: Use
551
                  no: "Don't use"
552
            - course reserves
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (+34 lines)
Lines 1-3 Link Here
1
[% USE AuthorisedValues %]
2
3
[% ShowCourseReserves = 0 %]
4
[% IF UseCourseReserves %]
5
    [% FOREACH item IN itemloop %]
6
       [% IF item.course_reserves %]
7
           [% FOREACH r IN item.course_reserves %]
8
               [% IF r.course.enabled == 'yes' %]
9
                   [% ShowCourseReserves = 1 %]
10
               [% END %]
11
           [% END %]
12
        [% END %]
13
    [% END %]
14
[% END %]
15
1
[% INCLUDE 'doc-head-open.inc' %]
16
[% INCLUDE 'doc-head-open.inc' %]
2
[% INCLUDE 'greybox.inc' %]
17
[% INCLUDE 'greybox.inc' %]
3
<title>Koha &rsaquo; Catalog &rsaquo;
18
<title>Koha &rsaquo; Catalog &rsaquo;
Lines 370-375 function verify_images() { Link Here
370
                [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th>Spine label</th>[% END %]
385
                [% IF ( SpineLabelShowPrintOnBibDetails ) %]<th>Spine label</th>[% END %]
371
                [% IF ( hostrecords ) %]<th>Host records</th>[% END %]
386
                [% IF ( hostrecords ) %]<th>Host records</th>[% END %]
372
                [% IF ( analyze ) %]<th>Used in</th><th></th>[% END %]
387
                [% IF ( analyze ) %]<th>Used in</th><th></th>[% END %]
388
                [% IF ( ShowCourseReserves ) %]<th>Course Reserves</th>[% END %]
373
            </tr>
389
            </tr>
374
        </thead>
390
        </thead>
375
        <tbody>
391
        <tbody>
Lines 522-527 function verify_images() { Link Here
522
                        <td><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=[% item.biblionumber %]&amp;hostitemnumber=[% item.itemnumber %]">Create analytics</a></td>
538
                        <td><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?hostbiblionumber=[% item.biblionumber %]&amp;hostitemnumber=[% item.itemnumber %]">Create analytics</a></td>
523
                    [% END %]
539
                    [% END %]
524
540
541
                [% IF ShowCourseReserves %]
542
                    <td>
543
                        [% IF item.course_reserves %]
544
                            [% FOREACH r IN item.course_reserves %]
545
                                [% IF r.course.enabled == 'yes' %]
546
                                    <p>
547
                                      <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% r.course.course_id %]">
548
                                         [% r.course.course_name %]
549
                                         <!--[% IF r.course.course_number %] [% r.course.course_number %] [% END %]-->
550
                                         [% IF r.course.section %] [% r.course.section %] [% END %]
551
                                         [% IF r.course.term %] [% AuthorisedValues.GetByCode( 'TERM', r.course.term ) %] [% END %]
552
                                      </a>
553
                                   </p>
554
                               [% END %]
555
                           [% END %]
556
                       [% END %]
557
                    </td>
558
                [% END %]
525
                </tr>
559
                </tr>
526
            [% END %]
560
            [% END %]
527
        </tbody>
561
        </tbody>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt (-1 / +1 lines)
Lines 10-16 $(document).ready(function(){ Link Here
10
            window.close();
10
            window.close();
11
        [% END %]
11
        [% END %]
12
    [% END %]
12
    [% END %]
13
		$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
13
            $("fieldset.rows input").addClass("noEnterSubmit");
14
		/* Inline edit/delete links */
14
		/* Inline edit/delete links */
15
		var biblionumber = $("input[name='biblionumber']").attr("value");
15
		var biblionumber = $("input[name='biblionumber']").attr("value");
16
		$("td").click(function(event){
16
		$("td").click(function(event){
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt (+63 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<script type="text/javascript">
7
//<![CDATA[
8
9
$(document).ready(function() {
10
  $('#barcode').focus();
11
});
12
13
//]]>
14
</script>
15
16
<body>
17
18
[% INCLUDE 'header.inc' %]
19
[% INCLUDE 'cat-search.inc' %]
20
21
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; Add reserves for <i><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]">[% course.course_name %]</a></i></div>
22
23
<div id="doc2" class="yui-t7">
24
    <div id="bd">
25
        <div id="yui-main">
26
            <div class="yui-b">
27
                <div class="yui-g">
28
                    <div class="yui-u first">
29
                        [% IF ERROR_BARCODE_NOT_FOUND %]
30
                            <div class="error">No item found for barcode [% ERROR_BARCODE_NOT_FOUND %]</div>
31
                        [% END %]
32
33
                        <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
34
                            <input type="hidden" name="course_id" value="[% course.course_id %]" />
35
                            <input type="hidden" name="action" value="lookup" />
36
37
                            <fieldset class="rows">
38
                                <legend>Add items: scan barcode</legend>
39
40
                                    <p>
41
42
                                    <li>
43
                                        <label class="required" for="barcode">Item barcode:</label>
44
                                        <input id="barcode" name="barcode" type="text" />
45
                                    </li>
46
                                </ol>
47
                            </fieldset>
48
49
                            <fieldset class="action">
50
                                <input type="submit" value="Submit" class="submit" />
51
52
                                <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]" class="cancel">Cancel</a>
53
                            </fieldset>
54
                        </form>
55
                    </div>
56
                </div>
57
            </div>
58
        </div>
59
    </div>
60
</div>
61
62
63
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step2.tt (+133 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Course reserves &rsaquo; Add items</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
5
<script type="text/javascript">
6
//<![CDATA[
7
$(document).ready(function() {
8
  $('#submit').focus();
9
});
10
//]]>
11
</script>
12
13
</head>
14
15
<body>
16
17
[% INCLUDE 'header.inc' %]
18
[% INCLUDE 'cat-search.inc' %]
19
20
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; Reserve <i><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% item.biblionumber %]">[% item.title %]</a></i> for <i><a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]">[% course.course_name %]</a></i></div>
21
22
<div id="doc2" class="yui-t7">
23
    <div id="bd">
24
        <div id="yui-main">
25
            <div class="yui-b">
26
                <div class="yui-g">
27
                    <div class="yui-u first">
28
                        [% IF course_reserve %]<div class="warn" id="already_on_reserve_this">This course already has this item on reserve.<div>[% END %]
29
                        [% IF course_item    %]<div class="warn" id="already_on_reserve">Number of courses reserving this item: [% course_item.course_reserves.size %]<div>[% END %]
30
31
                        <form method="post" action="/cgi-bin/koha/course_reserves/add_items.pl">
32
                            <input type="hidden" name="course_id" value="[% course.course_id %]" />
33
                            <input type="hidden" name="action" value="add" />
34
35
                            <fieldset class="rows">
36
                                <legend>Add <i>[% item.title %]</i> to <i>[% course.course_name %]</i></legend>
37
                                <ol>
38
                                    <li>
39
                                        <label for="barcode">Barcode:</label>
40
                                        <span id="barcode">[% item.barcode %]</span>
41
                                        <input type="hidden" name="itemnumber" value="[% item.itemnumber %]" />
42
                                    </li>
43
44
                                    [% IF item_level_itypes %]
45
                                    <li>
46
                                        <label class="required" for="itype">Item Type:</label>
47
                                        <select id="itype" name="itype">
48
                                            <option value="">LEAVE UNCHANGED</option>
49
50
                                            [% FOREACH it IN itypes %]
51
                                                [% IF course_item.itype && ( ( course.enabled == 'yes' && it.itemtype == item.itype ) || ( course.enabled == 'no' && it.itemtype == course_item.itype ) ) %]
52
                                                    <option value="[% it.itemtype %]" selected="selected">[% it.description %]</option>
53
                                                [% ELSE %]
54
                                                    <option value="[% it.itemtype %]">[% it.description %]</option>
55
                                                [% END %]
56
                                            [% END %]
57
                                        </select>
58
                                    </li>
59
                                    [% END %]
60
61
                                    <li>
62
                                        <label class="required" for="ccode">Collection Code:</label>
63
                                        <select id="ccode" name="ccode">
64
                                            <option value="">LEAVE UNCHANGED</option>
65
66
                                            [% FOREACH c IN ccodes %]
67
                                                [% IF course_item.ccode && ( ( course.enabled == 'yes' && c.authorised_value == item.ccode ) || ( course.enabled == 'no' && c.authorised_value == course_item.ccode ) ) %]
68
                                                    <option value="[% c.authorised_value %]" selected="selected">[% c.lib %]</option>
69
                                                [% ELSE %]
70
                                                    <option value="[% c.authorised_value %]">[% c.lib %]</option>
71
                                                [% END %]
72
                                            [% END %]
73
                                        </select>
74
                                    </li>
75
76
                                    <li>
77
                                        <label class="required" for="location">Shelving Location:</label>
78
                                        <select id="location" name="location">
79
                                            <option value="">LEAVE UNCHANGED</option>
80
81
                                            [% FOREACH s IN locations %]
82
                                                [% IF course_item.location && ( ( course.enabled == 'yes' && s.authorised_value == item.location ) || ( course.enabled == 'no' && s.authorised_value == course_item.location ) ) %]
83
                                                    <option value="[% s.authorised_value %]" selected="selected">[% s.lib %]</option>
84
                                                [% ELSE %]
85
                                                    <option value="[% s.authorised_value %]">[% s.lib %]</option>
86
                                                [% END %]
87
                                            [% END %]
88
                                        </select>
89
                                    </li>
90
91
                                    <li>
92
                                        <label class="required" for="holdingbranch">Holding Library:</label>
93
                                        <select id="holdingbranch" name="holdingbranch">
94
                                            <option value="">LEAVE UNCHANGED</option>
95
96
                                            [% FOREACH b IN branches %]
97
                                                [% IF course_item.holdingbranch && ( ( course.enabled == 'yes' && b.value == item.holdingbranch ) || ( course.enabled == 'no' && b.value == course_item.holdingbranch ) ) %]
98
                                                    <option value="[% b.value %]" selected="selected">[% b.branchname %]</option>
99
                                                [% ELSE %]
100
                                                    <option value="[% b.value %]">[% b.branchname %]</option>
101
                                                [% END %]
102
                                            [% END %]
103
                                        </select>
104
                                    </li>
105
106
                                    <li>
107
                                        <label for="staff_note">Staff note:</label>
108
                                        <textarea name="staff_note" id="staff_note">[% course_reserve.staff_note %]</textarea>
109
                                    </li>
110
111
                                    <li>
112
                                        <label for="public_note">Public note:</label>
113
                                        <textarea name="public_note" id="public_note">[% course_reserve.public_note %]</textarea>
114
                                    </li>
115
116
                                </ol>
117
                            </fieldset>
118
119
                            <fieldset class="action">
120
                                <input type="submit" id="submit" value="Save" class="submit" />
121
122
                                <a href="/cgi-bin/koha/course_reserves/course-details.pl?course_id=[% course.course_id %]" class="cancel">Cancel</a>
123
                            </fieldset>
124
125
                    </div>
126
                </div>
127
            </div>
128
        </div>
129
    </div>
130
</div>
131
132
133
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-details.tt (+185 lines)
Line 0 Link Here
1
[% USE AuthorisedValues %]
2
[% USE ItemTypes %]
3
[% USE Branches %]
4
[% INCLUDE 'doc-head-open.inc' %]
5
<title>Koha &rsaquo; Course reserves &rsaquo; New course</title>
6
[% INCLUDE 'doc-head-close.inc' %]
7
8
<script type="text/javascript">
9
//<![CDATA[
10
11
    function confirmItemDelete(){
12
        return confirm( _('Are you sure you want to delete this item?');
13
    }
14
15
//]]>
16
</script>
17
18
</head>
19
20
<body>
21
22
[% INCLUDE 'header.inc' %]
23
[% INCLUDE 'cat-search.inc' %]
24
25
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; Course details for <i>[% course.course_name %]</i></div>
26
27
<div id="doc2" class="yui-t7">
28
    <div id="bd">
29
        <div id="yui-main">
30
            <div id="toolbar">
31
                <script type="text/javascript">
32
                //<![CDATA[
33
                    $(document).ready(function(){
34
                        addItemsButton     = new YAHOO.widget.Button("add_items");
35
                        editCourseButton   = new YAHOO.widget.Button("edit_course");
36
                        deleteCourseButton = new YAHOO.widget.Button("delete_course");
37
38
                        deleteCourseButton.on("click", confirmDelete );
39
                    });
40
41
                    function confirmDelete(p_oEvent){
42
                        if ( ! confirm( _('Are you sure you want to delete this course?') ) ) {
43
                            YAHOO.util.Event.stopEvent( p_oEvent );
44
                        }
45
                    }
46
47
                //]]>
48
                </script>
49
                <ul class="toolbar">
50
                    [% IF CAN_user_coursereserves_add_reserves %]<li><a id="add_items" href="/cgi-bin/koha/course_reserves/add_items.pl?course_id=[% course.course_id %]">Add reserves</a></li>[% END %]
51
                    [% IF ( CAN_user_coursereserves_manage_courses ) %]<li><a id="edit_course" href="/cgi-bin/koha/course_reserves/course.pl?course_id=[% course.course_id %]">Edit course</a></li>[% END %]
52
                    [% IF ( CAN_user_coursereserves_manage_courses ) %]<li><a id="delete_course" href="/cgi-bin/koha/course_reserves/mod_course.pl?course_id=[% course.course_id %]&action=del">Delete course</a></li>[% END %]
53
                </ul>
54
            </div><!-- /toolbar -->
55
56
            <table>
57
                <tr><th>Course name</th><td>[% course.course_name %]</td></tr>
58
                <tr><th>Term</th><td>[% AuthorisedValues.GetByCode( 'TERM', course.term ) %]</td></tr>
59
                <tr><th>Department</th><td>_[% AuthorisedValues.GetByCode( 'DEPARTMENT', course.department ) %]</td></tr>
60
                <tr><th>Course number</th><td>[% course.course_number %]</td></tr>
61
                <tr><th>Section</th><td>[% course.section %]</td></tr>
62
                <tr><th>Instructors</th><td>[% FOREACH i IN course.instructors %]<div class="instructor"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% i.borrowernumber %]">[% i.firstname %] [% i.surname %]</a></div>[% END %]</td></tr>
63
                <tr><th>Staff note</th><td>[% course.staff_note %]</td></tr>
64
                <tr><th>Public note</th><td>[% course.public_note %]</td></tr>
65
                <tr><th>Students count</th><td>[% course.students_count %]</td></tr>
66
                <tr><th>Status</th><td>[% IF course.enabled == 'yes' %]Active[% ELSE %]Inactive[% END %]</td></tr>
67
            </table>
68
69
            <table>
70
                <thead>
71
                    <tr>
72
                        <th>Title</th>
73
                        <th>Barcode</th>
74
                        <th>Call number</th>
75
                        [% IF item_level_itypes %]<th>Item type</th>[% END %]
76
                        <th>Collection</th>
77
                        <th>Location</th>
78
                        <th>Library</th>
79
                        <th>Staff note</th>
80
                        <th>Public note</th>
81
                        [% IF CAN_user_coursereserves_add_reserves %]<th>&nbsp;<!-- Edit --></th>[% END %]
82
                        [% IF CAN_user_coursereserves_delete_reserves %]<th>&nbsp;<!-- Remove --></th>[% END %]
83
                        <th>Other course reserves</th>
84
                    </tr>
85
                </thead>
86
87
                <tbody>
88
                    [% FOREACH cr IN course_reserves %]
89
                        <tr>
90
                            <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% cr.item.biblionumber %]">[% cr.item.title %]</a></td>
91
                            <td><a href="/cgi-bin/koha/catalogue/moredetail.pl?itemnumber=[% cr.item.itemnumber %]&biblionumber=[% cr.item.biblionumber %]&bi=[% cr.item.biblioitemnumber %]">[% cr.item.barcode %]</a></td>
92
                            <td>[% cr.item.itemcallnumber %]</td>
93
                            [% IF item_level_itypes %]
94
                            <td>
95
                                [% IF cr.course_item.itype %]
96
                                    [% IF cr.course_item.enabled == 'yes' %]
97
                                        [% ItemTypes.GetDescription( cr.item.itype ) %]
98
                                    [% ELSE %]
99
                                        [% ItemTypes.GetDescription( cr.course_item.itype ) %]
100
                                    [% END %]
101
                                [% ELSE %]
102
                                     <i>Unchanged</i>
103
                                     ([% ItemTypes.GetDescription( cr.item.itype ) %])
104
                                [% END %]
105
                            </td>
106
                            [% END %]
107
                            <td>
108
                                 [% IF cr.course_item.ccode %]
109
                                     [% IF cr.course_item.enabled == 'yes' %]
110
                                          [% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %]
111
                                     [% ELSE %]
112
                                         [% AuthorisedValues.GetByCode( 'CCODE', cr.course_item.ccode ) %]
113
                                     [% END %]
114
                                 [% ELSE %]
115
                                     <i>Unchanged</i>
116
                                     ([% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %])
117
                                 [% END %]
118
                            </td>
119
                            <td>
120
                                [% IF cr.course_item.location %]
121
                                     [% IF cr.course_item.enabled == 'yes' %]
122
                                         [% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) %]
123
                                    [% ELSE %]
124
                                        [% AuthorisedValues.GetByCode( 'LOC', cr.course_item.location ) %]
125
                                    [% END %]
126
                                [% ELSE %]
127
                                    <i>Unchanged</i>
128
                                    ([% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) %])
129
                                [% END %]
130
                            </td>
131
                            <td>
132
                                [% IF cr.course_item.holdingbranch %]
133
                                    [% IF cr.course_item.enabled == 'yes' %]
134
                                        [% Branches.GetName( cr.item.holdingbranch ) %]
135
                                    [% ELSE %]
136
                                        [% Branches.GetName( cr.course_item.holdingbranch ) %]
137
                                    [% END %]
138
                                [% ELSE %]
139
                                    <i>Unchanged</i>
140
                                    ([% Branches.GetName( cr.item.holdingbranch ) %])
141
                                [% END %]
142
                            </td>
143
                            <td>[% cr.staff_note %]</td>
144
                            <td>[% cr.public_note %]</td>
145
146
                            [% IF CAN_user_coursereserves_add_reserves %]
147
                                <td><a href="add_items.pl?course_id=[% course.course_id %]&barcode=[% cr.item.barcode %]&action=lookup">Edit</a></td>
148
                            [% END %]
149
150
                            [% IF CAN_user_coursereserves_delete_reserves %]
151
                                <td>
152
                                    [% IF cr.item.onloan %]
153
                                        On Loan
154
                                    [% ELSIF cr.item.itemlost %]
155
                                        Item Lost
156
                                    [% ELSE %]
157
                                        <a href="course-details.pl?course_id=[% course.course_id %]&action=del_reserve&cr_id=[% cr.cr_id %]" onclick="return confirmItemDelete()" >Remove</a>
158
                                    [% END %]
159
160
                                </td>
161
                            [% END %]
162
163
                            <td>
164
                                [% FOREACH course IN cr.courses %]
165
                                    [% UNLESS cr.course_id == course.course_id %]
166
                                        <p>
167
                                            <a href="course-details.pl?course_id=[% course.course_id %]">
168
                                                [% course.course_name %]
169
                                                [% IF course.section %] [% course.section %] [% END %]
170
                                                [% IF course.term %] [% AuthorisedValues.GetByCode( 'TERM', course.term ) %] [% END %]
171
                                            </a>
172
                                        </p>
173
                                    [% END %]
174
                                [% END %]
175
                            </td>
176
                        </tr>
177
                    [% END %]
178
                </tbody>
179
            </table>
180
        </div>
181
    </div>
182
</div>
183
184
185
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course-reserves.tt (+119 lines)
Line 0 Link Here
1
[% USE AuthorisedValues %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Course reserves</title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
6
<link rel="stylesheet" type="text/css" href="/intranet-tmpl/prog/en/css/datatables.css" />
7
<script type="text/javascript" src="/intranet-tmpl/prog/en/lib/jquery/plugins/jquery.dataTables.min.js"></script>
8
[% INCLUDE 'datatables-strings.inc' %]
9
<script type="text/javascript" src="/intranet-tmpl/prog/en/js/datatables.js"></script>
10
<script type="text/javascript" id="js">$(document).ready(function() {
11
 $(document).ready(function() {
12
    $("#course_reserves_table").dataTable($.extend(true, {}, dataTablesDefaults, {
13
        "sPaginationType": "four_button",
14
    }));
15
 });
16
});
17
</script>
18
19
</head>
20
<body id="lists_shelves" class="lists">
21
22
[% INCLUDE 'header.inc' %]
23
[% INCLUDE 'cat-search.inc' %]
24
25
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a></div>
26
27
<div id="doc2" class="yui-t7">
28
    <div id="bd">
29
        <div id="yui-main">
30
            <div class="yui-b">
31
                <div class="yui-g">
32
33
                    <div id="toolbar">
34
                        <script type="text/javascript">
35
                        //<![CDATA[
36
                            $(document).ready(function(){
37
                                newCourseButton = new YAHOO.widget.Button("new_course");
38
                            });
39
                        //]]>
40
                        </script>
41
                        <ul class="toolbar">
42
                            [% IF ( CAN_user_coursereserves_manage_courses ) %]
43
                            <li><a id="new_course" href="/cgi-bin/koha/course_reserves/course.pl">New course</a></li>
44
                            [% END %]
45
                        </ul>
46
                    </div><!-- /toolbar -->
47
48
                    <!--
49
                    <div id="search-toolbar">
50
                        <script type="text/javascript">
51
                        //<![CDATA[
52
                            function submitSearchForm(p_oEvent){
53
                                $('#search_courses_form').submit();
54
                            }
55
56
                            $(document).ready(function(){
57
                                newCourseButton = new YAHOO.widget.Button("search_courses");
58
                                newCourseButton.on("click", submitSearchForm );
59
                            });
60
                        //]]>
61
                        </script>
62
                        <ul class="toolbar">
63
                            <li><form id="search_courses_form"><input type="text" name="search_on" id="search_on"></form></li>
64
                            <li><a id="search_courses">Search courses</a></li>
65
                        </ul>
66
                    </div>
67
                    -->
68
69
                    <h1>Courses</h1>
70
                    <table id="course_reserves_table">
71
                        <thead>
72
                            <tr>
73
                                <th>Name</th>
74
                                <th>Dept.</th>
75
                                <th>Course #</th>
76
                                <th>Section</th>
77
                                <th>Term</th>
78
                                <th>Instructors</th>
79
                                <th>Staff note</th>
80
                                <th>Public note</th>
81
                                <th># of Students</th>
82
                                <th>Enabled</th>
83
                            </tr>
84
                        </thead>
85
86
                        <tbody>
87
                            [% FOREACH c IN courses %]
88
                                <tr>
89
                                    <td><a href="course-details.pl?course_id=[% c.course_id %]">[% c.course_name %]</a></td>
90
                                    <td>[% AuthorisedValues.GetByCode( 'DEPARTMENT', c.department ) %]</td>
91
                                    <td>[% c.course_number %]</td>
92
                                    <td>[% c.section %]</td>
93
                                    <td>[% AuthorisedValues.GetByCode( 'TERM' c.term ) %]</td>
94
                                    <td>
95
                                        [% FOREACH i IN c.instructors %]
96
                                            <div class="instructor"><a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% i.borrowernumber %]">[% i.firstname %] [% i.surname %]</a></div>
97
                                        [% END %]
98
                                    </td>
99
                                    <td>[% c.staff_note %]</td>
100
                                    <td>[% c.public_note %]</td>
101
                                    <td>[% c.students_count %]</td>
102
                                    <td>
103
                                        [% IF c.enabled == 'yes' %]
104
                                            <img src="/intranet-tmpl/prog/img/approve.gif" />
105
                                        [% ELSE %]
106
                                            <img src="http://kohadev:8080/intranet-tmpl/prog/img/deny.gif" />
107
                                        [% END %]
108
                                    </td>
109
                            [% END %]
110
                        </tbody>
111
                    </table>
112
                </div>
113
            </div>
114
        </div>
115
    </div>
116
</div>
117
118
119
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/course.tt (+205 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Course reserves &rsaquo; [% IF course_name %] Edit [% course_name %] [% ELSE %] New course [% END %]</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
5
<script type="text/javascript">
6
//<![CDATA[
7
8
    function Check(f) {
9
        var _alertString = "";
10
11
        if( ! $("#department").val() ) {
12
            _alertString += _("- You must choose a department") + "\n";
13
        }
14
15
        if( ! $("#course_number").val() ) {
16
            _alertString += _("- You must choose a course number") + "\n";
17
        }
18
19
        if( ! $("#course_name").val() ) {
20
            _alertString += _("- You must add a course name") + "\n";
21
        }
22
23
        if ( _alertString.length ) {
24
            var alertHeader;
25
            alertHeader = _("Form not submitted because of the following problem(s)");
26
            alertHeader += "\n------------------------------------------------------------------------------------\n\n";
27
28
            alert( alertHeader + _alertString );
29
        } else {
30
            f.submit();
31
        }
32
    }
33
34
//]]>
35
</script>
36
37
<script type="text/javascript">
38
//<![CDATA[
39
$(document).ready(function(){
40
    $( "#find_instructor" ).autocomplete({
41
        source: "/cgi-bin/koha/circ/ysearch.pl",
42
        minLength: 3,
43
        select: function( event, ui ) {
44
            AddInstructor( ui.item.firstname + " " + ui.item.surname, ui.item.cardnumber );
45
            return false;
46
        }
47
    })
48
    .data( "autocomplete" )._renderItem = function( ul, item ) {
49
        return $( "<li></li>" )
50
        .data( "item.autocomplete", item )
51
        .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" )
52
        .appendTo( ul );
53
    };
54
55
});
56
57
function AddInstructor( name, cardnumber ) {
58
    div = "<div id='borrower_" + cardnumber + "'>" + name + " ( <a href='#' onclick='RemoveInstructor(" + cardnumber + ");'> Remove </a> ) <input type='hidden' name='instructors' value='" + cardnumber + "' /></div>";
59
    $('#instructors').append( div );
60
61
    $('#find_instructor').val('').focus();
62
}
63
64
function RemoveInstructor( cardnumber ) {
65
    $( '#borrower_' + cardnumber ).remove();
66
}
67
68
//]]>
69
</script>
70
71
</head>
72
73
<body>
74
75
[% INCLUDE 'header.inc' %]
76
[% INCLUDE 'cat-search.inc' %]
77
78
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/course_reserves/course-reserves.pl">Course reserves</a> &rsaquo; [% IF course_name %] Edit <i>[% course_name %]</i> [% ELSE %] New course [% END %]</div>
79
80
<div id="doc2" class="yui-t7">
81
    <div id="bd">
82
        <div id="yui-main">
83
            <div class="yui-b">
84
                <div class="yui-g">
85
                    <div class="yui-u first">
86
                        <form method="post" action="/cgi-bin/koha/course_reserves/mod_course.pl">
87
                            [% IF course_id %]<input type="hidden" name="course_id" value="[% course_id %]" />[% END %]
88
                            <fieldset class="rows">
89
                                <legend>[% IF course_id %] Edit [% ELSE %] Create [% END %] course</legend>
90
                                <ol>
91
                                    <li>
92
                                        <label class="required" for="department">Department:</label>
93
                                        [% IF departments %]
94
                                            <select id="department" name="department">
95
                                                <option value="">Select A Department</option>
96
97
                                                [% FOREACH d IN departments %]
98
                                                    [% IF d.authorised_value == department %]
99
                                                        <option value="[% d.authorised_value %]" selected="selected">[% d.lib %]</option>
100
                                                    [% ELSE %]
101
                                                        <option value="[% d.authorised_value %]">[% d.lib %]</option>
102
                                                    [% END %]
103
                                                [% END %]
104
                                            </select>
105
                                        [% ELSE %]
106
                                            <span id="department">No DEPARTMENT authorised values found! Please create one or more authorised values with the category DEPARTMENT.</span>
107
                                        [% END %]
108
                                    </li>
109
110
                                    <li>
111
                                        <label class="required" for="course_number">Course number:</label>
112
                                        <input id="course_number" name="course_number" type="text" value="[% course_number %]" />
113
                                    </li>
114
115
                                    <li>
116
                                        <label for="section">Section:</label>
117
                                        <input id="section" name="section" type="text" value="[% section %]"/>
118
                                    </li>
119
120
                                    <li>
121
                                        <label class="required" for="course_name">Course name:</label>
122
                                        <input id="course_name" name="course_name" type="text" value="[% course_name %]" />
123
                                    </li>
124
125
                                    <li>
126
                                        <label for="term">Term:</label>
127
                                        [% IF terms %]
128
                                            <select id="term" name="term">
129
                                                <option value=""></option>
130
131
                                                [% FOREACH t IN terms %]
132
                                                    [% IF t.authorised_value == term %]
133
                                                        <option value="[% t.authorised_value %]" selected="selected">[% t.lib %]</option>
134
                                                    [% ELSE %]
135
                                                        <option value="[% t.authorised_value %]">[% t.lib %]</option>
136
                                                    [% END %]
137
                                                [% END %]
138
                                            </select>
139
                                        [% ELSE %]
140
                                            <span id="term">No TERM authorised values found! Please create one or more authorised values with the category TERM.</span>
141
                                        [% END %]
142
                                    </li>
143
144
                                    <!-- TODO: Add Instructors -->
145
                                    <li>
146
                                        <label for="instructors">Instructors:</label>
147
148
                                        <fieldset>
149
                                             <div id="instructors">
150
                                                 [% FOREACH i IN instructors %]
151
                                                     <div id="borrower_[% i.cardnumber %]">
152
                                                         [% i.surname %], [% i.firstname %] ( <a href='#' onclick='RemoveInstructor( [% i.cardnumber %] );'> Remove </a> )
153
                                                         <input type='hidden' name='instructors' value='[% i.cardnumber %]' />
154
                                                     </div>
155
                                                 [% END %]
156
                                             </div>
157
158
                                        </fieldset>
159
160
                                        <fieldset>
161
                                            <label for="find_instructor">Instructor search:</label>
162
                                            <input autocomplete="off" id="find_instructor" type="text" style="width:150px" class="noEnterSubmit"/>
163
                                            <div id="find_instructor_container"></div>
164
                                        </fieldset>
165
                                    <li>
166
                                        <label for="staff_note">Staff note:</label>
167
                                        <textarea name="staff_note" id="staff_note">[% staff_note %]</textarea>
168
                                    </li>
169
170
                                    <li>
171
                                        <label for="public_note">Public note:</label>
172
                                        <textarea name="public_note" id="public_note">[% public_note %]</textarea>
173
                                    </li>
174
175
                                    <li>
176
                                        <label for="students_count">Number of students:</label>
177
                                        <input id="students_count" name="students_count" type="text" value="[% students_count %]" />
178
                                    </li>
179
180
                                    <li>
181
                                        <label for="enabled">Enabled?</label>
182
                                        [% IF enabled == 'no' %]
183
                                            <input type="checkbox" name="enabled" id="enabled" />
184
                                        [% ELSE %]
185
                                            <input type="checkbox" name="enabled" id="enabled" checked="checked" />
186
                                        [% END %]
187
                                    </li>
188
                                </ol>
189
                            </fieldset>
190
191
                            <fieldset class="action">
192
                                <input type="submit" onclick="Check(this.form); return false;" value="Save" class="submit" />
193
194
                                <a href="/cgi-bin/koha/course_reserves/course-reserves.pl" class="cancel">Cancel</a>
195
                            </fieldset>
196
197
                    </div>
198
                </div>
199
            </div>
200
        </div>
201
    </div>
202
</div>
203
204
205
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/mancredit.tt (-1 / +1 lines)
Lines 4-11 Link Here
4
<script type="text/javascript">
4
<script type="text/javascript">
5
//<![CDATA[
5
//<![CDATA[
6
$(document).ready(function(){
6
$(document).ready(function(){
7
	$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
8
        $('#mancredit').preventDoubleFormSubmit();
7
        $('#mancredit').preventDoubleFormSubmit();
8
        $("fieldset.rows input").addClass("noEnterSubmit");
9
});
9
});
10
//]]>
10
//]]>
11
</script>
11
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-1 / +1 lines)
Lines 4-11 Link Here
4
<script type="text/javascript">
4
<script type="text/javascript">
5
//<![CDATA[
5
//<![CDATA[
6
$(document).ready(function(){
6
$(document).ready(function(){
7
	$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
8
        $('#maninvoice').preventDoubleFormSubmit();
7
        $('#maninvoice').preventDoubleFormSubmit();
8
        $("fieldset.rows input").addClass("noEnterSubmit");
9
});
9
});
10
//]]>
10
//]]>
11
</script>
11
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt (-1 / +1 lines)
Lines 6-12 Link Here
6
<script type="text/javascript">
6
<script type="text/javascript">
7
//<![CDATA[
7
//<![CDATA[
8
    $(document).ready(function() {
8
    $(document).ready(function() {
9
		$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
9
         $("fieldset.rows input").addClass("noEnterSubmit");
10
        $("#guarantordelete").click(function() {
10
        $("#guarantordelete").click(function() {
11
            $("#contact-details").hide().find('a').remove();
11
            $("#contact-details").hide().find('a').remove();
12
            $("#guarantorid, #contactname, #contactfirstname").each(function () { this.value = "" });
12
            $("#guarantorid, #contactname, #contactfirstname").each(function () { this.value = "" });
(-)a/koha-tmpl/opac-tmpl/ccsr/en/includes/masthead.inc (+1 lines)
Lines 247-252 Link Here
247
247
248
<div id="moresearches">
248
<div id="moresearches">
249
<a href="/cgi-bin/koha/opac-search.pl">Advanced search</a>
249
<a href="/cgi-bin/koha/opac-search.pl">Advanced search</a>
250
[% IF ( UseCourseReserves ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-course-reserves.pl">Course Reserves</a>[% END %]
250
[% IF ( OpacBrowser ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-browser.pl">Browse by hierarchy</a>[% END %]
251
[% IF ( OpacBrowser ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-browser.pl">Browse by hierarchy</a>[% END %]
251
[% IF ( OpacAuthorities ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-authorities-home.pl">Browse by author or subject</a>[% END %]
252
[% IF ( OpacAuthorities ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-authorities-home.pl">Browse by author or subject</a>[% END %]
252
[% IF ( opacuserlogin && reviewson && OpacShowRecentComments ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-showreviews.pl">Recent comments</a>[% END %]
253
[% IF ( opacuserlogin && reviewson && OpacShowRecentComments ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-showreviews.pl">Recent comments</a>[% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc (+1 lines)
Lines 118-123 Link Here
118
118
119
<div id="moresearches">
119
<div id="moresearches">
120
<a href="/cgi-bin/koha/opac-search.pl">Advanced search</a>
120
<a href="/cgi-bin/koha/opac-search.pl">Advanced search</a>
121
[% IF ( UseCourseReserves ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-course-reserves.pl">Course Reserves</a>[% END %]
121
[% IF ( OpacBrowser ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-browser.pl">Browse by hierarchy</a>[% END %]
122
[% IF ( OpacBrowser ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-browser.pl">Browse by hierarchy</a>[% END %]
122
[% IF ( OpacAuthorities ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-authorities-home.pl">Browse by author or subject</a>[% END %]
123
[% IF ( OpacAuthorities ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-authorities-home.pl">Browse by author or subject</a>[% END %]
123
[% IF ( opacuserlogin && reviewson && OpacShowRecentComments ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-showreviews.pl">Recent comments</a>[% END %]
124
[% IF ( opacuserlogin && reviewson && OpacShowRecentComments ) %]<span class="pipe"> | </span><a href="/cgi-bin/koha/opac-showreviews.pl">Recent comments</a>[% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-course-details.tt (+63 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% USE AuthorisedValues %]
3
[% USE ItemTypes %]
4
[% USE Branches %]
5
[% INCLUDE 'doc-head-open.inc' %]
6
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog
7
[% INCLUDE 'doc-head-close.inc' %]
8
</head>
9
<body id="opac-main">
10
[% IF ( OpacNav ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %]
11
   <div id="bd">
12
[% INCLUDE 'masthead.inc' %]
13
14
<div id="doc2" class="yui-t7">
15
    <div id="yui-main">
16
17
        <table>
18
            <tr><th>Course Name</th><td>[% course.course_name %]</td></tr>
19
            <tr><th>Term</th><td>[% AuthorisedValues.GetByCode( 'TERM', course.term ) %]</td></tr>
20
            <tr><th>Department</th><td>[% AuthorisedValues.GetByCode( 'DEPARTMENT', course.department ) %]</td></tr>
21
            <tr><th>Course Number</th><td>[% course.course_number %]</td></tr>
22
            <tr><th>Section</th><td>[% course.section %]</td></tr>
23
            <tr><th>Instructors</th><td>[% FOREACH i IN course.instructors %]<div class="instructor">[% i.firstname %] [% i.surname %]</div>[% END %]</td></tr>
24
            <tr><th>Notes</th><td>[% course.public_note %]</td></tr>
25
        </table>
26
27
        <table>
28
            <thead>
29
                <tr>
30
                    <th>Title</th>
31
                    <th>Item type</th>
32
                    <th>Location</th>
33
                    <th>Collection</th>
34
                    <th>Call number</th>
35
                    <th>Copy</th>
36
                    <th>Status</td>
37
                    <th>Date due</td>
38
                    <th>Notes</th>
39
                </tr>
40
            </thead>
41
42
            <tbody>
43
                [% FOREACH cr IN course_reserves %]
44
                    <tr>
45
                        <td><a href="opac-detail.pl?biblionumber=[% cr.item.biblionumber %]">[% cr.item.title %]</a></td>
46
                        <td>[% ItemTypes.GetDescription( cr.item.itype ) %]</td>
47
                        <td>[% Branches.GetName( cr.item.holdingbranch ) %] <br/> <i>[% AuthorisedValues.GetByCode( 'LOC', cr.item.location ) %]</i></td>
48
                        <td>[% AuthorisedValues.GetByCode( 'CCODE', cr.item.ccode ) %]</td>
49
                        <td>[% cr.item.itemcallnumber %]</td>
50
                        <td>[% cr.item.copynumber %]</td>
51
                        <td>[% INCLUDE 'item-status.inc' item = cr.item %]</td>
52
                        <td>[% cr.issue.date_due | $KohaDates %]</td>
53
                        <td>[% cr.public_note %]</td>
54
                    </tr>
55
                [% END %]
56
            </tbody>
57
        </table>
58
59
    </div>
60
</div>
61
62
63
[% INCLUDE 'opac-bottom.inc' %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-course-reserves.tt (+62 lines)
Line 0 Link Here
1
[% USE AuthorisedValues %]
2
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog
5
[% INCLUDE 'doc-head-close.inc' %]
6
</head>
7
<body id="opac-main">
8
[% IF ( OpacNav ) %]<div id="doc3" class="yui-t1">[% ELSE %]<div id="doc3" class="yui-t7">[% END %]
9
   <div id="bd">
10
[% INCLUDE 'masthead.inc' %]
11
12
13
<div id="doc2" class="yui-t7">
14
        <div id="yui-main">
15
            <div class="yui-b">
16
                <div class="yui-g">
17
18
                    <div id="search-toolbar">
19
                        <form id="search_courses_form">
20
                            <input type="text" name="search_on" id="search_on" />
21
                            <input type="submit" value="Search" />
22
                        </form>
23
                    </div><!-- /toolbar -->
24
25
                    <h1>Courses</h1>
26
                    <table id="course_reserves_table">
27
                        <thead>
28
                            <tr>
29
                                <th>Name</th>
30
                                <th>Dept.</th>
31
                                <th>Course #</th>
32
                                <th>Section</th>
33
                                <th>Term</th>
34
                                <th>Instructors</th>
35
                                <th>Notes</th>
36
                            </tr>
37
                        </thead>
38
39
                        <tbody>
40
                            [% FOREACH c IN courses %]
41
                                <tr>
42
                                    <td><a href="opac-course-details.pl?course_id=[% c.course_id %]">[% c.course_name %]</a></td>
43
                                    <td>[% AuthorisedValues.GetByCode( 'DEPARTMENT', c.department, 1 ) %]</td>
44
                                    <td>[% c.course_number %]</td>
45
                                    <td>[% c.section %]</td>
46
                                    <td>[% AuthorisedValues.GetByCode( 'TERM' c.term ) %]</td>
47
                                    <td>
48
                                      [% FOREACH i IN c.instructors %]
49
                                          <div class="instructor">[% i.firstname %] [% i.surname %]</div>
50
                                      [% END %]
51
                                    </td>
52
                                    <td>[% c.public_note %]</td>
53
                            [% END %]
54
                        </tbody>
55
                    </table>
56
                </div>
57
            </div>
58
        </div>
59
</div>
60
61
62
[% INCLUDE 'opac-bottom.inc' %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt (+31 lines)
Lines 1-7 Link Here
1
[% USE KohaDates %]
1
[% USE KohaDates %]
2
[% USE AuthorisedValues %]
2
[% SET TagsShowEnabled = ( TagsEnabled && TagsShowOnDetail ) %]
3
[% SET TagsShowEnabled = ( TagsEnabled && TagsShowOnDetail ) %]
3
[% SET TagsInputEnabled = ( opacuserlogin && TagsEnabled && TagsInputOnDetail ) %]
4
[% SET TagsInputEnabled = ( opacuserlogin && TagsEnabled && TagsInputOnDetail ) %]
4
5
6
[% ShowCourseReservesHeader = 0 %]
7
[% IF UseCourseReserves %]
8
    [% FOREACH ITEM_RESULT IN itemloop %]
9
       [% IF ITEM_RESULT.course_reserves %]
10
           [% FOREACH r IN ITEM_RESULT.course_reserves %]
11
               [% IF r.course.enabled == 'yes' %]
12
                   [% ShowCourseReservesHeader = 1 %]
13
               [% END %]
14
           [% END %]
15
        [% END %]
16
    [% END %]
17
[% END %]
18
5
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Details for: [% title |html %][% FOREACH subtitl IN subtitle %], [% subtitl.subfield |html %][% END %]
19
[% INCLUDE 'doc-head-open.inc' %][% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Details for: [% title |html %][% FOREACH subtitl IN subtitle %], [% subtitl.subfield |html %][% END %]
6
[% INCLUDE 'doc-head-close.inc' %]
20
[% INCLUDE 'doc-head-close.inc' %]
7
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
21
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
Lines 1469-1474 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1469
        [% ELSIF show_priority %]
1483
        [% ELSIF show_priority %]
1470
            <th>Item hold queue priority</th>
1484
            <th>Item hold queue priority</th>
1471
        [% END %]
1485
        [% END %]
1486
        [% IF ( ShowCourseReservesHeader ) %]<th id="item_coursereserves">Course Reserves</th>[% END %]
1472
        </tr></thead>
1487
        </tr></thead>
1473
	    <tbody>[% FOREACH ITEM_RESULT IN items %]
1488
	    <tbody>[% FOREACH ITEM_RESULT IN items %]
1474
      <tr>[% IF ( item_level_itypes ) %]<td class="itype">[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %]
1489
      <tr>[% IF ( item_level_itypes ) %]<td class="itype">[% UNLESS ( noItemTypeImages ) %][% IF ( ITEM_RESULT.imageurl ) %]<img src="[% ITEM_RESULT.imageurl %]" title="[% ITEM_RESULT.description %]" alt="[% ITEM_RESULT.description %]" />[% END %][% END %] [% ITEM_RESULT.description %]</td>[% END %]
Lines 1515-1520 YAHOO.util.Event.onContentReady("furtherm", function () { Link Here
1515
            [% END %]
1530
            [% END %]
1516
                </td>
1531
                </td>
1517
        [% END %]
1532
        [% END %]
1533
        [% IF ShowCourseReservesHeader %]
1534
            <td>
1535
                [% IF ITEM_RESULT.course_reserves %]
1536
                    [% FOREACH r IN ITEM_RESULT.course_reserves %]
1537
                        <p>
1538
                            <a href="opac-course-details.pl?course_id=[% r.course.course_id %]">
1539
                                [% r.course.course_name %]
1540
                                <!--[% IF r.course.course_number %] [% r.course.course_number %] [% END %]-->
1541
                                [% IF r.course.section %] [% r.course.section %] [% END %]
1542
                                [% IF r.course.term %] [% AuthorisedValues.GetByCode( 'TERM', r.course.term ) %] [% END %]
1543
                            </a>
1544
                        </p>
1545
                    [% END %]
1546
                [% END %]
1547
            </td>
1548
        [% END %]
1518
	    </tr>
1549
	    </tr>
1519
	    [% END %]</tbody>
1550
	    [% END %]</tbody>
1520
	</table>
1551
	</table>
(-)a/opac/opac-course-details.pl (+60 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#
4
# Copyright 2012 Bywater Solutions
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use Modern::Perl;
22
23
use CGI;
24
25
use C4::Auth;
26
use C4::Output;
27
use C4::Koha;
28
29
use C4::CourseReserves;
30
31
my $cgi = new CGI;
32
33
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
34
    {
35
        template_name   => "opac-course-details.tmpl",
36
        query           => $cgi,
37
        type            => "opac",
38
        authnotrequired => 1,
39
        debug           => 1,
40
    }
41
);
42
43
my $action = $cgi->param('action') || '';
44
my $course_id = $cgi->param('course_id');
45
46
die( "No course_id given" ) unless ( $course_id );
47
48
if ( $action eq 'del_reserve' ) {
49
    DelCourseReserve( cr_id => $cgi->param('cr_id') );
50
}
51
52
my $course = GetCourse( $course_id );
53
my $course_reserves = GetCourseReserves( course_id => $course_id, include_items => 1, include_count => 1 );
54
55
$template->param(
56
    course => $course,
57
    course_reserves => $course_reserves,
58
);
59
60
output_html_with_http_headers $cgi, $cookie, $template->output;
(-)a/opac/opac-course-reserves.pl (+51 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
#
4
# Copyright 2012 Bywater Solutions
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along
18
# with Koha; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
use Modern::Perl;
22
23
use CGI;
24
25
use C4::Auth;
26
use C4::Output;
27
28
use C4::CourseReserves;
29
30
my $cgi = new CGI;
31
32
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
33
    {
34
        template_name   => "opac-course-reserves.tmpl",
35
        query           => $cgi,
36
        type            => "opac",
37
        authnotrequired => 1,
38
        debug           => 1,
39
    }
40
);
41
42
my $search_on = $cgi->param('search_on');
43
44
my $courses = SearchCourses( term => $search_on, enabled => 'yes' );
45
46
if ( @$courses == 1 ) {
47
    print $cgi->redirect("/cgi-bin/koha/opac-course-details.pl?course_id=" . $courses->[0]->{'course_id'});
48
} else {
49
    $template->param( courses => $courses );
50
    output_html_with_http_headers $cgi, $cookie, $template->output;
51
}
(-)a/opac/opac-detail.pl (-1 / +7 lines)
Lines 50-55 use List::MoreUtils qw/any none/; Link Here
50
use C4::Images;
50
use C4::Images;
51
use Koha::DateUtils;
51
use Koha::DateUtils;
52
use C4::HTML5Media;
52
use C4::HTML5Media;
53
use C4::CourseReserves;
53
54
54
BEGIN {
55
BEGIN {
55
	if (C4::Context->preference('BakerTaylorEnabled')) {
56
	if (C4::Context->preference('BakerTaylorEnabled')) {
Lines 1008-1011 if (C4::Context->preference('OpacHighlightedWords')) { Link Here
1008
}
1009
}
1009
$template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks');
1010
$template->{VARS}->{'trackclicks'} = C4::Context->preference('TrackClicks');
1010
1011
1012
if ( C4::Context->preference('UseCourseReserves') ) {
1013
    foreach my $i ( @items ) {
1014
        $i->{'course_reserves'} = GetItemReservesInfo( itemnumber => $i->{'itemnumber'} );
1015
    }
1016
}
1017
1011
output_html_with_http_headers $query, $cookie, $template->output;
1018
output_html_with_http_headers $query, $cookie, $template->output;
1012
- 

Return to bug 8215